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
@@ -23,7 +23,7 @@ const CorrelationTable_1 = __importDefault(require("./CorrelationTable/Correlati
23
23
  const Overview_1 = __importDefault(require("./Overview"));
24
24
  const SetMolecularFormulaModal_1 = __importDefault(require("./SetMolecularFormulaModal"));
25
25
  const SetShiftTolerancesModal_1 = __importDefault(require("./SetShiftTolerancesModal"));
26
- const Utilities_1 = require("./Utilities");
26
+ const Utilities_1 = require("./utilities/Utilities");
27
27
  const panelStyle = (0, react_1.css) `
28
28
  display: flex;
29
29
  flex-direction: column;
@@ -197,51 +197,20 @@ function SummaryPanel() {
197
197
  correlation: {
198
198
  ...correlation,
199
199
  equivalence: value,
200
- edited: { ...correlation.edited, equivalence: true },
200
+ edited: { ...correlation.edited, equivalence: value !== 1 },
201
201
  },
202
202
  },
203
203
  });
204
204
  }, [dispatch]);
205
- const editProtonsCountSaveHandler = (0, react_2.useCallback)((correlation, valuesString) => {
206
- let values;
207
- if (/^(?:[0-9],{0,1})+$/g.test(valuesString)) {
208
- // allow digits followed by optional comma only
209
- values = valuesString
210
- .split(',')
211
- .filter((char) => char.length > 0)
212
- .map((char) => Number(char));
213
- }
214
- else if (valuesString.trim().length === 0) {
215
- // set values to default
216
- values = [];
217
- }
218
- if (values) {
219
- // ignore not supported text input
220
- dispatch({
221
- type: Types_1.SET_CORRELATION,
222
- payload: {
223
- id: correlation.id,
224
- correlation: {
225
- ...correlation,
226
- protonsCount: values,
227
- edited: { ...correlation.edited, protonsCount: true },
228
- },
229
- options: {
230
- skipDataUpdate: true,
231
- },
232
- },
233
- });
234
- }
235
- }, [dispatch]);
236
- const changeHybridizationSaveHandler = (0, react_2.useCallback)((correlation, value) => {
205
+ const editNumericValuesSaveHandler = (0, react_2.useCallback)(({ correlation, values, key, }) => {
237
206
  dispatch({
238
207
  type: Types_1.SET_CORRELATION,
239
208
  payload: {
240
209
  id: correlation.id,
241
210
  correlation: {
242
211
  ...correlation,
243
- hybridization: value,
244
- edited: { ...correlation.edited, hybridization: true },
212
+ [key]: values,
213
+ edited: { ...correlation.edited, [key]: true },
245
214
  },
246
215
  options: {
247
216
  skipDataUpdate: true,
@@ -299,20 +268,48 @@ function SummaryPanel() {
299
268
  });
300
269
  }
301
270
  }, [assignmentData, dispatch, spectraData]);
271
+ const changeSignalPathLengthHandler = (0, react_2.useCallback)((link) => {
272
+ const linkDim = (0, nmr_correlation_1.getLinkDim)(link);
273
+ if (linkDim === 2) {
274
+ const spectrum = (0, FindUtilities_1.findSpectrum)(spectraData, link.experimentID, false);
275
+ const zone = (0, FindUtilities_1.findZone)(spectrum, link.signal.id);
276
+ const signal = (0, FindUtilities_1.findSignal2D)(spectrum, link.signal.id);
277
+ dispatch({
278
+ type: Types_1.SET_2D_SIGNAL_PATH_LENGTH,
279
+ payload: {
280
+ spectrum,
281
+ zone,
282
+ signal,
283
+ pathLength: link.signal.j?.pathLength,
284
+ },
285
+ });
286
+ }
287
+ }, [dispatch, spectraData]);
302
288
  const editCorrelationTableCellHandler = (0, react_2.useCallback)((editedCorrelations, action, link, options) => {
303
289
  if (action === 'add' ||
304
290
  action === 'move' ||
305
291
  action === 'remove' ||
306
- action === 'unmove') {
307
- if (action === 'remove' && link && link.pseudo === false) {
308
- deleteSignalHandler(link);
292
+ action === 'unmove' ||
293
+ action === 'setPathLength') {
294
+ if (link && link.pseudo === false) {
295
+ if (action === 'remove') {
296
+ deleteSignalHandler(link);
297
+ }
298
+ else if (action === 'setPathLength') {
299
+ changeSignalPathLengthHandler(link);
300
+ }
309
301
  }
310
302
  setCorrelationsHandler(editedCorrelations, options);
311
303
  }
312
304
  else if (action === 'removeAll') {
313
305
  deleteCorrelationHandler(editedCorrelations[0]);
314
306
  }
315
- }, [deleteCorrelationHandler, deleteSignalHandler, setCorrelationsHandler]);
307
+ }, [
308
+ changeSignalPathLengthHandler,
309
+ deleteCorrelationHandler,
310
+ deleteSignalHandler,
311
+ setCorrelationsHandler,
312
+ ]);
316
313
  const handleOnFilter = (0, react_2.useCallback)(() => {
317
314
  setFilterIsActive(!filterIsActive);
318
315
  }, [filterIsActive]);
@@ -331,6 +328,6 @@ function SummaryPanel() {
331
328
  width: '70px',
332
329
  height: '18px',
333
330
  border: '1px solid grey',
334
- } }, void 0)] }, void 0) }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(CorrelationTable_1.default, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, changeHybridizationSaveHandler: changeHybridizationSaveHandler, editProtonsCountSaveHandler: editProtonsCountSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData }, void 0)] }, void 0));
331
+ } }, void 0)] }, void 0) }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(CorrelationTable_1.default, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData }, void 0)] }, void 0));
335
332
  }
336
333
  exports.default = (0, react_2.memo)(SummaryPanel);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ const ChartContext_1 = require("../../../context/ChartContext");
5
+ const Utilities_1 = require("./Utilities");
6
+ function IsInView({ correlation }) {
7
+ const { data: spectraData, xDomain, yDomain, displayerMode, activeTab, activeSpectrum, } = (0, ChartContext_1.useChartData)();
8
+ return (0, react_1.useMemo)(() => (0, Utilities_1.isInView)(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation), [
9
+ activeSpectrum,
10
+ activeTab,
11
+ correlation,
12
+ displayerMode,
13
+ spectraData,
14
+ xDomain,
15
+ yDomain,
16
+ ]);
17
+ }
18
+ exports.default = IsInView;
@@ -3,12 +3,15 @@ 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.getLabelColor = exports.getEditedCorrelations = exports.getAtomType = exports.getAbbreviation = exports.findSignalMatch2D = exports.findSignalMatch1D = exports.cloneCorrelationAndEditLink = exports.buildNewLink2D = exports.buildNewLink1D = void 0;
6
+ exports.isInView = exports.getLabelColor = exports.getEditedCorrelations = exports.getAtomType = exports.getAbbreviation = exports.findSignalMatch2D = exports.findSignalMatch1D = exports.convertValuesString = exports.cloneCorrelationAndEditLink = exports.buildNewLink2D = exports.buildNewLink1D = void 0;
7
7
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const nmr_correlation_1 = require("nmr-correlation");
10
- const FindUtilities_1 = require("../../../data/utilities/FindUtilities");
11
- const Constants_1 = require("./CorrelationTable/Constants");
10
+ const DefaultPathLengths_1 = __importDefault(require("../../../../data/constants/DefaultPathLengths"));
11
+ const FindUtilities_1 = require("../../../../data/utilities/FindUtilities");
12
+ const isDefaultPathLength_1 = __importDefault(require("../../../modal/editZone/validation/isDefaultPathLength"));
13
+ const Constants_1 = require("../../../reducer/core/Constants");
14
+ const Constants_2 = require("../CorrelationTable/Constants");
12
15
  function getAtomType(nucleus) {
13
16
  return nucleus.split(/\d+/)[1];
14
17
  }
@@ -16,7 +19,7 @@ exports.getAtomType = getAtomType;
16
19
  function getLabelColor(correlationData, correlation) {
17
20
  const error = (0, get_1.default)(correlationData, `state.${correlation.atomType}.error`, null);
18
21
  if (error) {
19
- for (let { key, color } of Constants_1.ErrorColors) {
22
+ for (let { key, color } of Constants_2.ErrorColors) {
20
23
  if (key !== 'incomplete' && // do not consider this for a single atom type
21
24
  (key === 'notAttached' || key === 'ambiguousAttachment') &&
22
25
  (0, get_1.default)(error, `${key}`, []).some((index) => correlationData.values[index].id === correlation.id)) {
@@ -55,27 +58,38 @@ function findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0,
55
58
  }
56
59
  exports.findSignalMatch2D = findSignalMatch2D;
57
60
  function getAbbreviation(link) {
61
+ let abbreviation = 'X';
58
62
  if (link.experimentType === 'hsqc' || link.experimentType === 'hmqc') {
59
- return !link.signal || link.signal.sign === 0
60
- ? 'S'
61
- : `S${link.signal.sign === 1 ? '+' : '-'}`;
63
+ abbreviation =
64
+ !link.signal || link.signal.sign === 0
65
+ ? 'S'
66
+ : `S${link.signal.sign === 1 ? '+' : '-'}`;
62
67
  }
63
68
  else if (link.experimentType === 'hmbc' ||
64
69
  link.experimentType === 'cosy' ||
65
70
  link.experimentType === 'tocsy') {
66
- return 'M';
71
+ abbreviation = 'M';
67
72
  }
68
73
  else if (link.experimentType === 'noesy' ||
69
74
  link.experimentType === 'roesy') {
70
- return 'NOE';
75
+ abbreviation = 'NOE';
71
76
  }
72
77
  else if (link.experimentType === 'inadequate') {
73
- return 'I';
78
+ abbreviation = 'I';
74
79
  }
75
80
  else if (link.experimentType === 'adequate') {
76
- return 'A';
81
+ abbreviation = 'A';
77
82
  }
78
- return 'X';
83
+ const pathLength = link.signal.j?.pathLength;
84
+ if (pathLength) {
85
+ const isDefaultCorrelation = DefaultPathLengths_1.default[link.experimentType] &&
86
+ pathLength.from >= DefaultPathLengths_1.default[link.experimentType].from &&
87
+ pathLength.from <= DefaultPathLengths_1.default[link.experimentType].to &&
88
+ pathLength.to >= DefaultPathLengths_1.default[link.experimentType].from &&
89
+ pathLength.to <= DefaultPathLengths_1.default[link.experimentType].to;
90
+ return `${abbreviation}${isDefaultCorrelation ? '' : '*'}`;
91
+ }
92
+ return abbreviation;
79
93
  }
80
94
  exports.getAbbreviation = getAbbreviation;
81
95
  function buildNewLink1D(link) {
@@ -115,9 +129,9 @@ function cloneCorrelationAndEditLink(correlation, link, axis, action) {
115
129
  return _correlation;
116
130
  }
117
131
  exports.cloneCorrelationAndEditLink = cloneCorrelationAndEditLink;
118
- function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationValueDim1, selectedCorrelationValueDim2, action, link, correlations, }) {
119
- const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim1);
120
- const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim2);
132
+ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationIdDim1, selectedCorrelationIdDim2, action, link, correlations, }) {
133
+ const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim1);
134
+ const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim2);
121
135
  const hasChangedDim1 = selectedCorrelationDim1?.id !== correlationDim1.id;
122
136
  const hasChangedDim2 = correlationDim2 && selectedCorrelationDim2?.id !== correlationDim2?.id;
123
137
  const linkDim = (0, nmr_correlation_1.getLinkDim)(link);
@@ -153,14 +167,14 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
153
167
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
154
168
  }
155
169
  else if (selectedCorrelationDim1 &&
156
- selectedCorrelationValueDim2 === 'new') {
170
+ selectedCorrelationIdDim2 === 'new') {
157
171
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim1 ? selectedCorrelationDim1 : _correlationDim1, link, 'x', 'add'));
158
172
  editedCorrelations.push((0, nmr_correlation_1.buildCorrelation)({
159
173
  atomType: correlationDim2.atomType,
160
174
  link: [buildNewLink2D(link, 'y')],
161
175
  }));
162
176
  }
163
- else if (selectedCorrelationValueDim1 === 'new' &&
177
+ else if (selectedCorrelationIdDim1 === 'new' &&
164
178
  selectedCorrelationDim2) {
165
179
  editedCorrelations.push((0, nmr_correlation_1.buildCorrelation)({
166
180
  atomType: correlationDim1.atomType,
@@ -168,8 +182,8 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
168
182
  }));
169
183
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
170
184
  }
171
- else if (selectedCorrelationValueDim1 === 'new' &&
172
- selectedCorrelationValueDim2 === 'new') {
185
+ else if (selectedCorrelationIdDim1 === 'new' &&
186
+ selectedCorrelationIdDim2 === 'new') {
173
187
  editedCorrelations.push((0, nmr_correlation_1.buildCorrelation)({
174
188
  atomType: correlationDim1.atomType,
175
189
  link: [buildNewLink2D(link, 'x')],
@@ -203,6 +217,130 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
203
217
  }
204
218
  }
205
219
  }
220
+ else if (action === 'setPathLength') {
221
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim1, link, 'x'));
222
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim2, link, 'y'));
223
+ }
206
224
  return { editedCorrelations, buildCorrelationDataOptions };
207
225
  }
208
226
  exports.getEditedCorrelations = getEditedCorrelations;
227
+ function cloneCorrelationAndSetPathLength(correlation, editedLink, axis) {
228
+ const _correlation = (0, cloneDeep_1.default)(correlation);
229
+ const linkDim = (0, nmr_correlation_1.getLinkDim)(editedLink);
230
+ if (linkDim === 2) {
231
+ const editedLinkID = editedLink.id.split('_')[axis === 'x' ? 0 : 1];
232
+ const _link = _correlation.link.find((link) => link.id === editedLinkID);
233
+ if (_link) {
234
+ const newPathLength = editedLink.signal.j?.pathLength;
235
+ // remove (previous) pathLength if it is same as default
236
+ if ((0, isDefaultPathLength_1.default)(newPathLength, _link.experimentType)) {
237
+ delete _link.signal.j?.pathLength;
238
+ if (_link.signal.j && Object.keys(_link.signal.j).length === 0) {
239
+ delete _link.signal.j;
240
+ }
241
+ delete _link.edited.pathLength;
242
+ }
243
+ else {
244
+ if (!_link.signal.j) {
245
+ _link.signal.j = { pathLength: newPathLength };
246
+ }
247
+ else {
248
+ _link.signal.j.pathLength = newPathLength;
249
+ }
250
+ _link.edited.pathLength = true;
251
+ }
252
+ }
253
+ }
254
+ return _correlation;
255
+ }
256
+ function convertValuesString(valuesString, key) {
257
+ valuesString = valuesString
258
+ .toLowerCase()
259
+ .replace(/\s+/g, '')
260
+ .split(',')
261
+ .map((token) => (token === 'sp' ? 'sp1' : token))
262
+ .join(',');
263
+ valuesString = valuesString.replaceAll('sp', '');
264
+ let values = [];
265
+ const regex = /^(?:[0-9],{0,1})+$/g;
266
+ if (regex.test(valuesString)) {
267
+ // allow digits followed by optional comma only
268
+ values = valuesString
269
+ .split(',')
270
+ .filter((char) => char.length > 0)
271
+ .map((char) => Number(char));
272
+ }
273
+ // allow key specific values only
274
+ // protonsCount: [0, 1, 2, 3, ...], hybridization: [1, 2, 3]
275
+ values = values.filter((value) => value >= (key === 'protonsCount' ? 0 : 1) &&
276
+ (key === 'protonsCount' || value <= 3));
277
+ // unique values
278
+ return values.filter((index, i, a) => a.indexOf(index) === i);
279
+ }
280
+ exports.convertValuesString = convertValuesString;
281
+ function isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation) {
282
+ if (correlation.pseudo === true) {
283
+ return false;
284
+ }
285
+ if (activeSpectrum === null ||
286
+ !correlation.link.some((link) => link.experimentID === activeSpectrum.id)) {
287
+ return false;
288
+ }
289
+ const atomTypesInView = activeTab.split(',').map((tab) => getAtomType(tab));
290
+ const factor = 10000;
291
+ const xDomain0 = xDomain[0] * factor;
292
+ const xDomain1 = xDomain[1] * factor;
293
+ const yDomain0 = yDomain[0] * factor;
294
+ const yDomain1 = yDomain[1] * factor;
295
+ if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
296
+ const firstLink1D = correlation.link.find((link) => (0, nmr_correlation_1.getLinkDim)(link) === 1);
297
+ if (!firstLink1D) {
298
+ return false;
299
+ }
300
+ let delta = (0, nmr_correlation_1.getLinkDelta)(firstLink1D);
301
+ if (delta === undefined) {
302
+ return false;
303
+ }
304
+ delta *= factor;
305
+ const spectrum = (0, FindUtilities_1.findSpectrum)(spectraData, firstLink1D.experimentID, true);
306
+ if (spectrum &&
307
+ atomTypesInView[0] === correlation.atomType &&
308
+ delta >= xDomain0 &&
309
+ delta <= xDomain1) {
310
+ return true;
311
+ }
312
+ // try to find a link which contains the belonging 2D signal in the spectra in view
313
+ if (correlation.link.some((link) => {
314
+ const spectrum = (0, FindUtilities_1.findSpectrum)(spectraData, link.experimentID, true);
315
+ return findSignalMatch1D(spectrum, link, factor, xDomain0, xDomain1);
316
+ })) {
317
+ return true;
318
+ }
319
+ }
320
+ else if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
321
+ if (!atomTypesInView.includes(correlation.atomType)) {
322
+ return false;
323
+ }
324
+ const firstLink2D = correlation.link.find((link) => (0, nmr_correlation_1.getLinkDim)(link) === 2);
325
+ if (!firstLink2D) {
326
+ return false;
327
+ }
328
+ const spectrum = (0, FindUtilities_1.findSpectrum)(spectraData, firstLink2D.experimentID, true);
329
+ // correlation is represented by a 2D signal
330
+ if (findSignalMatch2D(spectrum, firstLink2D, factor, xDomain0, xDomain1, yDomain0, yDomain1)) {
331
+ return true;
332
+ }
333
+ else {
334
+ // try to find a link which contains the belonging 2D signal in the spectra in view
335
+ if (correlation.link.some((link) => {
336
+ const spectrum = (0, FindUtilities_1.findSpectrum)(spectraData, link.experimentID, true);
337
+ return findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0, yDomain1);
338
+ })) {
339
+ return true;
340
+ }
341
+ }
342
+ }
343
+ // do not show correlation
344
+ return false;
345
+ }
346
+ exports.isInView = isInView;
@@ -10,7 +10,10 @@ const SignalsKinds_1 = require("../../../../data/constants/SignalsKinds");
10
10
  const assignment_1 = require("../../../assignment");
11
11
  const DispatchContext_1 = require("../../../context/DispatchContext");
12
12
  const Select_1 = __importDefault(require("../../../elements/Select"));
13
+ const Modal_1 = require("../../../elements/popup/Modal");
14
+ const EditZoneModal_1 = __importDefault(require("../../../modal/editZone/EditZoneModal"));
13
15
  const Types_1 = require("../../../reducer/types/Types");
16
+ const ToolTypes_1 = require("../../../toolbar/ToolTypes");
14
17
  const selectBoxStyle = {
15
18
  marginLeft: 2,
16
19
  marginRight: 2,
@@ -20,6 +23,7 @@ const selectBoxStyle = {
20
23
  function ActionsColumn({ rowData, rowSpanTags }) {
21
24
  const dispatch = (0, DispatchContext_1.useDispatch)();
22
25
  const assignmentData = (0, assignment_1.useAssignmentData)();
26
+ const modal = (0, Modal_1.useModal)();
23
27
  const changeSignalKindHandler = (0, react_1.useCallback)((value) => {
24
28
  dispatch({
25
29
  type: Types_1.CHANGE_ZONE_SIGNAL_KIND,
@@ -54,8 +58,27 @@ function ActionsColumn({ rowData, rowSpanTags }) {
54
58
  : [rowData.y.to - yMargin, rowData.y.from + yMargin],
55
59
  });
56
60
  }, [dispatch, rowData.x.from, rowData.x.to, rowData.y.from, rowData.y.to]);
61
+ const saveEditZoneHandler = (0, react_1.useCallback)((editedRowData) => {
62
+ dispatch({
63
+ type: Types_1.SAVE_EDITED_ZONE,
64
+ payload: {
65
+ editedRowData,
66
+ },
67
+ });
68
+ }, [dispatch]);
69
+ const openEditZoneHandler = (0, react_1.useCallback)(() => {
70
+ dispatch({
71
+ type: Types_1.SET_SELECTED_TOOL,
72
+ payload: { selectedTool: ToolTypes_1.options.editRange.id, tempRange: rowData },
73
+ });
74
+ modal.show((0, jsx_runtime_1.jsx)(EditZoneModal_1.default, { onCloseEditZoneModal: () => modal.close(), onSaveEditZoneModal: saveEditZoneHandler, onZoomEditZoneModal: () => zoomZoneHandler(), rowData: rowData }, void 0), {
75
+ position: Modal_1.positions.MIDDLE_RIGHT,
76
+ transition: Modal_1.transitions.SCALE,
77
+ isBackgroundBlur: false,
78
+ });
79
+ }, [dispatch, modal, rowData, saveEditZoneHandler, zoomZoneHandler]);
57
80
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(Select_1.default, { onChange: (value) => {
58
81
  changeSignalKindHandler(value);
59
- }, data: SignalsKinds_1.SignalKinds, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("td", { ...rowSpanTags, children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zoom-button", onClick: zoomZoneHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, { title: "Zoom to zone in spectrum" }, void 0) }, void 0)] }, void 0)] }, void 0));
82
+ }, data: SignalsKinds_1.SignalKinds, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("td", { ...rowSpanTags, children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "zoom-button", onClick: zoomZoneHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, { title: "Zoom to zone in spectrum" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "edit-button", onClick: openEditZoneHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaEdit, { color: "blue" }, void 0) }, void 0)] }, void 0)] }, void 0));
60
83
  }
61
84
  exports.default = ActionsColumn;
@@ -45,7 +45,7 @@ const style = (0, react_1.css) `
45
45
  align-items: center;
46
46
  }
47
47
  `;
48
- function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
48
+ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment }) {
49
49
  const [filterIsActive, setFilterIsActive] = (0, react_2.useState)(false);
50
50
  const assignmentData = (0, assignment_1.useAssignmentData)();
51
51
  const dispatch = (0, DispatchContext_1.useDispatch)();
@@ -142,14 +142,22 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
142
142
  `,
143
143
  ], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { counter: zones.values ? zones.values.length : 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', filterIsActive: filterIsActive, counterFiltered: tableData?.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: `Remove all Assignments`, popupPlacement: "right", children: (0, jsx_runtime_1.jsx)("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "show/hide zones", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('zones'), children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "show/hide signals", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('signals'), children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "show/hide peaks", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('peaks'), children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }, void 0) }, void 0)] }, void 0)), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler }, void 0)), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)("div", { className: "table-container", children: tableData && tableData.length > 0 ? ((0, jsx_runtime_1.jsx)(ZonesTable_1.default, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
144
144
  ? activeTab.split(',')
145
- : ['?', '?'] }, void 0)) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {}, void 0)) }, void 0)) : ((0, jsx_runtime_1.jsx)(ZonesPreferences_1.default, { ref: settingRef }, void 0)) }, void 0)] }, void 0) }, void 0));
145
+ : ['?', '?'], experiment: experiment }, void 0)) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {}, void 0)) }, void 0)) : ((0, jsx_runtime_1.jsx)(ZonesPreferences_1.default, { ref: settingRef }, void 0)) }, void 0)] }, void 0) }, void 0));
146
146
  }
