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
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PANELS_ACCORDION = void 0;
6
+ exports.TOOLS_PANELS_ACCORDION = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const analysis_ui_components_1 = require("analysis-ui-components");
9
9
  const get_1 = __importDefault(require("lodash/get"));
@@ -12,7 +12,7 @@ const ChartContext_1 = require("../context/ChartContext");
12
12
  const PreferencesContext_1 = require("../context/PreferencesContext");
13
13
  const useCheckExperimentalFeature_1 = __importDefault(require("../hooks/useCheckExperimentalFeature"));
14
14
  const Constants_1 = require("../reducer/core/Constants");
15
- const ToolTypes_1 = require("../toolbar/ToolTypes");
15
+ const AutomaticAssignment_1 = __importDefault(require("./AutomaticAssignment/AutomaticAssignment"));
16
16
  const InformationPanel_1 = __importDefault(require("./InformationPanel"));
17
17
  const IntegralPanel_1 = __importDefault(require("./IntegralsPanel/IntegralPanel"));
18
18
  const MatrixGenerationPanel_1 = __importDefault(require("./MatrixGenerationPanel/MatrixGenerationPanel"));
@@ -29,14 +29,12 @@ const accordionItems = [
29
29
  {
30
30
  title: 'Spectra',
31
31
  component: (0, jsx_runtime_1.jsx)(SpectrumListPanel_1.default, {}, void 0),
32
- openWhen: null,
33
32
  hidePreferenceKey: 'hideSpectraPanel',
34
33
  mode: null,
35
34
  },
36
35
  {
37
36
  title: 'Information',
38
37
  component: (0, jsx_runtime_1.jsx)(InformationPanel_1.default, {}, void 0),
39
- openWhen: null,
40
38
  style: { overflow: 'hidden' },
41
39
  hidePreferenceKey: 'hideInformationPanel',
42
40
  mode: null,
@@ -44,42 +42,36 @@ const accordionItems = [
44
42
  {
45
43
  title: 'Peaks',
46
44
  component: (0, jsx_runtime_1.jsx)(PeaksPanel_1.default, {}, void 0),
47
- openWhen: [ToolTypes_1.options.peakPicking.id],
48
45
  hidePreferenceKey: 'hidePeaksPanel',
49
46
  mode: null,
50
47
  },
51
48
  {
52
49
  title: 'Filters',
53
50
  component: (0, jsx_runtime_1.jsx)(FilterPanel_1.default, {}, void 0),
54
- openWhen: null,
55
51
  hidePreferenceKey: 'hideFiltersPanel',
56
52
  mode: null,
57
53
  },
58
54
  {
59
55
  title: 'Integrals',
60
56
  component: (0, jsx_runtime_1.jsx)(IntegralPanel_1.default, {}, void 0),
61
- openWhen: [ToolTypes_1.options.integral.id],
62
57
  hidePreferenceKey: 'hideIntegralsPanel',
63
58
  mode: null,
64
59
  },
65
60
  {
66
61
  title: 'Ranges',
67
62
  component: (0, jsx_runtime_1.jsx)(RangesPanel_1.default, {}, void 0),
68
- openWhen: [ToolTypes_1.options.rangesPicking.id],
69
63
  hidePreferenceKey: 'hideRangesPanel',
70
64
  mode: Constants_1.DISPLAYER_MODE.DM_1D,
71
65
  },
72
66
  {
73
67
  title: 'Multiple Spectra Analysis',
74
68
  component: (0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisPanel_1.default, {}, void 0),
75
- openWhen: [ToolTypes_1.options.multipleSpectraAnalysis.id],
76
69
  hidePreferenceKey: 'hideMultipleSpectraAnalysisPanel',
77
70
  mode: null,
78
71
  },
79
72
  {
80
73
  title: 'Matrix Generation',
81
74
  component: (0, jsx_runtime_1.jsx)(MatrixGenerationPanel_1.default, {}, void 0),
82
- openWhen: [],
83
75
  hidePreferenceKey: '',
84
76
  mode: null,
85
77
  isExperimental: true,
@@ -87,38 +79,42 @@ const accordionItems = [
87
79
  {
88
80
  title: 'Zones',
89
81
  component: (0, jsx_runtime_1.jsx)(ZonesPanel_1.default, {}, void 0),
90
- openWhen: [ToolTypes_1.options.zone2D.id],
91
82
  hidePreferenceKey: 'hideZonesPanel',
92
83
  mode: Constants_1.DISPLAYER_MODE.DM_2D,
93
84
  },
94
85
  {
95
86
  title: 'Summary',
96
87
  component: (0, jsx_runtime_1.jsx)(SummaryPanel_1.default, {}, void 0),
97
- openWhen: [],
98
88
  hidePreferenceKey: 'hideSummaryPanel',
99
89
  mode: null,
100
90
  },
101
91
  {
102
92
  title: 'Structures',
103
93
  component: (0, jsx_runtime_1.jsx)(MoleculePanel_1.default, {}, void 0),
104
- openWhen: [ToolTypes_1.options.rangesPicking.id],
105
94
  hidePreferenceKey: 'hideStructuresPanel',
106
95
  mode: null,
107
96
  },
108
97
  {
109
98
  title: 'Database',
110
99
  component: (0, jsx_runtime_1.jsx)(DatabasePanel_1.default, {}, void 0),
111
- openWhen: [],
112
100
  hidePreferenceKey: 'hideDatabasePanel',
113
101
  mode: null,
114
102
  },
103
+ {
104
+ title: 'Automatic Assignment',
105
+ component: (0, jsx_runtime_1.jsx)(AutomaticAssignment_1.default, {}, void 0),
106
+ hidePreferenceKey: '',
107
+ mode: null,
108
+ isExperimental: true,
109
+ },
115
110
  ];
116
- exports.PANELS_ACCORDION = {
111
+ exports.TOOLS_PANELS_ACCORDION = {
117
112
  null: 'Spectra',
118
113
  peakPicking: 'Peaks',
119
114
  integral: 'Integrals',
120
115
  rangesPicking: 'Ranges',
121
116
  zone2D: 'Zones',
117
+ multipleSpectraAnalysis: 'Multiple Spectra Analysis',
122
118
  };
123
119
  function PanelsInner({ displayerMode }) {
124
120
  const preferences = (0, PreferencesContext_1.usePreferences)();
@@ -76,8 +76,8 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
76
76
  to,
77
77
  });
78
78
  const dataToClipboard = {
79
- x: x.slice(fromIndex, toIndex),
80
- y: re.slice(fromIndex, toIndex),
79
+ x: Array.from(x.slice(fromIndex, toIndex)),
80
+ y: Array.from(re.slice(fromIndex, toIndex)),
81
81
  ...value,
82
82
  };
83
83
  const success = await (0, Export_1.copyTextToClipboard)(JSON.stringify(dataToClipboard, undefined, 2));
@@ -12,7 +12,8 @@ const generateID_1 = __importDefault(require("../../../../data/utilities/generat
12
12
  const ContextMenu_1 = __importDefault(require("../../../elements/ContextMenu"));
13
13
  const Modal_1 = require("../../../elements/popup/Modal");
14
14
  const highlight_1 = require("../../../highlight");
15
- const Utilities_1 = require("../Utilities");
15
+ const IsInView_1 = __importDefault(require("../utilities/IsInView"));
16
+ const Utilities_1 = require("../utilities/Utilities");
16
17
  const EditLinkModal_1 = __importDefault(require("./editLink/EditLinkModal"));
17
18
  function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks, correlations, spectraData, onEdit, }) {
18
19
  const contextRef = (0, react_1.useRef)();
@@ -140,6 +141,8 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
140
141
  return arr;
141
142
  }, [])
142
143
  .join('/'), [commonLinks]);
144
+ const isInViewRow = (0, IsInView_1.default)({ correlation: rowCorrelation });
145
+ const isInViewColumn = (0, IsInView_1.default)({ correlation: columnCorrelation });
143
146
  return ((0, jsx_runtime_1.jsxs)("td", { onContextMenu: (e) => {
144
147
  if (contextMenu.length > 0) {
145
148
  contextMenuHandler(e);
@@ -147,7 +150,9 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
147
150
  }, style: {
148
151
  backgroundColor: highlightCommonLinks.isActive
149
152
  ? '#ff6f0057'
150
- : 'inherit',
153
+ : isInViewColumn || isInViewRow
154
+ ? '#f5f5dc'
155
+ : 'inherit',
151
156
  }, title: title, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, children: [contentLabel, (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: contextMenu }, void 0)] }, void 0));
152
157
  }
153
158
  exports.default = AdditionalColumnField;
@@ -12,7 +12,8 @@ const FindUtilities_1 = require("../../../../data/utilities/FindUtilities");
12
12
  const ContextMenu_1 = __importDefault(require("../../../elements/ContextMenu"));
13
13
  const Modal_1 = require("../../../elements/popup/Modal");
14
14
  const highlight_1 = require("../../../highlight");
15
- const Utilities_1 = require("../Utilities");
15
+ const IsInView_1 = __importDefault(require("../utilities/IsInView"));
16
+ const Utilities_1 = require("../utilities/Utilities");
16
17
  const EditLinkModal_1 = __importDefault(require("./editLink/EditLinkModal"));
17
18
  function AdditionalColumnHeader({ spectraData, correlationsData, correlation, onEdit, }) {
18
19
  const contextRef = (0, react_1.useRef)();
@@ -43,13 +44,16 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
43
44
  event.currentTarget.blur();
44
45
  highlightAdditionalColumn.hide();
45
46
  }, [highlightAdditionalColumn]);
