nmrium 0.20.1 → 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 (238) 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/EventsTrackers/KeysListenerTracker.js +98 -81
  9. package/lib/component/NMRium.d.ts +9 -2
  10. package/lib/component/NMRium.js +9 -9
  11. package/lib/component/elements/EditableColumn.d.ts +1 -1
  12. package/lib/component/elements/NumberInput.d.ts +1 -2
  13. package/lib/component/elements/Tab/Tab.js +1 -0
  14. package/lib/component/header/Header.js +13 -10
  15. package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
  16. package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
  17. package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
  18. package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
  19. package/lib/component/hooks/useIntegralPath.js +53 -0
  20. package/lib/component/hooks/useToolsFunctions.js +6 -6
  21. package/lib/component/hooks/useXScale.d.ts +2 -0
  22. package/lib/component/hooks/useXScale.js +7 -0
  23. package/lib/component/loader/DropZone.js +88 -88
  24. package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
  25. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  26. package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
  27. package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
  28. package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
  29. package/lib/component/modal/editZone/EditZoneModal.js +96 -0
  30. package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
  31. package/lib/component/modal/editZone/SignalFormTab.js +6 -0
  32. package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
  33. package/lib/component/modal/editZone/SignalsForm.js +62 -0
  34. package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
  35. package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
  36. package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
  37. package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
  38. package/lib/component/modal/setting/ControllersTabContent.js +1 -1
  39. package/lib/component/modal/setting/DisplayTabContent.js +1 -1
  40. package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
  41. package/lib/component/modal/setting/GeneralSettings.js +13 -9
  42. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
  43. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
  44. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
  45. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
  46. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  47. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
  48. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  49. package/lib/component/panels/Panels.d.ts +1 -1
  50. package/lib/component/panels/Panels.js +10 -14
  51. package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  52. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
  53. package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
  54. package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
  55. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  56. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  57. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  58. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
  59. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
  60. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
  61. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  62. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
  63. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  64. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
  65. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
  66. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
  67. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +6 -6
  68. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  69. package/lib/component/panels/SummaryPanel/SummaryPanel.js +40 -43
  70. package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
  71. package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
  72. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
  73. package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
  74. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
  75. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
  76. package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
  77. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
  78. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
  79. package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
  80. package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
  81. package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
  82. package/lib/component/reducer/IgnoreActions.js +2 -1
  83. package/lib/component/reducer/Reducer.d.ts +20 -34
  84. package/lib/component/reducer/Reducer.js +7 -8
  85. package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
  86. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  87. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  88. package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
  89. package/lib/component/reducer/actions/DomainActions.js +20 -1
  90. package/lib/component/reducer/actions/IntegralsActions.js +2 -0
  91. package/lib/component/reducer/actions/LoadActions.js +22 -1
  92. package/lib/component/reducer/actions/PreferencesActions.js +0 -2
  93. package/lib/component/reducer/actions/RangesActions.js +3 -1
  94. package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
  95. package/lib/component/reducer/actions/ToolsActions.js +43 -56
  96. package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
  97. package/lib/component/reducer/actions/ZonesActions.js +33 -2
  98. package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
  99. package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
  100. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
  101. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
  102. package/lib/component/reducer/preferencesReducer.d.ts +3 -8
  103. package/lib/component/reducer/preferencesReducer.js +87 -37
  104. package/lib/component/reducer/types/Types.d.ts +3 -1
  105. package/lib/component/reducer/types/Types.js +3 -1
  106. package/lib/component/toolbar/FunctionToolBar.js +7 -10
  107. package/lib/component/toolbar/ToolTypes.js +3 -3
  108. package/lib/component/workspaces/Workspace.d.ts +6 -0
  109. package/lib/component/workspaces/Workspace.js +1 -0
  110. package/lib/component/workspaces/basic.d.ts +2 -0
  111. package/lib/component/workspaces/basic.js +45 -0
  112. package/lib/component/workspaces/exercise1D.d.ts +2 -0
  113. package/lib/component/workspaces/exercise1D.js +45 -0
  114. package/lib/component/workspaces/index.d.ts +6 -0
  115. package/lib/component/workspaces/index.js +4 -0
  116. package/lib/component/workspaces/process1D.d.ts +2 -0
  117. package/lib/component/workspaces/process1D.js +43 -0
  118. package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
  119. package/lib/data/constants/DefaultPathLengths.js +8 -0
  120. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
  121. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
  122. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  123. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
  124. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
  125. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  126. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
  127. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
  128. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
  129. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
  130. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
  131. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
  132. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  133. package/lib/data/migration/MigrationManager.js +3 -0
  134. package/lib/versionInfo.js +1 -1
  135. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  136. package/lib-cjs/component/1d/Integral.js +1 -6
  137. package/lib-cjs/component/1d/Viewer1D.js +4 -4
  138. package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
  139. package/lib-cjs/component/1d/utilities/scale.js +7 -6
  140. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  141. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
  142. package/lib-cjs/component/NMRium.js +10 -10
  143. package/lib-cjs/component/elements/Tab/Tab.js +1 -0
  144. package/lib-cjs/component/header/Header.js +13 -10
  145. package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
  146. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
  147. package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
  148. package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
  149. package/lib-cjs/component/hooks/useXScale.js +11 -0
  150. package/lib-cjs/component/loader/DropZone.js +88 -88
  151. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
  152. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  153. package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
  154. package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
  155. package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
  156. package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
  157. package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
  158. package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
  159. package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
  160. package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
  161. package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
  162. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
  163. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
  164. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  165. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
  166. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  167. package/lib-cjs/component/panels/Panels.js +11 -15
  168. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  169. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
  170. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
  171. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
  172. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  173. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  174. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  175. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
  176. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  177. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  178. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
  179. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
  180. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  181. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
  182. package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
  183. package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
  184. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
  185. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
  186. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
  187. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
  188. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
  189. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
  190. package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
  191. package/lib-cjs/component/reducer/Reducer.js +7 -8
  192. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
  193. package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
  194. package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
  195. package/lib-cjs/component/reducer/actions/LoadActions.js +22 -1
  196. package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
  197. package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
  198. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
  199. package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
  200. package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
  201. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
  202. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
  203. package/lib-cjs/component/reducer/preferencesReducer.js +87 -37
  204. package/lib-cjs/component/reducer/types/Types.js +6 -4
  205. package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
  206. package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
  207. package/lib-cjs/component/workspaces/Workspace.js +2 -0
  208. package/lib-cjs/component/workspaces/basic.js +48 -0
  209. package/lib-cjs/component/workspaces/exercise1D.js +48 -0
  210. package/lib-cjs/component/workspaces/index.js +6 -0
  211. package/lib-cjs/component/workspaces/process1D.js +46 -0
  212. package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
  213. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
  214. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  215. package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
  216. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  217. package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
  218. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
  219. package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
  220. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  221. package/lib-cjs/data/migration/MigrationManager.js +3 -0
  222. package/lib-cjs/versionInfo.js +1 -1
  223. package/package.json +15 -16
  224. package/lib/component/1d/utilities/useIntegralPath.js +0 -63
  225. package/lib/component/nmriumMode/basic.d.ts +0 -38
  226. package/lib/component/nmriumMode/basic.js +0 -37
  227. package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
  228. package/lib/component/nmriumMode/exercise1D.js +0 -37
  229. package/lib/component/nmriumMode/process1D.d.ts +0 -38
  230. package/lib/component/nmriumMode/process1D.js +0 -37
  231. package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
  232. package/lib/component/reducer/actions/Zoom.d.ts +0 -16
  233. package/lib/component/reducer/actions/Zoom.js +0 -92
  234. package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
  235. package/lib-cjs/component/nmriumMode/basic.js +0 -39
  236. package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
  237. package/lib-cjs/component/nmriumMode/process1D.js +0 -39
  238. package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
