nmrium 0.54.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +3 -1
- package/lib/component/1d/Viewer1D.js +36 -11
- package/lib/component/1d/XAxis.js +1 -1
- package/lib/component/1d/integral/IntegralsSeries.js +2 -2
- package/lib/component/1d/integral/Integration.d.ts +3 -1
- package/lib/component/1d/integral/Integration.js +3 -2
- package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
- package/lib/component/1d/matrix/Boxplot.js +97 -0
- package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
- package/lib/component/1d/matrix/Stocsy.js +101 -0
- package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
- package/lib/component/1d/matrix/useMatrix.js +93 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
- package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
- package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
- package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
- package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
- package/lib/component/1d/ranges/Atoms.js +4 -5
- package/lib/component/1d/ranges/Range.js +48 -6
- package/lib/component/1d/ranges/Ranges.js +2 -1
- package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
- package/lib/component/1d/utilities/scale.d.ts +2 -1
- package/lib/component/1d/utilities/scale.js +6 -1
- package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
- package/lib/component/1d-2d/FieldEdition.js +42 -0
- package/lib/component/2d/Chart2D.js +5 -3
- package/lib/component/2d/zones/Zone.js +18 -2
- package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
- package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
- package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
- package/lib/component/context/PrepareExportContext.d.ts +21 -0
- package/lib/component/context/PrepareExportContext.js +124 -0
- package/lib/component/context/ShareDataContext.d.ts +10 -0
- package/lib/component/context/ShareDataContext.js +22 -0
- package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
- package/lib/component/elements/ActionsButtonsPopover.js +22 -0
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
- package/lib/component/elements/SVGButton.d.ts +14 -0
- package/lib/component/elements/SVGButton.js +6 -0
- package/lib/component/elements/SVGGroup.js +15 -13
- package/lib/component/elements/SVGText.d.ts +8 -0
- package/lib/component/elements/SVGText.js +24 -0
- package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.d.ts +2 -1
- package/lib/component/elements/formik/FormikInput.js +4 -3
- package/lib/component/header/Header.js +7 -10
- package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
- package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useExport.js +4 -4
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
- package/lib/component/hooks/useIntegralPath.d.ts +2 -0
- package/lib/component/hooks/useIntegralPath.js +3 -1
- package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
- package/lib/component/hooks/usePanelPreferences.js +4 -3
- package/lib/component/hooks/useSaveSettings.js +7 -14
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
- package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
- package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
- package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
- package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
- package/lib/component/hooks/useWorkspaceAction.js +89 -0
- package/lib/component/loader/DropZone.js +0 -3
- package/lib/component/main/InnerNMRium.js +3 -1
- package/lib/component/main/InnerNMRiumContents.js +14 -2
- package/lib/component/main/NMRiumStateProvider.js +4 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
- package/lib/component/modal/setting/GeneralSettings.js +7 -21
- package/lib/component/modal/setting/WorkspaceItem.js +1 -1
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
- package/lib/component/modal/setting/settingsValidation.js +36 -40
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
- package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
- package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +18 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
- package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
- package/lib/component/panels/databasePanel/DatabaseTable.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +6 -0
- package/lib/component/reducer/Reducer.js +6 -0
- package/lib/component/reducer/actions/DomainActions.d.ts +12 -4
- package/lib/component/reducer/actions/DomainActions.js +35 -5
- package/lib/component/reducer/actions/FiltersActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +5 -2
- package/lib/component/reducer/actions/RangesActions.js +12 -6
- package/lib/component/reducer/actions/SpectraActions.d.ts +1 -0
- package/lib/component/reducer/actions/SpectraActions.js +7 -2
- package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
- package/lib/component/reducer/actions/ZonesActions.js +47 -13
- package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
- package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
- package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
- package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
- package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
- package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +63 -26
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
- package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +5 -2
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +17 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +9 -25
- package/lib/component/reducer/preferences/preferencesReducer.js +28 -19
- package/lib/component/toolbar/ToolBar.js +23 -20
- package/lib/component/utility/PathBuilder.d.ts +1 -0
- package/lib/component/utility/PathBuilder.js +8 -1
- package/lib/component/utility/PreferencesHelper.js +5 -4
- package/lib/component/utility/export.js +4 -0
- package/lib/component/workspaces/assignment.js +0 -1
- package/lib/component/workspaces/basic.js +0 -1
- package/lib/component/workspaces/embedded.js +0 -1
- package/lib/component/workspaces/exercise.js +26 -29
- package/lib/component/workspaces/prediction.js +171 -174
- package/lib/component/workspaces/process1D.js +0 -1
- package/lib/component/workspaces/simulation.js +35 -38
- package/lib/component/workspaces/workspaceDefaultProperties.js +9 -11
- package/lib/data/types/common/DeepPartial.d.ts +3 -0
- package/lib/data/types/common/DeepPartial.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +39 -39
- package/lib/component/elements/CustomToolTip.d.ts +0 -8
- package/lib/component/elements/CustomToolTip.js +0 -107
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Axis, Heading, Legend, LineSeries, Plot, } from 'react-plot';
|
|
3
3
|
export default function PlotChart({ data, sign, color, yLogBase, hideHeading = false, }) {
|
|
4
|
-
return (_jsxs(Plot, { width: 180, height: 220, children: [!hideHeading && _jsx(Heading, { title: "
|
|
4
|
+
return (_jsxs(Plot, { width: 180, height: 220, children: [!hideHeading && _jsx(Heading, { title: "SAN plot" }), _jsx(LineSeries, { data: data.sanPlot?.[sign] || [], xAxis: "x", yAxis: "y", label: sign, lineStyle: {
|
|
5
5
|
stroke: color,
|
|
6
6
|
strokeWidth: 1.2,
|
|
7
7
|
}, markerStyle: {
|
|
@@ -7,7 +7,7 @@ function Spectrum2DHistogram({ color = 'red', data, }) {
|
|
|
7
7
|
const processedData = useMemo(() => {
|
|
8
8
|
return processSnapPlot('2D', data.rr, yLogBase);
|
|
9
9
|
}, [data]);
|
|
10
|
-
return (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "
|
|
10
|
+
return (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "SAN plot" }), _jsxs("div", { style: {
|
|
11
11
|
borderTop: '1px solid #ededed',
|
|
12
12
|
marginTop: '10px',
|
|
13
13
|
paddingTop: '10px',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ZoneData } from '../hooks/useMapZones';
|
|
2
|
+
interface ZoneAssignmentLabelColumnProps {
|
|
3
|
+
rowData: ZoneData;
|
|
4
|
+
}
|
|
5
|
+
export declare function ZoneAssignmentLabelColumn({ rowData, }: ZoneAssignmentLabelColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDispatch } from '../../../context/DispatchContext';
|
|
3
|
+
import EditableColumn from '../../../elements/EditableColumn';
|
|
4
|
+
export function ZoneAssignmentLabelColumn({ rowData, }) {
|
|
5
|
+
const dispatch = useDispatch();
|
|
6
|
+
function saveHandler(event) {
|
|
7
|
+
dispatch({
|
|
8
|
+
type: 'CHANGE_ZONE_ASSIGNMENT_LABEL',
|
|
9
|
+
payload: {
|
|
10
|
+
value: event.target.value,
|
|
11
|
+
zoneID: rowData.id,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return (_jsx("td", { children: _jsx(EditableColumn, { value: rowData?.assignment || '', onSave: saveHandler, style: { padding: '0.1rem 0.4rem' } }) }));
|
|
16
|
+
}
|
|
@@ -3,18 +3,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useState, useMemo, useCallback, useRef, memo } from 'react';
|
|
5
5
|
import { FaUnlink } from 'react-icons/fa';
|
|
6
|
+
import { LuSubtitles } from 'react-icons/lu';
|
|
6
7
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
7
8
|
import { useChartData } from '../../context/ChartContext';
|
|
8
9
|
import { useDispatch } from '../../context/DispatchContext';
|
|
9
10
|
import { useModal } from '../../elements/popup/Modal';
|
|
10
11
|
import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
|
|
11
12
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
13
|
+
import { booleanToString } from '../../utility/booleanToString';
|
|
12
14
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
13
15
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
14
16
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
15
17
|
import ZonesPreferences from './ZonesPreferences';
|
|
16
18
|
import ZonesTable from './ZonesTable';
|
|
17
|
-
function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, }) {
|
|
19
|
+
function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, showAssignmentsLabels, }) {
|
|
18
20
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
19
21
|
const assignmentData = useAssignmentData();
|
|
20
22
|
const dispatch = useDispatch();
|
|
@@ -115,7 +117,14 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
115
117
|
payload: { key: 'showPeaks' },
|
|
116
118
|
});
|
|
117
119
|
};
|
|
120
|
+
function handleShowAssignmentsLabel() {
|
|
121
|
+
dispatch({
|
|
122
|
+
type: 'TOGGLE_ZONES_VIEW_PROPERTY',
|
|
123
|
+
payload: { key: 'showAssignmentsLabels' },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
118
126
|
const total = zones?.values?.length || 0;
|
|
127
|
+
const hasZones = zones?.values && zones.values.length > 0;
|
|
119
128
|
return (_jsxs("div", { css: [
|
|
120
129
|
tablePanelStyle,
|
|
121
130
|
isFlipped &&
|
|
@@ -126,7 +135,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
126
135
|
`,
|
|
127
136
|
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: tableData?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', onSettingClick: settingsPanelHandler, leftButtons: [
|
|
128
137
|
{
|
|
129
|
-
disabled: !
|
|
138
|
+
disabled: !hasZones,
|
|
130
139
|
icon: _jsx(FaUnlink, {}),
|
|
131
140
|
tooltip: 'Remove all assignments',
|
|
132
141
|
onClick: handleOnRemoveAssignments,
|
|
@@ -149,6 +158,13 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
149
158
|
active: showPeaks,
|
|
150
159
|
onClick: handleSetShowPeaks,
|
|
151
160
|
},
|
|
161
|
+
{
|
|
162
|
+
disabled: !hasZones,
|
|
163
|
+
icon: _jsx(LuSubtitles, {}),
|
|
164
|
+
tooltip: `${booleanToString(!showAssignmentsLabels)} assignments labels`,
|
|
165
|
+
onClick: handleShowAssignmentsLabel,
|
|
166
|
+
active: showAssignmentsLabels,
|
|
167
|
+
},
|
|
152
168
|
] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: _jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nucleus: activeTab, info: info }) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
|
|
153
169
|
}
|
|
154
170
|
const MemoizedZonesPanel = memo(ZonesPanelInner);
|
|
@@ -19,36 +19,42 @@ const preferences1DFields = [
|
|
|
19
19
|
const preferences2DFields = [
|
|
20
20
|
{
|
|
21
21
|
id: 1,
|
|
22
|
-
label: 'Serial number
|
|
22
|
+
label: 'Serial number:',
|
|
23
23
|
checkControllerName: 'showSerialNumber',
|
|
24
24
|
hideFormatField: true,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
id: 2,
|
|
28
|
-
label: '
|
|
29
|
-
checkControllerName: '
|
|
28
|
+
label: 'Assignment label:',
|
|
29
|
+
checkControllerName: 'showAssignmentLabel',
|
|
30
30
|
hideFormatField: true,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
id: 3,
|
|
34
|
-
label: '
|
|
35
|
-
checkControllerName: '
|
|
34
|
+
label: 'Kind:',
|
|
35
|
+
checkControllerName: 'showKind',
|
|
36
36
|
hideFormatField: true,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
id: 4,
|
|
40
|
-
label: '
|
|
41
|
-
checkControllerName: '
|
|
40
|
+
label: 'Assignment links:',
|
|
41
|
+
checkControllerName: 'showAssignment',
|
|
42
42
|
hideFormatField: true,
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
id: 5,
|
|
46
|
-
label: '
|
|
47
|
-
checkControllerName: '
|
|
46
|
+
label: 'Delete action:',
|
|
47
|
+
checkControllerName: 'showDeleteAction',
|
|
48
48
|
hideFormatField: true,
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
id: 6,
|
|
52
|
+
label: 'Zoom action:',
|
|
53
|
+
checkControllerName: 'showZoomAction',
|
|
54
|
+
hideFormatField: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 7,
|
|
52
58
|
label: 'Edit action :',
|
|
53
59
|
checkControllerName: 'showEditAction',
|
|
54
60
|
hideFormatField: true,
|
|
@@ -67,7 +67,7 @@ function ZonesTable({ tableData, onUnlink, nucleus, info }) {
|
|
|
67
67
|
const { items: sortedData, isSortedDesc, onSort } = useTableSortBy(data);
|
|
68
68
|
const { deltaPPM: deltaX } = usePanelPreferences('zones', nuclei?.[0]);
|
|
69
69
|
const { deltaPPM: deltaY } = usePanelPreferences('zones', nuclei?.[1]);
|
|
70
|
-
const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, } = usePanelPreferences('zones', nucleus);
|
|
70
|
+
const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, showAssignmentLabel, } = usePanelPreferences('zones', nucleus);
|
|
71
71
|
const showActions = showDeleteAction || showEditAction || showZoomAction;
|
|
72
72
|
if (isFid) {
|
|
73
73
|
return _jsx(NoDataForFid, {});
|
|
@@ -75,7 +75,7 @@ function ZonesTable({ tableData, onUnlink, nucleus, info }) {
|
|
|
75
75
|
if (!tableData || tableData.length === 0) {
|
|
76
76
|
return _jsx(NoTableData, {});
|
|
77
77
|
}
|
|
78
|
-
return (_jsx("div", { children: _jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [showSerialNumber && _jsx("th", { rowSpan: 2, children: "#" }), (deltaX.show || deltaX.show) && _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { colSpan: 2, children: _jsx(FaLink, {}) }), _jsx("th", { colSpan: 2, children: "\u03A3" })] })), showKind && _jsx("th", { rowSpan: 2, children: "Kind" }), showActions && _jsx("th", { rowSpan: 2, children: '' })] }), _jsxs("tr", { children: [deltaX.show && (_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }) })), deltaY.show && (_jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }) })), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) })] }))] })] }), _jsx("tbody", { children: sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, nucleus: nucleus }, `${rowData.tableMetaInfo.id}`))) })] }) }));
|
|
78
|
+
return (_jsx("div", { children: _jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [showSerialNumber && _jsx("th", { rowSpan: 2, children: "#" }), showAssignmentLabel && _jsx("th", { rowSpan: 2, children: "Assignment" }), (deltaX.show || deltaX.show) && _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { colSpan: 2, children: _jsx(FaLink, {}) }), _jsx("th", { colSpan: 2, children: "\u03A3" })] })), showKind && _jsx("th", { rowSpan: 2, children: "Kind" }), showActions && _jsx("th", { rowSpan: 2, children: '' })] }), _jsxs("tr", { children: [deltaX.show && (_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }) })), deltaY.show && (_jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }) })), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) })] }))] })] }), _jsx("tbody", { children: sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, nucleus: nucleus }, `${rowData.tableMetaInfo.id}`))) })] }) }));
|
|
79
79
|
}
|
|
80
80
|
function SurroundedText(props) {
|
|
81
81
|
return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
@@ -10,6 +10,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
|
10
10
|
import ActionsColumn from './TableColumns/ActionsColumn';
|
|
11
11
|
import SignalAssignmentsColumns from './TableColumns/SignalAssignmentsColumns';
|
|
12
12
|
import SignalDeltaColumn from './TableColumns/SignalDeltaColumn';
|
|
13
|
+
import { ZoneAssignmentLabelColumn } from './TableColumns/ZoneAssignmentLabelColumn';
|
|
13
14
|
import ZoneAssignmentsColumns from './TableColumns/ZoneAssignmentsColumns';
|
|
14
15
|
const HighlightedRowStyle = { backgroundColor: '#ff6f0057' };
|
|
15
16
|
const ConstantlyHighlightedRowStyle = { backgroundColor: '#f5f5dc' };
|
|
@@ -21,7 +22,7 @@ function ZonesTableRow({ rowData, onUnlink, contextMenu = [], onContextMenuSelec
|
|
|
21
22
|
const assignmentSignal = useAssignment(rowData.tableMetaInfo.id);
|
|
22
23
|
const highlightSignalX = useHighlight([buildID(assignmentSignal.id, 'X')].concat(assignmentSignal.assigned?.x || [], buildID(assignmentSignal.id, 'Crosshair')));
|
|
23
24
|
const highlightSignalY = useHighlight([buildID(assignmentSignal.id, 'Y')].concat(assignmentSignal.assigned?.y || [], buildID(assignmentSignal.id, 'Crosshair')));
|
|
24
|
-
const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, } = usePanelPreferences('zones', nucleus);
|
|
25
|
+
const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, showAssignmentLabel, } = usePanelPreferences('zones', nucleus);
|
|
25
26
|
const rowSpanTags = useMemo(() => {
|
|
26
27
|
return {
|
|
27
28
|
rowSpan: rowData.tableMetaInfo.rowSpan,
|
|
@@ -119,6 +120,6 @@ function ZonesTableRow({ rowData, onUnlink, contextMenu = [], onContextMenuSelec
|
|
|
119
120
|
? HighlightedRowStyle
|
|
120
121
|
: lodashGet(rowData, 'tableMetaInfo.isConstantlyHighlighted', false)
|
|
121
122
|
? ConstantlyHighlightedRowStyle
|
|
122
|
-
: null, ...highlightZone.onHover, children: [showSerialNumber && _jsx("td", { ...rowSpanTags, children: rowIndex + 1 }), _jsx(SignalDeltaColumn, { rowData: rowData, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, nucleus: nucleus }), showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumns, { rowData: rowData, assignmentSignal: assignmentSignal, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, onClick: clickHandler, onUnlink: unlinkHandler, highlightSignalX: highlightSignalX, highlightSignalY: highlightSignalY }), _jsx(ZoneAssignmentsColumns, { rowData: rowData, assignmentZone: assignmentZone, onHoverZoneX: onHoverZoneX, onHoverZoneY: onHoverZoneY, rowSpanTags: rowSpanTags, onClick: clickHandler, onUnlink: unlinkHandler, highlightZoneX: highlightZoneX, highlightZoneY: highlightZoneY })] })), _jsx(ActionsColumn, { rowData: rowData, rowSpanTags: rowSpanTags, showKind, showDeleteAction, showEditAction, showZoomAction })] }));
|
|
123
|
+
: null, ...highlightZone.onHover, children: [showSerialNumber && _jsx("td", { ...rowSpanTags, children: rowIndex + 1 }), showAssignmentLabel && _jsx(ZoneAssignmentLabelColumn, { rowData: rowData }), _jsx(SignalDeltaColumn, { rowData: rowData, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, nucleus: nucleus }), showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumns, { rowData: rowData, assignmentSignal: assignmentSignal, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, onClick: clickHandler, onUnlink: unlinkHandler, highlightSignalX: highlightSignalX, highlightSignalY: highlightSignalY }), _jsx(ZoneAssignmentsColumns, { rowData: rowData, assignmentZone: assignmentZone, onHoverZoneX: onHoverZoneX, onHoverZoneY: onHoverZoneY, rowSpanTags: rowSpanTags, onClick: clickHandler, onUnlink: unlinkHandler, highlightZoneX: highlightZoneX, highlightZoneY: highlightZoneY })] })), _jsx(ActionsColumn, { rowData: rowData, rowSpanTags: rowSpanTags, showKind, showDeleteAction, showEditAction, showZoomAction })] }));
|
|
123
124
|
}
|
|
124
125
|
export default ZonesTableRow;
|
|
@@ -106,7 +106,7 @@ const databaseTableColumns = (databasePreferences) => [
|
|
|
106
106
|
Cell({ row }) {
|
|
107
107
|
const { idCode, coordinates } = row.original?.ocl || {};
|
|
108
108
|
const smiles = row.original?.smiles;
|
|
109
|
-
return (_jsx(ResponsiveChart, { children: ({ width, height }) => {
|
|
109
|
+
return (_jsx(ResponsiveChart, { minWidth: 50, minHeight: 23, children: ({ width, height }) => {
|
|
110
110
|
if (idCode && coordinates) {
|
|
111
111
|
return (_jsx(IdcodeSvgRenderer, { height: height, width: width, idcode: idCode, coordinates: coordinates }));
|
|
112
112
|
}
|
|
@@ -151,6 +151,6 @@ function DatabaseTable({ data, onAdd, onSave, totalCount, }) {
|
|
|
151
151
|
}
|
|
152
152
|
return columns.sort((object1, object2) => object1.index - object2.index);
|
|
153
153
|
}, [databasePreferences, initialColumns]);
|
|
154
|
-
return (_jsx(ReactTable, { data: data, columns: tableColumns, highlightedSource: HighlightEventSource.DATABASE, groupKey: "index", approxItemHeight: 23
|
|
154
|
+
return (_jsx(ReactTable, { data: data, columns: tableColumns, highlightedSource: HighlightEventSource.DATABASE, groupKey: "index", approxItemHeight: 23, enableVirtualScroll: true, totalCount: totalCount, disableDefaultRowStyle: true }));
|
|
155
155
|
}
|
|
156
156
|
export default memo(DatabaseTable);
|
|
@@ -57,7 +57,7 @@ function MultipleSpectraAnalysisPreferences({ data, activeTab, onAfterSave }, re
|
|
|
57
57
|
}, children: _jsx(LegendsPreferences, {}) }), _jsx(GroupPane, { text: "General", style: {
|
|
58
58
|
header: { color: 'black' },
|
|
59
59
|
container: { padding: '5px' },
|
|
60
|
-
}, children: _jsx(Label, { title: "
|
|
60
|
+
}, children: _jsx(Label, { title: "Sort spectra when sorting columns", children: _jsx(FormikCheckBox, { name: "analysisOptions.resortSpectra" }) }) }), _jsx(GroupPane, { text: "Columns Settings ", style: {
|
|
61
61
|
header: { color: 'black' },
|
|
62
62
|
container: { padding: '5px' },
|
|
63
63
|
}, children: _jsx(AnalysisTablePreferences, {}) }), isExperimental && (_jsx(GroupPane, { text: "Execute code ", style: {
|
|
@@ -39,6 +39,12 @@ export interface TwoDimensionPhaseCorrection {
|
|
|
39
39
|
activeTraceDirection: TraceDirection;
|
|
40
40
|
addTracesToBothDirections: boolean;
|
|
41
41
|
}
|
|
42
|
+
export interface MatrixGenerationOptions {
|
|
43
|
+
showBoxPlot: boolean;
|
|
44
|
+
showStocsy: boolean;
|
|
45
|
+
scaleRatio: number;
|
|
46
|
+
chemicalShift: number | null;
|
|
47
|
+
}
|
|
42
48
|
export declare const getDefaultTwoDimensionsPhaseCorrectionTraceOptions: () => TwoDimensionPhaseCorrection['traces'];
|
|
43
49
|
export declare function getDefaultViewState(): ViewState;
|
|
44
50
|
export declare const getInitialState: () => State;
|
|
@@ -180,6 +180,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
180
180
|
return IntegralsActions.handleCutIntegral(draft, action);
|
|
181
181
|
case 'TOGGLE_INTEGRALS_VIEW_PROPERTY':
|
|
182
182
|
return IntegralsActions.handleToggleIntegralsViewProperty(draft, action);
|
|
183
|
+
case 'SET_AXIS_DOMAIN':
|
|
184
|
+
return DomainActions.handleSetAxisDomain(draft, action);
|
|
183
185
|
case 'SET_X_DOMAIN':
|
|
184
186
|
return DomainActions.handleSetXDomain(draft, action);
|
|
185
187
|
case 'SET_Y_DOMAIN':
|
|
@@ -402,6 +404,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
402
404
|
return ZonesActions.handleToggleZonesViewProperty(draft, action);
|
|
403
405
|
case 'SAVE_EDITED_ZONE':
|
|
404
406
|
return ZonesActions.handleSaveEditedZone(draft, action);
|
|
407
|
+
case 'CHANGE_ZONE_ASSIGNMENT_LABEL':
|
|
408
|
+
return ZonesActions.handleChangeZoneAssignmentLabel(draft, action);
|
|
409
|
+
case 'SET_ZONE_ASSIGNMENT_LABEL_COORDINATION':
|
|
410
|
+
return ZonesActions.handleSetZoneAssignmentLabelCoordination(draft, action);
|
|
405
411
|
case 'ORDER_MULTIPLE_SPECTRA_ANALYSIS':
|
|
406
412
|
return SpectraAnalysisActions.handleOrderSpectra(draft, action);
|
|
407
413
|
case 'RESURRECTING_SPECTRUM_FROM_RANGES':
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
+
import { NucleiPreferences } from 'nmr-load-save';
|
|
2
3
|
import { State } from '../Reducer';
|
|
3
4
|
import { ActionType } from '../types/ActionType';
|
|
5
|
+
type SetAxisDomainAction = ActionType<'SET_AXIS_DOMAIN', {
|
|
6
|
+
nucleiPreferences: NucleiPreferences[];
|
|
7
|
+
}>;
|
|
4
8
|
type SetXDomainAction = ActionType<'SET_X_DOMAIN', {
|
|
5
9
|
xDomain: [number, number];
|
|
6
10
|
}>;
|
|
@@ -11,14 +15,17 @@ type MoveXAxisAction = ActionType<'MOVE', {
|
|
|
11
15
|
shiftX: number;
|
|
12
16
|
shiftY: number;
|
|
13
17
|
}>;
|
|
14
|
-
export type DomainActions = SetXDomainAction | SetYDomainAction | MoveXAxisAction;
|
|
15
|
-
|
|
18
|
+
export type DomainActions = SetXDomainAction | SetYDomainAction | SetAxisDomainAction | MoveXAxisAction;
|
|
19
|
+
interface GetDomainOptions {
|
|
20
|
+
domainSpectraScope?: 'visible' | 'all';
|
|
21
|
+
}
|
|
22
|
+
declare function getDomain(draft: Draft<State>, options?: GetDomainOptions): {
|
|
16
23
|
xDomain: [number, number] | never[] | [undefined, undefined];
|
|
17
24
|
yDomain: [number, number] | never[] | [undefined, undefined];
|
|
18
25
|
yDomains: Record<string, number[]>;
|
|
19
26
|
xDomains: Record<string, number[]>;
|
|
20
27
|
};
|
|
21
|
-
export interface SetDomainOptions {
|
|
28
|
+
export interface SetDomainOptions extends GetDomainOptions {
|
|
22
29
|
updateYDomain?: boolean;
|
|
23
30
|
isYDomainShared?: boolean;
|
|
24
31
|
updateXDomain?: boolean;
|
|
@@ -27,5 +34,6 @@ declare function setDomain(draft: Draft<State>, options?: SetDomainOptions): voi
|
|
|
27
34
|
declare function setMode(draft: Draft<State>): void;
|
|
28
35
|
declare function handleSetXDomain(draft: Draft<State>, action: SetXDomainAction): void;
|
|
29
36
|
declare function handleSetYDomain(draft: Draft<State>, action: SetYDomainAction): void;
|
|
37
|
+
declare function handleSetAxisDomain(draft: Draft<State>, action: SetAxisDomainAction): void;
|
|
30
38
|
declare function handleMoveOverXAxis(draft: Draft<State>, action: MoveXAxisAction): void;
|
|
31
|
-
export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, };
|
|
39
|
+
export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, handleSetAxisDomain, };
|
|
@@ -22,7 +22,8 @@ function getActiveData(draft) {
|
|
|
22
22
|
}
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
-
function getDomain(draft) {
|
|
25
|
+
function getDomain(draft, options = {}) {
|
|
26
|
+
const { domainSpectraScope = 'visible' } = options;
|
|
26
27
|
let xArray = [];
|
|
27
28
|
let yArray = [];
|
|
28
29
|
const yDomains = {};
|
|
@@ -36,7 +37,8 @@ function getDomain(draft) {
|
|
|
36
37
|
const domain = [data.x[0], data.x.at(-1)];
|
|
37
38
|
yDomains[id] = _extent;
|
|
38
39
|
xDomains[id] = domain;
|
|
39
|
-
if (
|
|
40
|
+
if (domainSpectraScope === 'all' ||
|
|
41
|
+
(domainSpectraScope === 'visible' && display.isVisible)) {
|
|
40
42
|
xArray = xArray.concat(domain);
|
|
41
43
|
yArray = yArray.concat(_extent);
|
|
42
44
|
}
|
|
@@ -120,11 +122,11 @@ function get2DDomain(state) {
|
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
function setDomain(draft, options) {
|
|
123
|
-
const { updateYDomain = true, isYDomainShared = true, updateXDomain = true, } = options || {};
|
|
125
|
+
const { updateYDomain = true, isYDomainShared = true, updateXDomain = true, domainSpectraScope, } = options || {};
|
|
124
126
|
let domain;
|
|
125
127
|
if (draft.view.spectra.activeTab) {
|
|
126
128
|
if (draft.displayerMode === '1D') {
|
|
127
|
-
domain = getDomain(draft);
|
|
129
|
+
domain = getDomain(draft, { domainSpectraScope });
|
|
128
130
|
}
|
|
129
131
|
else {
|
|
130
132
|
domain = get2DDomain(draft);
|
|
@@ -190,6 +192,34 @@ function handleSetYDomain(draft, action) {
|
|
|
190
192
|
draft.yDomain = yDomain;
|
|
191
193
|
addToBrushHistory(draft, { xDomain: draft.xDomain, yDomain });
|
|
192
194
|
}
|
|
195
|
+
//action
|
|
196
|
+
function handleSetAxisDomain(draft, action) {
|
|
197
|
+
const { nucleiPreferences } = action.payload;
|
|
198
|
+
const { originDomain: { xDomain, yDomain }, displayerMode, view: { spectra: { activeTab }, }, } = draft;
|
|
199
|
+
const axisDomain = {};
|
|
200
|
+
const [xNucleus, yNucleus] = activeTab?.split(',') || [];
|
|
201
|
+
for (const nuclei of nucleiPreferences) {
|
|
202
|
+
const { nucleus, axisFrom, axisTo } = nuclei;
|
|
203
|
+
if (nucleus?.toLowerCase() === xNucleus?.toLowerCase()) {
|
|
204
|
+
axisDomain.x = { from: axisFrom, to: axisTo };
|
|
205
|
+
}
|
|
206
|
+
if (nucleus?.toLowerCase() === yNucleus?.toLowerCase()) {
|
|
207
|
+
axisDomain.y = { from: axisFrom, to: axisTo };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const { x, y } = axisDomain;
|
|
211
|
+
const x1 = x?.from ?? xDomain[0];
|
|
212
|
+
const x2 = x?.to ?? xDomain[1];
|
|
213
|
+
const y1 = y?.from ?? yDomain[0];
|
|
214
|
+
const y2 = y?.to ?? yDomain[1];
|
|
215
|
+
if (displayerMode === '1D') {
|
|
216
|
+
draft.xDomain = [x1, x2];
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
draft.xDomain = [x1, x2];
|
|
220
|
+
draft.yDomain = [y1, y2];
|
|
221
|
+
}
|
|
222
|
+
}
|
|
193
223
|
function handleMoveOverXAxis(draft, action) {
|
|
194
224
|
const { shiftX, shiftY } = action.payload;
|
|
195
225
|
const [x1, x2] = draft.xDomain;
|
|
@@ -219,4 +249,4 @@ function handleMoveOverXAxis(draft, action) {
|
|
|
219
249
|
draft.xDomain = [x1Domain, x2Domain];
|
|
220
250
|
draft.yDomain = [y1Domain, y2Domain];
|
|
221
251
|
}
|
|
222
|
-
export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, };
|
|
252
|
+
export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, handleSetAxisDomain, };
|
|
@@ -761,7 +761,7 @@ function handleDeleteSpectraFilter(draft, action) {
|
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
resetSelectedTool(draft);
|
|
764
|
-
setDomain(draft);
|
|
764
|
+
setDomain(draft, { domainSpectraScope: 'all' });
|
|
765
765
|
setMode(draft);
|
|
766
766
|
}
|
|
767
767
|
}
|
|
@@ -791,7 +791,7 @@ function handleSignalProcessingFilter(draft, action) {
|
|
|
791
791
|
], { forceReapply: true });
|
|
792
792
|
}
|
|
793
793
|
const { updateXDomain, updateYDomain } = signalProcessing.DOMAIN_UPDATE_RULES;
|
|
794
|
-
setDomain(draft, { updateXDomain, updateYDomain });
|
|
794
|
+
setDomain(draft, { updateXDomain, updateYDomain, domainSpectraScope: 'all' });
|
|
795
795
|
}
|
|
796
796
|
//action
|
|
797
797
|
function handleAddExclusionZone(draft, action) {
|
|
@@ -116,7 +116,10 @@ function initData(draft, action, options = {}) {
|
|
|
116
116
|
const state = getInitialState();
|
|
117
117
|
return produce(state, (initialDraft) => {
|
|
118
118
|
setData(initialDraft, action.payload);
|
|
119
|
-
setActiveTab(initialDraft, {
|
|
119
|
+
setActiveTab(initialDraft, {
|
|
120
|
+
tab: viewState?.spectra?.activeTab || '',
|
|
121
|
+
domainOptions: { domainSpectraScope: 'all' },
|
|
122
|
+
});
|
|
120
123
|
initialDraft.width = draft.width;
|
|
121
124
|
initialDraft.height = draft.height;
|
|
122
125
|
setPreferences(initialDraft, viewState);
|
|
@@ -152,7 +155,7 @@ function handleLoadDropFiles(draft, action) {
|
|
|
152
155
|
}
|
|
153
156
|
else {
|
|
154
157
|
setData(draft, payload);
|
|
155
|
-
setActiveTab(draft);
|
|
158
|
+
setActiveTab(draft, { domainOptions: { domainSpectraScope: 'all' } });
|
|
156
159
|
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
157
160
|
// set source undefined when dragging and dropping a spectra file to prevent export spectra with the data source.
|
|
158
161
|
if (resetSourceObject && spectra?.length > 0) {
|
|
@@ -9,7 +9,7 @@ import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/
|
|
|
9
9
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
10
10
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
11
11
|
import { getSpectrum } from '../helper/getSpectrum';
|
|
12
|
-
import { setRangesViewProperty } from '../helper/setRangesViewProperty';
|
|
12
|
+
import { initializeRangeViewObject, setRangesViewProperty, } from '../helper/setRangesViewProperty';
|
|
13
13
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
14
14
|
import { setDomain } from './DomainActions';
|
|
15
15
|
import { toggleDisplayingPeaks } from './PeaksActions';
|
|
@@ -368,11 +368,17 @@ function handleChangeRangeAssignmentLabel(draft, action) {
|
|
|
368
368
|
if (activeSpectrum?.id) {
|
|
369
369
|
const { index } = activeSpectrum;
|
|
370
370
|
const spectrum = draft.data[index];
|
|
371
|
-
if (isSpectrum1D(spectrum)) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
371
|
+
if (!isSpectrum1D(spectrum)) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
initializeRangeViewObject(draft, activeSpectrum.id);
|
|
375
|
+
const rangesView = draft.view.ranges[spectrum.id];
|
|
376
|
+
if (!rangesView.showAssignmentsLabels) {
|
|
377
|
+
rangesView.showAssignmentsLabels = true;
|
|
378
|
+
}
|
|
379
|
+
const range = spectrum.ranges.values.find((range) => range.id === rangeID);
|
|
380
|
+
if (range) {
|
|
381
|
+
range.assignment = value;
|
|
376
382
|
}
|
|
377
383
|
}
|
|
378
384
|
}
|
|
@@ -12,6 +12,7 @@ type ChangeSpectrumVisibilityByIdAction = ActionType<'CHANGE_SPECTRUM_VISIBILITY
|
|
|
12
12
|
type ChangeSpectraVisibilityByNucleusAction = ActionType<'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS', {
|
|
13
13
|
nucleus: Nucleus;
|
|
14
14
|
flag: boolean;
|
|
15
|
+
mode?: 'selected' | 'all';
|
|
15
16
|
}>;
|
|
16
17
|
type ChangeActiveSpectrumAction = ActionType<'CHANGE_ACTIVE_SPECTRUM', {
|
|
17
18
|
modifier?: 'shift[false]_ctrl[true]' | 'shift[true]_ctrl[false]' | 'shift[true]_ctrl[true]' | (string & {});
|
|
@@ -93,10 +93,15 @@ function handleChangeSpectrumVisibilityById(draft, action) {
|
|
|
93
93
|
}
|
|
94
94
|
//action
|
|
95
95
|
function handleChangeSpectraVisibilityByNucleus(draft, action) {
|
|
96
|
-
const { nucleus, flag } = action.payload;
|
|
96
|
+
const { nucleus, flag, mode = 'all' } = action.payload;
|
|
97
97
|
const activeSpectra = getActiveSpectraAsObject(draft);
|
|
98
98
|
for (const datum of getSpectraByNucleus(nucleus, draft.data)) {
|
|
99
|
-
if (
|
|
99
|
+
if (mode === 'selected') {
|
|
100
|
+
if (activeSpectra && datum.id in activeSpectra) {
|
|
101
|
+
setVisible(datum, flag);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
100
105
|
setVisible(datum, flag);
|
|
101
106
|
}
|
|
102
107
|
}
|
|
@@ -65,7 +65,18 @@ type UnlinkZoneAction = ActionType<'UNLINK_ZONE', UnlinkZoneProps>;
|
|
|
65
65
|
type ToggleZonesViewAction = ActionType<'TOGGLE_ZONES_VIEW_PROPERTY', {
|
|
66
66
|
key: keyof FilterType<ZonesViewState, boolean>;
|
|
67
67
|
}>;
|
|
68
|
-
|
|
68
|
+
type ChangeZoneAssignmentLabelAction = ActionType<'CHANGE_ZONE_ASSIGNMENT_LABEL', {
|
|
69
|
+
zoneID: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}>;
|
|
72
|
+
type SetZoneAssignmentLabelCoordinationAction = ActionType<'SET_ZONE_ASSIGNMENT_LABEL_COORDINATION', {
|
|
73
|
+
zoneID: string;
|
|
74
|
+
coordination: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
};
|
|
78
|
+
}>;
|
|
79
|
+
export type ZonesActions = AutoZonesDetectionAction | ChangeZonesFactorAction | Add2dZoneAction | ChangeZoneSignalDeltaAction | ChangeZoneSignalKindAction | DeleteZoneAction | DeleteSignal2DAction | SetSignalPathLengthAction | SetZoneDiaIDAction | SaveEditedZoneAction | UnlinkZoneAction | ToggleZonesViewAction | ChangeZoneAssignmentLabelAction | SetZoneAssignmentLabelCoordinationAction | ActionType<'AUTO_ZONES_SPECTRA_PICKING'>;
|
|
69
80
|
declare function handleChangeZonesFactor(draft: Draft<State>, action: ChangeZonesFactorAction): void;
|
|
70
81
|
declare function handleAdd2dZone(draft: Draft<State>, action: Add2dZoneAction): void;
|
|
71
82
|
declare function handleAutoZonesDetection(draft: Draft<State>, action: AutoZonesDetectionAction): void;
|
|
@@ -81,4 +92,6 @@ declare function handleUnlinkZone(draft: Draft<State>, action: UnlinkZoneAction)
|
|
|
81
92
|
declare function handleSetDiaIDZone(draft: Draft<State>, action: SetZoneDiaIDAction): void;
|
|
82
93
|
declare function handleSaveEditedZone(draft: Draft<State>, action: SaveEditedZoneAction): void;
|
|
83
94
|
declare function handleToggleZonesViewProperty(draft: Draft<State>, action: ToggleZonesViewAction): void;
|
|
84
|
-
|
|
95
|
+
declare function handleChangeZoneAssignmentLabel(draft: Draft<State>, action: ChangeZoneAssignmentLabelAction): void;
|
|
96
|
+
declare function handleSetZoneAssignmentLabelCoordination(draft: Draft<State>, action: SetZoneAssignmentLabelCoordinationAction): void;
|
|
97
|
+
export { handleAdd2dZone, handleAutoZonesDetection, handleDeleteSignal, deleteSignal2D, handleDeleteZone, handleChangeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, unlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, handleChangeZonesFactor, handleAutoSpectraZonesDetection, handleToggleZonesViewProperty, handleChangeZoneAssignmentLabel, handleSetZoneAssignmentLabelCoordination, };
|
|
@@ -3,7 +3,7 @@ import lodashCloneDeep from 'lodash/cloneDeep';
|
|
|
3
3
|
import { setPathLength } from 'nmr-correlation';
|
|
4
4
|
import { Filters, FiltersManager } from 'nmr-processing';
|
|
5
5
|
import { DATUM_KIND, SIGNAL_INLCUDED_KINDS, } from '../../../data/constants/signalsKinds';
|
|
6
|
-
import { changeZoneSignal, detectZones, detectZonesManual, } from '../../../data/data2d/Spectrum2D';
|
|
6
|
+
import { changeZoneSignal, detectZones, detectZonesManual, isSpectrum2D, } from '../../../data/data2d/Spectrum2D';
|
|
7
7
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/ZoneUtilities';
|
|
8
8
|
import { isNumber } from '../../../data/utilities/isNumber';
|
|
9
9
|
import { defaultZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
|
|
@@ -233,23 +233,57 @@ function handleSaveEditedZone(draft, action) {
|
|
|
233
233
|
handleUpdateCorrelations(draft);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
+
function initializeZoneViewObject(draft, spectrumID) {
|
|
237
|
+
const zonesView = draft.view.zones;
|
|
238
|
+
if (spectrumID in zonesView)
|
|
239
|
+
return;
|
|
240
|
+
const defaultZonesView = { ...defaultZonesViewState };
|
|
241
|
+
zonesView[spectrumID] = defaultZonesView;
|
|
242
|
+
}
|
|
236
243
|
function togglePeaksViewProperty(draft, key) {
|
|
237
244
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
238
|
-
if (activeSpectrum?.id)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
else {
|
|
244
|
-
const defaultZonesView = { ...defaultZonesViewState };
|
|
245
|
-
defaultZonesView[key] = !defaultZonesView[key];
|
|
246
|
-
zonesView[activeSpectrum.id] = defaultZonesView;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
245
|
+
if (!activeSpectrum?.id)
|
|
246
|
+
return;
|
|
247
|
+
initializeZoneViewObject(draft, activeSpectrum.id);
|
|
248
|
+
const zonesView = draft.view.zones;
|
|
249
|
+
zonesView[activeSpectrum.id][key] = !zonesView[activeSpectrum.id][key];
|
|
249
250
|
}
|
|
250
251
|
//action
|
|
251
252
|
function handleToggleZonesViewProperty(draft, action) {
|
|
252
253
|
const { key } = action.payload;
|
|
253
254
|
togglePeaksViewProperty(draft, key);
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
+
function handleChangeZoneAssignmentLabel(draft, action) {
|
|
257
|
+
const { zoneID, value } = action.payload;
|
|
258
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
259
|
+
if (!activeSpectrum?.id)
|
|
260
|
+
return;
|
|
261
|
+
const { index } = activeSpectrum;
|
|
262
|
+
const spectrum = draft.data[index];
|
|
263
|
+
if (!isSpectrum2D(spectrum))
|
|
264
|
+
return;
|
|
265
|
+
initializeZoneViewObject(draft, activeSpectrum.id);
|
|
266
|
+
const zoneView = draft.view.zones[spectrum.id];
|
|
267
|
+
if (!zoneView.showAssignmentsLabels) {
|
|
268
|
+
zoneView.showAssignmentsLabels = true;
|
|
269
|
+
}
|
|
270
|
+
const zone = spectrum.zones.values.find((zone) => zone.id === zoneID);
|
|
271
|
+
if (zone) {
|
|
272
|
+
zone.assignment = value;
|
|
273
|
+
if (!value) {
|
|
274
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
275
|
+
delete zoneView.assignmentsLabelsCoordinates[zoneID];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function handleSetZoneAssignmentLabelCoordination(draft, action) {
|
|
280
|
+
const { zoneID, coordination } = action.payload;
|
|
281
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
282
|
+
if (!activeSpectrum)
|
|
283
|
+
return;
|
|
284
|
+
initializeZoneViewObject(draft, activeSpectrum.id);
|
|
285
|
+
const zonesView = draft.view.zones;
|
|
286
|
+
zonesView[activeSpectrum.id].assignmentsLabelsCoordinates[zoneID] =
|
|
287
|
+
coordination;
|
|
288
|
+
}
|
|
289
|
+
export { handleAdd2dZone, handleAutoZonesDetection, handleDeleteSignal, deleteSignal2D, handleDeleteZone, handleChangeZoneSignalDelta, handleChangeZoneSignalKind, handleUnlinkZone, unlinkZone, handleSaveEditedZone, handleSetDiaIDZone, handleSetSignalPathLength, handleChangeZonesFactor, handleAutoSpectraZonesDetection, handleToggleZonesViewProperty, handleChangeZoneAssignmentLabel, handleSetZoneAssignmentLabelCoordination, };
|
|
@@ -3,3 +3,4 @@ import { RangesViewState } from 'nmr-load-save';
|
|
|
3
3
|
import { State } from '../Reducer';
|
|
4
4
|
export declare function setRangesViewProperty<T extends keyof RangesViewState>(draft: Draft<State>, key: T, value: (value: RangesViewState[T]) => RangesViewState[T]): void;
|
|
5
5
|
export declare function setRangesViewProperty<T extends keyof RangesViewState>(draft: Draft<State>, key: T, value: RangesViewState[T]): void;
|
|
6
|
+
export declare function initializeRangeViewObject(draft: Draft<State>, spectrumID: string): void;
|