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.
Files changed (165) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  2. package/lib/component/1d/Integral.js +1 -6
  3. package/lib/component/1d/Viewer1D.js +4 -4
  4. package/lib/component/1d/ranges/RangeIntegral.js +2 -6
  5. package/lib/component/1d/utilities/scale.d.ts +1 -1
  6. package/lib/component/1d/utilities/scale.js +7 -6
  7. package/lib/component/2d/Viewer2D.js +5 -5
  8. package/lib/component/NMRium.d.ts +2 -0
  9. package/lib/component/elements/EditableColumn.d.ts +1 -1
  10. package/lib/component/header/Header.js +3 -7
  11. package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
  12. package/lib/component/hooks/useIntegralPath.js +53 -0
  13. package/lib/component/hooks/useToolsFunctions.js +4 -5
  14. package/lib/component/hooks/useXScale.d.ts +2 -0
  15. package/lib/component/hooks/useXScale.js +7 -0
  16. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  17. package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
  18. package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
  19. package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
  20. package/lib/component/modal/editZone/EditZoneModal.js +96 -0
  21. package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
  22. package/lib/component/modal/editZone/SignalFormTab.js +6 -0
  23. package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
  24. package/lib/component/modal/editZone/SignalsForm.js +62 -0
  25. package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
  26. package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
  27. package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
  28. package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
  29. package/lib/component/modal/setting/ControllersTabContent.js +1 -1
  30. package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
  31. package/lib/component/modal/setting/GeneralSettings.js +13 -5
  32. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
  33. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
  34. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
  35. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
  36. package/lib/component/panels/Panels.d.ts +1 -1
  37. package/lib/component/panels/Panels.js +10 -14
  38. package/lib/component/panels/RangesPanel/RangesPanel.js +2 -2
  39. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  40. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  41. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
  42. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
  43. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
  44. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  45. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
  46. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  47. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
  48. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
  49. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
  50. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
  51. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  52. package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
  53. package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
  54. package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
  55. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
  56. package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
  57. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
  58. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
  59. package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -4
  60. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
  61. package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
  62. package/lib/component/reducer/IgnoreActions.js +2 -1
  63. package/lib/component/reducer/Reducer.d.ts +9 -23
  64. package/lib/component/reducer/Reducer.js +7 -8
  65. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  66. package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
  67. package/lib/component/reducer/actions/DomainActions.js +20 -1
  68. package/lib/component/reducer/actions/IntegralsActions.js +2 -0
  69. package/lib/component/reducer/actions/LoadActions.js +22 -1
  70. package/lib/component/reducer/actions/PreferencesActions.js +0 -2
  71. package/lib/component/reducer/actions/RangesActions.js +3 -1
  72. package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
  73. package/lib/component/reducer/actions/ToolsActions.js +31 -27
  74. package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
  75. package/lib/component/reducer/actions/ZonesActions.js +33 -2
  76. package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
  77. package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
  78. package/lib/component/reducer/preferencesReducer.d.ts +1 -8
  79. package/lib/component/reducer/preferencesReducer.js +11 -1
  80. package/lib/component/reducer/types/Types.d.ts +3 -1
  81. package/lib/component/reducer/types/Types.js +3 -1
  82. package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
  83. package/lib/data/constants/DefaultPathLengths.js +8 -0
  84. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
  85. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
  86. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  87. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
  88. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
  89. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  90. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
  91. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
  92. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
  93. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
  94. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
  95. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
  96. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  97. package/lib/versionInfo.js +1 -1
  98. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  99. package/lib-cjs/component/1d/Integral.js +1 -6
  100. package/lib-cjs/component/1d/Viewer1D.js +4 -4
  101. package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
  102. package/lib-cjs/component/1d/utilities/scale.js +7 -6
  103. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  104. package/lib-cjs/component/header/Header.js +3 -7
  105. package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
  106. package/lib-cjs/component/hooks/useToolsFunctions.js +4 -5
  107. package/lib-cjs/component/hooks/useXScale.js +11 -0
  108. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  109. package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
  110. package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
  111. package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
  112. package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
  113. package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
  114. package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
  115. package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
  116. package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -4
  117. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
  118. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
  119. package/lib-cjs/component/panels/Panels.js +11 -15
  120. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  121. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  122. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  123. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
  124. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  125. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  126. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
  127. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
  128. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  129. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
  130. package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
  131. package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
  132. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
  133. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -4
  134. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
  135. package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
  136. package/lib-cjs/component/reducer/Reducer.js +7 -8
  137. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
  138. package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
  139. package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
  140. package/lib-cjs/component/reducer/actions/LoadActions.js +22 -1
  141. package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
  142. package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
  143. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
  144. package/lib-cjs/component/reducer/actions/ToolsActions.js +38 -34
  145. package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
  146. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
  147. package/lib-cjs/component/reducer/preferencesReducer.js +12 -2
  148. package/lib-cjs/component/reducer/types/Types.js +6 -4
  149. package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
  150. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
  151. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  152. package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
  153. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  154. package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
  155. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
  156. package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
  157. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  158. package/lib-cjs/versionInfo.js +1 -1
  159. package/package.json +1 -1
  160. package/lib/component/1d/utilities/useIntegralPath.js +0 -63
  161. package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
  162. package/lib/component/reducer/actions/Zoom.d.ts +0 -16
  163. package/lib/component/reducer/actions/Zoom.js +0 -92
  164. package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
  165. package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