147
147
  const MemoizedZonesPanel = (0, react_2.memo)(ZonesPanelInner);
148
148
  const emptyData = { zones: {} };
149
149
  function ZonesPanel() {
150
150
  const { displayerKey, xDomain, yDomain, activeTab } = (0, ChartContext_1.useChartData)();
151
- const { zones } = (0, useSpectrum_1.default)(emptyData);
151
+ const { zones, info } = (0, useSpectrum_1.default)(emptyData);
152
152
  const preferences = (0, PreferencesContext_1.usePreferences)();
153
- return ((0, jsx_runtime_1.jsx)(MemoizedZonesPanel, { ...{ xDomain, yDomain, activeTab, displayerKey, preferences, zones } }, void 0));
153
+ return ((0, jsx_runtime_1.jsx)(MemoizedZonesPanel, { ...{
154
+ xDomain,
155
+ yDomain,
156
+ activeTab,
157
+ displayerKey,
158
+ preferences,
159
+ zones,
160
+ experiment: info.experiment,
161
+ } }, void 0));
154
162
  }
155
163
  exports.default = ZonesPanel;
@@ -57,7 +57,7 @@ const tableStyle = (0, react_1.css) `
57
57
  }
58
58
  }
59
59
  `;
60
- function ZonesTable({ tableData, onUnlink, context, nuclei }) {
60
+ function ZonesTable({ tableData, onUnlink, context, nuclei, experiment, }) {
61
61
  const contextRef = (0, react_2.useRef)(null);
62
62
  const contextMenuHandler = (0, react_2.useCallback)((e, rowData) => {
63
63
  if (!(0, checkModifierKeyActivated_1.default)(e)) {
@@ -77,6 +77,8 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
77
77
  rowIndex: i,
78
78
  signalIndex: 0,
79
79
  id: zone.signals[0].id,
80
+ experiment,
81
+ nuclei,
80
82
  },
81
83
  });
82
84
  }
@@ -105,13 +107,14 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
105
107
  rowIndex: i,
106
108
  signalIndex: j,
107
109
  id: signal.id,
110
+ experiment,
108
111
  },