47
+ const isInView = (0, IsInView_1.default)({ correlation });
46
48
  const tableHeaderProps = (0, react_1.useMemo)(() => {
47
49
  return {
48
50
  style: {
49
51
  ...{ color: (0, Utilities_1.getLabelColor)(correlationsData, correlation) || undefined },
50
52
  backgroundColor: highlightAdditionalColumn.isActive
51
53
  ? '#ff6f0057'
52
- : 'inherit',
54
+ : isInView
55
+ ? '#f5f5dc'
56
+ : 'inherit',
53
57
  },
54
58
  title: correlation.pseudo === false &&
55
59
  correlation.link
@@ -69,6 +73,7 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
69
73
  correlation,
70
74
  correlationsData,
71
75
  highlightAdditionalColumn.isActive,
76
+ isInView,
72
77
  mouseEnterHandler,
73
78
  mouseLeaveHandler,
74
79
  ]);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hybridizations = exports.ErrorColors = exports.Errors = exports.EditLinkActions = exports.DefaultTolerance = void 0;
3
+ exports.Hybridizations = exports.ErrorColors = exports.Errors = exports.DefaultTolerance = void 0;
4
4
  // error colors in priority order
5
5
  const ErrorColors = [
6
6
  { key: 'outOfLimit', color: 'red' },
@@ -43,10 +43,3 @@ const DefaultTolerance = {
43
43
  P: 0.25,
44
44
  };
45
45
  exports.DefaultTolerance = DefaultTolerance;
46
- const EditLinkActions = [
47
- { key: '-', value: '-', label: 'Select Action' },
48
- { key: 'delete', value: 'delete', label: 'Delete' },
49
- { key: 'move', value: 'move', label: 'Move' },
50
- { key: 'unmove', value: 'unmove', label: 'Unmove' },
51
- ];
52
- exports.EditLinkActions = EditLinkActions;
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
7
  /** @jsxImportSource @emotion/react */
8
8
  const react_1 = require("@emotion/react");
9
9
  const react_2 = require("react");
10
- const Utilities_1 = require("../Utilities");
10
+ const Utilities_1 = require("../utilities/Utilities");
11
11
  const AdditionalColumnHeader_1 = __importDefault(require("./AdditionalColumnHeader"));
12
12
  const CorrelationTableRow_1 = __importDefault(require("./CorrelationTableRow"));
13
13
  const tableStyle = (0, react_1.css) `
@@ -55,7 +55,7 @@ const tableStyle = (0, react_1.css) `
55
55
  }
56
56
  }
