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
@@ -1,8 +1,11 @@
1
1
  import lodashCloneDeep from 'lodash/cloneDeep';
2
2
  import lodashGet from 'lodash/get';
3
- import { addLink, buildCorrelation, buildLink, getLinkDim, removeLink, } from 'nmr-correlation';
4
- import { findSignal2D } from '../../../data/utilities/FindUtilities';
5
- import { ErrorColors } from './CorrelationTable/Constants';
3
+ import { addLink, buildCorrelation, buildLink, getLinkDelta, getLinkDim, removeLink, } from 'nmr-correlation';
4
+ import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
5
+ import { findSignal2D, findSpectrum, } from '../../../../data/utilities/FindUtilities';
6
+ import isDefaultPathLength from '../../../modal/editZone/validation/isDefaultPathLength';
7
+ import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
8
+ import { ErrorColors } from '../CorrelationTable/Constants';
6
9
  function getAtomType(nucleus) {
7
10
  return nucleus.split(/\d+/)[1];
8
11
  }
@@ -45,27 +48,38 @@ function findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0,
45
48
  return false;
46
49
  }
47
50
  function getAbbreviation(link) {
51
+ let abbreviation = 'X';
48
52
  if (link.experimentType === 'hsqc' || link.experimentType === 'hmqc') {
49
- return !link.signal || link.signal.sign === 0
50
- ? 'S'
51
- : `S${link.signal.sign === 1 ? '+' : '-'}`;
53
+ abbreviation =
54
+ !link.signal || link.signal.sign === 0
55
+ ? 'S'
56
+ : `S${link.signal.sign === 1 ? '+' : '-'}`;
52
57
  }
53
58
  else if (link.experimentType === 'hmbc' ||
54
59
  link.experimentType === 'cosy' ||
55
60
  link.experimentType === 'tocsy') {
56
- return 'M';
61
+ abbreviation = 'M';
57
62
  }
58
63
  else if (link.experimentType === 'noesy' ||
59
64
  link.experimentType === 'roesy') {
60
- return 'NOE';
65
+ abbreviation = 'NOE';
61
66
  }
62
67
  else if (link.experimentType === 'inadequate') {
63
- return 'I';
68
+ abbreviation = 'I';
64
69
  }
65
70
  else if (link.experimentType === 'adequate') {
66
- return 'A';
71
+ abbreviation = 'A';
67
72
  }
68
- return 'X';
73
+ const pathLength = link.signal.j?.pathLength;
74
+ if (pathLength) {
75
+ const isDefaultCorrelation = DefaultPathLengths[link.experimentType] &&
76
+ pathLength.from >= DefaultPathLengths[link.experimentType].from &&
77
+ pathLength.from <= DefaultPathLengths[link.experimentType].to &&
78
+ pathLength.to >= DefaultPathLengths[link.experimentType].from &&
79
+ pathLength.to <= DefaultPathLengths[link.experimentType].to;
80
+ return `${abbreviation}${isDefaultCorrelation ? '' : '*'}`;
81
+ }
82
+ return abbreviation;
69
83
  }
70
84
  function buildNewLink1D(link) {
71
85
  return buildLink({
@@ -101,9 +115,9 @@ function cloneCorrelationAndEditLink(correlation, link, axis, action) {
101
115
  }
102
116
  return _correlation;
103
117
  }
104
- function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationValueDim1, selectedCorrelationValueDim2, action, link, correlations, }) {
105
- const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim1);
106
- const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim2);
118
+ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationIdDim1, selectedCorrelationIdDim2, action, link, correlations, }) {
119
+ const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim1);
120
+ const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim2);
107
121
  const hasChangedDim1 = selectedCorrelationDim1?.id !== correlationDim1.id;
108
122
  const hasChangedDim2 = correlationDim2 && selectedCorrelationDim2?.id !== correlationDim2?.id;
109
123
  const linkDim = getLinkDim(link);
@@ -139,14 +153,14 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
139
153
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
140
154
  }
