nmrium 0.42.0 → 0.43.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/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +1 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +5 -5
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +89 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
- package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -6
- package/lib/component/reducer/Reducer.js +30 -6
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +1 -0
- package/lib/component/toolbar/ToolTypes.js +36 -0
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +5 -5
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
- package/lib-cjs/component/reducer/Reducer.js +29 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
|
|
3
3
|
import { useAssignmentData } from '../assignment/AssignmentsContext';
|
|
4
4
|
import { useChartData } from '../context/ChartContext';
|
|
@@ -13,8 +13,9 @@ import useExport from '../hooks/useExport';
|
|
|
13
13
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
14
14
|
import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
15
15
|
import { options } from '../toolbar/ToolTypes';
|
|
16
|
-
function KeysListenerTracker() {
|
|
17
|
-
const {
|
|
16
|
+
function KeysListenerTracker(props) {
|
|
17
|
+
const { mainDivRef } = props;
|
|
18
|
+
const { keysPreferences, displayerMode, data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
18
19
|
const dispatch = useDispatch();
|
|
19
20
|
const { dispatch: dispatchPreferences } = usePreferences();
|
|
20
21
|
const alert = useAlert();
|
|
@@ -24,6 +25,25 @@ function KeysListenerTracker() {
|
|
|
24
25
|
const { saveToClipboardHandler, saveAsJSONHandler, saveAsHandler } = useExport();
|
|
25
26
|
const isToolVisible = useCheckToolsVisibility();
|
|
26
27
|
const { highlight, remove } = useHighlightData();
|
|
28
|
+
const mouseIsOverDisplayer = useRef(false);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const div = mainDivRef.current;
|
|
31
|
+
if (!div) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
function mouseEnterHandler() {
|
|
35
|
+
mouseIsOverDisplayer.current = true;
|
|
36
|
+
}
|
|
37
|
+
function mouseLeaveHandler() {
|
|
38
|
+
mouseIsOverDisplayer.current = false;
|
|
39
|
+
}
|
|
40
|
+
div.addEventListener('mouseenter', mouseEnterHandler);
|
|
41
|
+
div.addEventListener('mouseleave', mouseLeaveHandler);
|
|
42
|
+
return () => {
|
|
43
|
+
div.removeEventListener('mouseenter', mouseEnterHandler);
|
|
44
|
+
div.removeEventListener('mouseleave', mouseLeaveHandler);
|
|
45
|
+
};
|
|
46
|
+
}, [mainDivRef]);
|
|
27
47
|
const assignmentData = useAssignmentData();
|
|
28
48
|
const allow1DTool = useMemo(() => {
|
|
29
49
|
return displayerMode === DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
@@ -170,6 +190,15 @@ function KeysListenerTracker() {
|
|
|
170
190
|
}
|
|
171
191
|
break;
|
|
172
192
|
}
|
|
193
|
+
case HighlightEventSource.BASELINE_ZONE: {
|
|
194
|
+
const { id } = extra || {};
|
|
195
|
+
if (id) {
|
|
196
|
+
dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
|
|
197
|
+
// remove keys from the highlighted list after delete
|
|
198
|
+
remove();
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
173
202
|
default:
|
|
174
203
|
break;
|
|
175
204
|
}
|
|
@@ -223,7 +252,6 @@ function KeysListenerTracker() {
|
|
|
223
252
|
handleFullZoomOut();
|
|
224
253
|
}
|
|
225
254
|
break;
|
|
226
|
-
case 'z':
|
|
227
255
|
case 'Escape':
|
|
228
256
|
if (isToolVisible('zoom')) {
|
|
229
257
|
handleChangeOption(options.zoom.id);
|
|
@@ -238,6 +266,12 @@ function KeysListenerTracker() {
|
|
|
238
266
|
}
|
|
239
267
|
break;
|
|
240
268
|
}
|
|
269
|
+
case 'z': {
|
|
270
|
+
if (isToolVisible('zeroFilling')) {
|
|
271
|
+
handleChangeOption(options.zeroFilling.id);
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
241
275
|
case 'a': {
|
|
242
276
|
if (isToolVisible('apodization')) {
|
|
243
277
|
handleChangeOption(options.apodization.id);
|
|
@@ -247,6 +281,14 @@ function KeysListenerTracker() {
|
|
|
247
281
|
}
|
|
248
282
|
break;
|
|
249
283
|
}
|
|
284
|
+
case 't': {
|
|
285
|
+
if (isToolVisible('fft')) {
|
|
286
|
+
dispatch({
|
|
287
|
+
type: 'APPLY_FFT_FILTER',
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
250
292
|
case 'b': {
|
|
251
293
|
if (isToolVisible('baselineCorrection')) {
|
|
252
294
|
handleChangeOption(options.baselineCorrection.id);
|
|
@@ -343,7 +385,7 @@ function KeysListenerTracker() {
|
|
|
343
385
|
saveToClipboardHandler,
|
|
344
386
|
]);
|
|
345
387
|
const handleOnKeyDown = useCallback((e) => {
|
|
346
|
-
if (checkNotInputField(e) &&
|
|
388
|
+
if (checkNotInputField(e) && mouseIsOverDisplayer.current) {
|
|
347
389
|
const num = Number(e.code.slice(-1)) || 0;
|
|
348
390
|
if (num > 0) {
|
|
349
391
|
keysPreferencesListenerHandler(e, num);
|
|
@@ -361,7 +403,6 @@ function KeysListenerTracker() {
|
|
|
361
403
|
deleteHandler,
|
|
362
404
|
highlight,
|
|
363
405
|
keysPreferencesListenerHandler,
|
|
364
|
-
overDisplayer,
|
|
365
406
|
toolsListenerHandler,
|
|
366
407
|
]);
|
|
367
408
|
useEffect(() => {
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface AssignmentProviderProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function AssignmentProvider(props: AssignmentProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useReducer, useMemo, useEffect } from 'react';
|
|
3
|
+
import { useChartData } from '../context/ChartContext';
|
|
3
4
|
import { assignmentState, assignmentContext, } from './AssignmentsContext';
|
|
4
5
|
import assignmentReducer from './AssignmentsReducer';
|
|
5
6
|
export function AssignmentProvider(props) {
|
|
6
|
-
const {
|
|
7
|
+
const { children } = props;
|
|
8
|
+
const { data: spectra } = useChartData();
|
|
7
9
|
const [data, dispatch] = useReducer(assignmentReducer, assignmentState);
|
|
8
10
|
const state = useMemo(() => ({ data, dispatch }), [data]);
|
|
9
11
|
useEffect(() => {
|
|
10
12
|
if (spectra) {
|
|
11
13
|
dispatch({
|
|
12
14
|
type: 'INITIATE_ASSIGNMENTS',
|
|
15
|
+
// TODO: Fix this type error. It's been here for a long time because this component wasn't typed.
|
|
16
|
+
// @ts-expect-error This should be fixed.
|
|
13
17
|
payload: { spectra },
|
|
14
18
|
});
|
|
15
19
|
}
|
|
@@ -5,7 +5,6 @@ import { DatabaseActions } from '../reducer/actions/DatabaseActions';
|
|
|
5
5
|
import { DimensionsActions } from '../reducer/actions/DimensionsActions';
|
|
6
6
|
import { DomainActions } from '../reducer/actions/DomainActions';
|
|
7
7
|
import { FiltersActions } from '../reducer/actions/FiltersActions';
|
|
8
|
-
import { GlobalActions } from '../reducer/actions/GlobalActions';
|
|
9
8
|
import { IntegralsActions } from '../reducer/actions/IntegralsActions';
|
|
10
9
|
import { LoadActions } from '../reducer/actions/LoadActions';
|
|
11
10
|
import { MoleculeActions } from '../reducer/actions/MoleculeActions';
|
|
@@ -17,7 +16,7 @@ import { SpectrumActions } from '../reducer/actions/SpectrumsActions';
|
|
|
17
16
|
import { ToolsActions } from '../reducer/actions/ToolsActions';
|
|
18
17
|
import { ZonesActions } from '../reducer/actions/ZonesActions';
|
|
19
18
|
import { ActionType } from '../reducer/types/ActionType';
|
|
20
|
-
export type Action = ToolsActions | SpectrumActions | SpectraAnalysisActions |
|
|
19
|
+
export type Action = ToolsActions | SpectrumActions | SpectraAnalysisActions | LoadActions | IntegralsActions | RangesActions | DatabaseActions | DimensionsActions | AssignmentsActions | DomainActions | PreferencesActions | PeaksActions | MoleculeActions | ZonesActions | FiltersActions | CorrelationsActions | ActionType<'INITIALIZE_NMRIUM'>;
|
|
21
20
|
export type Dispatch = (action: Action) => void;
|
|
22
21
|
export declare const dispatchContext: import("react").Context<Dispatch>;
|
|
23
22
|
export declare const DispatchProvider: import("react").Provider<Dispatch>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface KeyModifiers {
|
|
3
|
+
ctrlKey: boolean;
|
|
4
|
+
shiftKey: boolean;
|
|
5
|
+
altKey: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const KeyModifierContext: import("react").Context<KeyModifiers>;
|
|
8
|
+
export declare function useKeyModifiers(): KeyModifiers;
|
|
9
|
+
interface KeyModifierProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function KeyModifiersProvider({ children }: KeyModifierProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useState, } from 'react';
|
|
3
|
+
const defaultKeyModifiersState = {
|
|
4
|
+
ctrlKey: false,
|
|
5
|
+
shiftKey: false,
|
|
6
|
+
altKey: false,
|
|
7
|
+
};
|
|
8
|
+
export const KeyModifierContext = createContext(defaultKeyModifiersState);
|
|
9
|
+
export function useKeyModifiers() {
|
|
10
|
+
const context = useContext(KeyModifierContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error('key modifiers context was not found');
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
const isMac = navigator !== undefined && navigator.userAgent.toLowerCase().includes('mac');
|
|
17
|
+
function getModifiers(event) {
|
|
18
|
+
const { shiftKey, altKey, metaKey } = event;
|
|
19
|
+
const ctrlKey = isMac ? metaKey : event.ctrlKey;
|
|
20
|
+
return { ctrlKey, shiftKey, altKey };
|
|
21
|
+
}
|
|
22
|
+
export function KeyModifiersProvider({ children }) {
|
|
23
|
+
const [modifiers, setModifiers] = useState(defaultKeyModifiersState);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
function handleKeyDown(event) {
|
|
26
|
+
setModifiers(getModifiers(event));
|
|
27
|
+
}
|
|
28
|
+
function handleKeyUp(event) {
|
|
29
|
+
setModifiers(getModifiers(event));
|
|
30
|
+
}
|
|
31
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
32
|
+
document.addEventListener('keyup', handleKeyUp);
|
|
33
|
+
return () => {
|
|
34
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
35
|
+
document.removeEventListener('keyup', handleKeyUp);
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
return (_jsx(KeyModifierContext.Provider, { value: modifiers, children: children }));
|
|
39
|
+
}
|
|
@@ -13,11 +13,40 @@ export declare function usePreferences(): {
|
|
|
13
13
|
workspaces: import("../reducer/preferences/preferencesReducer").WorkspacesWithSource;
|
|
14
14
|
originalWorkspaces: import("../reducer/preferences/preferencesReducer").WorkspacesWithSource;
|
|
15
15
|
dispatch: (action?: ({
|
|
16
|
+
type: "INIT_PREFERENCES";
|
|
17
|
+
payload: {
|
|
18
|
+
display: import("nmr-load-save").WorkspacePreferences;
|
|
19
|
+
workspace: import("../main/types").NMRiumWorkspace;
|
|
20
|
+
customWorkspaces: Record<string, import("nmr-load-save").Workspace>;
|
|
21
|
+
dispatch: any;
|
|
22
|
+
};
|
|
23
|
+
} | ({
|
|
24
|
+
type: "SET_PREFERENCES";
|
|
25
|
+
payload: Partial<import("nmr-load-save").Workspace>;
|
|
26
|
+
} | {
|
|
27
|
+
type: "SET_PREFERENCES";
|
|
28
|
+
}) | {
|
|
29
|
+
type: "SET_PANELS_PREFERENCES";
|
|
30
|
+
payload: {
|
|
31
|
+
key: string;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
} | import("../reducer/preferences/preferencesReducer").SetWorkspaceAction | {
|
|
35
|
+
type: "REMOVE_WORKSPACE" | "SET_ACTIVE_WORKSPACE";
|
|
36
|
+
payload: {
|
|
37
|
+
workspace: string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
16
40
|
type: "ADD_WORKSPACE";
|
|
17
41
|
payload: {
|
|
18
42
|
workspaceKey: string;
|
|
19
43
|
data?: Omit<import("nmr-load-save").Workspace, "label" | "version"> | undefined;
|
|
20
44
|
};
|
|
45
|
+
} | {
|
|
46
|
+
type: "APPLY_General_PREFERENCES";
|
|
47
|
+
payload: {
|
|
48
|
+
data: Omit<import("nmr-load-save").Workspace, "label" | "version">;
|
|
49
|
+
};
|
|
21
50
|
} | {
|
|
22
51
|
type: "ANALYZE_SPECTRA";
|
|
23
52
|
payload: {
|
|
@@ -46,9 +75,10 @@ export declare function usePreferences(): {
|
|
|
46
75
|
data: import("nmr-load-save").MultipleSpectraAnalysisPreferences;
|
|
47
76
|
};
|
|
48
77
|
} | {
|
|
49
|
-
type: "
|
|
78
|
+
type: "SET_MATRIX_GENERATION_OPTIONS";
|
|
50
79
|
payload: {
|
|
51
|
-
|
|
80
|
+
nucleus: string;
|
|
81
|
+
options: import("../../data/types/data1d/MatrixOptions").MatrixOptions;
|
|
52
82
|
};
|
|
53
83
|
} | {
|
|
54
84
|
type: "ADD_MATRIX_GENERATION_EXCLUSION_ZONE";
|
|
@@ -63,41 +93,6 @@ export declare function usePreferences(): {
|
|
|
63
93
|
};
|
|
64
94
|
nucleus: string;
|
|
65
95
|
};
|
|
66
|
-
} | {
|
|
67
|
-
type: "REMOVE_WORKSPACE" | "SET_ACTIVE_WORKSPACE";
|
|
68
|
-
payload: {
|
|
69
|
-
workspace: string;
|
|
70
|
-
};
|
|
71
|
-
} | {
|
|
72
|
-
type: "SET_VERTICAL_SPLITTER_POSITION";
|
|
73
|
-
payload: {
|
|
74
|
-
value: import("react-science/ui").SplitPaneSize;
|
|
75
|
-
};
|
|
76
|
-
} | import("../reducer/preferences/preferencesReducer").SetWorkspaceAction | {
|
|
77
|
-
type: "INIT_PREFERENCES";
|
|
78
|
-
payload: {
|
|
79
|
-
display: import("nmr-load-save").WorkspacePreferences;
|
|
80
|
-
workspace: import("../NMRium").NMRiumWorkspace;
|
|
81
|
-
customWorkspaces: Record<string, import("nmr-load-save").Workspace>;
|
|
82
|
-
dispatch: any;
|
|
83
|
-
};
|
|
84
|
-
} | ({
|
|
85
|
-
type: "SET_PREFERENCES";
|
|
86
|
-
payload: Partial<import("nmr-load-save").Workspace>;
|
|
87
|
-
} | {
|
|
88
|
-
type: "SET_PREFERENCES";
|
|
89
|
-
}) | {
|
|
90
|
-
type: "SET_PANELS_PREFERENCES";
|
|
91
|
-
payload: {
|
|
92
|
-
key: string;
|
|
93
|
-
value: string;
|
|
94
|
-
};
|
|
95
|
-
} | {
|
|
96
|
-
type: "SET_MATRIX_GENERATION_OPTIONS";
|
|
97
|
-
payload: {
|
|
98
|
-
nucleus: string;
|
|
99
|
-
options: import("../../data/types/data1d/MatrixOptions").MatrixOptions;
|
|
100
|
-
};
|
|
101
96
|
} | {
|
|
102
97
|
type: "DELETE_MATRIX_GENERATION_EXCLUSION_ZONE";
|
|
103
98
|
payload: {
|
|
@@ -108,10 +103,15 @@ export declare function usePreferences(): {
|
|
|
108
103
|
};
|
|
109
104
|
nucleus: string;
|
|
110
105
|
};
|
|
106
|
+
} | {
|
|
107
|
+
type: "SET_VERTICAL_SPLITTER_POSITION";
|
|
108
|
+
payload: {
|
|
109
|
+
value: import("react-science/ui").SplitPaneSize;
|
|
110
|
+
};
|
|
111
111
|
}) | undefined) => void;
|
|
112
112
|
workspace: {
|
|
113
|
-
current: import("../
|
|
114
|
-
base: import("../
|
|
113
|
+
current: import("../main/types").NMRiumWorkspace;
|
|
114
|
+
base: import("../main/types").NMRiumWorkspace | null;
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
117
|
export declare function useWorkspacesList(): any[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
//TODO resolve the eslint rules
|
|
3
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
2
4
|
/** @jsxImportSource @emotion/react */
|
|
3
5
|
import { css } from '@emotion/react';
|
|
4
6
|
import { FaInfoCircle } from 'react-icons/fa';
|
|
@@ -7,6 +7,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
7
7
|
max?: any;
|
|
8
8
|
value?: number;
|
|
9
9
|
style?: CSSProperties;
|
|
10
|
+
autoSelect?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
13
|
export default NumberInput;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import { forwardRef, useEffect } from 'react';
|
|
3
|
+
import useCombinedRefs from '../hooks/useCombinedRefs';
|
|
3
4
|
const inputStyle = {
|
|
4
5
|
height: '100%',
|
|
5
6
|
width: '100px',
|
|
@@ -7,7 +8,13 @@ const inputStyle = {
|
|
|
7
8
|
border: '0.55px solid #c7c7c7',
|
|
8
9
|
textAlign: 'center',
|
|
9
10
|
};
|
|
10
|
-
const NumberInput = forwardRef(({ name, value: valueProp, style = {}, onChange, pattern = '^\\d*.\\d*$', step = 'any', min = 'any', max = 'any', ...otherProps }, ref) => {
|
|
11
|
-
|
|
11
|
+
const NumberInput = forwardRef(({ name, value: valueProp, style = {}, onChange, pattern = '^\\d*.\\d*$', step = 'any', min = 'any', max = 'any', autoSelect = false, ...otherProps }, ref) => {
|
|
12
|
+
const combinedRef = useCombinedRefs([ref]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (autoSelect) {
|
|
15
|
+
combinedRef?.current?.select();
|
|
16
|
+
}
|
|
17
|
+
}, [autoSelect, combinedRef]);
|
|
18
|
+
return (_jsx("input", { ref: combinedRef, name: name, style: { ...inputStyle, ...style }, type: "number", pattern: pattern, value: valueProp, step: step, onChange: onChange, min: min, max: max, ...otherProps }));
|
|
12
19
|
});
|
|
13
20
|
export default NumberInput;
|
|
@@ -60,6 +60,6 @@ function ConfirmationDialog({ style = {}, buttons = [], onClose, message, render
|
|
|
60
60
|
onClose();
|
|
61
61
|
}
|
|
62
62
|
}, [onClose]);
|
|
63
|
-
return (_jsxs("div", { style: style, css: styles, "data-
|
|
63
|
+
return (_jsxs("div", { style: style, css: styles, "data-testid": id, children: [render ? (render({ message, className: 'message' })) : (_jsx("p", { className: "message", children: message })), _jsx("div", { className: "buttons-container", children: buttons.map((option) => (_jsx("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }));
|
|
64
64
|
}
|
|
65
65
|
export default ConfirmationDialog;
|
|
@@ -28,21 +28,30 @@ const initialValues = {
|
|
|
28
28
|
};
|
|
29
29
|
function ApodizationOptionsInnerPanel(props) {
|
|
30
30
|
const dispatch = useDispatch();
|
|
31
|
-
const
|
|
31
|
+
const previousPreviewRef = useRef(initialValues.livePreview);
|
|
32
32
|
function handleApplyFilter(values, triggerSource = 'apply') {
|
|
33
|
-
const { livePreview, ...
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const { livePreview, ...options } = values;
|
|
34
|
+
switch (triggerSource) {
|
|
35
|
+
case 'onChange': {
|
|
36
|
+
if (livePreview || previousPreviewRef.current !== livePreview) {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: 'CALCULATE_APODIZATION_FILTER',
|
|
39
|
+
payload: { livePreview, options },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'apply': {
|
|
45
|
+
dispatch({
|
|
46
|
+
type: 'APPLY_APODIZATION_FILTER',
|
|
47
|
+
payload: { options },
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
break;
|
|
45
53
|
}
|
|
54
|
+
previousPreviewRef.current = livePreview;
|
|
46
55
|
}
|
|
47
56
|
function handleCancelFilter() {
|
|
48
57
|
dispatch({
|
|
@@ -53,7 +62,7 @@ function ApodizationOptionsInnerPanel(props) {
|
|
|
53
62
|
if (props.filter) {
|
|
54
63
|
formData = { ...initialValues, ...props.filter.value, livePreview: true };
|
|
55
64
|
}
|
|
56
|
-
return (
|
|
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, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Gauss broadening :", shortTitle: "GB :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "gaussBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "lineBroadeningCenter [0 - 1] : ", shortTitle: "LB Center :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadeningCenter", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", 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 })] })) }) }));
|
|
57
66
|
}
|
|
58
67
|
const MemoizedApodizationPanel = memo(ApodizationOptionsInnerPanel);
|
|
59
68
|
export default function ApodizationOptionsPanel() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Formik } from 'formik';
|
|
3
3
|
import { Filters } from 'nmr-processing';
|
|
4
|
-
import {
|
|
4
|
+
import { useState, memo, useRef } from 'react';
|
|
5
5
|
import * as Yup from 'yup';
|
|
6
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
7
7
|
import ActionButtons from '../elements/ActionButtons';
|
|
@@ -65,16 +65,37 @@ const formData = (algorithm, filterValues) => {
|
|
|
65
65
|
};
|
|
66
66
|
function BaseLineCorrectionInnerPanel(props) {
|
|
67
67
|
const dispatch = useDispatch();
|
|
68
|
-
const
|
|
68
|
+
const previousPreviewRef = useRef(true);
|
|
69
69
|
const { algorithm: baseAlgorithm = 'polynomial' } = props?.filter?.value || {};
|
|
70
70
|
const [algorithm, setAlgorithm] = useState(baseAlgorithm);
|
|
71
71
|
const handleApplyFilter = (values, triggerSource = 'apply') => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
const { livePreview, ...options } = values;
|
|
73
|
+
switch (triggerSource) {
|
|
74
|
+
case 'onChange': {
|
|
75
|
+
if (livePreview || previousPreviewRef !== livePreview) {
|
|
76
|
+
dispatch({
|
|
77
|
+
type: 'CALCULATE_BASE_LINE_CORRECTION_FILTER',
|
|
78
|
+
payload: {
|
|
79
|
+
options,
|
|
80
|
+
livePreview,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case 'apply': {
|
|
87
|
+
dispatch({
|
|
88
|
+
type: 'APPLY_BASE_LINE_CORRECTION_FILTER',
|
|
89
|
+
payload: {
|
|
90
|
+
options,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
default:
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
previousPreviewRef.current = livePreview;
|
|
78
99
|
};
|
|
79
100
|
const handleCancelFilter = () => {
|
|
80
101
|
dispatch({
|
|
@@ -85,8 +106,8 @@ function BaseLineCorrectionInnerPanel(props) {
|
|
|
85
106
|
setAlgorithm(selectedAlgorithm);
|
|
86
107
|
}
|
|
87
108
|
const form = formData(algorithm, props?.filter?.value || {});
|
|
88
|
-
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), _jsx(Formik, {
|
|
89
|
-
['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 ", htmlFor: "livePreview", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true })
|
|
109
|
+
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: "maxIterations:", 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 &&
|
|
110
|
+
['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 ", htmlFor: "livePreview", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) })] }));
|
|
90
111
|
}
|
|
91
112
|
const MemoizedBaseLineCorrectionPanel = memo(BaseLineCorrectionInnerPanel);
|
|
92
113
|
export default function BaseLineCorrectionPanel() {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { LabelStyle } from '../elements/Label';
|
|
2
2
|
export declare const headerLabelStyle: LabelStyle;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
interface HeaderInnerProps {
|
|
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'];
|
|
6
12
|
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -61,7 +61,7 @@ const styles = css `
|
|
|
61
61
|
}
|
|
62
62
|
`;
|
|
63
63
|
function HeaderInner(props) {
|
|
64
|
-
const {
|
|
64
|
+
const { isFullscreenEnabled, onEnableFullscreen, selectedOptionPanel, height, } = props;
|
|
65
65
|
const { current: { display: { general }, }, workspace, dispatch, } = usePreferences();
|
|
66
66
|
const workspacesList = useWorkspacesList();
|
|
67
67
|
const hideGeneralSettings = !!(general?.hideGeneralSettings && workspace.base);
|
|
@@ -100,7 +100,7 @@ function HeaderInner(props) {
|
|
|
100
100
|
alignItems: 'center',
|
|
101
101
|
}, children: [_jsx("div", { children: _jsx(Toolbar, { orientation: "horizontal", children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
|
|
102
102
|
alignItems: 'center',
|
|
103
|
-
}, children: [!hideGeneralSettings && (_jsxs(_Fragment, { children: [_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), _jsx(SaveButton, {})] })), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !
|
|
103
|
+
}, children: [!hideGeneralSettings && (_jsxs(_Fragment, { children: [_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), _jsx(SaveButton, {})] })), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !isFullscreenEnabled && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onEnableFullscreen, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
|
|
104
104
|
}
|
|
105
105
|
function SaveButton() {
|
|
106
106
|
const { workspace, workspaces, originalWorkspaces } = usePreferences();
|
|
@@ -117,10 +117,10 @@ function SaveButton() {
|
|
|
117
117
|
}), toolTip: "Save workspace locally in the browser", children: _jsx(FaRegSave, {}) }), _jsx(SaveSettingsModal, {})] }));
|
|
118
118
|
}
|
|
119
119
|
const MemoizedHeader = memo(HeaderInner);
|
|
120
|
-
export default function HeaderWrapper({
|
|
120
|
+
export default function HeaderWrapper({ isFullscreenEnabled, onEnableFullscreen, }) {
|
|
121
121
|
const { toolOptions: { selectedOptionPanel }, height, } = useChartData();
|
|
122
122
|
return (_jsx(MemoizedHeader, { selectedOptionPanel,
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
isFullscreenEnabled,
|
|
124
|
+
onEnableFullscreen,
|
|
125
125
|
height }));
|
|
126
126
|
}
|