@@ -4,20 +4,21 @@ import { css } from '@emotion/react';
4
4
  import { getLinkDim } from 'nmr-correlation';
5
5
  import { useCallback, useMemo, useState } from 'react';
6
6
  import CloseButton from '../../../../elements/CloseButton';
7
- import Select from '../../../../elements/Select';
8
- import { getEditedCorrelations } from '../../Utilities';
9
- import { EditLinkActions } from '../Constants';
7
+ import Tab from '../../../../elements/Tab/Tab';
8
+ import Tabs, { PositionsEnum } from '../../../../elements/Tab/Tabs';
9
+ import { getEditedCorrelations } from '../../utilities/Utilities';
10
10
  import EditLinkConfirmation from './Confirmation';
11
+ import EditPathLength from './EditPathLength';
11
12
  import MoveLink from './MoveLink';
12
13
  const modalContainer = css `
13
- overflow: auto;
14
- width: 380px;
15
- height: 230px;
14
+ width: 490px;
15
+ height: 220px;
16
16
  padding: 5px;
17
17
 
18
18
  button:focus {
19
19
  outline: none;
20
20
  }
21
+
21
22
  .header {
22
23
  height: 24px;
23
24
  border-bottom: 1px solid #f0f0f0;
@@ -61,14 +62,15 @@ const modalContainer = css `
61
62
  background-color: gray;
62
63
  }
63
64
 