141
155
  else if (selectedCorrelationDim1 &&
142
- selectedCorrelationValueDim2 === 'new') {
156
+ selectedCorrelationIdDim2 === 'new') {
143
157
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim1 ? selectedCorrelationDim1 : _correlationDim1, link, 'x', 'add'));
144
158
  editedCorrelations.push(buildCorrelation({
145
159
  atomType: correlationDim2.atomType,
146
160
  link: [buildNewLink2D(link, 'y')],
147
161
  }));
148
162
  }
149
- else if (selectedCorrelationValueDim1 === 'new' &&
163
+ else if (selectedCorrelationIdDim1 === 'new' &&
150
164
  selectedCorrelationDim2) {
151
165
  editedCorrelations.push(buildCorrelation({
152
166
  atomType: correlationDim1.atomType,
@@ -154,8 +168,8 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
154
168
  }));
155
169
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
156
170
  }
157
- else if (selectedCorrelationValueDim1 === 'new' &&
158
- selectedCorrelationValueDim2 === 'new') {
171
+ else if (selectedCorrelationIdDim1 === 'new' &&
172
+ selectedCorrelationIdDim2 === 'new') {
159
173
  editedCorrelations.push(buildCorrelation({
160
174
  atomType: correlationDim1.atomType,
161
175
  link: [buildNewLink2D(link, 'x')],
@@ -189,6 +203,128 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
189
203
  }
190
204
  }
191
205
  }
206
+ else if (action === 'setPathLength') {
207
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim1, link, 'x'));
208
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim2, link, 'y'));
209
+ }
192
210
  return { editedCorrelations, buildCorrelationDataOptions };
193
211
  }
