nmrium 0.20.2 → 0.23.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 (253) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  2. package/lib/component/1d/FooterBanner.js +1 -1
  3. package/lib/component/1d/Integral.js +1 -6
  4. package/lib/component/1d/Viewer1D.js +4 -4
  5. package/lib/component/1d/ranges/RangeIntegral.js +2 -6
  6. package/lib/component/1d/utilities/scale.d.ts +1 -1
  7. package/lib/component/1d/utilities/scale.js +7 -6
  8. package/lib/component/2d/Viewer2D.js +5 -5
  9. package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
  10. package/lib/component/NMRium.d.ts +10 -6
  11. package/lib/component/NMRium.js +3 -9
  12. package/lib/component/elements/EditableColumn.d.ts +1 -1
  13. package/lib/component/header/Header.js +13 -10
  14. package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
  15. package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
  16. package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
  17. package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
  18. package/lib/component/hooks/useIntegralPath.js +53 -0
  19. package/lib/component/hooks/useToolsFunctions.js +6 -6
  20. package/lib/component/hooks/useXScale.d.ts +2 -0
  21. package/lib/component/hooks/useXScale.js +7 -0
  22. package/lib/component/loader/DropZone.js +87 -87
  23. package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
  24. package/lib/component/modal/PredictSpectraModal.js +2 -32
  25. package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
  26. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  27. package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
  28. package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
  29. package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
  30. package/lib/component/modal/editZone/EditZoneModal.js +96 -0
  31. package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
  32. package/lib/component/modal/editZone/SignalFormTab.js +6 -0
  33. package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
  34. package/lib/component/modal/editZone/SignalsForm.js +62 -0
  35. package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
  36. package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
  37. package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
  38. package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
  39. package/lib/component/modal/setting/ControllersTabContent.js +1 -1
  40. package/lib/component/modal/setting/DisplayTabContent.js +5 -1
  41. package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
  42. package/lib/component/modal/setting/GeneralSettings.js +13 -9
  43. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
  44. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
  45. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
  46. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
  47. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  48. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
  49. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
  50. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
  51. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
  52. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
  53. package/lib/component/panels/Panels.d.ts +1 -1
  54. package/lib/component/panels/Panels.js +17 -14
  55. package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  56. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
  57. package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
  58. package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
  59. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  60. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  61. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  62. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
  63. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
  64. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
  65. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  66. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
  67. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  68. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
  69. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
  70. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
  71. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
  72. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  73. package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
  74. package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
  75. package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
  76. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
  77. package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
  78. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
  79. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
  80. package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
  81. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
  82. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
  83. package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
  84. package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
  85. package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
  86. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
  87. package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
  88. package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
  89. package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
  90. package/lib/component/reducer/IgnoreActions.js +2 -1
  91. package/lib/component/reducer/Reducer.d.ts +9 -23
  92. package/lib/component/reducer/Reducer.js +7 -8
  93. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  94. package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
  95. package/lib/component/reducer/actions/DomainActions.js +20 -1
  96. package/lib/component/reducer/actions/IntegralsActions.js +2 -0
  97. package/lib/component/reducer/actions/LoadActions.js +29 -1
  98. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  99. package/lib/component/reducer/actions/PreferencesActions.js +0 -2
  100. package/lib/component/reducer/actions/RangesActions.js +3 -1
  101. package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
  102. package/lib/component/reducer/actions/ToolsActions.js +43 -56
  103. package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
  104. package/lib/component/reducer/actions/ZonesActions.js +33 -2
  105. package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
  106. package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
  107. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
  108. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
  109. package/lib/component/reducer/preferencesReducer.d.ts +3 -8
  110. package/lib/component/reducer/preferencesReducer.js +86 -37
  111. package/lib/component/reducer/types/Types.d.ts +3 -1
  112. package/lib/component/reducer/types/Types.js +3 -1
  113. package/lib/component/toolbar/FunctionToolBar.js +7 -10
  114. package/lib/component/toolbar/ToolTypes.js +3 -3
  115. package/lib/component/workspaces/Workspace.d.ts +6 -0
  116. package/lib/component/workspaces/Workspace.js +1 -0
  117. package/lib/component/workspaces/basic.d.ts +2 -0
  118. package/lib/component/workspaces/basic.js +46 -0
  119. package/lib/component/workspaces/exercise1D.d.ts +2 -0
  120. package/lib/component/workspaces/exercise1D.js +46 -0
  121. package/lib/component/workspaces/index.d.ts +6 -0
  122. package/lib/component/workspaces/index.js +4 -0
  123. package/lib/component/workspaces/process1D.d.ts +2 -0
  124. package/lib/component/workspaces/process1D.js +44 -0
  125. package/lib/data/PredictionManager.d.ts +35 -3
  126. package/lib/data/PredictionManager.js +45 -7
  127. package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
  128. package/lib/data/constants/DefaultPathLengths.js +8 -0
  129. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
  130. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
  131. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  132. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
  133. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
  134. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  135. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
  136. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
  137. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
  138. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
  139. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
  140. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
  141. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  142. package/lib/data/migration/MigrationManager.js +3 -0
  143. package/lib/versionInfo.js +1 -1
  144. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  145. package/lib-cjs/component/1d/FooterBanner.js +1 -1
  146. package/lib-cjs/component/1d/Integral.js +1 -6
  147. package/lib-cjs/component/1d/Viewer1D.js +4 -4
  148. package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
  149. package/lib-cjs/component/1d/utilities/scale.js +7 -6
  150. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  151. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
  152. package/lib-cjs/component/NMRium.js +3 -10
  153. package/lib-cjs/component/header/Header.js +13 -10
  154. package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
  155. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
  156. package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
  157. package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
  158. package/lib-cjs/component/hooks/useXScale.js +11 -0
  159. package/lib-cjs/component/loader/DropZone.js +87 -87
  160. package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
  161. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
  162. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  163. package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
  164. package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
  165. package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
  166. package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
  167. package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
  168. package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
  169. package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
  170. package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -1
  171. package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
  172. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
  173. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
  174. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  175. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
  176. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
  177. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
  178. package/lib-cjs/component/panels/Panels.js +18 -15
  179. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  180. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
  181. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
  182. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
  183. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  184. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  185. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  186. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
  187. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  188. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  189. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
  190. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
  191. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  192. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
  193. package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
  194. package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
  195. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
  196. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
  197. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
  198. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
  199. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
  200. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
  201. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
  202. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
  203. package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
  204. package/lib-cjs/component/reducer/Reducer.js +7 -8
  205. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
  206. package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
  207. package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
  208. package/lib-cjs/component/reducer/actions/LoadActions.js +29 -1
  209. package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
  210. package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
  211. package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
  212. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
  213. package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
  214. package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
  215. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
  216. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
  217. package/lib-cjs/component/reducer/preferencesReducer.js +87 -38
  218. package/lib-cjs/component/reducer/types/Types.js +6 -4
  219. package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
  220. package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
  221. package/lib-cjs/component/workspaces/Workspace.js +2 -0
  222. package/lib-cjs/component/workspaces/basic.js +49 -0
  223. package/lib-cjs/component/workspaces/exercise1D.js +49 -0
  224. package/lib-cjs/component/workspaces/index.js +6 -0
  225. package/lib-cjs/component/workspaces/process1D.js +47 -0
  226. package/lib-cjs/data/PredictionManager.js +46 -8
  227. package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
  228. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
  229. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  230. package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
  231. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  232. package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
  233. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
  234. package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
  235. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  236. package/lib-cjs/data/migration/MigrationManager.js +3 -0
  237. package/lib-cjs/versionInfo.js +1 -1
  238. package/package.json +1 -1
  239. package/lib/component/1d/utilities/useIntegralPath.js +0 -63
  240. package/lib/component/nmriumMode/basic.d.ts +0 -38
  241. package/lib/component/nmriumMode/basic.js +0 -37
  242. package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
  243. package/lib/component/nmriumMode/exercise1D.js +0 -37
  244. package/lib/component/nmriumMode/process1D.d.ts +0 -38
  245. package/lib/component/nmriumMode/process1D.js +0 -37
  246. package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
  247. package/lib/component/reducer/actions/Zoom.d.ts +0 -16
  248. package/lib/component/reducer/actions/Zoom.js +0 -92
  249. package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
  250. package/lib-cjs/component/nmriumMode/basic.js +0 -39
  251. package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
  252. package/lib-cjs/component/nmriumMode/process1D.js +0 -39
  253. package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