64
- .select-action-container {
65
- margin-top: 10px;
65
+ .tabs-container {
66
66
  width: 100%;
67
- text-align: center;
67
+ flex: 1;
68
+ overflow: auto;
69
+ border: none;
68
70
  }
69
71
  `;
70
72
  export default function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, onClose, onEdit, }) {
71
- const [selectedAction, setSelectedActions] = useState('-');
73
+ const [activeTab, setActiveTab] = useState('move');
72
74
  const getLinkLabel = useCallback(() => {
73
75
  const linkDim = getLinkDim(link);
74
76
  if (linkDim === 1) {
@@ -79,37 +81,29 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
79
81
  }
80
82
  return '';
81
83
  }, [correlationDim1.label.origin, link, correlationDim2]);
82
- const handleOnEdit = useCallback((action, selectedCorrelationValueDim1, selectedCorrelationValueDim2) => {
84
+ const handleOnEdit = useCallback((action, selectedCorrelationIdDim1, selectedCorrelationIdDim2, editedLink) => {
83
85
  const { editedCorrelations, buildCorrelationDataOptions } = getEditedCorrelations({
84
86
  correlationDim1,
85
87
  correlationDim2,
86
- selectedCorrelationValueDim1,
87
- selectedCorrelationValueDim2,
88
+ selectedCorrelationIdDim1,
89
+ selectedCorrelationIdDim2,
88
90
  action,
89
- link,
91
+ link: editedLink || link,
90
92
  correlations,
91
93
  });
92
- onEdit(editedCorrelations, action, link, buildCorrelationDataOptions);
94
+ onEdit(editedCorrelations, action, editedLink || link, buildCorrelationDataOptions);
93
95
  onClose?.();
94
96
  }, [correlationDim1, correlationDim2, correlations, link, onClose, onEdit]);
95
- const component = useMemo(() => {
96
- switch (selectedAction) {
97
- case 'delete':
98
- return (_jsx(EditLinkConfirmation, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0));
99
- case 'move':
100
- return (_jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: handleOnEdit }, void 0));
101
- case 'unmove':
102
- return (_jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0));
103
- default:
104
- return null;
105
- }
106
- }, [
97
+ const tabsContainer = useMemo(() => (_jsx("div", { className: "tabs-container", children: _jsxs(Tabs, { position: PositionsEnum.TOP, activeTab: activeTab, onClick: (tab) => setActiveTab(tab.tabid), children: [_jsx(Tab, { tablabel: "Move", tabid: 'move', children: _jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: (correlationIdDim1, correlationIdDim2) => handleOnEdit('move', correlationIdDim1, correlationIdDim2) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Unmove", tabid: "unmove", children: _jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Remove", tabid: 'remove', children: _jsx(EditLinkConfirmation, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0) }, void 0), _jsx(Tab, { tablabel: "J Coupling", tabid: 'setPathLength', children: _jsx(EditPathLength, { signal: link.signal, experimentType: link.experimentType, onEdit: (editedSignal) => {
98
+ const editedLink = { ...link, signal: editedSignal };
99
+ handleOnEdit('setPathLength', correlationDim1, correlationDim2, editedLink);
100
+ } }, void 0) }, void 0)] }, void 0) }, void 0)), [
101
+ activeTab,
107
102
  correlationDim1,
108
103
  correlationDim2,
109
104
  correlations,
110
- link,
111
105
  handleOnEdit,
112
- selectedAction,
106
+ link,
113
107
  ]);
114
- return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }, void 0), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), _jsx("div", { className: "select-action-container", children: _jsx(Select, { data: EditLinkActions, onChange: (action) => setSelectedActions(action), defaultValue: selectedAction, style: { width: 120, height: 25, margin: 0 } }, void 0) }, void 0), component, _jsx("div", {}, void 0)] }, void 0));
108
+ return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }, void 0), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), tabsContainer] }, void 0));
115
109
  }
@@ -0,0 +1,8 @@
1
+ import { Signal2D } from '../../../../../data/types/data2d';
2
+ interface InputProps {
3
+ signal: Signal2D;
4
+ experimentType: string;
5
+ onEdit: (editedSignal: Signal2D) => void;
6
+ }
7
+ declare function EditPathLength({ signal, experimentType, onEdit }: InputProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
+ export default EditPathLength;
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import { useCallback, useEffect, useState } from 'react';
5
+ import DefaultPathLengths from '../../../../../data/constants/DefaultPathLengths';
6
+ import Button from '../../../../elements/Button';
7
+ import Input from '../../../../elements/Input';
8
+ import Label from '../../../../elements/Label';
9
+ const editPathLengthsStyles = css `
10
+ width: 100%;
11
+ height: 100%;
12
+ margin-top: 10px;
13
+ text-align: center;
14
+
15
+ .input-container {
16
+ width: 100%;
17
+ margin-top: 5px;
18
+ text-align: center;
19
+
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ justify-content: center;
24
+ }
25
+
26
+ button {
27
+ flex: 2;
28
+ padding: 5px;
29
+ border: 1px solid gray;
30
+ border-radius: 5px;
31
+ height: 30px;
32
+ margin: 0 auto;
33
+ margin-top: 15px;
34
+ display: block;
35
+ width: 60px;
36
+
37
+ color: white;
38
+ background-color: gray;
39
+ }
40
+
41
+ .warning {
42
+ margin-top: 5px;
43
+ color: red;
44
+ }
45
+ `;
46
+ function EditPathLength({ signal, experimentType, onEdit }) {
47
+ const [from, setFrom] = useState(signal.j?.pathLength !== undefined
48
+ ? signal.j.pathLength.from
49
+ : DefaultPathLengths[experimentType]?.from || 0);
50
+ const [to, setTo] = useState(signal.j?.pathLength !== undefined
51
+ ? signal.j.pathLength.to
52
+ : DefaultPathLengths[experimentType]?.to || 0);
53
+ const [isError, setIsError] = useState(false);
54
+ const handleOnEdit = useCallback(() => {
55
+ const pathLength = {
56
+ from,
57
+ to,
58
+ };
59
+ const editedSignal = {
60
+ ...signal,
61
+ j: {
62
+ ...signal.j,
63
+ pathLength,
64
+ },
65
+ };
66
+ onEdit(editedSignal);
67
+ }, [to, from, onEdit, signal]);
68
+ useEffect(() => {
69
+ setIsError(from <= 0 || from > to);
70
+ }, [to, from]);
71
+ return (_jsxs("div", { css: editPathLengthsStyles, children: [_jsx("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), _jsxs("div", { className: "input-container", children: [_jsx(Label, { title: "Min:", style: {
72
+ label: {
73
+ marginRight: '5px',
74
+ fontSize: '14px',
75
+ fontWeight: 'normal',
76
+ },
77
+ }, children: _jsx(Input, { type: "number", value: from, onChange: (e) => {
78
+ setFrom(Number(e.target.value));
79
+ }, style: { input: { color: isError ? 'red' : 'black' } } }, void 0) }, void 0), _jsx(Label, { title: "Max:", style: {
80
+ label: {
81
+ marginRight: '5px',
82
+ fontSize: '14px',
83
+ fontWeight: 'normal',
84
+ },
85
+ }, children: _jsx(Input, { type: "number", value: to, onChange: (e) => {
86
+ setTo(Number(e.target.value));
87
+ } }, void 0) }, void 0)] }, void 0), isError ? (_jsxs("p", { className: "warning", children: ["Minimum must not be 0 or higher than the maximum value.", ' '] }, void 0)) : (_jsx(Button, { type: "button", onClick: handleOnEdit, disabled: isError, children: "Set" }, void 0))] }, void 0));
88
+ }
89
+ export default EditPathLength;
@@ -4,7 +4,7 @@ interface MoveLinkProps {
4
4
  correlationDim2: Correlation;
5
5
  link: Link;
6
6
  correlations: Correlation[];
7
- onEdit: (action: string, valueDim1: string, valueDim2: string | undefined) => void;
7
+ onEdit: (correlationIdDim1: string, correlationIdDim2: string | undefined) => void;
8
8
  }
9
9
  declare function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit, }: MoveLinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
10
  export default MoveLink;
@@ -75,6 +75,6 @@ function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit
75
75
  border: '1px solid grey',
76
76
  } }, void 0));
77
77
  }, [correlationDim1, correlationDim2, correlations, link.atomType]);
78
- return (_jsxs("div", { css: moveLinkStyles, children: [_jsx("p", { children: "Move of signals on either one or both axes." }, void 0), _jsx("p", { children: "\"New\" means to separate into a new row or column." }, void 0), _jsxs("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), _jsx("button", { type: "button", onClick: () => onEdit('move', selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
78
+ return (_jsxs("div", { css: moveLinkStyles, children: [_jsx("p", { children: "Move of signals on either one or both axes." }, void 0), _jsx("p", { children: "\"New\" means to separate into a new row or column." }, void 0), _jsxs("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), _jsx("button", { type: "button", onClick: () => onEdit(selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
79
79
  }
80
80
  export default MoveLink;
@@ -12,13 +12,13 @@ import Select from '../../elements/Select';
12
12
  import ToolTip from '../../elements/ToolTip/ToolTip';
13
13
  import { useModal } from '../../elements/popup/Modal';
14
14
  import { DISPLAYER_MODE } from '../../reducer/core/Constants';
15
- import { DELETE_1D_SIGNAL, DELETE_2D_SIGNAL, DELETE_CORRELATION, SET_CORRELATION, SET_CORRELATIONS, SET_CORRELATIONS_MF, SET_CORRELATIONS_TOLERANCE, } from '../../reducer/types/Types';
15
+ import { DELETE_1D_SIGNAL, DELETE_2D_SIGNAL, DELETE_CORRELATION, SET_2D_SIGNAL_PATH_LENGTH, SET_CORRELATION, SET_CORRELATIONS, SET_CORRELATIONS_MF, SET_CORRELATIONS_TOLERANCE, } from '../../reducer/types/Types';
16
16
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
17
17
  import CorrelationTable from './CorrelationTable/CorrelationTable';
18
18
  import Overview from './Overview';
19
19
  import SetMolecularFormulaModal from './SetMolecularFormulaModal';
20
20
  import SetShiftToleranceModal from './SetShiftTolerancesModal';
21
- import { findSignalMatch1D, findSignalMatch2D, getAtomType } from './Utilities';
21
+ import { findSignalMatch1D, findSignalMatch2D, getAtomType, } from './utilities/Utilities';
22
22
  const panelStyle = css `
23
23
  display: flex;
24
24
  flex-direction: column;
@@ -192,51 +192,20 @@ function SummaryPanel() {
192
192
  correlation: {
193
193
  ...correlation,
194
194
  equivalence: value,
195
- edited: { ...correlation.edited, equivalence: true },
195
+ edited: { ...correlation.edited, equivalence: value !== 1 },
196
196
  },
197
197
  },
198
198
  });