194
- export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, };
212
+ function cloneCorrelationAndSetPathLength(correlation, editedLink, axis) {
213
+ const _correlation = lodashCloneDeep(correlation);
214
+ const linkDim = getLinkDim(editedLink);
215
+ if (linkDim === 2) {
216
+ const editedLinkID = editedLink.id.split('_')[axis === 'x' ? 0 : 1];
217
+ const _link = _correlation.link.find((link) => link.id === editedLinkID);
218
+ if (_link) {
219
+ const newPathLength = editedLink.signal.j?.pathLength;
220
+ // remove (previous) pathLength if it is same as default
221
+ if (isDefaultPathLength(newPathLength, _link.experimentType)) {
222
+ delete _link.signal.j?.pathLength;
223
+ if (_link.signal.j && Object.keys(_link.signal.j).length === 0) {
224
+ delete _link.signal.j;
225
+ }
226
+ delete _link.edited.pathLength;
227
+ }
228
+ else {
229
+ if (!_link.signal.j) {
230
+ _link.signal.j = { pathLength: newPathLength };
231
+ }
232
+ else {
233
+ _link.signal.j.pathLength = newPathLength;
234
+ }
235
+ _link.edited.pathLength = true;
236
+ }
237
+ }
238
+ }
239
+ return _correlation;
240
+ }
241
+ function convertValuesString(valuesString, key) {
242
+ valuesString = valuesString
243
+ .toLowerCase()
244
+ .replace(/\s+/g, '')
245
+ .split(',')
246
+ .map((token) => (token === 'sp' ? 'sp1' : token))
247
+ .join(',');
248
+ valuesString = valuesString.replaceAll('sp', '');
249
+ let values = [];
250
+ const regex = /^(?:[0-9],{0,1})+$/g;
251
+ if (regex.test(valuesString)) {
252
+ // allow digits followed by optional comma only
253
+ values = valuesString
254
+ .split(',')
255
+ .filter((char) => char.length > 0)
256
+ .map((char) => Number(char));
257
+ }
258
+ // allow key specific values only
259
+ // protonsCount: [0, 1, 2, 3, ...], hybridization: [1, 2, 3]
260
+ values = values.filter((value) => value >= (key === 'protonsCount' ? 0 : 1) &&
261
+ (key === 'protonsCount' || value <= 3));
262
+ // unique values
263
+ return values.filter((index, i, a) => a.indexOf(index) === i);
264
+ }
265
+ function isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation) {
266
+ if (correlation.pseudo === true) {
267
+ return false;
268
+ }
269
+ if (activeSpectrum === null ||
270
+ !correlation.link.some((link) => link.experimentID === activeSpectrum.id)) {
271
+ return false;
272
+ }
273
+ const atomTypesInView = activeTab.split(',').map((tab) => getAtomType(tab));
274
+ const factor = 10000;
275
+ const xDomain0 = xDomain[0] * factor;
276
+ const xDomain1 = xDomain[1] * factor;
277
+ const yDomain0 = yDomain[0] * factor;
278
+ const yDomain1 = yDomain[1] * factor;
279
+ if (displayerMode === DISPLAYER_MODE.DM_1D) {
280
+ const firstLink1D = correlation.link.find((link) => getLinkDim(link) === 1);
281
+ if (!firstLink1D) {
282
+ return false;
283
+ }
284
+ let delta = getLinkDelta(firstLink1D);
285
+ if (delta === undefined) {
286
+ return false;
287
+ }
288
+ delta *= factor;
289
+ const spectrum = findSpectrum(spectraData, firstLink1D.experimentID, true);
290
+ if (spectrum &&
291
+ atomTypesInView[0] === correlation.atomType &&
292
+ delta >= xDomain0 &&
293
+ delta <= xDomain1) {
294
+ return true;
295
+ }
296
+ // try to find a link which contains the belonging 2D signal in the spectra in view
297
+ if (correlation.link.some((link) => {
298
+ const spectrum = findSpectrum(spectraData, link.experimentID, true);
299
+ return findSignalMatch1D(spectrum, link, factor, xDomain0, xDomain1);
300
+ })) {
301
+ return true;
302
+ }
303
+ }
304
+ else if (displayerMode === DISPLAYER_MODE.DM_2D) {
305
+ if (!atomTypesInView.includes(correlation.atomType)) {
306
+ return false;
307
+ }
308
+ const firstLink2D = correlation.link.find((link) => getLinkDim(link) === 2);
309
+ if (!firstLink2D) {
310
+ return false;
311
+ }
312
+ const spectrum = findSpectrum(spectraData, firstLink2D.experimentID, true);
313
+ // correlation is represented by a 2D signal
314
+ if (findSignalMatch2D(spectrum, firstLink2D, factor, xDomain0, xDomain1, yDomain0, yDomain1)) {
315
+ return true;
316
+ }
317
+ else {
318
+ // try to find a link which contains the belonging 2D signal in the spectra in view
319
+ if (correlation.link.some((link) => {
320
+ const spectrum = findSpectrum(spectraData, link.experimentID, true);
321
+ return findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0, yDomain1);
322
+ })) {
323
+ return true;
324
+ }
325
+ }
326
+ }
327
+ // do not show correlation
328
+ return false;
329
+ }
330
+ export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
@@ -8,6 +8,7 @@ export interface RowDataProps {
8
8
  signal: {
9
9
  kind: any;
10
10
  };
11
+ experiment: string;
11
12
  };
12
13
  x: {
13
14
  from: number;
@@ -1,11 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, useCallback } from 'react';
3
- import { FaRegTrashAlt, FaSearchPlus } from 'react-icons/fa';
3
+ import { FaEdit, FaRegTrashAlt, FaSearchPlus } from 'react-icons/fa';
4
4
  import { SignalKinds } from '../../../../data/constants/SignalsKinds';
5
5
  import { useAssignmentData } from '../../../assignment';
6
6
  import { useDispatch } from '../../../context/DispatchContext';
7
7
  import Select from '../../../elements/Select';
