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
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useCallback } from 'react';
|
|
3
|
-
import { FaRegTrashAlt, FaSearchPlus } from 'react-icons/fa';
|
|
3
|
+
import { FaEdit, FaRegTrashAlt, FaSearchPlus } from 'react-icons/fa';
|
|
4
4
|
import { SignalKinds } from '../../../../data/constants/SignalsKinds';
|
|
5
5
|
import { useAssignmentData } from '../../../assignment';
|
|
6
6
|
import { useDispatch } from '../../../context/DispatchContext';
|
|
7
7
|
import Select from '../../../elements/Select';
|
|
8
|
-
import {
|
|
8
|
+
import { useModal, positions, transitions, } from '../../../elements/popup/Modal';
|
|
9
|
+
import EditZoneModal from '../../../modal/editZone/EditZoneModal';
|
|
10
|
+
import { CHANGE_ZONE_SIGNAL_KIND, DELETE_2D_ZONE, SAVE_EDITED_ZONE, SET_SELECTED_TOOL, SET_X_DOMAIN, SET_Y_DOMAIN, } from '../../../reducer/types/Types';
|
|
11
|
+
import { options } from '../../../toolbar/ToolTypes';
|
|
9
12
|
const selectBoxStyle = {
|
|
10
13
|
marginLeft: 2,
|
|
11
14
|
marginRight: 2,
|
|
@@ -15,6 +18,7 @@ const selectBoxStyle = {
|
|
|
15
18
|
function ActionsColumn({ rowData, rowSpanTags }) {
|
|
16
19
|
const dispatch = useDispatch();
|
|
17
20
|
const assignmentData = useAssignmentData();
|
|
21
|
+
const modal = useModal();
|
|
18
22
|
const changeSignalKindHandler = useCallback((value) => {
|
|
19
23
|
dispatch({
|
|
20
24
|
type: CHANGE_ZONE_SIGNAL_KIND,
|
|
@@ -49,8 +53,27 @@ function ActionsColumn({ rowData, rowSpanTags }) {
|
|
|
49
53
|
: [rowData.y.to - yMargin, rowData.y.from + yMargin],
|
|
50
54
|
});
|
|
51
55
|
}, [dispatch, rowData.x.from, rowData.x.to, rowData.y.from, rowData.y.to]);
|
|
56
|
+
const saveEditZoneHandler = useCallback((editedRowData) => {
|
|
57
|
+
dispatch({
|
|
58
|
+
type: SAVE_EDITED_ZONE,
|
|
59
|
+
payload: {
|
|
60
|
+
editedRowData,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}, [dispatch]);
|
|
64
|
+
const openEditZoneHandler = useCallback(() => {
|
|
65
|
+
dispatch({
|
|
66
|
+
type: SET_SELECTED_TOOL,
|
|
67
|
+
payload: { selectedTool: options.editRange.id, tempRange: rowData },
|
|
68
|
+
});
|
|
69
|
+
modal.show(_jsx(EditZoneModal, { onCloseEditZoneModal: () => modal.close(), onSaveEditZoneModal: saveEditZoneHandler, onZoomEditZoneModal: () => zoomZoneHandler(), rowData: rowData }, void 0), {
|
|
70
|
+
position: positions.MIDDLE_RIGHT,
|
|
71
|
+
transition: transitions.SCALE,
|
|
72
|
+
isBackgroundBlur: false,
|
|
73
|
+
});
|
|
74
|
+
}, [dispatch, modal, rowData, saveEditZoneHandler, zoomZoneHandler]);
|
|
52
75
|
return (_jsxs(Fragment, { children: [_jsx("td", { children: _jsx(Select, { onChange: (value) => {
|
|
53
76
|
changeSignalKindHandler(value);
|
|
54
|
-
}, data: SignalKinds, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }, void 0) }, void 0), _jsxs("td", { ...rowSpanTags, children: [_jsx("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: _jsx(FaRegTrashAlt, {}, void 0) }, void 0), _jsx("button", { type: "button", className: "zoom-button", onClick: zoomZoneHandler, children: _jsx(FaSearchPlus, { title: "Zoom to zone in spectrum" }, void 0) }, void 0)] }, void 0)] }, void 0));
|
|
77
|
+
}, data: SignalKinds, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }, void 0) }, void 0), _jsxs("td", { ...rowSpanTags, children: [_jsx("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: _jsx(FaRegTrashAlt, {}, void 0) }, void 0), _jsx("button", { type: "button", className: "zoom-button", onClick: zoomZoneHandler, children: _jsx(FaSearchPlus, { title: "Zoom to zone in spectrum" }, void 0) }, void 0), _jsx("button", { type: "button", className: "edit-button", onClick: openEditZoneHandler, children: _jsx(FaEdit, { color: "blue" }, void 0) }, void 0)] }, void 0)] }, void 0));
|
|
55
78
|
}
|
|
56
79
|
export default ActionsColumn;
|
|
@@ -40,7 +40,7 @@ const style = css `
|
|
|
40
40
|
align-items: center;
|
|
41
41
|
}
|
|
42
42
|
`;
|
|
43
|
-
function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
|
|
43
|
+
function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment }) {
|
|
44
44
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
45
45
|
const assignmentData = useAssignmentData();
|
|
46
46
|
const dispatch = useDispatch();
|
|
@@ -137,13 +137,21 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
|
|
|
137
137
|
`,
|
|
138
138
|
], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: zones.values ? zones.values.length : 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', filterIsActive: filterIsActive, counterFiltered: tableData?.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: `Remove all Assignments`, popupPlacement: "right", children: _jsx("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: _jsx(FaUnlink, {}, void 0) }, void 0) }, void 0), _jsx(ToggleButton, { popupTitle: "show/hide zones", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('zones'), children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }, void 0) }, void 0), _jsx(ToggleButton, { popupTitle: "show/hide signals", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('signals'), children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }, void 0) }, void 0), _jsx(ToggleButton, { popupTitle: "show/hide peaks", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('peaks'), children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }, void 0) }, void 0)] }, void 0)), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler }, void 0)), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: tableData && tableData.length > 0 ? (_jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
|
|
139
139
|
? activeTab.split(',')
|
|
140
|
-
: ['?', '?'] }, void 0)) : (_jsx(NoTableData, {}, void 0)) }, void 0)) : (_jsx(ZonesPreferences, { ref: settingRef }, void 0)) }, void 0)] }, void 0) }, void 0));
|
|
140
|
+
: ['?', '?'], experiment: experiment }, void 0)) : (_jsx(NoTableData, {}, void 0)) }, void 0)) : (_jsx(ZonesPreferences, { ref: settingRef }, void 0)) }, void 0)] }, void 0) }, void 0));
|
|
141
141
|
}
|
|
142
142
|
const MemoizedZonesPanel = memo(ZonesPanelInner);
|
|
143
143
|
const emptyData = { zones: {} };
|
|
144
144
|
export default function ZonesPanel() {
|
|
145
145
|
const { displayerKey, xDomain, yDomain, activeTab } = useChartData();
|
|
146
|
-
const { zones } = useSpectrum(emptyData);
|
|
146
|
+
const { zones, info } = useSpectrum(emptyData);
|
|
147
147
|
const preferences = usePreferences();
|
|
148
|
-
return (_jsx(MemoizedZonesPanel, { ...{
|
|
148
|
+
return (_jsx(MemoizedZonesPanel, { ...{
|
|
149
|
+
xDomain,
|
|
150
|
+
yDomain,
|
|
151
|
+
activeTab,
|
|
152
|
+
displayerKey,
|
|
153
|
+
preferences,
|
|
154
|
+
zones,
|
|
155
|
+
experiment: info.experiment,
|
|
156
|
+
} }, void 0));
|
|
149
157
|
}
|
|
@@ -8,7 +8,8 @@ interface ZonesTableProps {
|
|
|
8
8
|
}>;
|
|
9
9
|
onUnlink: (zoneData: any, isOnZoneLevel: any, signalIndex: any, axis: any) => void;
|
|
10
10
|
context?: any;
|
|
11
|
-
nuclei:
|
|
11
|
+
nuclei: string[];
|
|
12
|
+
experiment: string;
|
|
12
13
|
}
|
|
13
|
-
declare function ZonesTable({ tableData, onUnlink, context, nuclei }: ZonesTableProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function ZonesTable({ tableData, onUnlink, context, nuclei, experiment, }: ZonesTableProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default ZonesTable;
|
|
@@ -52,7 +52,7 @@ const tableStyle = css `
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
|
-
function ZonesTable({ tableData, onUnlink, context, nuclei }) {
|
|
55
|
+
function ZonesTable({ tableData, onUnlink, context, nuclei, experiment, }) {
|
|
56
56
|
const contextRef = useRef(null);
|
|
57
57
|
const contextMenuHandler = useCallback((e, rowData) => {
|
|
58
58
|
if (!checkModifierKeyActivated(e)) {
|
|
@@ -72,6 +72,8 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
|
|
|
72
72
|
rowIndex: i,
|
|
73
73
|
signalIndex: 0,
|
|
74
74
|
id: zone.signals[0].id,
|
|
75
|
+
experiment,
|
|
76
|
+
nuclei,
|
|
75
77
|
},
|
|
76
78
|
});
|
|
77
79
|
}
|
|
@@ -100,13 +102,14 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
|
|
|
100
102
|
rowIndex: i,
|
|
101
103
|
signalIndex: j,
|
|
102
104
|
id: signal.id,
|
|
105
|
+
experiment,
|
|
103
106
|
},
|
|
104
107
|
});
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
110
|
});
|
|
108
111
|
return _data;
|
|
109
|
-
}, [tableData]);
|
|
112
|
+
}, [experiment, nuclei, tableData]);
|
|
110
113
|
const { items: sortedData, isSortedDesc, onSort } = useTableSortBy(data);
|
|
111
114
|
const rows = useMemo(() => sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, onContextMenu: (e, rowData) => contextMenuHandler(e, rowData) }, `${rowData.tableMetaInfo.id}`))), [contextMenuHandler, sortedData, onUnlink]);
|
|
112
115
|
return (_jsxs("div", { children: [_jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [_jsx("th", { rowSpan: 2, children: "#" }, void 0), _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }, void 0), _jsx("th", { colSpan: 2, children: _jsx(FaLink, {}, void 0) }, void 0), _jsx("th", { colSpan: 2, children: "\u03A3" }, void 0), _jsx("th", { rowSpan: 2, children: "Kind" }, void 0), _jsx("th", { rowSpan: 2, children: '' }, void 0)] }, void 0), _jsxs("tr", { children: [_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }, void 0) }, void 0), _jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx("tbody", { children: rows }, void 0)] }, void 0), _jsx(ContextMenu, { ref: contextRef, context: context }, void 0)] }, void 0));
|
|
@@ -16,7 +16,7 @@ const ignoreActions = [
|
|
|
16
16
|
types.SET_DIMENSIONS,
|
|
17
17
|
types.SET_X_DOMAIN,
|
|
18
18
|
types.SET_Y_DOMAIN,
|
|
19
|
-
types.
|
|
19
|
+
types.SET_ZOOM,
|
|
20
20
|
types.TOGGLE_REAL_IMAGINARY_VISIBILITY,
|
|
21
21
|
types.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER,
|
|
22
22
|
types.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE,
|
|
@@ -28,6 +28,7 @@ const ignoreActions = [
|
|
|
28
28
|
types.CHANGE_PEAKS_MARKERS_VISIBILITY,
|
|
29
29
|
types.CHANGE_ACTIVE_SPECTRUM,
|
|
30
30
|
types.CHANGE_SPECTRUM_COLOR,
|
|
31
|
+
types.SET_MOUSE_OVER_DISPLAYER,
|
|
31
32
|
];
|
|
32
33
|
function checkActionType(type) {
|
|
33
34
|
if (!ignoreActions.includes(type))
|
|
@@ -7,7 +7,6 @@ import { Contours } from '../../data/types/data2d/Contours';
|
|
|
7
7
|
import { UsedColors } from '../../types/UsedColors';
|
|
8
8
|
import { Spectra } from '../NMRium';
|
|
9
9
|
import { DISPLAYER_MODE } from './core/Constants';
|
|
10
|
-
import { Zoom1D } from './helper/Zoom1DManager';
|
|
11
10
|
import { ZoomHistory } from './helper/ZoomHistoryManager';
|
|
12
11
|
export interface ActiveSpectrum {
|
|
13
12
|
id: string;
|
|
@@ -79,6 +78,12 @@ export interface State {
|
|
|
79
78
|
yDomains: Record<string, Array<number>>;
|
|
80
79
|
shareYDomain: boolean;
|
|
81
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* y axis domain per spectrum for integrals
|
|
83
|
+
* value change when vertical scale change for the integrals
|
|
84
|
+
* @default {}
|
|
85
|
+
*/
|
|
86
|
+
integralsYDomains: Record<string, Array<number>>;
|
|
82
87
|
/**
|
|
83
88
|
* current select tab (nucleus)
|
|
84
89
|
* @default null
|
|
@@ -166,8 +171,6 @@ export interface State {
|
|
|
166
171
|
*/
|
|
167
172
|
zoom: {
|
|
168
173
|
history: ZoomHistory;
|
|
169
|
-
spectra: Zoom1D;
|
|
170
|
-
integral: Zoom1D;
|
|
171
174
|
};
|
|
172
175
|
/**
|
|
173
176
|
* boolean indicator to check if the mouse over the displayer or not
|
|
@@ -590,6 +593,9 @@ export declare const spectrumReducer: (base: {
|
|
|
590
593
|
};
|
|
591
594
|
readonly shareYDomain: boolean;
|
|
592
595
|
};
|
|
596
|
+
readonly integralsYDomains: {
|
|
597
|
+
readonly [x: string]: readonly number[];
|
|
598
|
+
};
|
|
593
599
|
readonly activeTab: string;
|
|
594
600
|
readonly width: number;
|
|
595
601
|
readonly height: number;
|
|
@@ -682,26 +688,6 @@ export declare const spectrumReducer: (base: {
|
|
|
682
688
|
readonly yDomain: readonly number[];
|
|
683
689
|
}[];
|
|
684
690
|
};
|
|
685
|
-
readonly spectra: {
|
|
686
|
-
readonly scales: {
|
|
687
|
-
readonly [x: string]: number;
|
|
688
|
-
};
|
|
689
|
-
readonly options: {
|
|
690
|
-
readonly slowZoomStep: number;
|
|
691
|
-
readonly fastZoomStep: number;
|
|
692
|
-
readonly speedThreshold: number;
|
|
693
|
-
};
|
|
694
|
-
};
|
|
695
|
-
readonly integral: {
|
|
696
|
-
readonly scales: {
|
|
697
|
-
readonly [x: string]: number;
|
|
698
|
-
};
|
|
699
|
-
readonly options: {
|
|
700
|
-
readonly slowZoomStep: number;
|
|
701
|
-
readonly fastZoomStep: number;
|
|
702
|
-
readonly speedThreshold: number;
|
|
703
|
-
};
|
|
704
|
-
};
|
|
705
691
|
};
|
|
706
692
|
readonly overDisplayer: boolean;
|
|
707
693
|
readonly toolOptions: {
|
|
@@ -25,7 +25,6 @@ import * as SpectrumsActions from './actions/SpectrumsActions';
|
|
|
25
25
|
import * as ToolsActions from './actions/ToolsActions';
|
|
26
26
|
import * as ZonesActions from './actions/ZonesActions';
|
|
27
27
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from './core/Constants';
|
|
28
|
-
import { initZoom1D } from './helper/Zoom1DManager';
|
|
29
28
|
import { UNDO, REDO, RESET } from './types/HistoryTypes';
|
|
30
29
|
import * as types from './types/Types';
|
|
31
30
|
export const initialState = {
|
|
@@ -44,6 +43,7 @@ export const initialState = {
|
|
|
44
43
|
yDomains: {},
|
|
45
44
|
shareYDomain: false,
|
|
46
45
|
},
|
|
46
|
+
integralsYDomains: {},
|
|
47
47
|
activeTab: '',
|
|
48
48
|
width: 0,
|
|
49
49
|
height: 0,
|
|
@@ -76,8 +76,6 @@ export const initialState = {
|
|
|
76
76
|
displayerKey: '',
|
|
77
77
|
zoom: {
|
|
78
78
|
history: {},
|
|
79
|
-
spectra: {},
|
|
80
|
-
integral: {},
|
|
81
79
|
},
|
|
82
80
|
overDisplayer: false,
|
|
83
81
|
toolOptions: {
|
|
@@ -101,14 +99,11 @@ export function initState(state) {
|
|
|
101
99
|
const correlations = buildCorrelationData([], {
|
|
102
100
|
tolerance: DefaultTolerance,
|
|
103
101
|
});
|
|
104
|
-
const spectra = initZoom1D();
|
|
105
|
-
const integral = initZoom1D();
|
|
106
|
-
const zoom = { spectra, integral, history: {} };
|
|
107
102
|
return {
|
|
108
103
|
...state,
|
|
109
104
|
correlations,
|
|
110
105
|
displayerKey,
|
|
111
|
-
|
|
106
|
+
history: {},
|
|
112
107
|
};
|
|
113
108
|
}
|
|
114
109
|
export function dispatchMiddleware(dispatch) {
|
|
@@ -272,7 +267,7 @@ function innerSpectrumReducer(draft, action) {
|
|
|
272
267
|
return SpectrumsActions.generateSpectrumFromPublicationStringHandler(draft, action);
|
|
273
268
|
case types.TOGGLE_REAL_IMAGINARY_VISIBILITY:
|
|
274
269
|
return ToolsActions.handleToggleRealImaginaryVisibility(draft);
|
|
275
|
-
case types.
|
|
270
|
+
case types.SET_ZOOM:
|
|
276
271
|
return ToolsActions.handleZoom(draft, action);
|
|
277
272
|
case types.SET_SPECTRA_SAME_TOP:
|
|
278
273
|
return ToolsActions.setSpectraSameTopHandler(draft);
|
|
@@ -366,6 +361,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
366
361
|
return ZonesActions.handleDeleteZone(draft, action);
|
|
367
362
|
case types.DELETE_2D_SIGNAL:
|
|
368
363
|
return ZonesActions.handleDeleteSignal(draft, action);
|
|
364
|
+
case types.SET_2D_SIGNAL_PATH_LENGTH:
|
|
365
|
+
return ZonesActions.handleSetSignalPathLength(draft, action);
|
|
369
366
|
case types.RESET_DOMAIN:
|
|
370
367
|
return DomainActions.handelResetDomain(draft);
|
|
371
368
|
case types.CHANGE_ZONE_SIGNAL_VALUE:
|
|
@@ -378,6 +375,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
378
375
|
return ZonesActions.handleSetDiaIDZone(draft, action);
|
|
379
376
|
case types.AUTO_ZONES_SPECTRA_PICKING:
|
|
380
377
|
return ZonesActions.handleAutoSpectraZonesDetection(draft);
|
|
378
|
+
case types.SAVE_EDITED_ZONE:
|
|
379
|
+
return ZonesActions.handleSaveEditedZone(draft, action);
|
|
381
380
|
case types.ANALYZE_SPECTRA:
|
|
382
381
|
return SpectraAnalysisActions.analyzeSpectra(draft, action);
|
|
383
382
|
case types.DELETE_ANALYZE_SPECTRA_RANGE:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generateSpectrumFromRanges } from '../../../data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges';
|
|
2
|
+
import { setZoom } from '../helper/Zoom1DManager';
|
|
2
3
|
import { setDomain } from './DomainActions';
|
|
3
|
-
import { setZoom } from './Zoom';
|
|
4
4
|
function handleRangeResurrecting(draft, action) {
|
|
5
5
|
const { ranges, info } = action.payload;
|
|
6
6
|
const datum = generateSpectrumFromRanges(ranges, info, draft.usedColors);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { Datum1D } from '../../../data/types/data1d';
|
|
2
3
|
import { State } from '../Reducer';
|
|
3
4
|
declare function getDomain(drfat: Draft<State>): {
|
|
4
5
|
xDomain: [number, number] | [undefined, undefined];
|
|
@@ -13,9 +14,10 @@ export interface SetDomainOptions {
|
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
declare function setDomain(draft: Draft<State>, options?: SetDomainOptions): void;
|
|
17
|
+
declare function setIntegralsYDomain(draft: Draft<State>, data: Datum1D[] | Datum1D): void;
|
|
16
18
|
declare function setOriginalDomain(draft: Draft<State>, originDomain: any): void;
|
|
17
19
|
declare function setXDomain(draft: Draft<State>, xDomain: any): void;
|
|
18
20
|
declare function setYDomain(draft: Draft<State>, yDomain: any): void;
|
|
19
21
|
declare function handelResetDomain(draft: Draft<State>): void;
|
|
20
22
|
declare function setMode(draft: Draft<State>): void;
|
|
21
|
-
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, };
|
|
23
|
+
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, setIntegralsYDomain, };
|
|
@@ -149,6 +149,25 @@ function setDomain(draft, options) {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
function getSpectrumIntegralsDomain(datum) {
|
|
153
|
+
const { integrals, ranges } = datum;
|
|
154
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
155
|
+
for (const integral of integrals.values) {
|
|
156
|
+
max = Math.max(max, integral.absolute);
|
|
157
|
+
}
|
|
158
|
+
for (const range of ranges.values) {
|
|
159
|
+
max = Math.max(max, range.absolute);
|
|
160
|
+
}
|
|
161
|
+
return [0, max];
|
|
162
|
+
}
|
|
163
|
+
function setIntegralsYDomain(draft, data) {
|
|
164
|
+
for (const spectrum of Array.isArray(data) ? data : [data]) {
|
|
165
|
+
if (spectrum?.info?.dimension === 1) {
|
|
166
|
+
draft.integralsYDomains[spectrum.id] =
|
|
167
|
+
getSpectrumIntegralsDomain(spectrum);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
152
171
|
function setOriginalDomain(draft, originDomain) {
|
|
153
172
|
draft.originDomain = originDomain;
|
|
154
173
|
}
|
|
@@ -170,4 +189,4 @@ function setMode(draft) {
|
|
|
170
189
|
nucleusToString(datum.info.nucleus) === draft.activeTab);
|
|
171
190
|
draft.mode = data[0]?.info.isFid ? 'LTR' : 'RTL';
|
|
172
191
|
}
|
|
173
|
-
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, };
|
|
192
|
+
export { getDomain, setOriginalDomain, setXDomain, setYDomain, handelResetDomain, setDomain, setMode, setIntegralsYDomain, };
|
|
@@ -4,6 +4,7 @@ import { updateIntegralsRelativeValues, changeIntegralsRelative, getShiftX, } fr
|
|
|
4
4
|
import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
5
5
|
import generateID from '../../../data/utilities/generateID';
|
|
6
6
|
import getRange from '../helper/getRange';
|
|
7
|
+
import { setIntegralsYDomain } from './DomainActions';
|
|
7
8
|
function handleChangeIntegralSum(draft, options) {
|
|
8
9
|
const { data, activeSpectrum, activeTab: nucleus } = draft;
|
|
9
10
|
if (activeSpectrum?.id) {
|
|
@@ -36,6 +37,7 @@ function addIntegral(draft, action) {
|
|
|
36
37
|
nucleus,
|
|
37
38
|
});
|
|
38
39
|
updateIntegralsRelativeValues(datum);
|
|
40
|
+
setIntegralsYDomain(draft, datum);
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
function deleteIntegral(draft, action) {
|
|
@@ -28,9 +28,30 @@ function setData(draft, data) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
|
|
31
|
+
// in case of older NMRium data are imported, convert hybridization string to number array
|
|
32
|
+
// @TODO remove following command to overwrite correlations at some point in future
|
|
33
|
+
draft.correlations =
|
|
34
|
+
convertHybridizationStringValuesInCorrelations(correlations);
|
|
35
|
+
// draft.correlations = correlations // original command without overwriting
|
|
32
36
|
}
|
|
33
37
|
}
|
|
38
|
+
function convertHybridizationStringValuesInCorrelations(correlations) {
|
|
39
|
+
return {
|
|
40
|
+
...correlations,
|
|
41
|
+
values: correlations.values.map((correlation) => {
|
|
42
|
+
if (typeof correlation.hybridization === 'string') {
|
|
43
|
+
let values = [];
|
|
44
|
+
if (correlation.hybridization.length > 0) {
|
|
45
|
+
const hybridizationString = correlation.hybridization.replaceAll('SP', '');
|
|
46
|
+
const value = Number(hybridizationString);
|
|
47
|
+
values.push(value);
|
|
48
|
+
}
|
|
49
|
+
correlation.hybridization = values;
|
|
50
|
+
}
|
|
51
|
+
return correlation;
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
34
55
|
function setPreferences(draft, data) {
|
|
35
56
|
const emptyPreferences = {
|
|
36
57
|
verticalAlign: null,
|
|
@@ -3,7 +3,6 @@ import GroupByInfoKey from '../../utility/GroupByInfoKey';
|
|
|
3
3
|
import nucleusToString from '../../utility/nucleusToString';
|
|
4
4
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from '../core/Constants';
|
|
5
5
|
import { setDomain } from './DomainActions';
|
|
6
|
-
import { setZoom } from './Zoom';
|
|
7
6
|
function changeSpectrumVerticalAlignment(draft, options) {
|
|
8
7
|
if (draft.data && draft.data.length > 0) {
|
|
9
8
|
let dataPerNucleus = [];
|
|
@@ -109,7 +108,6 @@ function applyKeyPreferencesHandler(draft, keyCode) {
|
|
|
109
108
|
}
|
|
110
109
|
else {
|
|
111
110
|
draft.zoom = preferences.zoom;
|
|
112
|
-
setZoom(draft);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
113
|
}
|
|
@@ -9,7 +9,7 @@ import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
|
9
9
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
10
10
|
import getRange from '../helper/getRange';
|
|
11
11
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
12
|
-
import { setDomain } from './DomainActions';
|
|
12
|
+
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
13
13
|
function handleAutoRangesDetection(draft, options) {
|
|
14
14
|
const { activeSpectrum, data, xDomain, molecules, activeTab: nucleus, } = draft;
|
|
15
15
|
if (activeSpectrum?.id) {
|
|
@@ -35,6 +35,7 @@ function handleAutoRangesDetection(draft, options) {
|
|
|
35
35
|
nucleus,
|
|
36
36
|
});
|
|
37
37
|
handleOnChangeRangesData(draft);
|
|
38
|
+
setIntegralsYDomain(draft, datum);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
function handleAutoSpectraRangesDetection(draft) {
|
|
@@ -210,6 +211,7 @@ function handleAddRange(draft, action) {
|
|
|
210
211
|
const [from, to] = range;
|
|
211
212
|
addRange(draft.data[index], { from, to, nucleus, molecules });
|
|
212
213
|
handleOnChangeRangesData(draft);
|
|
214
|
+
setIntegralsYDomain(draft, draft.data[index]);
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
function handleChangeRangeRelativeValue(draft, action) {
|
|
@@ -5,10 +5,10 @@ import { generateSpectrumFromPublicationString, getReferenceShift, } from '../..
|
|
|
5
5
|
import { getMissingProjection } from '../../../data/data2d/Spectrum2D';
|
|
6
6
|
import { options } from '../../toolbar/ToolTypes';
|
|
7
7
|
import GroupByInfoKey from '../../utility/GroupByInfoKey';
|
|
8
|
+
import { setZoom } from '../helper/Zoom1DManager';
|
|
8
9
|
import { setDomain, setMode } from './DomainActions';
|
|
9
10
|
import { resetSpectrumByFilter } from './FiltersActions';
|
|
10
11
|
import { setTab, setActiveTab } from './ToolsActions';
|
|
11
|
-
import { setZoom } from './Zoom';
|
|
12
12
|
function checkIsVisible2D(datum) {
|
|
13
13
|
if (datum.display.isPositiveVisible === false &&
|
|
14
14
|
datum.display.isNegativeVisible === false) {
|
|
@@ -8,13 +8,13 @@ import { LAYOUT } from '../../2d/utilities/DimensionLayout';
|
|
|
8
8
|
import { get2DYScale } from '../../2d/utilities/scale';
|
|
9
9
|
import { options } from '../../toolbar/ToolTypes';
|
|
10
10
|
import GroupByInfoKey from '../../utility/GroupByInfoKey';
|
|
11
|
+
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
11
12
|
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
12
|
-
import
|
|
13
|
+
import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
|
|
13
14
|
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
14
|
-
import { setDomain, setMode } from './DomainActions';
|
|
15
|
+
import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
|
|
15
16
|
import { resetSpectrumByFilter } from './FiltersActions';
|
|
16
17
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
17
|
-
import { setZoom1D, setZoom, ZoomType, wheel } from './Zoom';
|
|
18
18
|
function getStrongestPeak(draft) {
|
|
19
19
|
const { activeSpectrum, data } = draft;
|
|
20
20
|
if (activeSpectrum) {
|
|
@@ -204,34 +204,37 @@ function getSpectrumID(draft, index) {
|
|
|
204
204
|
return spectrum?.id ? spectrum.id : null;
|
|
205
205
|
}
|
|
206
206
|
function handleZoom(draft, action) {
|
|
207
|
-
const {
|
|
208
|
-
const { activeSpectrum, toolOptions: { data: { showRangesIntegrals }, }, } = draft;
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
case LAYOUT.LEFT_1D: {
|
|
218
|
-
const id = getSpectrumID(draft, 1);
|
|
219
|
-
wheel(deltaY, deltaMode, draft, id);
|
|
220
|
-
setZoom1D(draft, draft.margin.left, 10, 1);
|
|
221
|
-
break;
|
|
207
|
+
const { event, trackID, selectedTool } = action;
|
|
208
|
+
const { activeSpectrum, toolOptions: { data: { showRangesIntegrals }, }, displayerMode, } = draft;
|
|
209
|
+
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
210
|
+
const index = trackID === LAYOUT.TOP_1D ? 0 : trackID === LAYOUT.LEFT_1D ? 1 : null;
|
|
211
|
+
if (index !== null) {
|
|
212
|
+
const id = getSpectrumID(draft, index);
|
|
213
|
+
if (id) {
|
|
214
|
+
const domain = draft.yDomains[id];
|
|
215
|
+
draft.yDomains[id] = wheelZoom(event, domain);
|
|
222
216
|
}
|
|
223
|
-
default:
|
|
224
|
-
break;
|
|
225
217
|
}
|
|
226
218
|
}
|
|
227
|
-
else if (activeSpectrum?.id &&
|
|
228
|
-
shiftKey &&
|
|
229
|
-
(showRangesIntegrals || selectedTool === options.integral.id)) {
|
|
230
|
-
Zoom1DManager(draft.zoom.integral).wheel(deltaY, activeSpectrum?.id);
|
|
231
|
-
}
|
|
232
219
|
else {
|
|
233
|
-
|
|
234
|
-
|
|
220
|
+
if (activeSpectrum?.id) {
|
|
221
|
+
if ((showRangesIntegrals || selectedTool === options.integral.id) &&
|
|
222
|
+
event.shiftKey) {
|
|
223
|
+
const domain = draft.integralsYDomains[activeSpectrum?.id];
|
|
224
|
+
draft.integralsYDomains[activeSpectrum?.id] = wheelZoom(event, domain);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
const domain = draft.yDomains[activeSpectrum?.id];
|
|
228
|
+
draft.yDomains[activeSpectrum?.id] = wheelZoom(event, domain);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
const spectra = getSpectraByNucleus(draft.activeTab, draft.data);
|
|
233
|
+
for (const spectrum of spectra) {
|
|
234
|
+
const domain = draft.yDomains[spectrum.id];
|
|
235
|
+
draft.yDomains[spectrum.id] = wheelZoom(event, domain);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
235
238
|
}
|
|
236
239
|
}
|
|
237
240
|
function zoomOut(draft, action) {
|
|
@@ -387,6 +390,7 @@ function setActiveTab(draft, options) {
|
|
|
387
390
|
resetTool(draft);
|
|
388
391
|
Processing2DData(draft, dataGroupByNucleus);
|
|
389
392
|
setDomain(draft, domainOptions);
|
|
393
|
+
setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
|
|
390
394
|
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
|
|
391
395
|
const zoomValue = zoomHistory.getLast();
|
|
392
396
|
if (zoomValue) {
|
|
@@ -8,6 +8,8 @@ declare function changeZoneSignalDelta(draft: Draft<State>, action: any): void;
|
|
|
8
8
|
declare function handleChangeZoneSignalKind(draft: Draft<State>, action: any): void;
|
|
9
9
|
declare function handleDeleteZone(draft: Draft<State>, action: any): void;
|
|
10
10
|
declare function handleDeleteSignal(draft: Draft<State>, action: any): void;
|
|
11
|
+
declare function handleSetSignalPathLength(draft: Draft<State>, action: any): void;
|
|
11
12
|
declare function handleUnlinkZone(draft: Draft<State>, action: any): void;
|
|
12
13
|
declare function handleSetDiaIDZone(draft: Draft<State>, action: any): void;
|
|
13
|
-
|
|
14
|
+
declare function handleSaveEditedZone(draft: Draft<State>, action: any): void;
|
|
15
|
+
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { original } from 'immer';
|
|
2
2
|
import lodashCloneDeep from 'lodash/cloneDeep';
|
|
3
|
+
import { setPathLength } from 'nmr-correlation';
|
|
3
4
|
import * as Filters from '../../../data/Filters';
|
|
4
5
|
import * as FiltersManager from '../../../data/FiltersManager';
|
|
5
6
|
import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/SignalsKinds';
|
|
@@ -125,6 +126,21 @@ function handleDeleteSignal(draft, action) {
|
|
|
125
126
|
handleOnChangeZonesData(draft);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
129
|
+
function handleSetSignalPathLength(draft, action) {
|
|
130
|
+
const { spectrum, zone, signal, pathLength } = action.payload;
|
|
131
|
+
if (spectrum && zone) {
|
|
132
|
+
const datum2D = draft.data.find((datum) => datum.id === spectrum.id);
|
|
133
|
+
const zoneIndex = datum2D.zones.values.findIndex((_zone) => _zone.id === zone.id);
|
|
134
|
+
const signalIndex = zone.signals.findIndex((_signal) => _signal.id === signal.id);
|
|
135
|
+
const _zone = unlink(lodashCloneDeep(zone), false, signalIndex, undefined);
|
|
136
|
+
_zone.signals[signalIndex].j = {
|
|
137
|
+
..._zone.signals[signalIndex].j,
|
|
138
|
+
pathLength,
|
|
139
|
+
};
|
|
140
|
+
datum2D.zones.values[zoneIndex] = _zone;
|
|
141
|
+
handleOnChangeZonesData(draft);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
128
144
|
function handleUnlinkZone(draft, action) {
|
|
129
145
|
const state = original(draft);
|
|
130
146
|
if (state.activeSpectrum?.id) {
|
|
@@ -163,10 +179,25 @@ function handleSetDiaIDZone(draft, action) {
|
|
|
163
179
|
_zone.signals[signalIndex][axis].diaIDs = diaIDs;
|
|
164
180
|
_zone.signals[signalIndex][axis].nbAtoms = getNbAtoms(nbAtoms, _zone.signals[signalIndex][axis].nbAtoms);
|
|
165
181
|
}
|
|
166
|
-
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function handleSaveEditedZone(draft, action) {
|
|
185
|
+
const state = original(draft);
|
|
186
|
+
if (state.activeSpectrum?.id) {
|
|
187
|
+
const { index } = state.activeSpectrum;
|
|
188
|
+
const { editedRowData } = action.payload;
|
|
189
|
+
delete editedRowData.tableMetaInfo;
|
|
190
|
+
const zoneIndex = getZoneIndex(state, index, editedRowData.id);
|
|
191
|
+
draft.data[index].zones.values[zoneIndex] = editedRowData;
|
|
192
|
+
if (editedRowData.signals) {
|
|
193
|
+
editedRowData.signals.forEach((signal) => {
|
|
194
|
+
setPathLength(draft.correlations.values, signal.id, signal.j?.pathLength);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
handleOnChangeZonesData(draft);
|
|
167
198
|
}
|
|
168
199
|
}
|
|
169
200
|
function handleOnChangeZonesData(draft) {
|
|
170
201
|
handleUpdateCorrelations(draft);
|
|
171
202
|
}
|
|
172
|
-
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSetDiaIDZone, changeZonesFactorHandler, handleAutoSpectraZonesDetection, };
|
|
203
|
+
export { add2dZoneHandler, handleAutoZonesDetection, handleDeleteSignal, handleDeleteZone, changeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, changeZonesFactorHandler, handleAutoSpectraZonesDetection, };
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Draft } from 'immer';
|
|
2
|
+
import { State } from '../Reducer';
|
|
3
|
+
export declare const ZoomType: {
|
|
4
|
+
HORIZONTAL: string;
|
|
5
|
+
VERTICAL: string;
|
|
6
|
+
STEP_HORIZONTAL: string;
|
|
7
|
+
FULL: string;
|
|
8
|
+
};
|
|
9
|
+
interface ZoomOptions {
|
|
10
|
+
factor?: number;
|
|
11
|
+
invert?: boolean;
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
getScale: (id: string) => number;
|
|
18
|
-
}
|
|
19
|
-
export declare function initZoom1D(): Zoom1D;
|
|
20
|
-
export declare function setAllScales(Zoom1DObject: Zoom1D, newScale: number): void;
|
|
21
|
-
export default function zoom1DManager(Zoom1DObject: Zoom1D, defaultScale?: number): Zoom1DManager;
|
|
22
|
-
export {};
|
|
13
|
+
declare function wheelZoom(event: WheelEvent, domain: number[], zoomOptions?: ZoomOptions): number[];
|
|
14
|
+
declare function setZoom(draft: Draft<State>, options?: {
|
|
15
|
+
scale?: number;
|
|
16
|
+
spectrumID?: string;
|
|
17
|
+
}): void;
|
|
18
|
+
export { setZoom, wheelZoom };
|