199
199
  }, [dispatch]);
200
- const editProtonsCountSaveHandler = useCallback((correlation, valuesString) => {
201
- let values;
202
- if (/^(?:[0-9],{0,1})+$/g.test(valuesString)) {
203
- // allow digits followed by optional comma only
204
- values = valuesString
205
- .split(',')
206
- .filter((char) => char.length > 0)
207
- .map((char) => Number(char));
208
- }
209
- else if (valuesString.trim().length === 0) {
210
- // set values to default
211
- values = [];
212
- }
213
- if (values) {
214
- // ignore not supported text input
215
- dispatch({
216
- type: SET_CORRELATION,
217
- payload: {
218
- id: correlation.id,
219
- correlation: {
220
- ...correlation,
221
- protonsCount: values,
222
- edited: { ...correlation.edited, protonsCount: true },
223
- },
224
- options: {
225
- skipDataUpdate: true,
226
- },
227
- },
228
- });
229
- }
230
- }, [dispatch]);
231
- const changeHybridizationSaveHandler = useCallback((correlation, value) => {
200
+ const editNumericValuesSaveHandler = useCallback(({ correlation, values, key, }) => {
232
201
  dispatch({
233
202
  type: SET_CORRELATION,
234
203
  payload: {
235
204
  id: correlation.id,
236
205
  correlation: {
237
206
  ...correlation,
238
- hybridization: value,
239
- edited: { ...correlation.edited, hybridization: true },
207
+ [key]: values,
208
+ edited: { ...correlation.edited, [key]: true },
240
209
  },
241
210
  options: {
242
211
  skipDataUpdate: true,
@@ -294,20 +263,48 @@ function SummaryPanel() {
294
263
  });
295
264
  }
296
265
  }, [assignmentData, dispatch, spectraData]);
266
+ const changeSignalPathLengthHandler = useCallback((link) => {
267
+ const linkDim = getLinkDim(link);
268
+ if (linkDim === 2) {
269
+ const spectrum = findSpectrum(spectraData, link.experimentID, false);
270
+ const zone = findZone(spectrum, link.signal.id);
271
+ const signal = findSignal2D(spectrum, link.signal.id);
272
+ dispatch({
273
+ type: SET_2D_SIGNAL_PATH_LENGTH,
274
+ payload: {
275
+ spectrum,
276
+ zone,
277
+ signal,
278
+ pathLength: link.signal.j?.pathLength,
279
+ },
280
+ });
281
+ }
282
+ }, [dispatch, spectraData]);
297
283
  const editCorrelationTableCellHandler = useCallback((editedCorrelations, action, link, options) => {
298
284
  if (action === 'add' ||
299
285
  action === 'move' ||
300
286
  action === 'remove' ||
301
- action === 'unmove') {
302
- if (action === 'remove' && link && link.pseudo === false) {
303
- deleteSignalHandler(link);
287
+ action === 'unmove' ||
288
+ action === 'setPathLength') {
289
+ if (link && link.pseudo === false) {
290
+ if (action === 'remove') {
291
+ deleteSignalHandler(link);
292
+ }
293
+ else if (action === 'setPathLength') {
294
+ changeSignalPathLengthHandler(link);
295
+ }
304
296
  }
305
297
  setCorrelationsHandler(editedCorrelations, options);
306
298
  }
307
299
  else if (action === 'removeAll') {
308
300
  deleteCorrelationHandler(editedCorrelations[0]);
309
301
  }
310
- }, [deleteCorrelationHandler, deleteSignalHandler, setCorrelationsHandler]);
302
+ }, [
303
+ changeSignalPathLengthHandler,
304
+ deleteCorrelationHandler,
305
+ deleteSignalHandler,
306
+ setCorrelationsHandler,
307
+ ]);
311
308
  const handleOnFilter = useCallback(() => {
312
309
  setFilterIsActive(!filterIsActive);
313
310
  }, [filterIsActive]);
@@ -326,6 +323,6 @@ function SummaryPanel() {
326
323
  width: '70px',
327
324
  height: '18px',
328
325
  border: '1px solid grey',
329
- } }, void 0)] }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, changeHybridizationSaveHandler: changeHybridizationSaveHandler, editProtonsCountSaveHandler: editProtonsCountSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData }, void 0)] }, void 0));
326
+ } }, void 0)] }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData }, void 0)] }, void 0));
330
327
  }
