nmrium 0.20.2 → 0.23.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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/Integral.js +1 -6
- package/lib/component/1d/Viewer1D.js +4 -4
- package/lib/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib/component/1d/utilities/scale.d.ts +1 -1
- package/lib/component/1d/utilities/scale.js +7 -6
- package/lib/component/2d/Viewer2D.js +5 -5
- package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib/component/NMRium.d.ts +10 -6
- package/lib/component/NMRium.js +3 -9
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/header/Header.js +13 -10
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
- package/lib/component/hooks/useIntegralPath.js +53 -0
- package/lib/component/hooks/useToolsFunctions.js +6 -6
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- package/lib/component/loader/DropZone.js +87 -87
- package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
- package/lib/component/modal/PredictSpectraModal.js +2 -32
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
- package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
- package/lib/component/modal/editZone/EditZoneModal.js +96 -0
- package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
- package/lib/component/modal/editZone/SignalFormTab.js +6 -0
- package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
- package/lib/component/modal/editZone/SignalsForm.js +62 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
- package/lib/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -9
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib/component/panels/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +17 -14
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
- package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
- package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
- package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
- package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +9 -23
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
- package/lib/component/reducer/actions/DomainActions.js +20 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib/component/reducer/actions/LoadActions.js +29 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib/component/reducer/actions/RangesActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +43 -56
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
- package/lib/component/reducer/actions/ZonesActions.js +33 -2
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
- package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/preferencesReducer.d.ts +3 -8
- package/lib/component/reducer/preferencesReducer.js +86 -37
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/toolbar/FunctionToolBar.js +7 -10
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +46 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +46 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +44 -0
- package/lib/data/PredictionManager.d.ts +35 -3
- package/lib/data/PredictionManager.js +45 -7
- package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
- package/lib/data/constants/DefaultPathLengths.js +8 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/FooterBanner.js +1 -1
- package/lib-cjs/component/1d/Integral.js +1 -6
- package/lib-cjs/component/1d/Viewer1D.js +4 -4
- package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib-cjs/component/1d/utilities/scale.js +7 -6
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib-cjs/component/NMRium.js +3 -10
- package/lib-cjs/component/header/Header.js +13 -10
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- package/lib-cjs/component/loader/DropZone.js +87 -87
- package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
- package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
- package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
- package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
- package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
- package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
- package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib-cjs/component/panels/Panels.js +18 -15
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
- package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
- package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
- package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
- package/lib-cjs/component/reducer/Reducer.js +7 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +29 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
- package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +87 -38
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +49 -0
- package/lib-cjs/component/workspaces/exercise1D.js +49 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +47 -0
- package/lib-cjs/data/PredictionManager.js +46 -8
- package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +1 -1
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
- package/lib/component/reducer/actions/Zoom.d.ts +0 -16
- package/lib/component/reducer/actions/Zoom.js +0 -92
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
- package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
|
@@ -23,6 +23,5 @@ function ExclusionZonesAnnotations() {
|
|
|
23
23
|
}
|
|
24
24
|
export default ExclusionZonesAnnotations;
|
|
25
25
|
function getExclusionZones(data) {
|
|
26
|
-
return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id)
|
|
27
|
-
?.value || []);
|
|
26
|
+
return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id && filter.flag)?.value || []);
|
|
28
27
|
}
|
|
@@ -86,7 +86,7 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
|
|
|
86
86
|
100).toFixed(2), "%"] }, void 0)] }, void 0))] }, void 0)), activeSpectrum && (_jsxs(Fragment, { children: [_jsx("div", { className: "separator" }, void 0), _jsx(IoPulseSharp, {}, void 0), _jsxs("div", { children: [_jsx("span", { className: "label", children: "Intensity: " }, void 0), _jsx("span", { className: "value yvalue", children: format(getYValue(position.x)) }, void 0)] }, void 0)] }, void 0))] }, void 0));
|
|
87
87
|
}
|
|
88
88
|
const MemoizedFooterBanner = memo(FooterBannerInner);
|
|
89
|
-
const emptyData = { info: {}, data:
|
|
89
|
+
const emptyData = { info: {}, data: null };
|
|
90
90
|
export default function FooterBanner() {
|
|
91
91
|
const { margin, width, height, activeSpectrum, activeTab } = useChartData();
|
|
92
92
|
const spectrum = useSpectrum(emptyData);
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// import { xyReduce, xyIntegral } from 'ml-spectra-processing';
|
|
3
2
|
import { useMemo } from 'react';
|
|
4
|
-
import { useChartData } from '../context/ChartContext';
|
|
5
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
4
|
+
import useIntegralPath from '../hooks/useIntegralPath';
|
|
6
5
|
import { integralDefaultValues } from '../panels/extra/preferences/defaultValues';
|
|
7
6
|
import { getValue } from '../utility/LocalStorage';
|
|
8
7
|
import IntegralResizable from './IntegralResizable';
|
|
9
|
-
import useIntegralPath from './utilities/useIntegralPath';
|
|
10
8
|
function Integral({ integral, isActive }) {
|
|
11
9
|
const preferences = usePreferences();
|
|
12
10
|
const path = useIntegralPath(integral);
|
|
13
|
-
const { height, margin } = useChartData();
|
|
14
11
|
const integralSettings = useMemo(() => {
|
|
15
12
|
let { color = integralDefaultValues.color, strokeWidth = integralDefaultValues.strokeWidth, } = getValue(preferences, 'formatting.panels.integrals') || {};
|
|
16
13
|
return { color, strokeWidth };
|
|
17
14
|
}, [preferences]);
|
|
18
15
|
return (_jsxs("g", { children: [_jsx("path", { className: "line", stroke: integralSettings.color, strokeWidth: integralSettings.strokeWidth, fill: "none", style: {
|
|
19
|
-
transformOrigin: 'center top',
|
|
20
16
|
opacity: isActive ? 1 : 0.2,
|
|
21
|
-
transform: `translateY(-${margin.bottom + height * 0.3}px)`,
|
|
22
17
|
}, d: path }, void 0), _jsx(IntegralResizable, { integralData: integral }, void 0)] }, void 0));
|
|
23
18
|
}
|
|
24
19
|
export default Integral;
|
|
@@ -14,10 +14,10 @@ import { useAlert } from '../elements/popup/Alert';
|
|
|
14
14
|
import { useModal } from '../elements/popup/Modal';
|
|
15
15
|
import Spinner from '../loader/Spinner';
|
|
16
16
|
import MultipletAnalysisModal from '../modal/MultipletAnalysisModal';
|
|
17
|
-
import { ZoomType } from '../reducer/
|
|
17
|
+
import { ZoomType } from '../reducer/helper/Zoom1DManager';
|
|
18
18
|
import getRange from '../reducer/helper/getRange';
|
|
19
19
|
import scaleReducer, { scaleInitialState, SET_SCALE, } from '../reducer/scaleReducer';
|
|
20
|
-
import { ADD_INTEGRAL, ADD_PEAKS, ADD_BASE_LINE_ZONE, BRUSH_END, FULL_ZOOM_OUT,
|
|
20
|
+
import { ADD_INTEGRAL, ADD_PEAKS, ADD_BASE_LINE_ZONE, BRUSH_END, FULL_ZOOM_OUT, SET_ZOOM, ADD_PEAK, SET_VERTICAL_INDICATOR_X_POSITION, ADD_RANGE, ANALYZE_SPECTRA, ADD_EXCLUSION_ZONE, } from '../reducer/types/Types';
|
|
21
21
|
import BrushXY, { BRUSH_TYPE } from '../tool/BrushXY';
|
|
22
22
|
import CrossLinePointer from '../tool/CrossLinePointer';
|
|
23
23
|
import { options } from '../toolbar/ToolTypes';
|
|
@@ -163,7 +163,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
163
163
|
}, [
|
|
164
164
|
scaleState,
|
|
165
165
|
selectedTool,
|
|
166
|
-
general
|
|
166
|
+
general?.disableMultipletAnalysis,
|
|
167
167
|
modal,
|
|
168
168
|
data,
|
|
169
169
|
activeSpectrum,
|
|
@@ -175,7 +175,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
175
175
|
dispatch({ type: FULL_ZOOM_OUT, zoomType: ZoomType.STEP_HORIZONTAL });
|
|
176
176
|
}, [dispatch]);
|
|
177
177
|
const handleZoom = useCallback((event) => {
|
|
178
|
-
dispatch({ type:
|
|
178
|
+
dispatch({ type: SET_ZOOM, event, selectedTool });
|
|
179
179
|
}, [dispatch, selectedTool]);
|
|
180
180
|
const mouseClick = useCallback((position) => {
|
|
181
181
|
const propagateEvent = () => {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import useIntegralPath from '../utilities/useIntegralPath';
|
|
2
|
+
import useIntegralPath from '../../hooks/useIntegralPath';
|
|
4
3
|
function RangeIntegral({ range }) {
|
|
5
4
|
const path = useIntegralPath(range);
|
|
6
|
-
|
|
7
|
-
return (_jsx("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", style: {
|
|
8
|
-
transform: `translateY(-${margin.bottom + height * 0.3}px)`,
|
|
9
|
-
}, d: path }, void 0));
|
|
5
|
+
return (_jsx("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", d: path }, void 0));
|
|
10
6
|
}
|
|
11
7
|
export default RangeIntegral;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare function getXScale(state: any, spectrumId?: number | null | string): import("d3-scale").ScaleLinear<any, any, never>;
|
|
2
2
|
declare function getYScale(state: any, spectrumId?: number | null | string): import("d3-scale").ScaleLinear<any, any, never>;
|
|
3
|
-
declare function getIntegralYScale(state: any
|
|
3
|
+
declare function getIntegralYScale(state: any): import("d3-scale").ScaleLinear<any, any, never>;
|
|
4
4
|
declare function reScaleY(scale: number, { domain, height, margin }: {
|
|
5
5
|
domain: any;
|
|
6
6
|
height: any;
|
|
@@ -20,13 +20,14 @@ function getYScale(state, spectrumId = null) {
|
|
|
20
20
|
}
|
|
21
21
|
return scaleLinear(domainY, [_height, margin.top]);
|
|
22
22
|
}
|
|
23
|
-
function getIntegralYScale(state
|
|
24
|
-
const { height, margin, verticalAlign, integralsYDomains } = state;
|
|
23
|
+
function getIntegralYScale(state) {
|
|
24
|
+
const { height, margin, verticalAlign, integralsYDomains, activeSpectrum } = state;
|
|
25
25
|
const _height = verticalAlign.align === 'center' ? height / 2 : height;
|
|
26
|
-
return scaleLinear(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
return scaleLinear(activeSpectrum?.id &&
|
|
27
|
+
integralsYDomains &&
|
|
28
|
+
integralsYDomains[activeSpectrum?.id]
|
|
29
|
+
? integralsYDomains[activeSpectrum?.id]
|
|
30
|
+
: [0, 0], [_height * 0.3, margin.top + _height * 0.1]);
|
|
30
31
|
}
|
|
31
32
|
function reScaleY(scale, { domain, height, margin }) {
|
|
32
33
|
const _scale = scaleLinear(domain, [height - margin.bottom, margin.top]);
|
|
@@ -8,7 +8,7 @@ import { useDispatch } from '../context/DispatchContext';
|
|
|
8
8
|
import useSpectrum from '../hooks/useSpectrum';
|
|
9
9
|
import NoData from '../loader/NoData';
|
|
10
10
|
import Spinner from '../loader/Spinner';
|
|
11
|
-
import { BRUSH_END, FULL_ZOOM_OUT, SET_DIMENSIONS, SET_2D_LEVEL,
|
|
11
|
+
import { BRUSH_END, FULL_ZOOM_OUT, SET_DIMENSIONS, SET_2D_LEVEL, SET_ZOOM, ADD_2D_ZONE, } from '../reducer/types/Types';
|
|
12
12
|
import BrushXY, { BRUSH_TYPE } from '../tool/BrushXY';
|
|
13
13
|
import CrossLinePointer from '../tool/CrossLinePointer';
|
|
14
14
|
import { options } from '../toolbar/ToolTypes';
|
|
@@ -79,15 +79,15 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
79
79
|
dispatch({ type: FULL_ZOOM_OUT, trackID });
|
|
80
80
|
}
|
|
81
81
|
}, [DIMENSION, dispatch]);
|
|
82
|
-
const handleZoom = (
|
|
83
|
-
const { x: startX, y: startY } =
|
|
82
|
+
const handleZoom = (event) => {
|
|
83
|
+
const { x: startX, y: startY } = event;
|
|
84
84
|
const trackID = getLayoutID(DIMENSION, { startX, startY });
|
|
85
85
|
if (trackID) {
|
|
86
86
|
if (trackID === 'CENTER_2D') {
|
|
87
|
-
dispatch({ type: SET_2D_LEVEL, ...
|
|
87
|
+
dispatch({ type: SET_2D_LEVEL, ...event });
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
dispatch({ type:
|
|
90
|
+
dispatch({ type: SET_ZOOM, event, trackID });
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
};
|
|
@@ -12,7 +12,7 @@ import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
|
12
12
|
import { SET_KEY_PREFERENCES, APPLY_KEY_PREFERENCES, DELETE_INTEGRAL, DELETE_PEAK_NOTATION, DELETE_RANGE, DELETE_2D_ZONE, DELETE_EXCLUSION_ZONE, } from '../reducer/types/Types';
|
|
13
13
|
import { options } from '../toolbar/ToolTypes';
|
|
14
14
|
function KeysListenerTracker() {
|
|
15
|
-
const { keysPreferences, displayerMode, overDisplayer, data } = useChartData();
|
|
15
|
+
const { keysPreferences, displayerMode, overDisplayer, data, activeSpectrum, } = useChartData();
|
|
16
16
|
const dispatch = useDispatch();
|
|
17
17
|
const alert = useAlert();
|
|
18
18
|
const openLoader = useLoader();
|
|
@@ -23,9 +23,6 @@ function KeysListenerTracker() {
|
|
|
23
23
|
const allow1DTool = useMemo(() => {
|
|
24
24
|
return displayerMode === DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
25
25
|
}, [data, displayerMode]);
|
|
26
|
-
const allow2DTool = useMemo(() => {
|
|
27
|
-
return displayerMode === DISPLAYER_MODE.DM_2D && data && data.length > 0;
|
|
28
|
-
}, [data, displayerMode]);
|
|
29
26
|
const deleteHandler = useCallback(async (sourceData) => {
|
|
30
27
|
const { type, extra: { id }, } = sourceData;
|
|
31
28
|
switch (type) {
|
|
@@ -120,106 +117,126 @@ function KeysListenerTracker() {
|
|
|
120
117
|
}
|
|
121
118
|
}, [alert, data, dispatch, keysPreferences]);
|
|
122
119
|
const toolsListenerHandler = useCallback((e) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
120
|
+
function check1DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
121
|
+
if (displayerMode === DISPLAYER_MODE.DM_1D && !activeSpectrum) {
|
|
122
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
123
|
+
}
|
|
124
|
+
else if (checkSwitch && displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
125
|
+
throw new Error(`Switch to 1D Mode and select a spectrum to proceed with ${label}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function check2DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
129
|
+
if (displayerMode === DISPLAYER_MODE.DM_2D && !activeSpectrum) {
|
|
130
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
131
|
+
}
|
|
132
|
+
else if (checkSwitch && displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
133
|
+
throw new Error(`Switch to 2D Mode and select a spectrum to proceed with ${label}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
if (!e.shiftKey && !e.metaKey) {
|
|
138
|
+
switch (e.key) {
|
|
139
|
+
case 'f':
|
|
140
|
+
handleFullZoomOut();
|
|
141
|
+
break;
|
|
142
|
+
case 'z':
|
|
143
|
+
case 'Escape':
|
|
144
|
+
handleChangeOption(options.zoom.id);
|
|
145
|
+
break;
|
|
146
|
+
case 'r': {
|
|
147
|
+
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
148
|
+
check2DModeWithActiveSpectrum(options.zone2D.label, false);
|
|
149
|
+
handleChangeOption(options.zone2D.id);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
check1DModeWithActiveSpectrum(options.rangesPicking.label, false);
|
|
153
|
+
handleChangeOption(options.rangesPicking.id);
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 'a': {
|
|
158
|
+
check1DModeWithActiveSpectrum(options.phaseCorrection.label);
|
|
143
159
|
handleChangeOption(options.phaseCorrection.id);
|
|
160
|
+
break;
|
|
144
161
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
case 'b': {
|
|
148
|
-
if (allow1DTool) {
|
|
162
|
+
case 'b': {
|
|
163
|
+
check1DModeWithActiveSpectrum(options.baseLineCorrection.label);
|
|
149
164
|
handleChangeOption(options.baseLineCorrection.id);
|
|
165
|
+
break;
|
|
150
166
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
case 'p': {
|
|
154
|
-
if (allow1DTool) {
|
|
167
|
+
case 'p': {
|
|
168
|
+
check1DModeWithActiveSpectrum(options.peakPicking.label);
|
|
155
169
|
handleChangeOption(options.peakPicking.id);
|
|
170
|
+
break;
|
|
156
171
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
case 'i': {
|
|
160
|
-
if (allow1DTool) {
|
|
172
|
+
case 'i': {
|
|
173
|
+
check1DModeWithActiveSpectrum(options.integral.label);
|
|
161
174
|
handleChangeOption(options.integral.id);
|
|
175
|
+
break;
|
|
162
176
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
case 'e': {
|
|
166
|
-
if (allow1DTool) {
|
|
177
|
+
case 'e': {
|
|
178
|
+
check1DModeWithActiveSpectrum(options.exclusionZones.label);
|
|
167
179
|
handleChangeOption(options.exclusionZones.id);
|
|
180
|
+
break;
|
|
168
181
|
}
|
|
169
|
-
|
|
182
|
+
default:
|
|
170
183
|
}
|
|
171
|
-
default:
|
|
172
184
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
186
|
+
switch (e.key) {
|
|
187
|
+
case 'c': {
|
|
188
|
+
if (allow1DTool) {
|
|
189
|
+
alignSpectrumsVerticallyHandler();
|
|
190
|
+
}
|
|
191
|
+
break;
|
|
179
192
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
193
|
+
case 's': {
|
|
194
|
+
if (allow1DTool) {
|
|
195
|
+
changeDisplayViewModeHandler();
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
185
198
|
}
|
|
186
|
-
|
|
199
|
+
default:
|
|
187
200
|
}
|
|
188
|
-
default:
|
|
189
201
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
203
|
+
switch (e.key) {
|
|
204
|
+
case 'c':
|
|
205
|
+
void saveToClipboardHandler();
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
break;
|
|
208
|
+
case 's':
|
|
209
|
+
void saveAsJSONHandler();
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
break;
|
|
212
|
+
case 'o':
|
|
213
|
+
openLoader();
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
break;
|
|
216
|
+
default:
|
|
217
|
+
}
|
|
206
218
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
220
|
+
switch (e.key) {
|
|
221
|
+
case 's':
|
|
222
|
+
case 'S':
|
|
223
|
+
void saveAsHandler();
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
}
|
|
216
228
|
}
|
|
217
229
|
}
|
|
230
|
+
catch (e) {
|
|
231
|
+
alert.error(e.message);
|
|
232
|
+
}
|
|
218
233
|
}, [
|
|
234
|
+
activeSpectrum,
|
|
235
|
+
alert,
|
|
219
236
|
alignSpectrumsVerticallyHandler,
|
|
220
237
|
allow1DTool,
|
|
221
|
-
allow2DTool,
|
|
222
238
|
changeDisplayViewModeHandler,
|
|
239
|
+
displayerMode,
|
|
223
240
|
handleChangeOption,
|
|
224
241
|
handleFullZoomOut,
|
|
225
242
|
openLoader,
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { CorrelationData } from 'nmr-correlation';
|
|
2
3
|
import { ReactElement, ReactNode } from 'react';
|
|
3
4
|
import { Datum1D } from '../data/types/data1d';
|
|
4
5
|
import { Datum2D } from '../data/types/data2d';
|
|
5
6
|
import { State } from './reducer/Reducer';
|
|
6
|
-
export declare
|
|
7
|
-
EXERCISE_1D = "exercise1D",
|
|
8
|
-
PROCESS_1D = "process1D",
|
|
9
|
-
DEFAULT = "default"
|
|
10
|
-
}
|
|
7
|
+
export declare type NMRIumWorkspace = 'exercise1D' | 'process1D' | 'default';
|
|
11
8
|
export interface NMRiumProps {
|
|
12
9
|
data?: NMRiumData;
|
|
13
10
|
onDataChange?: (data: State) => void;
|
|
14
|
-
|
|
11
|
+
workspace?: NMRIumWorkspace;
|
|
15
12
|
preferences?: NMRiumPreferences;
|
|
16
13
|
emptyText?: ReactNode;
|
|
17
14
|
/**
|
|
@@ -23,6 +20,8 @@ export declare type NMRiumPreferences = Partial<{
|
|
|
23
20
|
general: Partial<{
|
|
24
21
|
disableMultipletAnalysis: boolean;
|
|
25
22
|
hideSetSumFromMolecule: boolean;
|
|
23
|
+
hideGeneralSettings: boolean;
|
|
24
|
+
hideExperimentalFeatures: boolean;
|
|
26
25
|
}>;
|
|
27
26
|
panels: Partial<{
|
|
28
27
|
hideSpectraPanel: boolean;
|
|
@@ -36,6 +35,7 @@ export declare type NMRiumPreferences = Partial<{
|
|
|
36
35
|
hideSummaryPanel: boolean;
|
|
37
36
|
hideMultipleSpectraAnalysisPanel: boolean;
|
|
38
37
|
hideDatabasePanel: boolean;
|
|
38
|
+
hidePredictionPanel: boolean;
|
|
39
39
|
}>;
|
|
40
40
|
toolBarButtons: Partial<{
|
|
41
41
|
hideZoomTool: boolean;
|
|
@@ -47,12 +47,15 @@ export declare type NMRiumPreferences = Partial<{
|
|
|
47
47
|
hideRealImaginary: boolean;
|
|
48
48
|
hidePeakTool: boolean;
|
|
49
49
|
hideIntegralTool: boolean;
|
|
50
|
+
hideZonePickingTool: boolean;
|
|
51
|
+
hideSlicingTool: boolean;
|
|
50
52
|
hideAutoRangesTool: boolean;
|
|
51
53
|
hideZeroFillingTool: boolean;
|
|
52
54
|
hidePhaseCorrectionTool: boolean;
|
|
53
55
|
hideBaseLineCorrectionTool: boolean;
|
|
54
56
|
hideFFTTool: boolean;
|
|
55
57
|
hideMultipleSpectraAnalysisTool: boolean;
|
|
58
|
+
hideExclusionZonesTool: boolean;
|
|
56
59
|
}>;
|
|
57
60
|
}>;
|
|
58
61
|
export declare type Molecules = Array<{
|
|
@@ -65,6 +68,7 @@ declare type DeepPartial<T> = {
|
|
|
65
68
|
export interface NMRiumData {
|
|
66
69
|
molecules?: Molecules;
|
|
67
70
|
spectra: DeepPartial<Spectra>;
|
|
71
|
+
correlations?: CorrelationData;
|
|
68
72
|
}
|
|
69
73
|
declare function NMRium(props: NMRiumProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
70
74
|
declare const _default: import("react").MemoExoticComponent<typeof NMRium>;
|
package/lib/component/NMRium.js
CHANGED
|
@@ -96,12 +96,6 @@ const containerStyles = css `
|
|
|
96
96
|
border-right: 0.55px #bbbbbb solid;
|
|
97
97
|
}
|
|
98
98
|
`;
|
|
99
|
-
export var NMRiumMode;
|
|
100
|
-
(function (NMRiumMode) {
|
|
101
|
-
NMRiumMode["EXERCISE_1D"] = "exercise1D";
|
|
102
|
-
NMRiumMode["PROCESS_1D"] = "process1D";
|
|
103
|
-
NMRiumMode["DEFAULT"] = "default";
|
|
104
|
-
})(NMRiumMode || (NMRiumMode = {}));
|
|
105
99
|
const defaultPreferences = {};
|
|
106
100
|
const defaultData = {
|
|
107
101
|
spectra: [],
|
|
@@ -109,7 +103,7 @@ const defaultData = {
|
|
|
109
103
|
function NMRium(props) {
|
|
110
104
|
return (_jsx(RootLayout, { style: { width: '100%' }, children: _jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, children: _jsx(InnerNMRium, { ...props }, void 0) }, void 0) }, void 0));
|
|
111
105
|
}
|
|
112
|
-
function InnerNMRium({ data: dataProp = defaultData,
|
|
106
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace = 'default', preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, }) {
|
|
113
107
|
const rootRef = useRef(null);
|
|
114
108
|
const elementsWraperRef = useRef(null);
|
|
115
109
|
const [show, toggle] = useToggle(false);
|
|
@@ -137,11 +131,11 @@ function InnerNMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT,
|
|
|
137
131
|
type: INIT_PREFERENCES,
|
|
138
132
|
payload: {
|
|
139
133
|
display: preferences,
|
|
140
|
-
|
|
134
|
+
workspace,
|
|
141
135
|
dispatch: dispatchPreferences,
|
|
142
136
|
},
|
|
143
137
|
});
|
|
144
|
-
}, [preferences,
|
|
138
|
+
}, [preferences, workspace]);
|
|
145
139
|
useEffect(() => {
|
|
146
140
|
dispatchMiddleWare({ type: SET_LOADING_FLAG, isLoading: true });
|
|
147
141
|
if (dataProp) {
|
|
@@ -4,7 +4,7 @@ interface EditableColumnProps {
|
|
|
4
4
|
onEditStart?: (element: any) => void;
|
|
5
5
|
type?: 'number' | 'text';
|
|
6
6
|
editStatus?: boolean;
|
|
7
|
-
value: string;
|
|
7
|
+
value: string | number;
|
|
8
8
|
style?: CSSProperties;
|
|
9
9
|
}
|
|
10
10
|
declare const _default: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
|
|
@@ -5,7 +5,7 @@ import { useMemo, useCallback, memo } from 'react';
|
|
|
5
5
|
import { FaRegWindowMaximize, FaWrench, FaQuestionCircle, } from 'react-icons/fa';
|
|
6
6
|
import { docsBaseUrl } from '../../constants';
|
|
7
7
|
import { useChartData } from '../context/ChartContext';
|
|
8
|
-
import {
|
|
8
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
9
9
|
import { useModal, positions } from '../elements/popup/Modal';
|
|
10
10
|
import AboutUsModal from '../modal/AboutUsModal';
|
|
11
11
|
import GeneralSettings from '../modal/setting/GeneralSettings';
|
|
@@ -17,8 +17,7 @@ import RangesPickingOptionPanel from './RangesPickingOptionPanel';
|
|
|
17
17
|
import ZeroFillingOptionsPanel from './ZeroFillingOptionsPanel';
|
|
18
18
|
import Zones2DOptionPanel from './Zones2DOptionPanel';
|
|
19
19
|
function HeaderInner(props) {
|
|
20
|
-
const { isFullscreen, onMaximize = () => null, selectedOptionPanel } = props;
|
|
21
|
-
const alert = useAlert();
|
|
20
|
+
const { isFullscreen, onMaximize = () => null, selectedOptionPanel, hideGeneralSettings, } = props;
|
|
22
21
|
const modal = useModal();
|
|
23
22
|
const selectedPanel = useMemo(() => {
|
|
24
23
|
switch (selectedOptionPanel) {
|
|
@@ -39,15 +38,13 @@ function HeaderInner(props) {
|
|
|
39
38
|
}
|
|
40
39
|
}, [selectedOptionPanel]);
|
|
41
40
|
const openGeneralSettingsHandler = useCallback(() => {
|
|
42
|
-
modal.show(_jsx(GeneralSettings, {
|
|
43
|
-
alert.success('Settings saved successfully');
|
|
44
|
-
modal.close();
|
|
45
|
-
} }, void 0), {
|
|
41
|
+
modal.show(_jsx(GeneralSettings, {}, void 0), {
|
|
46
42
|
position: positions.TOP_CENTER,
|
|
47
43
|
enableResizing: true,
|
|
48
44
|
width: 600,
|
|
45
|
+
height: 400,
|
|
49
46
|
});
|
|
50
|
-
}, [
|
|
47
|
+
}, [modal]);
|
|
51
48
|
const openAboutUs = useCallback(() => {
|
|
52
49
|
modal.show(_jsx(AboutUsModal, {}, void 0), {
|
|
53
50
|
isBackgroundBlur: false,
|
|
@@ -64,10 +61,16 @@ function HeaderInner(props) {
|
|
|
64
61
|
display: 'flex',
|
|
65
62
|
alignItems: 'center',
|
|
66
63
|
justifyContent: 'center',
|
|
67
|
-
}, children: _jsx(SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), _jsx("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}, void 0) }, void 0), _jsx(Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: _jsx(FaWrench, {}, void 0) }, void 0), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
64
|
+
}, children: _jsx(SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), _jsx("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}, void 0) }, void 0), !hideGeneralSettings && (_jsx(Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: _jsx(FaWrench, {}, void 0) }, void 0)), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
68
65
|
}
|
|
69
66
|
const MemoizedHeader = memo(HeaderInner);
|
|
70
67
|
export default function HeaderWrapper({ isFullscreen, onMaximize }) {
|
|
71
68
|
const { toolOptions: { selectedOptionPanel }, } = useChartData();
|
|
72
|
-
|
|
69
|
+
const { display: { general }, } = usePreferences();
|
|
70
|
+
return (_jsx(MemoizedHeader, { ...{
|
|
71
|
+
selectedOptionPanel,
|
|
72
|
+
isFullscreen,
|
|
73
|
+
onMaximize,
|
|
74
|
+
hideGeneralSettings: general?.hideGeneralSettings || false,
|
|
75
|
+
} }, void 0));
|
|
73
76
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import lodashGet from 'lodash/get';
|
|
1
2
|
import { useMemo } from 'react';
|
|
2
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
3
4
|
export default function useCheckExperimentalFeature() {
|
|
4
5
|
const preferences = usePreferences();
|
|
5
6
|
return useMemo(() => {
|
|
6
|
-
return !preferences
|
|
7
|
+
return !lodashGet(preferences, 'display.general.hideExperimentalFeatures', false);
|
|
7
8
|
}, [preferences]);
|
|
8
9
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCheckToolsVisibility(): (toolKey: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import lodashGet from 'lodash/get';
|
|
2
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
3
|
+
export function useCheckToolsVisibility() {
|
|
4
|
+
const preferences = usePreferences();
|
|
5
|
+
return (toolKey) => !lodashGet(preferences, `display.toolBarButtons.${toolKey}`, false);
|
|
6
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { xyIntegral, xyReduce } from 'ml-spectra-processing';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { getIntegralYScale } from '../1d/utilities/scale';
|
|
4
|
+
import { useChartData } from '../context/ChartContext';
|
|
5
|
+
import { PathBuilder } from '../utility/PathBuilder';
|
|
6
|
+
import { useXScale } from './useXScale';
|
|
7
|
+
function useIntegralYDomain() {
|
|
8
|
+
const { height, margin, verticalAlign, activeSpectrum, integralsYDomains } = useChartData();
|
|
9
|
+
return useMemo(() => getIntegralYScale({
|
|
10
|
+
height,
|
|
11
|
+
margin,
|
|
12
|
+
verticalAlign,
|
|
13
|
+
activeSpectrum,
|
|
14
|
+
integralsYDomains,
|
|
15
|
+
}), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
|
|
16
|
+
}
|
|
17
|
+
export default function useIntegralPath(integralOptions) {
|
|
18
|
+
const { data, activeSpectrum } = useChartData();
|
|
19
|
+
const scaleX = useXScale();
|
|
20
|
+
const scaleY = useIntegralYDomain();
|
|
21
|
+
const integral = useMemo(() => {
|
|
22
|
+
if (activeSpectrum) {
|
|
23
|
+
const { x, re } = data[activeSpectrum?.index].data;
|
|
24
|
+
const { from, to } = integralOptions;
|
|
25
|
+
return xyIntegral({ x, y: re }, {
|
|
26
|
+
from,
|
|
27
|
+
to,
|
|
28
|
+
reverse: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return { x: [], y: [] };
|
|
32
|
+
}, [activeSpectrum, data, integralOptions]);
|
|
33
|
+
const paths = useMemo(() => {
|
|
34
|
+
if (integral) {
|
|
35
|
+
const xySeries = xyReduce(integral, {
|
|
36
|
+
// from: xDomain[0],
|
|
37
|
+
// to: xDomain[1],
|
|
38
|
+
nbPoints: 200,
|
|
39
|
+
optimize: true,
|
|
40
|
+
});
|
|
41
|
+
const pathBuilder = new PathBuilder();
|
|
42
|
+
pathBuilder.moveTo(scaleX(xySeries.x[0]), scaleY(xySeries.y[0]));
|
|
43
|
+
for (let i = 1; i < xySeries.x.length; i++) {
|
|
44
|
+
pathBuilder.lineTo(scaleX(xySeries.x[i]), scaleY(xySeries.y[i]));
|
|
45
|
+
}
|
|
46
|
+
return pathBuilder.toString();
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
}, [integral, scaleX, scaleY]);
|
|
52
|
+
return paths;
|
|
53
|
+
}
|