8
- import { CHANGE_ZONE_SIGNAL_KIND, DELETE_2D_ZONE, SET_X_DOMAIN, SET_Y_DOMAIN, } from '../../../reducer/types/Types';
8
+ import { useModal, positions, transitions, } from '../../../elements/popup/Modal';
9
+ import EditZoneModal from '../../../modal/editZone/EditZoneModal';
10
+ import { CHANGE_ZONE_SIGNAL_KIND, DELETE_2D_ZONE, SAVE_EDITED_ZONE, SET_SELECTED_TOOL, SET_X_DOMAIN, SET_Y_DOMAIN, } from '../../../reducer/types/Types';
11
+ import { options } from '../../../toolbar/ToolTypes';
9
12
  const selectBoxStyle = {
10
13
  marginLeft: 2,
11
14
  marginRight: 2,
@@ -15,6 +18,7 @@ const selectBoxStyle = {
15
18
  function ActionsColumn({ rowData, rowSpanTags }) {
16
19
  const dispatch = useDispatch();
17
20
  const assignmentData = useAssignmentData();
21
+ const modal = useModal();
18
22
  const changeSignalKindHandler = useCallback((value) => {
19
23
  dispatch({
20
24
  type: CHANGE_ZONE_SIGNAL_KIND,
@@ -49,8 +53,27 @@ function ActionsColumn({ rowData, rowSpanTags }) {
49
53
  : [rowData.y.to - yMargin, rowData.y.from + yMargin],
50
54
  });
51
55
  }, [dispatch, rowData.x.from, rowData.x.to, rowData.y.from, rowData.y.to]);
56
+ const saveEditZoneHandler = useCallback((editedRowData) => {
57
+ dispatch({
58
+ type: SAVE_EDITED_ZONE,
59
+ payload: {
60
+ editedRowData,
61
+ },
62
+ });
63
+ }, [dispatch]);
64
+ const openEditZoneHandler = useCallback(() => {
65
+ dispatch({
66
+ type: SET_SELECTED_TOOL,
67
+ payload: { selectedTool: options.editRange.id, tempRange: rowData },
68
+ });
69
+ modal.show(_jsx(EditZoneModal, { onCloseEditZoneModal: () => modal.close(), onSaveEditZoneModal: saveEditZoneHandler, onZoomEditZoneModal: () => zoomZoneHandler(), rowData: rowData }, void 0), {
70
+ position: positions.MIDDLE_RIGHT,
71
+ transition: transitions.SCALE,
72
+ isBackgroundBlur: false,
73
+ });
74
+ }, [dispatch, modal, rowData, saveEditZoneHandler, zoomZoneHandler]);
52
75
  return (_jsxs(Fragment, { children: [_jsx("td", { children: _jsx(Select, { onChange: (value) => {
53
76
  changeSignalKindHandler(value);
54
- }, data: SignalKinds, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }, void 0) }, void 0), _jsxs("td", { ...rowSpanTags, children: [_jsx("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: _jsx(FaRegTrashAlt, {}, void 0) }, void 0), _jsx("button", { type: "button", className: "zoom-button", onClick: zoomZoneHandler, children: _jsx(FaSearchPlus, { title: "Zoom to zone in spectrum" }, void 0) }, void 0)] }, void 0)] }, void 0));
77
+ }, data: SignalKinds, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }, void 0) }, void 0), _jsxs("td", { ...rowSpanTags, children: [_jsx("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: _jsx(FaRegTrashAlt, {}, void 0) }, void 0), _jsx("button", { type: "button", className: "zoom-button", onClick: zoomZoneHandler, children: _jsx(FaSearchPlus, { title: "Zoom to zone in spectrum" }, void 0) }, void 0), _jsx("button", { type: "button", className: "edit-button", onClick: openEditZoneHandler, children: _jsx(FaEdit, { color: "blue" }, void 0) }, void 0)] }, void 0)] }, void 0));
55
78
  }
56
79
  export default ActionsColumn;
@@ -40,7 +40,7 @@ const style = css `
40
40
  align-items: center;
41
41
  }
42
42
  `;
43
- function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
43
+ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment }) {
44
44
  const [filterIsActive, setFilterIsActive] = useState(false);
45
45
  const assignmentData = useAssignmentData();
46
46
  const dispatch = useDispatch();
@@ -118,9 +118,6 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
118
118
  }, [assignmentData, dispatch, modal]);
119
119
  const settingsPanelHandler = useCallback(() => {
120
120
  setFlipStatus(!isFlipped);
121
- if (!isFlipped) {
122
- settingRef.current.cancelSetting();
123
- }
124
121
  }, [isFlipped]);
125
122
  const saveSettingHandler = useCallback(() => {
126
123
  settingRef.current.saveSetting();
@@ -140,13 +137,21 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain }) {
140
137
  `,
141
138
  ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { 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: [_jsx(ToolTip, { title: `Remove all Assignments`, popupPlacement: "right", children: _jsx("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: _jsx(FaUnlink, {}, void 0) }, void 0) }, void 0), _jsx(ToggleButton, { popupTitle: "show/hide zones", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('zones'), children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }, void 0) }, void 0), _jsx(ToggleButton, { popupTitle: "show/hide signals", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('signals'), children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }, void 0) }, void 0), _jsx(ToggleButton, { popupTitle: "show/hide peaks", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('peaks'), children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }, void 0) }, void 0)] }, void 0)), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler }, void 0)), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: tableData && tableData.length > 0 ? (_jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
142
139
  ? activeTab.split(',')
143
- : ['?', '?'] }, void 0)) : (_jsx(NoTableData, {}, void 0)) }, void 0)) : (_jsx(ZonesPreferences, { ref: settingRef }, void 0)) }, void 0)] }, void 0) }, void 0));
140
+ : ['?', '?'], experiment: experiment }, void 0)) : (_jsx(NoTableData, {}, void 0)) }, void 0)) : (_jsx(ZonesPreferences, { ref: settingRef }, void 0)) }, void 0)] }, void 0) }, void 0));
144
141
  }
145
142
  const MemoizedZonesPanel = memo(ZonesPanelInner);
146
143
  const emptyData = { zones: {} };
147
144
  export default function ZonesPanel() {
148
145
  const { displayerKey, xDomain, yDomain, activeTab } = useChartData();
149
- const { zones } = useSpectrum(emptyData);
146
+ const { zones, info } = useSpectrum(emptyData);
150
147
  const preferences = usePreferences();
151
- return (_jsx(MemoizedZonesPanel, { ...{ xDomain, yDomain, activeTab, displayerKey, preferences, zones } }, void 0));
148
+ return (_jsx(MemoizedZonesPanel, { ...{
149
+ xDomain,
150
+ yDomain,
151
+ activeTab,
152
+ displayerKey,
153
+ preferences,
154
+ zones,
155
+ experiment: info.experiment,
156
+ } }, void 0));
152
157
  }
@@ -7,7 +7,7 @@ import FormikForm from '../../elements/formik/FormikForm';
7
7
  import { useAlert } from '../../elements/popup/Alert';
8
8
  import useNucleus from '../../hooks/useNucleus';
9
9
  import { SET_PANELS_PREFERENCES } from '../../reducer/preferencesReducer';
10
- import { useStateWithLocalStorage, getValue as getValueByKeyPath, } from '../../utility/LocalStorage';
10
+ import { getValue as getValueByKeyPath } from '../../utility/LocalStorage';
11
11
  import { zoneDefaultValues } from '../extra/preferences/defaultValues';
12
12
  const styles = {
13
13
  container: {
@@ -71,7 +71,6 @@ const formatFields = [
71
71
  ];
72
72
  function ZonesPreferencesInner({ nucleus, innerRef, }) {
73
73
  const alert = useAlert();
74
- const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
75
74
  const preferences = usePreferences();
76
75
  const formRef = useRef();
77
76
  const updateValues = useCallback(() => {
@@ -87,31 +86,19 @@ function ZonesPreferencesInner({ nucleus, innerRef, }) {
87
86
  useEffect(() => {
88
87
  updateValues();
89
88
  }, [updateValues]);
90
- const saveToLocalStorgate = (values) => {
91
- setSettingsData(values, 'formatting.panels.ranges');
92
- };
93
- const saveHandler = useCallback((values, showMessage = false) => {
89
+ const saveHandler = useCallback((values) => {
94
90
  preferences.dispatch({
95
91
  type: SET_PANELS_PREFERENCES,
96
92
  payload: { key: 'zones', value: values },
97
93
  });
98
- if (showMessage) {
99
- alert.success('zones preferences saved successfully');
100
- }
94
+ alert.success('zones preferences saved successfully');
101
95
  }, [alert, preferences]);
102
96
  useImperativeHandle(innerRef, () => ({
103
97
  saveSetting: () => {
104
98
  formRef.current.submitForm();
105
99
  },
106
- cancelSetting: () => {
107
- updateValues();
108
- },
109
- }), [updateValues]);
110
- const handleSubmit = (values) => {
111
- saveHandler(values, true);
112
- saveToLocalStorgate(values);
113
- };
114
- return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: handleSubmit, ref: formRef, children: nucleus?.map((nucleusLabel) => (_jsxs("div", { style: styles.groupContainer, children: [_jsx(IsotopesViewer, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => (_jsx(FormikColumnFormatField, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
100
+ }), []);
101
+ return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => (_jsxs("div", { style: styles.groupContainer, children: [_jsx(IsotopesViewer, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => (_jsx(FormikColumnFormatField, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
115
102
  }
116
103
  const MemoizedZonesPreferences = memo(ZonesPreferencesInner);
117
104
  // TODO: remove this hacky use of ref.
@@ -8,7 +8,8 @@ interface ZonesTableProps {
8
8
  }>;
9
9
  onUnlink: (zoneData: any, isOnZoneLevel: any, signalIndex: any, axis: any) => void;
10
10
  context?: any;
11
- nuclei: any;
11
+ nuclei: string[];
12
+ experiment: string;
12
13
  }
13
- declare function ZonesTable({ tableData, onUnlink, context, nuclei }: ZonesTableProps): import("@emotion/react/jsx-runtime").JSX.Element;
14
+ declare function ZonesTable({ tableData, onUnlink, context, nuclei, experiment, }: ZonesTableProps): import("@emotion/react/jsx-runtime").JSX.Element;
14
15
  export default ZonesTable;
@@ -52,7 +52,7 @@ const tableStyle = css `
52
52
  }
53
53
  }
54
54
  `;
55
- function ZonesTable({ tableData, onUnlink, context, nuclei }) {
55
+ function ZonesTable({ tableData, onUnlink, context, nuclei, experiment, }) {
56
56
  const contextRef = useRef(null);
57
57
  const contextMenuHandler = useCallback((e, rowData) => {
58
58
  if (!checkModifierKeyActivated(e)) {
@@ -72,6 +72,8 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
72
72
  rowIndex: i,
73
73
  signalIndex: 0,
74
74
  id: zone.signals[0].id,
75
+ experiment,
76
+ nuclei,
75
77
  },
76
78
  });
77
79
  }
@@ -100,13 +102,14 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
100
102
  rowIndex: i,
101
103
  signalIndex: j,
102
104
  id: signal.id,
105
+ experiment,
103
106
  },
104
107
  });
105
108
  });
106
109
  }
107
110
  });
108
111
  return _data;
109
- }, [tableData]);
112
+ }, [experiment, nuclei, tableData]);
110
113
  const { items: sortedData, isSortedDesc, onSort } = useTableSortBy(data);
111
114
  const rows = useMemo(() => sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, onContextMenu: (e, rowData) => contextMenuHandler(e, rowData) }, `${rowData.tableMetaInfo.id}`))), [contextMenuHandler, sortedData, onUnlink]);
112
115
  return (_jsxs("div", { children: [_jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [_jsx("th", { rowSpan: 2, children: "#" }, void 0), _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }, void 0), _jsx("th", { colSpan: 2, children: _jsx(FaLink, {}, void 0) }, void 0), _jsx("th", { colSpan: 2, children: "\u03A3" }, void 0), _jsx("th", { rowSpan: 2, children: "Kind" }, void 0), _jsx("th", { rowSpan: 2, children: '' }, void 0)] }, void 0), _jsxs("tr", { children: [_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }, void 0) }, void 0), _jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx("tbody", { children: rows }, void 0)] }, void 0), _jsx(ContextMenu, { ref: contextRef, context: context }, void 0)] }, void 0));
@@ -61,9 +61,6 @@ function DatabasePanelInner({ nucleus, selectedTool }) {
61
61
  const { item } = useAccordionContext('Database');
62
62
  const settingsPanelHandler = useCallback(() => {
63
63
  setFlipStatus(!isFlipped);
64
- if (!isFlipped) {
65
- settingRef.current.cancelSetting();
66
- }
67
64
  }, [isFlipped]);
68
65
  const saveSettingHandler = useCallback(() => {
69
66
  settingRef.current.saveSetting();
@@ -5,7 +5,7 @@ import FormikColumnFormatField from '../../elements/formik/FormikColumnFormatFie
5
5
  import FormikForm from '../../elements/formik/FormikForm';
6
6
  import { useAlert } from '../../elements/popup/Alert';
7
7
  import { SET_PANELS_PREFERENCES } from '../../reducer/preferencesReducer';
8
- import { useStateWithLocalStorage, getValue as getValueByKeyPath, } from '../../utility/LocalStorage';
8
+ import { getValue as getValueByKeyPath } from '../../utility/LocalStorage';
9
9
  import { databaseDefaultValues } from '../extra/preferences/defaultValues';
10
10
  const styles = {
11
11
  container: {
@@ -43,7 +43,6 @@ const styles = {
43
43
  function DatabasePreferences(props, ref) {
44
44
  const preferences = usePreferences();
45
45
  const alert = useAlert();
46
- const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
47
46
  const formRef = useRef();
48
47
  const updateValues = useCallback(() => {
49
48
  const databasePreferences = getValueByKeyPath(preferences, `formatting.panels.database`);
@@ -52,30 +51,18 @@ function DatabasePreferences(props, ref) {
52
51
  useEffect(() => {
53
52
  updateValues();
54
53
  }, [updateValues]);
55
- const saveToLocalStorage = (values) => {
56
- setSettingsData(values, 'formatting.panels.database');
57
- };
58
- const saveHandler = useCallback((values, showMessage = false) => {
54
+ const saveHandler = useCallback((values) => {
59
55
  preferences.dispatch({
60
56
  type: SET_PANELS_PREFERENCES,
61
57
  payload: { key: 'database', value: values },
62
58
  });
63
- if (showMessage) {
64
- alert.success('database preferences saved successfully');
65
- }
59
+ alert.success('database preferences saved successfully');
66
60
  }, [alert, preferences]);
67
61
  useImperativeHandle(ref, () => ({
68
62
  saveSetting: () => {
69
63
  formRef.current.submitForm();
70
64
  },
71
- cancelSetting: () => {
72
- updateValues();
73
- },
74
65
  }));
75
- const handleSubmit = (values) => {
76
- saveHandler(values, true);
77
- saveToLocalStorage(values);
78
- };
79
- return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: handleSubmit, ref: formRef, children: _jsxs("div", { style: styles.groupContainer, children: [_jsx(FormikColumnFormatField, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
66
+ return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: saveHandler, ref: formRef, children: _jsxs("div", { style: styles.groupContainer, children: [_jsx(FormikColumnFormatField, { label: "Smiles", checkControllerName: "showSmiles", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "showRange", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "showDelta", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "showCoupling", hideFormat: true }, void 0), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormat: true }, void 0)] }, void 0) }, void 0) }, void 0));
80
67
  }
81
68
  export default forwardRef(DatabasePreferences);
@@ -16,7 +16,7 @@ const ignoreActions = [
16
16
  types.SET_DIMENSIONS,
17
17
  types.SET_X_DOMAIN,
18
18
  types.SET_Y_DOMAIN,
19
- types.SET_ZOOM_FACTOR,
19
+ types.SET_ZOOM,
20
20
  types.TOGGLE_REAL_IMAGINARY_VISIBILITY,
21
21
  types.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER,
22
22
  types.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE,
@@ -28,6 +28,7 @@ const ignoreActions = [
28
28
  types.CHANGE_PEAKS_MARKERS_VISIBILITY,
29
29
  types.CHANGE_ACTIVE_SPECTRUM,
30
30
  types.CHANGE_SPECTRUM_COLOR,
31
+ types.SET_MOUSE_OVER_DISPLAYER,
31
32
  ];
32
33
  function checkActionType(type) {
33
34
  if (!ignoreActions.includes(type))