331
328
  export default memo(SummaryPanel);
@@ -0,0 +1,6 @@
1
+ import { Correlation } from 'nmr-correlation';
2
+ interface InputProps {
3
+ correlation: Correlation;
4
+ }
5
+ declare function IsInView({ correlation }: InputProps): boolean;
6
+ export default IsInView;
@@ -0,0 +1,16 @@
1
+ import { useMemo } from 'react';
2
+ import { useChartData } from '../../../context/ChartContext';
3
+ import { isInView } from './Utilities';
4
+ function IsInView({ correlation }) {
5
+ const { data: spectraData, xDomain, yDomain, displayerMode, activeTab, activeSpectrum, } = useChartData();
6
+ return useMemo(() => isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation), [
7
+ activeSpectrum,
8
+ activeTab,
9
+ correlation,
10
+ displayerMode,
11
+ spectraData,
12
+ xDomain,
13
+ yDomain,
14
+ ]);
15
+ }
16
+ export default IsInView;
@@ -0,0 +1,29 @@
1
+ import { Correlation, Link } from 'nmr-correlation';
2
+ import { Datum2D } from '../../../../data/types/data2d';
3
+ import { Spectra } from '../../../NMRium';
4
+ import { ActiveSpectrum } from '../../../reducer/Reducer';
5
+ declare function getAtomType(nucleus: string): string;
6
+ declare function getLabelColor(correlationData: any, correlation: any): string | null;
7
+ declare function findSignalMatch1D(spectrum: Datum2D, link: Link, factor: number, xDomain0: number, xDomain1: number): boolean;
8
+ declare function findSignalMatch2D(spectrum: Datum2D, link: Link, factor: number, xDomain0: number, xDomain1: number, yDomain0: number, yDomain1: number): boolean;
9
+ declare function getAbbreviation(link: Link): string;
10
+ declare function buildNewLink1D(link: any): Link;
11
+ declare function buildNewLink2D(link: Link, axis: 'x' | 'y'): Link;
12
+ declare function cloneCorrelationAndEditLink(correlation: Correlation, link: Link, axis: 'x' | 'y', action: 'add' | 'remove' | 'unmove'): Correlation;
13
+ declare function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationIdDim1, selectedCorrelationIdDim2, action, link, correlations, }: {
14
+ correlationDim1: Correlation;
15
+ correlationDim2: Correlation;
16
+ action: 'move' | 'remove' | 'unmove' | 'setPathLength';
17
+ selectedCorrelationIdDim1: string | undefined;
18
+ selectedCorrelationIdDim2: string | undefined;
19
+ link: Link;
20
+ correlations: Correlation[];
21
+ }): {
22
+ editedCorrelations: Correlation[];
23
+ buildCorrelationDataOptions: {
24
+ skipDataUpdate?: boolean | undefined;
25
+ };
26
+ };
27
+ declare function convertValuesString(valuesString: string, key: 'protonsCount' | 'hybridization'): number[];
28
+ declare function isInView(spectraData: Spectra, activeTab: string, activeSpectrum: ActiveSpectrum | null, xDomain: number[], yDomain: number[], displayerMode: string, correlation: Correlation): boolean;
29
+ export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
@@ -1,8 +1,11 @@
1
1
  import lodashCloneDeep from 'lodash/cloneDeep';