57
57
  `;
58
- function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, changeHybridizationSaveHandler, editProtonsCountSaveHandler, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
58
+ function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, onSaveEditNumericValues, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
59
59
  const rows = (0, react_2.useMemo)(() => {
60
60
  if (!filteredCorrelationsData) {
61
61
  return [];
@@ -68,15 +68,14 @@ function CorrelationTable({ correlationsData, filteredCorrelationsData, addition
68
68
  ? {
69
69
  color: (0, Utilities_1.getLabelColor)(correlationsData, correlation),
70
70
  }
71
- : {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onChangeHybridization: changeHybridizationSaveHandler, onSaveEditProtonsCount: editProtonsCountSaveHandler, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
71
+ : {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onSaveEditNumericValues: onSaveEditNumericValues, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
72
72
  }, [
73
73
  filteredCorrelationsData,
74
74
  showProtonsAsRows,
75
75
  additionalColumnData,
76
76
  correlationsData,
77
77
  editEquivalencesSaveHandler,
78
- changeHybridizationSaveHandler,
79
- editProtonsCountSaveHandler,
78
+ onSaveEditNumericValues,
80
79
  onEditCorrelationTableCellHandler,
81
80
  spectraData,
82
81
  ]);
@@ -10,19 +10,13 @@ const Concatenation_1 = require("../../../../data/utilities/Concatenation");
10
10
  const FindUtilities_1 = require("../../../../data/utilities/FindUtilities");
11
11
  const ContextMenu_1 = __importDefault(require("../../../elements/ContextMenu"));
12
12
  const EditableColumn_1 = __importDefault(require("../../../elements/EditableColumn"));
13
- const Select_1 = __importDefault(require("../../../elements/Select"));
14
13
  const Modal_1 = require("../../../elements/popup/Modal");
15
14
  const highlight_1 = require("../../../highlight");
15
+ const IsInView_1 = __importDefault(require("../utilities/IsInView"));
16
+ const Utilities_1 = require("../utilities/Utilities");
16
17
  const AdditionalColumnField_1 = __importDefault(require("./AdditionalColumnField"));
17
- const Constants_1 = require("./Constants");
18
18
  const EditLinkModal_1 = __importDefault(require("./editLink/EditLinkModal"));
19
- const selectBoxStyle = {
20
- marginLeft: 2,
21
- marginRight: 2,
22
- border: 'none',
23
- height: '20px',
24
- };
25
- function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onChangeHybridization, onSaveEditProtonsCount, onEditCorrelationTableCellHandler, spectraData, }) {
19
+ function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }) {
26
20
  const contextRef = (0, react_1.useRef)();
27
21
  const modal = (0, Modal_1.useModal)();
28
22
  const highlightIDsRow = (0, react_1.useMemo)(() => {
@@ -46,9 +40,13 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
46
40
  const onSaveEquivalencesHandler = (0, react_1.useCallback)((e) => {
47
41
  onSaveEditEquivalences(correlation, e.target.value);
48
42
  }, [correlation, onSaveEditEquivalences]);
49
- const onSaveProtonsCountHandler = (0, react_1.useCallback)((e) => {
50
- onSaveEditProtonsCount(correlation, e.target.value);
51
- }, [correlation, onSaveEditProtonsCount]);
43
+ const onSaveEditNumericValuesHandler = (0, react_1.useCallback)((e, key) => {
44
+ onSaveEditNumericValues({
45
+ correlation,
46
+ values: (0, Utilities_1.convertValuesString)(e.target.value, key),
47
+ key,
48
+ });
49
+ }, [correlation, onSaveEditNumericValues]);
52
50
  const additionalColumnFields = (0, react_1.useMemo)(() => {
53
51
  return additionalColumnData.map((_correlation) => {
54
52
  const commonLinks = [];
@@ -80,9 +78,6 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
80
78
  onEditCorrelationTableCellHandler,
81
79
  spectraData,
82
80
  ]);
83
- const onChangeHybridizationHandler = (0, react_1.useCallback)((value) => {
84
- onChangeHybridization(correlation, value);
85
- }, [correlation, onChangeHybridization]);
86
81
  const equivalenceCellStyle = (0, react_1.useMemo)(() => {
87
82
  return correlation.edited.equivalence
88
83
  ? { color: 'blue' }
@@ -98,11 +93,16 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
98
93
  event.currentTarget.blur();
99
94
  highlightRow.hide();
100
95
  }, [highlightRow]);
96
+ const isInView = (0, IsInView_1.default)({ correlation });
101
97
  const tableDataProps = (0, react_1.useMemo)(() => {
102
98
  return {
103
99
  style: {
104
100
  ...styleRow,
105
- backgroundColor: highlightRow.isActive ? '#ff6f0057' : 'inherit',
101
+ backgroundColor: highlightRow.isActive
102
+ ? '#ff6f0057'
103
+ : isInView
104
+ ? '#f5f5dc'
105
+ : 'inherit',
106
106
  },
107
107
  title: correlation.pseudo === false &&
108
108
  correlation.link
@@ -122,6 +122,7 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
122
122
  correlation.link,
123
123
  correlation.pseudo,
124
124
  highlightRow.isActive,
125
+ isInView,
125
126
  mouseEnterHandler,
126
127
  mouseLeaveHandler,
127
128
  styleRow,
@@ -185,16 +186,11 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
185
186
  }
186
187
  }, children: [(0, nmr_correlation_1.getLabel)(correlations, correlation), (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: contextMenu }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: (0, nmr_correlation_1.getCorrelationDelta)(correlation)
187
188
  ? (0, nmr_correlation_1.getCorrelationDelta)(correlation)?.toFixed(2)
188
- : '' }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : ((0, jsx_runtime_1.jsx)("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: onSaveProtonsCountHandler }, void 0)) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...{
189
+ : '' }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : ((0, jsx_runtime_1.jsx)("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount') }, void 0)) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...{
189
190
  ...otherTableDataProps,
190
191
  style: { ...tableDataProps.style, borderRight: '1px solid' },
191
- }, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(Select_1.default, { onChange: onChangeHybridizationHandler, data: Constants_1.Hybridizations, defaultValue: correlation.hybridization, style: {
192
- ...selectBoxStyle,
193
- color: correlation.edited.hybridization ? 'blue' : 'black',
194
- backgroundColor: correlation.edited.hybridization
195
- ? 'inherit'
196
- : styleRow.backgroundColor,
197
- width: '50px',
198
- } }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
192
+ }, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "text", value: correlation.hybridization
193
+ .map((hybrid) => `sp${hybrid}`)
194
+ .join(','), style: correlation.edited.hybridization ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'hybridization') }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
199
195
  }
200
196
  exports.default = CorrelationTableRow;
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
@@ -9,20 +28,21 @@ const react_1 = require("@emotion/react");
9
28
  const nmr_correlation_1 = require("nmr-correlation");
10
29
  const react_2 = require("react");
11
30
  const CloseButton_1 = __importDefault(require("../../../../elements/CloseButton"));
12
- const Select_1 = __importDefault(require("../../../../elements/Select"));
13
- const Utilities_1 = require("../../Utilities");
14
- const Constants_1 = require("../Constants");
31
+ const Tab_1 = __importDefault(require("../../../../elements/Tab/Tab"));
32
+ const Tabs_1 = __importStar(require("../../../../elements/Tab/Tabs"));
33
+ const Utilities_1 = require("../../utilities/Utilities");
15
34
  const Confirmation_1 = __importDefault(require("./Confirmation"));
35
+ const EditPathLength_1 = __importDefault(require("./EditPathLength"));
16
36
  const MoveLink_1 = __importDefault(require("./MoveLink"));
17
37
  const modalContainer = (0, react_1.css) `