109
112
  });
110
113
  });
111
114
  }
112
115
  });
113
116
  return _data;
114
- }, [tableData]);
117
+ }, [experiment, nuclei, tableData]);
115
118
  const { items: sortedData, isSortedDesc, onSort } = (0, useTableSortBy_1.default)(data);
116
119
  const rows = (0, react_2.useMemo)(() => sortedData.map((rowData, index) => ((0, jsx_runtime_1.jsx)(ZonesTableRow_1.default, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, onContextMenu: (e, rowData) => contextMenuHandler(e, rowData) }, `${rowData.tableMetaInfo.id}`))), [contextMenuHandler, sortedData, onUnlink]);
117
120
  return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("table", { css: tableStyle, children: [(0, jsx_runtime_1.jsxs)("thead", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: "#" }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: "\u03B4 (ppm)" }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: (0, jsx_runtime_1.jsx)(fa_1.FaLink, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: "\u03A3" }, void 0), (0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: "Kind" }, void 0), (0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: '' }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: (0, jsx_runtime_1.jsxs)(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: (0, jsx_runtime_1.jsxs)(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("tbody", { children: rows }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: context }, void 0)] }, void 0));
@@ -37,7 +37,7 @@ const ignoreActions = [
37
37
  types.SET_DIMENSIONS,
38
38
  types.SET_X_DOMAIN,
39
39
  types.SET_Y_DOMAIN,
40
- types.SET_ZOOM_FACTOR,
40
+ types.SET_ZOOM,
41
41
  types.TOGGLE_REAL_IMAGINARY_VISIBILITY,
42
42
  types.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER,
43
43
  types.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE,
@@ -49,6 +49,7 @@ const ignoreActions = [
49
49
  types.CHANGE_PEAKS_MARKERS_VISIBILITY,
50
50
  types.CHANGE_ACTIVE_SPECTRUM,
51
51
  types.CHANGE_SPECTRUM_COLOR,
52
+ types.SET_MOUSE_OVER_DISPLAYER,
52
53
  ];
53
54
  function checkActionType(type) {
54
55
  if (!ignoreActions.includes(type))
@@ -50,7 +50,6 @@ const SpectrumsActions = __importStar(require("./actions/SpectrumsActions"));
50
50
  const ToolsActions = __importStar(require("./actions/ToolsActions"));
51
51
  const ZonesActions = __importStar(require("./actions/ZonesActions"));
52
52
  const Constants_2 = require("./core/Constants");
53
- const Zoom1DManager_1 = require("./helper/Zoom1DManager");
54
53
  const HistoryTypes_1 = require("./types/HistoryTypes");
55
54
  const types = __importStar(require("./types/Types"));
56
55
  exports.initialState = {
@@ -69,6 +68,7 @@ exports.initialState = {
69
68
  yDomains: {},
70
69
  shareYDomain: false,
71
70
  },
71
+ integralsYDomains: {},
72
72
  activeTab: '',
73
73
  width: 0,
74
74
  height: 0,
@@ -101,8 +101,6 @@ exports.initialState = {
101
101
  displayerKey: '',
102
102
  zoom: {
103
103
  history: {},
104
- spectra: {},
105
- integral: {},
106
104
  },
107
105
  overDisplayer: false,
108
106
  toolOptions: {
@@ -126,14 +124,11 @@ function initState(state) {
126
124
  const correlations = (0, nmr_correlation_1.buildCorrelationData)([], {
127
125
  tolerance: Constants_1.DefaultTolerance,
128
126
  });
129
- const spectra = (0, Zoom1DManager_1.initZoom1D)();
130
- const integral = (0, Zoom1DManager_1.initZoom1D)();
131
- const zoom = { spectra, integral, history: {} };
132
127
  return {
133
128
  ...state,
134
129
  correlations,
135
130
  displayerKey,
136
- zoom,
131
+ history: {},
137
132
  };
138
133
  }
139
134
  exports.initState = initState;
@@ -299,7 +294,7 @@ function innerSpectrumReducer(draft, action) {
299
294
  return SpectrumsActions.generateSpectrumFromPublicationStringHandler(draft, action);
300
295
  case types.TOGGLE_REAL_IMAGINARY_VISIBILITY:
301
296
  return ToolsActions.handleToggleRealImaginaryVisibility(draft);
302
- case types.SET_ZOOM_FACTOR:
297
+ case types.SET_ZOOM:
303
298
  return ToolsActions.handleZoom(draft, action);
304
299
  case types.SET_SPECTRA_SAME_TOP:
305
300
  return ToolsActions.setSpectraSameTopHandler(draft);
@@ -393,6 +388,8 @@ function innerSpectrumReducer(draft, action) {
393
388
  return ZonesActions.handleDeleteZone(draft, action);
394
389
  case types.DELETE_2D_SIGNAL:
395
390
  return ZonesActions.handleDeleteSignal(draft, action);
391
+ case types.SET_2D_SIGNAL_PATH_LENGTH:
392
+ return ZonesActions.handleSetSignalPathLength(draft, action);
396
393
  case types.RESET_DOMAIN:
397
394
  return DomainActions.handelResetDomain(draft);
398
395
  case types.CHANGE_ZONE_SIGNAL_VALUE:
@@ -405,6 +402,8 @@ function innerSpectrumReducer(draft, action) {
405
402
  return ZonesActions.handleSetDiaIDZone(draft, action);
406
403
  case types.AUTO_ZONES_SPECTRA_PICKING:
407
404
  return ZonesActions.handleAutoSpectraZonesDetection(draft);
405
+ case types.SAVE_EDITED_ZONE:
406
+ return ZonesActions.handleSaveEditedZone(draft, action);
408
407
  case types.ANALYZE_SPECTRA:
409
408
  return SpectraAnalysisActions.analyzeSpectra(draft, action);
410
409
  case types.DELETE_ANALYZE_SPECTRA_RANGE:
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleRangeResurrecting = void 0;
4
4
  const generateSpectrumFromRanges_1 = require("../../../data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges");
5
+ const Zoom1DManager_1 = require("../helper/Zoom1DManager");
5
6
  const DomainActions_1 = require("./DomainActions");
6
- const Zoom_1 = require("./Zoom");
7
7
  function handleRangeResurrecting(draft, action) {
8
8
  const { ranges, info } = action.payload;
9
9
  const datum = (0, generateSpectrumFromRanges_1.generateSpectrumFromRanges)(ranges, info, draft.usedColors);
10
10
  draft.data.push(datum);
11
11
  (0, DomainActions_1.setDomain)(draft, { yDomain: { isShared: false } });
12
- (0, Zoom_1.setZoom)(draft, { scale: 0.8, spectrumID: datum.id });
12
+ (0, Zoom1DManager_1.setZoom)(draft, { scale: 0.8, spectrumID: datum.id });
13
13
  }
14
14
  exports.handleRangeResurrecting = handleRangeResurrecting;
@@ -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.setMode = exports.setDomain = exports.handelResetDomain = exports.setYDomain = exports.setXDomain = exports.setOriginalDomain = exports.getDomain = void 0;
6
+ exports.setIntegralsYDomain = exports.setMode = exports.setDomain = exports.handelResetDomain = exports.setYDomain = exports.setXDomain = exports.setOriginalDomain = exports.getDomain = void 0;
7
7
  const d3_1 = require("d3");
8
8
  const get1DDataXY_1 = require("../../../data/data1d/Spectrum1D/get1DDataXY");
9
9
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
@@ -157,6 +157,26 @@ function setDomain(draft, options) {
157
157
  }
158
158
  }
159
159
  exports.setDomain = setDomain;
160
+ function getSpectrumIntegralsDomain(datum) {
161
+ const { integrals, ranges } = datum;
162
+ let max = Number.NEGATIVE_INFINITY;
163
+ for (const integral of integrals.values) {
164
+ max = Math.max(max, integral.absolute);
165
+ }
166
+ for (const range of ranges.values) {
167
+ max = Math.max(max, range.absolute);
168
+ }
169
+ return [0, max];
170
+ }
171
+ function setIntegralsYDomain(draft, data) {
172
+ for (const spectrum of Array.isArray(data) ? data : [data]) {
173
+ if (spectrum?.info?.dimension === 1) {
174
+ draft.integralsYDomains[spectrum.id] =
175
+ getSpectrumIntegralsDomain(spectrum);
176
+ }
177
+ }
178
+ }
179
+ exports.setIntegralsYDomain = setIntegralsYDomain;
160
180
  function setOriginalDomain(draft, originDomain) {
161
181
  draft.originDomain = originDomain;
162
182
  }