nmrium 0.21.0 → 0.22.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/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/NMRium.d.ts +2 -0
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/header/Header.js +3 -7
- 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 +4 -5
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- 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/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -5
- 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/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +10 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -2
- 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 -4
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- 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 +22 -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 +31 -27
- 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/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +11 -1
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- 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/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- 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/header/Header.js +3 -7
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +4 -5
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- 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/GeneralSettings.js +12 -4
- 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/Panels.js +11 -15
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- 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 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- 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 +22 -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 +38 -34
- 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/preferencesReducer.js +12 -2
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- 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/versionInfo.js +1 -1
- package/package.json +1 -1
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- 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/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
|
}
|
|
@@ -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
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
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';
|
|
@@ -70,6 +71,7 @@ declare type DeepPartial<T> = {
|
|
|
70
71
|
export interface NMRiumData {
|
|
71
72
|
molecules?: Molecules;
|
|
72
73
|
spectra: DeepPartial<Spectra>;
|
|
74
|
+
correlations?: CorrelationData;
|
|
73
75
|
}
|
|
74
76
|
declare function NMRium(props: NMRiumProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
75
77
|
declare const _default: import("react").MemoExoticComponent<typeof NMRium>;
|
|
@@ -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>>;
|
|
@@ -6,7 +6,6 @@ import { FaRegWindowMaximize, FaWrench, FaQuestionCircle, } from 'react-icons/fa
|
|
|
6
6
|
import { docsBaseUrl } from '../../constants';
|
|
7
7
|
import { useChartData } from '../context/ChartContext';
|
|
8
8
|
import { usePreferences } from '../context/PreferencesContext';
|
|
9
|
-
import { useAlert } from '../elements/popup/Alert';
|
|
10
9
|
import { useModal, positions } from '../elements/popup/Modal';
|
|
11
10
|
import AboutUsModal from '../modal/AboutUsModal';
|
|
12
11
|
import GeneralSettings from '../modal/setting/GeneralSettings';
|
|
@@ -19,7 +18,6 @@ import ZeroFillingOptionsPanel from './ZeroFillingOptionsPanel';
|
|
|
19
18
|
import Zones2DOptionPanel from './Zones2DOptionPanel';
|
|
20
19
|
function HeaderInner(props) {
|
|
21
20
|
const { isFullscreen, onMaximize = () => null, selectedOptionPanel, hideGeneralSettings, } = props;
|
|
22
|
-
const alert = useAlert();
|
|
23
21
|
const modal = useModal();
|
|
24
22
|
const selectedPanel = useMemo(() => {
|
|
25
23
|
switch (selectedOptionPanel) {
|
|
@@ -40,15 +38,13 @@ function HeaderInner(props) {
|
|
|
40
38
|
}
|
|
41
39
|
}, [selectedOptionPanel]);
|
|
42
40
|
const openGeneralSettingsHandler = useCallback(() => {
|
|
43
|
-
modal.show(_jsx(GeneralSettings, {
|
|
44
|
-
alert.success('Settings saved successfully');
|
|
45
|
-
modal.close();
|
|
46
|
-
} }, void 0), {
|
|
41
|
+
modal.show(_jsx(GeneralSettings, {}, void 0), {
|
|
47
42
|
position: positions.TOP_CENTER,
|
|
48
43
|
enableResizing: true,
|
|
49
44
|
width: 600,
|
|
45
|
+
height: 400,
|
|
50
46
|
});
|
|
51
|
-
}, [
|
|
47
|
+
}, [modal]);
|
|
52
48
|
const openAboutUs = useCallback(() => {
|
|
53
49
|
modal.show(_jsx(AboutUsModal, {}, void 0), {
|
|
54
50
|
isBackgroundBlur: false,
|
|
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
|
+
}
|
|
@@ -4,8 +4,8 @@ import lodashMap from 'lodash/map';
|
|
|
4
4
|
import { useCallback, useRef, useState } from 'react';
|
|
5
5
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
6
|
import { useAlert } from '../elements/popup/Alert';
|
|
7
|
-
import {
|
|
8
|
-
import { ZoomType } from '../reducer/
|
|
7
|
+
import { TOOLS_PANELS_ACCORDION } from '../panels/Panels';
|
|
8
|
+
import { ZoomType } from '../reducer/helper/Zoom1DManager';
|
|
9
9
|
import { CHANGE_SPECTRUM_DISPLAY_VIEW_MODE, FULL_ZOOM_OUT, SET_SELECTED_TOOL, SET_SPECTRUMS_VERTICAL_ALIGN, TOGGLE_REAL_IMAGINARY_VISIBILITY, } from '../reducer/types/Types';
|
|
10
10
|
import { options } from '../toolbar/ToolTypes';
|
|
11
11
|
export default function useToolsFunctions() {
|
|
@@ -23,9 +23,8 @@ export default function useToolsFunctions() {
|
|
|
23
23
|
].includes(selectedTool)) {
|
|
24
24
|
alert.show('Press Shift + Left Mouse button to select zone');
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
openPanel(PANELS_ACCORDION[selectedTool]);
|
|
26
|
+
if (Object.keys(TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
|
|
27
|
+
openPanel(TOOLS_PANELS_ACCORDION[selectedTool]);
|
|
29
28
|
}
|
|
30
29
|
dispatch({
|
|
31
30
|
type: SET_SELECTED_TOOL,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { getXScale } from '../1d/utilities/scale';
|
|
3
|
+
import { useChartData } from '../context/ChartContext';
|
|
4
|
+
export function useXScale() {
|
|
5
|
+
const { width, margin, xDomains, xDomain, mode } = useChartData();
|
|
6
|
+
return useMemo(() => getXScale({ width, margin, xDomains, xDomain, mode }), [margin, mode, width, xDomain, xDomains]);
|
|
7
|
+
}
|
|
@@ -21,7 +21,7 @@ const useValidation = () => useMemo(() => {
|
|
|
21
21
|
});
|
|
22
22
|
}),
|
|
23
23
|
}))
|
|
24
|
-
.min(1, 'There must be at least one coupling in a
|
|
24
|
+
.min(1, 'There must be at least one coupling in a signal'),
|
|
25
25
|
}))
|
|
26
26
|
.min(1, 'There must be at least one signal in a range!'),
|
|
27
27
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useFormikContext } from 'formik';
|
|
5
|
+
import DefaultPathLengths from '../../../data/constants/DefaultPathLengths';
|
|
6
|
+
import FormikNumberInput from '../../elements/formik/FormikNumberInput';
|
|
7
|
+
const editPathLengthsStyles = css `
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
margin-top: 10px;
|
|
11
|
+
text-align: center;
|
|
12
|
+
|
|
13
|
+
.input-container {
|
|
14
|
+
width: 100%;
|
|
15
|
+
margin-top: 5px;
|
|
16
|
+
text-align: center;
|
|
17
|
+
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
|
|
23
|
+
input::-webkit-outer-spin-button,
|
|
24
|
+
input::-webkit-inner-spin-button {
|
|
25
|
+
-webkit-appearance: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
button {
|
|
30
|
+
flex: 2;
|
|
31
|
+
padding: 5px;
|
|
32
|
+
border: 1px solid gray;
|
|
33
|
+
border-radius: 5px;
|
|
34
|
+
height: 30px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
margin-top: 15px;
|
|
37
|
+
display: block;
|
|
38
|
+
width: 60px;
|
|
39
|
+
|
|
40
|
+
color: white;
|
|
41
|
+
background-color: gray;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.warning {
|
|
45
|
+
margin-top: 5px;
|
|
46
|
+
color: red;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
function EditPathLengthFormik({ signalIndex }) {
|
|
50
|
+
const { errors, values, } = useFormikContext();
|
|
51
|
+
return (_jsxs("div", { css: editPathLengthsStyles, children: [_jsx("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), _jsxs("div", { className: "input-container", children: [_jsx(FormikNumberInput, { name: `signals[${signalIndex}].j.pathLength.from`, defaultValue: values.signals[signalIndex].j?.pathLength?.from ||
|
|
52
|
+
DefaultPathLengths[values.experimentType]?.from ||
|
|
53
|
+
1, label: "Min: ", style: {
|
|
54
|
+
input: {
|
|
55
|
+
color: errors.signals?.[signalIndex].j?.pathLength?.from
|
|
56
|
+
? 'red'
|
|
57
|
+
: 'black',
|
|
58
|
+
},
|
|
59
|
+
}, min: 1, max: values.signals[signalIndex].j?.pathLength?.to ||
|
|
60
|
+
DefaultPathLengths[values.experimentType]?.to, pattern: "[1-9]+" }, void 0), _jsx(FormikNumberInput, { name: `signals[${signalIndex}].j.pathLength.to`, defaultValue: values.signals[signalIndex].j?.pathLength?.to ||
|
|
61
|
+
DefaultPathLengths[values.experimentType]?.to ||
|
|
62
|
+
1, label: "Max: ", style: {
|
|
63
|
+
input: {
|
|
64
|
+
color: errors.signals?.[signalIndex].j?.pathLength?.to
|
|
65
|
+
? 'red'
|
|
66
|
+
: 'black',
|
|
67
|
+
},
|
|
68
|
+
}, min: values.signals[signalIndex].j?.pathLength?.from ||
|
|
69
|
+
DefaultPathLengths[values.experimentType]?.from ||
|
|
70
|
+
1, pattern: "[1-9]+" }, void 0)] }, void 0)] }, void 0));
|
|
71
|
+
}
|
|
72
|
+
export default EditPathLengthFormik;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface EditZoneModalProps {
|
|
2
|
+
onSaveEditZoneModal: (value: any) => Promise<void> | null | void;
|
|
3
|
+
onCloseEditZoneModal: () => void;
|
|
4
|
+
onZoomEditZoneModal: (value: any) => void;
|
|
5
|
+
rowData: any;
|
|
6
|
+
}
|
|
7
|
+
declare function EditZoneModal({ onSaveEditZoneModal, onCloseEditZoneModal, onZoomEditZoneModal, rowData, }: EditZoneModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default EditZoneModal;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
import { FaSearchPlus } from 'react-icons/fa';
|
|
6
|
+
import DefaultPathLengths from '../../../data/constants/DefaultPathLengths';
|
|
7
|
+
import Button from '../../elements/Button';
|
|
8
|
+
import CloseButton from '../../elements/CloseButton';
|
|
9
|
+
import SaveButton from '../../elements/SaveButton';
|
|
10
|
+
import FormikForm from '../../elements/formik/FormikForm';
|
|
11
|
+
import SignalsForm from './SignalsForm';
|
|
12
|
+
import useRangeFormValidation from './validation/EditZoneValidation';
|
|
13
|
+
import isDefaultPathLength from './validation/isDefaultPathLength';
|
|
14
|
+
const styles = css `
|
|
15
|
+
width: 500px;
|
|
16
|
+
height: 250px;
|
|
17
|
+
padding: 5px;
|
|
18
|
+
button:focus {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
.header {
|
|
22
|
+
height: 24px;
|
|
23
|
+
border-bottom: 1px solid #f0f0f0;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
span {
|
|
27
|
+
color: #464646;
|
|
28
|
+
font-size: 15px;
|
|
29
|
+
flex: 1;
|
|
30
|
+
border-left: 1px solid #ececec;
|
|
31
|
+
padding-left: 6px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
button {
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
border: none;
|
|
37
|
+
padding: 5px;
|
|
38
|
+
|
|
39
|
+
svg {
|
|
40
|
+
height: 16px;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.container {
|
|
45
|
+
display: flex;
|
|
46
|
+
margin: 30px 5px;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
function EditZoneModal({ onSaveEditZoneModal = () => null, onCloseEditZoneModal = () => null, onZoomEditZoneModal = () => null, rowData, }) {
|
|
50
|
+
const formRef = useRef(null);
|
|
51
|
+
const validation = useRangeFormValidation();
|
|
52
|
+
const handleOnZoom = useCallback(() => {
|
|
53
|
+
onZoomEditZoneModal(rowData);
|
|
54
|
+
}, [onZoomEditZoneModal, rowData]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
handleOnZoom();
|
|
57
|
+
}, [handleOnZoom]);
|
|
58
|
+
const handleOnClose = useCallback(() => {
|
|
59
|
+
onCloseEditZoneModal();
|
|
60
|
+
}, [onCloseEditZoneModal]);
|
|
61
|
+
const handleOnSave = useCallback(async (formValues) => {
|
|
62
|
+
const _rowData = {
|
|
63
|
+
...rowData,
|
|
64
|
+
signals: formValues.signals.map((signal) => {
|
|
65
|
+
if (isDefaultPathLength(signal.j?.pathLength, rowData.tableMetaInfo.experiment)) {
|
|
66
|
+
delete signal.j?.pathLength;
|
|
67
|
+
if (signal.j && Object.keys(signal.j).length === 0) {
|
|
68
|
+
delete signal.j;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return signal;
|
|
72
|
+
}),
|
|
73
|
+
};
|
|
74
|
+
await onSaveEditZoneModal(_rowData);
|
|
75
|
+
handleOnClose();
|
|
76
|
+
}, [handleOnClose, onSaveEditZoneModal, rowData]);
|
|
77
|
+
const data = useMemo(() => {
|
|
78
|
+
return {
|
|
79
|
+
activeTab: '0',
|
|
80
|
+
signals: rowData.signals.map((signal) => {
|
|
81
|
+
return {
|
|
82
|
+
...signal,
|
|
83
|
+
j: {
|
|
84
|
+
pathLength: {
|
|
85
|
+
from: DefaultPathLengths[rowData.tableMetaInfo.experiment]?.from || 1,
|
|
86
|
+
to: DefaultPathLengths[rowData.tableMetaInfo.experiment]?.to || 1,
|
|
87
|
+
},
|
|
88
|
+
...signal.j,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
}, [rowData.signals, rowData.tableMetaInfo.experiment]);
|
|
94
|
+
return (_jsx("div", { css: styles, children: _jsxs(FormikForm, { ref: formRef, initialValues: data, validationSchema: validation, onSubmit: handleOnSave, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button, { onClick: handleOnZoom, className: "zoom-button", children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }, void 0) }, void 0), _jsx("span", { children: `Zone and Signal edition` }, void 0), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), popupTitle: "Save and exit" }, void 0), _jsx(CloseButton, { onClick: handleOnClose }, void 0)] }, void 0), _jsx(SignalsForm, {}, void 0)] }, void 0) }, void 0));
|
|
95
|
+
}
|
|
96
|
+
export default EditZoneModal;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { useFormikContext } from 'formik';
|
|
5
|
+
import { useCallback, useMemo } from 'react';
|
|
6
|
+
import Tab from '../../elements/Tab/Tab';
|
|
7
|
+
import Tabs from '../../elements/Tab/Tabs';
|
|
8
|
+
import SignalFormTab from './SignalFormTab';
|
|
9
|
+
const textStyles = css `
|
|
10
|
+
text-align: center;
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
13
|
+
.errorText {
|
|
14
|
+
color: red;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.infoText {
|
|
18
|
+
padding: 10px;
|
|
19
|
+
margin: 10px 0;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
text-align: left;
|
|
22
|
+
color: white;
|
|
23
|
+
background-color: #5f5f5f;
|
|
24
|
+
border-radius: 5px;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
const tabStylesAddition = css `
|
|
28
|
+
color: red;
|
|
29
|
+
`;
|
|
30
|
+
const tabStyles = css `
|
|
31
|
+
display: inline-grid;
|
|
32
|
+
list-style: none;
|
|
33
|
+
padding: 0.5rem 1.5rem;
|
|
34
|
+
`;
|
|
35
|
+
function SignalsForm() {
|
|
36
|
+
const { values, setFieldValue, errors, } = useFormikContext();
|
|
37
|
+
const tabContainsErrors = useCallback((i) => {
|
|
38
|
+
return errors?.signals && errors?.signals[i] ? true : false;
|
|
39
|
+
}, [errors]);
|
|
40
|
+
const signalFormTabs = useMemo(() => {
|
|
41
|
+
const signalTabs = values.signals.length > 0
|
|
42
|
+
? values.signals.map((signal, i) => (_jsx(Tab
|
|
43
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
44
|
+
, { tabid: `${i}`, tabstyles: tabContainsErrors(i) ? tabStylesAddition : tabStyles, render: () => (_jsxs("div", { style: {
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
fontSize: '11px',
|
|
49
|
+
}, children: [_jsxs("span", { children: ["\uD835\uDEC5", _jsx("sub", { children: signal.x.nucleus }, void 0), ": ", signal.x.delta.toFixed(2)] }, void 0), _jsxs("span", { children: ["\uD835\uDEC5", _jsx("sub", { children: signal.y.nucleus }, void 0), ": ", signal.y.delta.toFixed(2)] }, void 0)] }, void 0)), children: _jsx(SignalFormTab, { signalIndex: i }, void 0) }, `signalForm_zone${i}`)))
|
|
50
|
+
: [];
|
|
51
|
+
return signalTabs;
|
|
52
|
+
}, [tabContainsErrors, values.signals]);
|
|
53
|
+
const tapClickHandler = useCallback(({ tabid }) => {
|
|
54
|
+
setFieldValue('activeTab', tabid);
|
|
55
|
+
}, [setFieldValue]);
|
|
56
|
+
const handleDeleteSignal = useCallback(({ tabid }) => {
|
|
57
|
+
const _signals = values.signals.filter((_signal, i) => i !== Number(tabid));
|
|
58
|
+
setFieldValue('signals', _signals);
|
|
59
|
+
}, [setFieldValue, values.signals]);
|
|
60
|
+
return (_jsxs("div", { children: [_jsx("div", { css: textStyles }, void 0), _jsx(Tabs, { activeTab: values.activeTab, onClick: tapClickHandler, onDelete: handleDeleteSignal, children: signalFormTabs }, void 0)] }, void 0));
|
|
61
|
+
}
|
|
62
|
+
export default SignalsForm;
|