@@ -12,13 +12,13 @@ import Select from '../../elements/Select';
12
12
  import ToolTip from '../../elements/ToolTip/ToolTip';
13
13
  import { useModal } from '../../elements/popup/Modal';
14
14
  import { DISPLAYER_MODE } from '../../reducer/core/Constants';
15
- import { DELETE_1D_SIGNAL, DELETE_2D_SIGNAL, DELETE_CORRELATION, SET_CORRELATION, SET_CORRELATIONS, SET_CORRELATIONS_MF, SET_CORRELATIONS_TOLERANCE, } from '../../reducer/types/Types';
15
+ import { DELETE_1D_SIGNAL, DELETE_2D_SIGNAL, DELETE_CORRELATION, SET_2D_SIGNAL_PATH_LENGTH, SET_CORRELATION, SET_CORRELATIONS, SET_CORRELATIONS_MF, SET_CORRELATIONS_TOLERANCE, } from '../../reducer/types/Types';
16
16
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
17
17
  import CorrelationTable from './CorrelationTable/CorrelationTable';
18
18
  import Overview from './Overview';
19
19
  import SetMolecularFormulaModal from './SetMolecularFormulaModal';
20
20
  import SetShiftToleranceModal from './SetShiftTolerancesModal';
21
- import { findSignalMatch1D, findSignalMatch2D, getAtomType } from './Utilities';
21
+ import { findSignalMatch1D, findSignalMatch2D, getAtomType, } from './utilities/Utilities';
22
22
  const panelStyle = css `
23
23
  display: flex;
24
24
  flex-direction: column;
@@ -192,51 +192,20 @@ function SummaryPanel() {
192
192
  correlation: {
193
193
  ...correlation,
194
194
  equivalence: value,
195
- edited: { ...correlation.edited, equivalence: true },
195
+ edited: { ...correlation.edited, equivalence: value !== 1 },
196
196
  },
197
197
  },
198
198
  });
199
199
  }, [dispatch]);
200
- const editProtonsCountSaveHandler = useCallback((correlation, valuesString) => {
201
- let values;
202
- if (/^(?:[0-9],{0,1})+$/g.test(valuesString)) {
203
- // allow digits followed by optional comma only
204
- values = valuesString
205
- .split(',')
206
- .filter((char) => char.length > 0)
207
- .map((char) => Number(char));
208
- }
209
- else if (valuesString.trim().length === 0) {
210
- // set values to default
211
- values = [];
212
- }
213
- if (values) {
214
- // ignore not supported text input
215
- dispatch({
216
- type: SET_CORRELATION,
217
- payload: {
218
- id: correlation.id,
219
- correlation: {
220
- ...correlation,
221
- protonsCount: values,
222
- edited: { ...correlation.edited, protonsCount: true },
223
- },
224
- options: {
225
- skipDataUpdate: true,
226
- },
227
- },
228
- });
229
- }
230
- }, [dispatch]);
231
- const changeHybridizationSaveHandler = useCallback((correlation, value) => {
200
+ const editNumericValuesSaveHandler = useCallback(({ correlation, values, key, }) => {
232
201
  dispatch({
233
202
  type: SET_CORRELATION,
234
203
  payload: {
235
204
  id: correlation.id,
236
205
  correlation: {
237
206
  ...correlation,
238
- hybridization: value,
239
- edited: { ...correlation.edited, hybridization: true },
207
+ [key]: values,
208
+ edited: { ...correlation.edited, [key]: true },
240
209
  },
241
210
  options: {
242
211
  skipDataUpdate: true,
@@ -294,20 +263,48 @@ function SummaryPanel() {
294
263
  });
295
264
  }
296
265
  }, [assignmentData, dispatch, spectraData]);
266
+ const changeSignalPathLengthHandler = useCallback((link) => {
267
+ const linkDim = getLinkDim(link);
268
+ if (linkDim === 2) {
269
+ const spectrum = findSpectrum(spectraData, link.experimentID, false);
270
+ const zone = findZone(spectrum, link.signal.id);
271
+ const signal = findSignal2D(spectrum, link.signal.id);
272
+ dispatch({
273
+ type: SET_2D_SIGNAL_PATH_LENGTH,
274
+ payload: {
275
+ spectrum,
276
+ zone,
277
+ signal,
278
+ pathLength: link.signal.j?.pathLength,
279
+ },
280
+ });
281
+ }
282
+ }, [dispatch, spectraData]);
297
283
  const editCorrelationTableCellHandler = useCallback((editedCorrelations, action, link, options) => {
298
284
  if (action === 'add' ||
299
285
  action === 'move' ||
300
286
  action === 'remove' ||
301
- action === 'unmove') {
302
- if (action === 'remove' && link && link.pseudo === false) {
303
- deleteSignalHandler(link);
287
+ action === 'unmove' ||
288
+ action === 'setPathLength') {
289
+ if (link && link.pseudo === false) {
290
+ if (action === 'remove') {
291
+ deleteSignalHandler(link);
292
+ }
293
+ else if (action === 'setPathLength') {
294
+ changeSignalPathLengthHandler(link);
295
+ }
304
296
  }
305
297
  setCorrelationsHandler(editedCorrelations, options);
306
298
  }
307
299
  else if (action === 'removeAll') {
308
300
  deleteCorrelationHandler(editedCorrelations[0]);
309
301
  }
310
- }, [deleteCorrelationHandler, deleteSignalHandler, setCorrelationsHandler]);
302
+ }, [
303
+ changeSignalPathLengthHandler,
304
+ deleteCorrelationHandler,
305
+ deleteSignalHandler,
306
+ setCorrelationsHandler,
307
+ ]);
311
308
  const handleOnFilter = useCallback(() => {
312
309
  setFilterIsActive(!filterIsActive);
313
310
  }, [filterIsActive]);
@@ -326,6 +323,6 @@ function SummaryPanel() {
326
323
  width: '70px',
327
324
  height: '18px',
328
325
  border: '1px solid grey',
329
- } }, void 0)] }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, changeHybridizationSaveHandler: changeHybridizationSaveHandler, editProtonsCountSaveHandler: editProtonsCountSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData }, void 0)] }, void 0));
326
+ } }, void 0)] }, void 0) }, void 0)] }, void 0)] }, void 0), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData }, void 0)] }, void 0));
330
327
  }
331
328
  export default memo(SummaryPanel);
@@ -0,0 +1,6 @@
1
+ import { Correlation } from 'nmr-correlation';
2
+ interface InputProps {
3
+ correlation: Correlation;
4
+ }
5
+ declare function IsInView({ correlation }: InputProps): boolean;
6
+ export default IsInView;
@@ -0,0 +1,16 @@
1
+ import { useMemo } from 'react';
2
+ import { useChartData } from '../../../context/ChartContext';
3
+ import { isInView } from './Utilities';
4
+ function IsInView({ correlation }) {
5
+ const { data: spectraData, xDomain, yDomain, displayerMode, activeTab, activeSpectrum, } = useChartData();
6
+ return useMemo(() => isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation), [
7
+ activeSpectrum,
8
+ activeTab,
9
+ correlation,
10
+ displayerMode,
11
+ spectraData,
12
+ xDomain,
13
+ yDomain,
14
+ ]);
15
+ }
16
+ export default IsInView;
@@ -0,0 +1,29 @@
1
+ import { Correlation, Link } from 'nmr-correlation';
2
+ import { Datum2D } from '../../../../data/types/data2d';
3
+ import { Spectra } from '../../../NMRium';
4
+ import { ActiveSpectrum } from '../../../reducer/Reducer';
5
+ declare function getAtomType(nucleus: string): string;
6
+ declare function getLabelColor(correlationData: any, correlation: any): string | null;
7
+ declare function findSignalMatch1D(spectrum: Datum2D, link: Link, factor: number, xDomain0: number, xDomain1: number): boolean;
8
+ declare function findSignalMatch2D(spectrum: Datum2D, link: Link, factor: number, xDomain0: number, xDomain1: number, yDomain0: number, yDomain1: number): boolean;
9
+ declare function getAbbreviation(link: Link): string;
10
+ declare function buildNewLink1D(link: any): Link;
11
+ declare function buildNewLink2D(link: Link, axis: 'x' | 'y'): Link;
12
+ declare function cloneCorrelationAndEditLink(correlation: Correlation, link: Link, axis: 'x' | 'y', action: 'add' | 'remove' | 'unmove'): Correlation;
13
+ declare function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationIdDim1, selectedCorrelationIdDim2, action, link, correlations, }: {
14
+ correlationDim1: Correlation;
15
+ correlationDim2: Correlation;
16
+ action: 'move' | 'remove' | 'unmove' | 'setPathLength';
17
+ selectedCorrelationIdDim1: string | undefined;
18
+ selectedCorrelationIdDim2: string | undefined;
19
+ link: Link;
20
+ correlations: Correlation[];
21
+ }): {
22
+ editedCorrelations: Correlation[];
23
+ buildCorrelationDataOptions: {
24
+ skipDataUpdate?: boolean | undefined;
25
+ };
26
+ };
27
+ declare function convertValuesString(valuesString: string, key: 'protonsCount' | 'hybridization'): number[];
28
+ declare function isInView(spectraData: Spectra, activeTab: string, activeSpectrum: ActiveSpectrum | null, xDomain: number[], yDomain: number[], displayerMode: string, correlation: Correlation): boolean;
29
+ export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
@@ -1,8 +1,11 @@
1
1
  import lodashCloneDeep from 'lodash/cloneDeep';
2
2
  import lodashGet from 'lodash/get';
3
- import { addLink, buildCorrelation, buildLink, getLinkDim, removeLink, } from 'nmr-correlation';
4
- import { findSignal2D } from '../../../data/utilities/FindUtilities';
5
- import { ErrorColors } from './CorrelationTable/Constants';
3
+ import { addLink, buildCorrelation, buildLink, getLinkDelta, getLinkDim, removeLink, } from 'nmr-correlation';
4
+ import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
5
+ import { findSignal2D, findSpectrum, } from '../../../../data/utilities/FindUtilities';
6
+ import isDefaultPathLength from '../../../modal/editZone/validation/isDefaultPathLength';
7
+ import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
8
+ import { ErrorColors } from '../CorrelationTable/Constants';
6
9
  function getAtomType(nucleus) {
7
10
  return nucleus.split(/\d+/)[1];
8
11
  }
@@ -45,27 +48,38 @@ function findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0,
45
48
  return false;
46
49
  }
47
50
  function getAbbreviation(link) {
51
+ let abbreviation = 'X';
48
52
  if (link.experimentType === 'hsqc' || link.experimentType === 'hmqc') {
49
- return !link.signal || link.signal.sign === 0
50
- ? 'S'
51
- : `S${link.signal.sign === 1 ? '+' : '-'}`;
53
+ abbreviation =
54
+ !link.signal || link.signal.sign === 0
55
+ ? 'S'
56
+ : `S${link.signal.sign === 1 ? '+' : '-'}`;
52
57
  }
53
58
  else if (link.experimentType === 'hmbc' ||
54
59
  link.experimentType === 'cosy' ||
55
60
  link.experimentType === 'tocsy') {
56
- return 'M';
61
+ abbreviation = 'M';
57
62
  }
58
63
  else if (link.experimentType === 'noesy' ||
59
64
  link.experimentType === 'roesy') {
60
- return 'NOE';
65
+ abbreviation = 'NOE';
61
66
  }
62
67
  else if (link.experimentType === 'inadequate') {
63
- return 'I';
68
+ abbreviation = 'I';
64
69
  }
65
70
  else if (link.experimentType === 'adequate') {
66
- return 'A';
71
+ abbreviation = 'A';
67
72
  }
68
- return 'X';
73
+ const pathLength = link.signal.j?.pathLength;
74
+ if (pathLength) {
75
+ const isDefaultCorrelation = DefaultPathLengths[link.experimentType] &&
76
+ pathLength.from >= DefaultPathLengths[link.experimentType].from &&
77
+ pathLength.from <= DefaultPathLengths[link.experimentType].to &&
78
+ pathLength.to >= DefaultPathLengths[link.experimentType].from &&
79
+ pathLength.to <= DefaultPathLengths[link.experimentType].to;
80
+ return `${abbreviation}${isDefaultCorrelation ? '' : '*'}`;
81
+ }
82
+ return abbreviation;
69
83
  }
70
84
  function buildNewLink1D(link) {
71
85
  return buildLink({
@@ -101,9 +115,9 @@ function cloneCorrelationAndEditLink(correlation, link, axis, action) {
101
115
  }
102
116
  return _correlation;
103
117
  }
104
- function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationValueDim1, selectedCorrelationValueDim2, action, link, correlations, }) {
105
- const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim1);
106
- const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationValueDim2);
118
+ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationIdDim1, selectedCorrelationIdDim2, action, link, correlations, }) {
119
+ const selectedCorrelationDim1 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim1);
120
+ const selectedCorrelationDim2 = correlations.find((correlation) => correlation.id === selectedCorrelationIdDim2);
107
121
  const hasChangedDim1 = selectedCorrelationDim1?.id !== correlationDim1.id;
108
122
  const hasChangedDim2 = correlationDim2 && selectedCorrelationDim2?.id !== correlationDim2?.id;
109
123
  const linkDim = getLinkDim(link);
@@ -139,14 +153,14 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
139
153
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
140
154
  }
141
155
  else if (selectedCorrelationDim1 &&
142
- selectedCorrelationValueDim2 === 'new') {
156
+ selectedCorrelationIdDim2 === 'new') {
143
157
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim1 ? selectedCorrelationDim1 : _correlationDim1, link, 'x', 'add'));
144
158
  editedCorrelations.push(buildCorrelation({
145
159
  atomType: correlationDim2.atomType,
146
160
  link: [buildNewLink2D(link, 'y')],
147
161
  }));
148
162
  }
149
- else if (selectedCorrelationValueDim1 === 'new' &&
163
+ else if (selectedCorrelationIdDim1 === 'new' &&
150
164
  selectedCorrelationDim2) {
151
165
  editedCorrelations.push(buildCorrelation({
152
166
  atomType: correlationDim1.atomType,
@@ -154,8 +168,8 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
154
168
  }));
155
169
  editedCorrelations.push(cloneCorrelationAndEditLink(hasChangedDim2 ? selectedCorrelationDim2 : _correlationDim2, link, 'y', 'add'));
156
170
  }
157
- else if (selectedCorrelationValueDim1 === 'new' &&
158
- selectedCorrelationValueDim2 === 'new') {
171
+ else if (selectedCorrelationIdDim1 === 'new' &&
172
+ selectedCorrelationIdDim2 === 'new') {
159
173
  editedCorrelations.push(buildCorrelation({
160
174
  atomType: correlationDim1.atomType,
161
175
  link: [buildNewLink2D(link, 'x')],
@@ -189,6 +203,128 @@ function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorre
189
203
  }
190
204
  }
191
205
  }
206
+ else if (action === 'setPathLength') {
207
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim1, link, 'x'));
208
+ editedCorrelations.push(cloneCorrelationAndSetPathLength(correlationDim2, link, 'y'));
209
+ }
192
210
  return { editedCorrelations, buildCorrelationDataOptions };
193
211
  }
194
- export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, };
212
+ function cloneCorrelationAndSetPathLength(correlation, editedLink, axis) {
213
+ const _correlation = lodashCloneDeep(correlation);
214
+ const linkDim = getLinkDim(editedLink);
215
+ if (linkDim === 2) {
216
+ const editedLinkID = editedLink.id.split('_')[axis === 'x' ? 0 : 1];
217
+ const _link = _correlation.link.find((link) => link.id === editedLinkID);
218
+ if (_link) {
219
+ const newPathLength = editedLink.signal.j?.pathLength;
220
+ // remove (previous) pathLength if it is same as default
221
+ if (isDefaultPathLength(newPathLength, _link.experimentType)) {
222
+ delete _link.signal.j?.pathLength;
223
+ if (_link.signal.j && Object.keys(_link.signal.j).length === 0) {
224
+ delete _link.signal.j;
225
+ }
226
+ delete _link.edited.pathLength;
227
+ }
228
+ else {
229
+ if (!_link.signal.j) {
230
+ _link.signal.j = { pathLength: newPathLength };
231
+ }
232
+ else {
233
+ _link.signal.j.pathLength = newPathLength;
234
+ }
235
+ _link.edited.pathLength = true;
236
+ }
237
+ }
238
+ }
239
+ return _correlation;
240
+ }
241
+ function convertValuesString(valuesString, key) {
242
+ valuesString = valuesString
243
+ .toLowerCase()
244
+ .replace(/\s+/g, '')
245
+ .split(',')
246
+ .map((token) => (token === 'sp' ? 'sp1' : token))
247
+ .join(',');
248
+ valuesString = valuesString.replaceAll('sp', '');
249
+ let values = [];
250
+ const regex = /^(?:[0-9],{0,1})+$/g;
251
+ if (regex.test(valuesString)) {
252
+ // allow digits followed by optional comma only
253
+ values = valuesString
254
+ .split(',')
255
+ .filter((char) => char.length > 0)
256
+ .map((char) => Number(char));
257
+ }
258
+ // allow key specific values only
259
+ // protonsCount: [0, 1, 2, 3, ...], hybridization: [1, 2, 3]
260
+ values = values.filter((value) => value >= (key === 'protonsCount' ? 0 : 1) &&
261
+ (key === 'protonsCount' || value <= 3));
262
+ // unique values
263
+ return values.filter((index, i, a) => a.indexOf(index) === i);
264
+ }
265
+ function isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation) {
266
+ if (correlation.pseudo === true) {
267
+ return false;
268
+ }
269
+ if (activeSpectrum === null ||
270
+ !correlation.link.some((link) => link.experimentID === activeSpectrum.id)) {
271
+ return false;
272
+ }
273
+ const atomTypesInView = activeTab.split(',').map((tab) => getAtomType(tab));
274
+ const factor = 10000;
275
+ const xDomain0 = xDomain[0] * factor;
276
+ const xDomain1 = xDomain[1] * factor;
277
+ const yDomain0 = yDomain[0] * factor;
278
+ const yDomain1 = yDomain[1] * factor;
279
+ if (displayerMode === DISPLAYER_MODE.DM_1D) {
280
+ const firstLink1D = correlation.link.find((link) => getLinkDim(link) === 1);
281
+ if (!firstLink1D) {
282
+ return false;
283
+ }
284
+ let delta = getLinkDelta(firstLink1D);
285
+ if (delta === undefined) {
286
+ return false;
287
+ }
288
+ delta *= factor;
289
+ const spectrum = findSpectrum(spectraData, firstLink1D.experimentID, true);
290
+ if (spectrum &&
291
+ atomTypesInView[0] === correlation.atomType &&
292
+ delta >= xDomain0 &&
293
+ delta <= xDomain1) {
294
+ return true;
295
+ }
296
+ // try to find a link which contains the belonging 2D signal in the spectra in view
297
+ if (correlation.link.some((link) => {
298
+ const spectrum = findSpectrum(spectraData, link.experimentID, true);
299
+ return findSignalMatch1D(spectrum, link, factor, xDomain0, xDomain1);
300
+ })) {
301
+ return true;
302
+ }
303
+ }
304
+ else if (displayerMode === DISPLAYER_MODE.DM_2D) {
305
+ if (!atomTypesInView.includes(correlation.atomType)) {
306
+ return false;
307
+ }
308
+ const firstLink2D = correlation.link.find((link) => getLinkDim(link) === 2);
309
+ if (!firstLink2D) {
310
+ return false;
311
+ }
312
+ const spectrum = findSpectrum(spectraData, firstLink2D.experimentID, true);
313
+ // correlation is represented by a 2D signal
314
+ if (findSignalMatch2D(spectrum, firstLink2D, factor, xDomain0, xDomain1, yDomain0, yDomain1)) {
315
+ return true;
316
+ }
317
+ else {
318
+ // try to find a link which contains the belonging 2D signal in the spectra in view
319
+ if (correlation.link.some((link) => {
320
+ const spectrum = findSpectrum(spectraData, link.experimentID, true);
321
+ return findSignalMatch2D(spectrum, link, factor, xDomain0, xDomain1, yDomain0, yDomain1);
322
+ })) {
323
+ return true;
324
+ }
325
+ }
326
+ }
327
+ // do not show correlation
328
+ return false;
329
+ }
330
+ export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
@@ -8,6 +8,7 @@ export interface RowDataProps {
8
8
  signal: {
9
9
  kind: any;
10
10
  };
11
+ experiment: string;
11
12
  };
12
13
  x: {
13
14
  from: number;
@@ -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();