18
- overflow: auto;
19
- width: 380px;
20
- height: 230px;
38
+ width: 490px;
39
+ height: 220px;
21
40
  padding: 5px;
22
41
 
23
42
  button:focus {
24
43
  outline: none;
25
44
  }
45
+
26
46
  .header {
27
47
  height: 24px;
28
48
  border-bottom: 1px solid #f0f0f0;
@@ -66,14 +86,15 @@ const modalContainer = (0, react_1.css) `
66
86
  background-color: gray;
67
87
  }
68
88
 
69
- .select-action-container {
70
- margin-top: 10px;
89
+ .tabs-container {
71
90
  width: 100%;
72
- text-align: center;
91
+ flex: 1;
92
+ overflow: auto;
93
+ border: none;
73
94
  }
74
95
  `;
75
96
  function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, onClose, onEdit, }) {
76
- const [selectedAction, setSelectedActions] = (0, react_2.useState)('-');
97
+ const [activeTab, setActiveTab] = (0, react_2.useState)('move');
77
98
  const getLinkLabel = (0, react_2.useCallback)(() => {
78
99
  const linkDim = (0, nmr_correlation_1.getLinkDim)(link);
79
100
  if (linkDim === 1) {
@@ -84,38 +105,30 @@ function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, o
84
105
  }
85
106
  return '';
86
107
  }, [correlationDim1.label.origin, link, correlationDim2]);
87
- const handleOnEdit = (0, react_2.useCallback)((action, selectedCorrelationValueDim1, selectedCorrelationValueDim2) => {
108
+ const handleOnEdit = (0, react_2.useCallback)((action, selectedCorrelationIdDim1, selectedCorrelationIdDim2, editedLink) => {
88
109
  const { editedCorrelations, buildCorrelationDataOptions } = (0, Utilities_1.getEditedCorrelations)({
89
110
  correlationDim1,
90
111
  correlationDim2,
91
- selectedCorrelationValueDim1,
92
- selectedCorrelationValueDim2,
112
+ selectedCorrelationIdDim1,
113
+ selectedCorrelationIdDim2,
93
114
  action,
94
- link,
115
+ link: editedLink || link,
95
116
  correlations,
96
117
  });
97
- onEdit(editedCorrelations, action, link, buildCorrelationDataOptions);
118
+ onEdit(editedCorrelations, action, editedLink || link, buildCorrelationDataOptions);
98
119
  onClose?.();
99
120
  }, [correlationDim1, correlationDim2, correlations, link, onClose, onEdit]);
100
- const component = (0, react_2.useMemo)(() => {
101
- switch (selectedAction) {
102
- case 'delete':
103
- return ((0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0));
104
- case 'move':
105
- return ((0, jsx_runtime_1.jsx)(MoveLink_1.default, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: handleOnEdit }, void 0));
106
- case 'unmove':
107
- return ((0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0));
108
- default:
109
- return null;
110
- }
111
- }, [
121
+ const tabsContainer = (0, react_2.useMemo)(() => ((0, jsx_runtime_1.jsx)("div", { className: "tabs-container", children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.TOP, activeTab: activeTab, onClick: (tab) => setActiveTab(tab.tabid), children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Move", tabid: 'move', children: (0, jsx_runtime_1.jsx)(MoveLink_1.default, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: (correlationIdDim1, correlationIdDim2) => handleOnEdit('move', correlationIdDim1, correlationIdDim2) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Unmove", tabid: "unmove", children: (0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Remove", tabid: 'remove', children: (0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "J Coupling", tabid: 'setPathLength', children: (0, jsx_runtime_1.jsx)(EditPathLength_1.default, { signal: link.signal, experimentType: link.experimentType, onEdit: (editedSignal) => {
122
+ const editedLink = { ...link, signal: editedSignal };
123
+ handleOnEdit('setPathLength', correlationDim1, correlationDim2, editedLink);
124
+ } }, void 0) }, void 0)] }, void 0) }, void 0)), [
125
+ activeTab,
112
126
  correlationDim1,
113
127
  correlationDim2,
114
128
  correlations,
115
- link,
116
129
  handleOnEdit,
117
- selectedAction,
130
+ link,
118
131
  ]);