2
2
  import lodashGet from 'lodash/get';
3
- import { addLink, buildCorrelation, buildLink, getLinkDim, removeLink, } from 'nmr-correlation';
4
- import { findSignal2D } from '../../../data/utilities/FindUtilities';
5
- import { ErrorColors } from './CorrelationTable/Constants';
3
+ import { addLink, buildCorrelation, buildLink, getLinkDelta, getLinkDim, removeLink, } from 'nmr-correlation';
4
+ import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
5
+ import { findSignal2D, findSpectrum, } from '../../../../data/utilities/FindUtilities';
6
+ import isDefaultPathLength from '../../../modal/editZone/validation/isDefaultPathLength';
7
+ import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
8
+ import { ErrorColors } from '../CorrelationTable/Constants';
6
9
  function getAtomType(nucleus) {
7
10
  return nucleus.split(/\d+/)[1];
8
11
  }
@@ -45,27 +48,38 @@ function findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0,
45
48
  return false;
46
49
  }
47
50
  function getAbbreviation(link) {
51
+ let abbreviation = 'X';
48
52
  if (link.experimentType === 'hsqc' || link.experimentType === 'hmqc') {
49
- return !link.signal || link.signal.sign === 0
50
- ? 'S'
51
- : `S${link.signal.sign === 1 ? '+' : '-'}`;
53
+ abbreviation =
54
+ !link.signal || link.signal.sign === 0
55
+ ? 'S'
56
+ : `S${link.signal.sign === 1 ? '+' : '-'}`;
52
57
  }
53
58
  else if (link.experimentType === 'hmbc' ||
54
59
  link.experimentType === 'cosy' ||
55
60
  link.experimentType === 'tocsy') {
56
- return 'M';
61
+ abbreviation = 'M';
57
62
  }
58
63
  else if (link.experimentType === 'noesy' ||
59
64
  link.experimentType === 'roesy') {
60
- return 'NOE';
65
+ abbreviation = 'NOE';
61
66
  }
62
67
  else if (link.experimentType === 'inadequate') {
63
- return 'I';
68
+ abbreviation = 'I';
64
69
  }
65
70
  else if (link.experimentType === 'adequate') {
66
- return 'A';
71
+ abbreviation = 'A';
67
72
  }
68
- return 'X';
73
+ const pathLength = link.signal.j?.pathLength;
74
+ if (pathLength) {
75
+ const isDefaultCorrelation = DefaultPathLengths[link.experimentType] &&
76
+ pathLength.from >= DefaultPathLengths[link.experimentType].from &&
77
+ pathLength.from <= DefaultPathLengths[link.experimentType].to &&
78
+ pathLength.to >= DefaultPathLengths[link.experimentType].from &&
79
+ pathLength.to <= DefaultPathLengths[link.experimentType].to;
80
+ return `${abbreviation}${isDefaultCorrelation ? '' : '*'}`;
81
+ }
82
+ return abbreviation;
69
83
  }