@@ -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)();
@@ -123,9 +123,6 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
123
123
  }, [assignmentData, dispatch, modal]);
124
124
  const settingsPanelHandler = (0, react_2.useCallback)(() => {
125
125
  setFlipStatus(!isFlipped);
126
- if (!isFlipped) {
127
- settingRef.current.cancelSetting();
128
- }
129
126
  }, [isFlipped]);
130
127
  const saveSettingHandler = (0, react_2.useCallback)(() => {
131
128
  settingRef.current.saveSetting();
@@ -145,14 +142,22 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
145
142
  `,
146
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
147
144
  ? activeTab.split(',')
148
- : ['?', '?'] }, 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));
149
146
  }
150
147
  const MemoizedZonesPanel = (0, react_2.memo)(ZonesPanelInner);
151
148
  const emptyData = { zones: {} };
152
149
  function ZonesPanel() {
153
150
  const { displayerKey, xDomain, yDomain, activeTab } = (0, ChartContext_1.useChartData)();
154
- const { zones } = (0, useSpectrum_1.default)(emptyData);
151
+ const { zones, info } = (0, useSpectrum_1.default)(emptyData);
155
152
  const preferences = (0, PreferencesContext_1.usePreferences)();
156
- 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));
157
162
  }
158
163
  exports.default = ZonesPanel;
@@ -76,7 +76,6 @@ const formatFields = [
76
76
  ];
77
77
  function ZonesPreferencesInner({ nucleus, innerRef, }) {
78
78
  const alert = (0, Alert_1.useAlert)();
79
- const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
80
79
  const preferences = (0, PreferencesContext_1.usePreferences)();
81
80
  const formRef = (0, react_1.useRef)();
82
81
  const updateValues = (0, react_1.useCallback)(() => {
@@ -92,31 +91,19 @@ function ZonesPreferencesInner({ nucleus, innerRef, }) {
92
91
  (0, react_1.useEffect)(() => {
93
92
  updateValues();
94
93
  }, [updateValues]);
95
- const saveToLocalStorgate = (values) => {
96
- setSettingsData(values, 'formatting.panels.ranges');
97
- };
98
- const saveHandler = (0, react_1.useCallback)((values, showMessage = false) => {
94
+ const saveHandler = (0, react_1.useCallback)((values) => {
99
95
  preferences.dispatch({
100
96
  type: preferencesReducer_1.SET_PANELS_PREFERENCES,
101
97
  payload: { key: 'zones', value: values },
102
98
  });
103
- if (showMessage) {
104
- alert.success('zones preferences saved successfully');
105
- }
99
+ alert.success('zones preferences saved successfully');
106
100
  }, [alert, preferences]);
107
101
  (0, react_1.useImperativeHandle)(innerRef, () => ({
108
102
  saveSetting: () => {
109
103
  formRef.current.submitForm();
110
104
  },
111
- cancelSetting: () => {
112
- updateValues();
113
- },
114
- }), [updateValues]);
115
- const handleSubmit = (values) => {
116
- saveHandler(values, true);
117
- saveToLocalStorgate(values);
118
- };
119
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: handleSubmit, ref: formRef, children: nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
105
+ }), []);
106
+ return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
120
107
  }
121
108
  const MemoizedZonesPreferences = (0, react_1.memo)(ZonesPreferencesInner);
122
109
  // TODO: remove this hacky use of ref.
@@ -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));
@@ -66,9 +66,6 @@ function DatabasePanelInner({ nucleus, selectedTool }) {
66
66
  const { item } = (0, analysis_ui_components_1.useAccordionContext)('Database');
67
67
  const settingsPanelHandler = (0, react_2.useCallback)(() => {
68
68
  setFlipStatus(!isFlipped);
69
- if (!isFlipped) {
70
- settingRef.current.cancelSetting();
71
- }
72
69
  }, [isFlipped]);
73
70
  const saveSettingHandler = (0, react_2.useCallback)(() => {
74
71
  settingRef.current.saveSetting();
@@ -48,7 +48,6 @@ const styles = {
48
48
  function DatabasePreferences(props, ref) {
49
49
  const preferences = (0, PreferencesContext_1.usePreferences)();
50
50
  const alert = (0, Alert_1.useAlert)();
51
- const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
52
51
  const formRef = (0, react_1.useRef)();
53
52
  const updateValues = (0, react_1.useCallback)(() => {
54
53
  const databasePreferences = (0, LocalStorage_1.getValue)(preferences, `formatting.panels.database`);
@@ -57,30 +56,18 @@ function DatabasePreferences(props, ref) {
57
56
  (0, react_1.useEffect)(() => {
58
57
  updateValues();
59
58
  }, [updateValues]);
60
- const saveToLocalStorage = (values) => {
61
- setSettingsData(values, 'formatting.panels.database');
62
- };
63
- const saveHandler = (0, react_1.useCallback)((values, showMessage = false) => {
59
+ const saveHandler = (0, react_1.useCallback)((values) => {
64
60
  preferences.dispatch({
65
61
  type: preferencesReducer_1.SET_PANELS_PREFERENCES,
66
62
  payload: { key: 'database', value: values },
67
63
  });
68
- if (showMessage) {
69
- alert.success('database preferences saved successfully');
70
- }
64
+ alert.success('database preferences saved successfully');
71
65
  }, [alert, preferences]);
72
66
  (0, react_1.useImperativeHandle)(ref, () => ({
73
67
  saveSetting: () => {
74
68
  formRef.current.submitForm();
75
69
  },
76
- cancelSetting: () => {
77
- updateValues();
78
- },
79
70
  }));
80
- const handleSubmit = (values) => {
81
- saveHandler(values, true);
82
- saveToLocalStorage(values);
83
- };
84
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: handleSubmit, ref: formRef, children: (0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
71
+ return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: (0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), (0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
85
72
  }
86
73
  exports.default = (0, react_1.forwardRef)(DatabasePreferences);
@@ -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
  }
@@ -10,6 +10,7 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
10
10
  const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
11
11
  const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
12
12
  const getRange_1 = __importDefault(require("../helper/getRange"));
13
+ const DomainActions_1 = require("./DomainActions");
13
14
  function handleChangeIntegralSum(draft, options) {
14
15
  const { data, activeSpectrum, activeTab: nucleus } = draft;
15
16
  if (activeSpectrum?.id) {
@@ -43,6 +44,7 @@ function addIntegral(draft, action) {
43
44
  nucleus,
44
45
  });
45
46
  (0, Spectrum1D_1.updateIntegralsRelativeValues)(datum);
47
+ (0, DomainActions_1.setIntegralsYDomain)(draft, datum);
46
48
  }
47
49
  }
48
50
  exports.addIntegral = addIntegral;