119
- return ((0, jsx_runtime_1.jsxs)("div", { css: modalContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "select-action-container", children: (0, jsx_runtime_1.jsx)(Select_1.default, { data: Constants_1.EditLinkActions, onChange: (action) => setSelectedActions(action), defaultValue: selectedAction, style: { width: 120, height: 25, margin: 0 } }, void 0) }, void 0), component, (0, jsx_runtime_1.jsx)("div", {}, void 0)] }, void 0));
132
+ return ((0, jsx_runtime_1.jsxs)("div", { css: modalContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), tabsContainer] }, void 0));
120
133
  }
121
134
  exports.default = EditLinkModal;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
+ /** @jsxImportSource @emotion/react */
8
+ const react_1 = require("@emotion/react");
9
+ const react_2 = require("react");
10
+ const DefaultPathLengths_1 = __importDefault(require("../../../../../data/constants/DefaultPathLengths"));
11
+ const Button_1 = __importDefault(require("../../../../elements/Button"));
12
+ const Input_1 = __importDefault(require("../../../../elements/Input"));
13
+ const Label_1 = __importDefault(require("../../../../elements/Label"));
14
+ const editPathLengthsStyles = (0, react_1.css) `
15
+ width: 100%;
16
+ height: 100%;
17
+ margin-top: 10px;
18
+ text-align: center;
19
+
20
+ .input-container {
21
+ width: 100%;
22
+ margin-top: 5px;
23
+ text-align: center;
24
+
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ justify-content: center;
29
+ }
30
+
31
+ button {
32
+ flex: 2;
33
+ padding: 5px;
34
+ border: 1px solid gray;
35
+ border-radius: 5px;
36
+ height: 30px;
37
+ margin: 0 auto;
38
+ margin-top: 15px;
39
+ display: block;
40
+ width: 60px;
41
+
42
+ color: white;
43
+ background-color: gray;
44
+ }
45
+
46
+ .warning {
47
+ margin-top: 5px;
48
+ color: red;
49
+ }
50
+ `;
51
+ function EditPathLength({ signal, experimentType, onEdit }) {
52
+ const [from, setFrom] = (0, react_2.useState)(signal.j?.pathLength !== undefined
53
+ ? signal.j.pathLength.from
54
+ : DefaultPathLengths_1.default[experimentType]?.from || 0);
55
+ const [to, setTo] = (0, react_2.useState)(signal.j?.pathLength !== undefined
56
+ ? signal.j.pathLength.to
57
+ : DefaultPathLengths_1.default[experimentType]?.to || 0);
58
+ const [isError, setIsError] = (0, react_2.useState)(false);
59
+ const handleOnEdit = (0, react_2.useCallback)(() => {
60
+ const pathLength = {
61
+ from,
62
+ to,
63
+ };
64
+ const editedSignal = {
65
+ ...signal,
66
+ j: {
67
+ ...signal.j,
68
+ pathLength,
69
+ },
70
+ };
71
+ onEdit(editedSignal);
72
+ }, [to, from, onEdit, signal]);
73
+ (0, react_2.useEffect)(() => {
74
+ setIsError(from <= 0 || from > to);
75
+ }, [to, from]);
76
+ return ((0, jsx_runtime_1.jsxs)("div", { css: editPathLengthsStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "input-container", children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Min:", style: {
77
+ label: {
78
+ marginRight: '5px',
79
+ fontSize: '14px',
80
+ fontWeight: 'normal',
81
+ },
82
+ }, children: (0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", value: from, onChange: (e) => {
83
+ setFrom(Number(e.target.value));
84
+ }, style: { input: { color: isError ? 'red' : 'black' } } }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Max:", style: {
85
+ label: {
86
+ marginRight: '5px',
87
+ fontSize: '14px',
88
+ fontWeight: 'normal',
89
+ },
90
+ }, children: (0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", value: to, onChange: (e) => {
91
+ setTo(Number(e.target.value));
92
+ } }, void 0) }, void 0)] }, void 0), isError ? ((0, jsx_runtime_1.jsxs)("p", { className: "warning", children: ["Minimum must not be 0 or higher than the maximum value.", ' '] }, void 0)) : ((0, jsx_runtime_1.jsx)(Button_1.default, { type: "button", onClick: handleOnEdit, disabled: isError, children: "Set" }, void 0))] }, void 0));
93
+ }
94
+ exports.default = EditPathLength;
@@ -80,6 +80,6 @@ function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit
80
80
  border: '1px solid grey',
81
81
  } }, void 0));
82
82
  }, [correlationDim1, correlationDim2, correlations, link.atomType]);
83
- return ((0, jsx_runtime_1.jsxs)("div", { css: moveLinkStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Move of signals on either one or both axes." }, void 0), (0, jsx_runtime_1.jsx)("p", { children: "\"New\" means to separate into a new row or column." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onEdit('move', selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
83
+ return ((0, jsx_runtime_1.jsxs)("div", { css: moveLinkStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Move of signals on either one or both axes." }, void 0), (0, jsx_runtime_1.jsx)("p", { children: "\"New\" means to separate into a new row or column." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onEdit(selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
84
84
  }
85
85
  exports.default = MoveLink;