70
84
  function buildNewLink1D(link) {
71
85
  return buildLink({
@@ -101,9 +115,9 @@ function cloneCorrelationAndEditLink(correlation, link, axis, action) {
101
115
  }
102
116
  return _correlation;
103
117
  }
104
- function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationValueDim1, selectedCorrelationValueDim2, action, link, correlations, }) {
105
- const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim1);
106
- const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim2);
118
+ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationIdDim1, selectedCorrelationIdDim2, action, link, correlations, }) {
119
+ const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim1);
120
+ const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim2);
107
121
  const hasChangedDim1 = selectedCorrelationDim1?.id !== correlationDim1.id;
108
122
  const hasChangedDim2 = correlationDim2 && selectedCorrelationDim2?.id !== correlationDim2?.id;
109
123
  const linkDim = getLinkDim(link);
@@ -139,14 +153,14 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
139
153
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
140
154
  }
141
155
  else if (selectedCorrelationDim1 &&
142
- selectedCorrelationValueDim2 === 'new') {
156
+ selectedCorrelationIdDim2 === 'new') {
143
157
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim1 ? selectedCorrelationDim1 : _correlationDim1, link, 'x', 'add'));
144
158
  editedCorrelations.push(buildCorrelation({
145
159
  atomType: correlationDim2.atomType,
146
160
  link: [buildNewLink2D(link, 'y')],
147
161
  }));
148
162
  }
149
- else if (selectedCorrelationValueDim1 === 'new' &&
163
+ else if (selectedCorrelationIdDim1 === 'new' &&
150
164
  selectedCorrelationDim2) {
151
165
  editedCorrelations.push(buildCorrelation({
152
166
  atomType: correlationDim1.atomType,
@@ -154,8 +168,8 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
154
168
  }));
155
169
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
156
170
  }
157
- else if (selectedCorrelationValueDim1 === 'new' &&
158
- selectedCorrelationValueDim2 === 'new') {
171
+ else if (selectedCorrelationIdDim1 === 'new' &&
172
+ selectedCorrelationIdDim2 === 'new') {
159
173
  editedCorrelations.push(buildCorrelation({
160
174
  atomType: correlationDim1.atomType,
161
175
  link: [buildNewLink2D(link, 'x')],
@@ -189,6 +203,128 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
189
203
  }
190
204
  }
191
205
  }
206
+ else if (action === 'setPathLength') {
207
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim1, link, 'x'));
208
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim2, link, 'y'));
209
+ }
192
210
  return { editedCorrelations, buildCorrelationDataOptions };
193
211
  }
194
- export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, };
212
+ function cloneCorrelationAndSetPathLength(correlation, editedLink, axis) {
213
+ const _correlation = lodashCloneDeep(correlation);
214
+ const linkDim = getLinkDim(editedLink);
215
+ if (linkDim === 2) {
216
+ const editedLinkID = editedLink.id.split('_')[axis === 'x' ? 0 : 1];
217
+ const _link = _correlation.link.find((link) => link.id === editedLinkID);
218
+ if (_link) {
219
+ const newPathLength = editedLink.signal.j?.pathLength;
220
+ // remove (previous) pathLength if it is same as default
221
+ if (isDefaultPathLength(newPathLength, _link.experimentType)) {
222
+ delete _link.signal.j?.pathLength;
223
+ if (_link.signal.j && Object.keys(_link.signal.j).length === 0) {
224
+ delete _link.signal.j;
225
+ }
226
+ delete _link.edited.pathLength;
227
+ }
228
+ else {
229
+ if (!_link.signal.j) {
230
+ _link.signal.j = { pathLength: newPathLength };
231
+ }
232
+ else {
233
+ _link.signal.j.pathLength = newPathLength;
234
+ }
235
+ _link.edited.pathLength = true;
236
+ }
237
+ }
238
+ }
239
+ return _correlation;
240
+ }
241
+ function convertValuesString(valuesString, key) {
242
+ valuesString = valuesString
243
+ .toLowerCase()
244
+ .replace(/\s+/g, '')
245
+ .split(',')
246
+ .map((token) => (token === 'sp' ? 'sp1' : token))
247
+ .join(',');
248
+ valuesString = valuesString.replaceAll('sp', '');
249
+ let values = [];
250
+ const regex = /^(?:[0-9],{0,1})+$/g;
251
+ if (regex.test(valuesString)) {
252
+ // allow digits followed by optional comma only
253
+ values = valuesString
254
+ .split(',')
255
+ .filter((char) => char.length > 0)
256
+ .map((char) => Number(char));
257
+ }
258
+ // allow key specific values only
259
+ // protonsCount: [0, 1, 2, 3, ...], hybridization: [1, 2, 3]
260
+ values = values.filter((value) => value >= (key === 'protonsCount' ? 0 : 1) &&
261
+ (key === 'protonsCount' || value <= 3));
262
+ // unique values
263
+ return values.filter((index, i, a) => a.indexOf(index) === i);
264
+ }
265
+ function isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation) {
266
+ if (correlation.pseudo === true) {
267
+ return false;
268
+ }
269
+ if (activeSpectrum === null ||
270
+ !correlation.link.some((link) => link.experimentID === activeSpectrum.id)) {
271
+ return false;
272
+ }
273
+ const atomTypesInView = activeTab.split(',').map((tab) => getAtomType(tab));
274
+ const factor = 10000;
275
+ const xDomain0 = xDomain[0] * factor;
276
+ const xDomain1 = xDomain[1] * factor;
277
+ const yDomain0 = yDomain[0] * factor;
278
+ const yDomain1 = yDomain[1] * factor;
279
+ if (displayerMode === DISPLAYER_MODE.DM_1D) {
280
+ const firstLink1D = correlation.link.find((link) => getLinkDim(link) === 1);
281
+ if (!firstLink1D) {
282
+ return false;
283
+ }
284
+ let delta = getLinkDelta(firstLink1D);
285
+ if (delta === undefined) {
286
+ return false;
287
+ }
288
+ delta *= factor;
289
+ const spectrum = findSpectrum(spectraData, firstLink1D.experimentID, true);
290
+ if (spectrum &&
291
+ atomTypesInView[0] === correlation.atomType &&
292
+ delta >= xDomain0 &&
293
+ delta <= xDomain1) {
294
+ return true;
295
+ }
296
+ // try to find a link which contains the belonging 2D signal in the spectra in view
297
+ if (correlation.link.some((link) => {
298
+ const spectrum = findSpectrum(spectraData, link.experimentID, true);
299
+ return findSignalMatch1D(spectrum, link, factor, xDomain0, xDomain1);
300
+ })) {
301
+ return true;
302
+ }
303
+ }
304
+ else if (displayerMode === DISPLAYER_MODE.DM_2D) {
305
+ if (!atomTypesInView.includes(correlation.atomType)) {
306
+ return false;
307
+ }
308
+ const firstLink2D = correlation.link.find((link) => getLinkDim(link) === 2);
309
+ if (!firstLink2D) {
310
+ return false;
311
+ }
312
+ const spectrum = findSpectrum(spectraData, firstLink2D.experimentID, true);
313
+ // correlation is represented by a 2D signal
314
+ if (findSignalMatch2D(spectrum, firstLink2D, factor, xDomain0, xDomain1, yDomain0, yDomain1)) {
315
+ return true;
316
+ }
317
+ else {
318
+ // try to find a link which contains the belonging 2D signal in the spectra in view
319
+ if (correlation.link.some((link) => {
320
+ const spectrum = findSpectrum(spectraData, link.experimentID, true);
321
+ return findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0, yDomain1);
322
+ })) {
323
+ return true;
324
+ }
325
+ }
326
+ }
327
+ // do not show correlation
328
+ return false;
329
+ }
330
+ export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
@@ -8,6 +8,7 @@ export interface RowDataProps {
8
8
  signal: {
9
9
  kind: any;
10
10
  };
11
+ experiment: string;
11
12
  };
12
13
  x: {
13
14
  from: number;