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
@@ -36,10 +36,4 @@ const DefaultTolerance = {
36
36
  Si: 0.25,
37
37
  P: 0.25,
38
38
  };
39
- const EditLinkActions = [
40
- { key: '-', value: '-', label: 'Select Action' },
41
- { key: 'delete', value: 'delete', label: 'Delete' },
42
- { key: 'move', value: 'move', label: 'Move' },
43
- { key: 'unmove', value: 'unmove', label: 'Unmove' },
44
- ];
45
- export { DefaultTolerance, EditLinkActions, Errors, ErrorColors, Hybridizations, };
39
+ export { DefaultTolerance, Errors, ErrorColors, Hybridizations };
@@ -1,10 +1,9 @@
1
- declare function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, changeHybridizationSaveHandler, editProtonsCountSaveHandler, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }: {
1
+ declare function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, onSaveEditNumericValues, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }: {
2
2
  correlationsData: any;
3
3
  filteredCorrelationsData: any;
4
4
  additionalColumnData: any;
5
5
  editEquivalencesSaveHandler: any;
6
- changeHybridizationSaveHandler: any;
7
- editProtonsCountSaveHandler: any;
6
+ onSaveEditNumericValues: any;
8
7
  onEditCorrelationTableCellHandler: any;
9
8
  showProtonsAsRows: any;
10
9
  spectraData: any;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { useMemo } from 'react';
5
- import { getLabelColor } from '../Utilities';
5
+ import { getLabelColor } from '../utilities/Utilities';
6
6
  import AdditionalColumnHeader from './AdditionalColumnHeader';
7
7
  import CorrelationTableRow from './CorrelationTableRow';
8
8
  const tableStyle = css `
@@ -50,7 +50,7 @@ const tableStyle = css `
50
50
  }
51
51
  }
52
52
  `;
53
- function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, changeHybridizationSaveHandler, editProtonsCountSaveHandler, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
53
+ function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, onSaveEditNumericValues, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
54
54
  const rows = useMemo(() => {
55
55
  if (!filteredCorrelationsData) {
56
56
  return [];
@@ -63,15 +63,14 @@ function CorrelationTable({ correlationsData, filteredCorrelationsData, addition
63
63
  ? {
64
64
  color: getLabelColor(correlationsData, correlation),
65
65
  }
66
- : {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onChangeHybridization: changeHybridizationSaveHandler, onSaveEditProtonsCount: editProtonsCountSaveHandler, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
66
+ : {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onSaveEditNumericValues: onSaveEditNumericValues, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
67
67
  }, [
68
68
  filteredCorrelationsData,
69
69
  showProtonsAsRows,
70
70
  additionalColumnData,
71
71
  correlationsData,
72
72
  editEquivalencesSaveHandler,
73
- changeHybridizationSaveHandler,
74
- editProtonsCountSaveHandler,
73
+ onSaveEditNumericValues,
75
74
  onEditCorrelationTableCellHandler,
76
75
  spectraData,
77
76
  ]);
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
- declare function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onChangeHybridization, onSaveEditProtonsCount, onEditCorrelationTableCellHandler, spectraData, }: {
2
+ declare function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }: {
3
3
  additionalColumnData: any;
4
4
  correlations: any;
5
5
  correlation: any;
6
6
  styleRow: any;
7
7
  styleLabel: any;
8
8
  onSaveEditEquivalences: any;
9
- onChangeHybridization: any;
10
- onSaveEditProtonsCount: any;
9
+ onSaveEditNumericValues: any;
11
10
  onEditCorrelationTableCellHandler: any;
12
11
  spectraData: any;
13
12
  }): JSX.Element;
@@ -5,19 +5,13 @@ import { buildID } from '../../../../data/utilities/Concatenation';
5
5
  import { findRangeOrZoneID } from '../../../../data/utilities/FindUtilities';
6
6
  import ContextMenu from '../../../elements/ContextMenu';
7
7
  import EditableColumn from '../../../elements/EditableColumn';
8
- import Select from '../../../elements/Select';
9
8
  import { positions, useModal } from '../../../elements/popup/Modal';
10
9
  import { useHighlight } from '../../../highlight';
10
+ import IsInView from '../utilities/IsInView';
11
+ import { convertValuesString } from '../utilities/Utilities';
11
12
  import AdditionalColumnField from './AdditionalColumnField';
12
- import { Hybridizations } from './Constants';
13
13
  import EditLinkModal from './editLink/EditLinkModal';
14
- const selectBoxStyle = {
15
- marginLeft: 2,
16
- marginRight: 2,
17
- border: 'none',
18
- height: '20px',
19
- };
20
- function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onChangeHybridization, onSaveEditProtonsCount, onEditCorrelationTableCellHandler, spectraData, }) {
14
+ function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }) {
21
15
  const contextRef = useRef();
22
16
  const modal = useModal();
23
17
  const highlightIDsRow = useMemo(() => {
@@ -41,9 +35,13 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
41
35
  const onSaveEquivalencesHandler = useCallback((e) => {
42
36
  onSaveEditEquivalences(correlation, e.target.value);
43
37
  }, [correlation, onSaveEditEquivalences]);
44
- const onSaveProtonsCountHandler = useCallback((e) => {
45
- onSaveEditProtonsCount(correlation, e.target.value);
46
- }, [correlation, onSaveEditProtonsCount]);
38
+ const onSaveEditNumericValuesHandler = useCallback((e, key) => {
39
+ onSaveEditNumericValues({
40
+ correlation,
41
+ values: convertValuesString(e.target.value, key),
42
+ key,
43
+ });
44
+ }, [correlation, onSaveEditNumericValues]);
47
45
  const additionalColumnFields = useMemo(() => {
48
46
  return additionalColumnData.map((_correlation) => {
49
47
  const commonLinks = [];
@@ -75,9 +73,6 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
75
73
  onEditCorrelationTableCellHandler,
76
74
  spectraData,
77
75
  ]);
78
- const onChangeHybridizationHandler = useCallback((value) => {
79
- onChangeHybridization(correlation, value);
80
- }, [correlation, onChangeHybridization]);
81
76
  const equivalenceCellStyle = useMemo(() => {
82
77
  return correlation.edited.equivalence
83
78
  ? { color: 'blue' }
@@ -93,11 +88,16 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
93
88
  event.currentTarget.blur();
94
89
  highlightRow.hide();
95
90
  }, [highlightRow]);
91
+ const isInView = IsInView({ correlation });
96
92
  const tableDataProps = useMemo(() => {
97
93
  return {
98
94
  style: {
99
95
  ...styleRow,
100
- backgroundColor: highlightRow.isActive ? '#ff6f0057' : 'inherit',
96
+ backgroundColor: highlightRow.isActive
97
+ ? '#ff6f0057'
98
+ : isInView
99
+ ? '#f5f5dc'
100
+ : 'inherit',
101
101
  },
102
102
  title: correlation.pseudo === false &&
103
103
  correlation.link
@@ -117,6 +117,7 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
117
117
  correlation.link,
118
118
  correlation.pseudo,
119
119
  highlightRow.isActive,
120
+ isInView,
120
121
  mouseEnterHandler,
121
122
  mouseLeaveHandler,
122
123
  styleRow,
@@ -180,16 +181,11 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
180
181
  }
181
182
  }, children: [getLabel(correlations, correlation), _jsx(ContextMenu, { ref: contextRef, context: contextMenu }, void 0)] }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: getCorrelationDelta(correlation)
182
183
  ? getCorrelationDelta(correlation)?.toFixed(2)
183
- : '' }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : (_jsx("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: onSaveProtonsCountHandler }, void 0)) : ('') }, void 0), _jsx("td", { title: t, ...{
184
+ : '' }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : (_jsx("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount') }, void 0)) : ('') }, void 0), _jsx("td", { title: t, ...{
184
185
  ...otherTableDataProps,
185
186
  style: { ...tableDataProps.style, borderRight: '1px solid' },
186
- }, children: correlation.atomType !== 'H' ? (_jsx(Select, { onChange: onChangeHybridizationHandler, data: Hybridizations, defaultValue: correlation.hybridization, style: {
187
- ...selectBoxStyle,
188
- color: correlation.edited.hybridization ? 'blue' : 'black',
189
- backgroundColor: correlation.edited.hybridization
190
- ? 'inherit'
191
- : styleRow.backgroundColor,
192
- width: '50px',
193
- } }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
187
+ }, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.hybridization
188
+ .map((hybrid) => `sp${hybrid}`)
189
+ .join(','), style: correlation.edited.hybridization ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'hybridization') }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
194
190
  }
195
191
  export default CorrelationTableRow;
@@ -4,20 +4,21 @@ import { css } from '@emotion/react';
4
4
  import { getLinkDim } from 'nmr-correlation';
5
5
  import { useCallback, useMemo, useState } from 'react';
6
6
  import CloseButton from '../../../../elements/CloseButton';
7
- import Select from '../../../../elements/Select';
8
- import { getEditedCorrelations } from '../../Utilities';
9
- import { EditLinkActions } from '../Constants';
7
+ import Tab from '../../../../elements/Tab/Tab';
8
+ import Tabs, { PositionsEnum } from '../../../../elements/Tab/Tabs';
9
+ import { getEditedCorrelations } from '../../utilities/Utilities';
10
10
  import EditLinkConfirmation from './Confirmation';
11
+ import EditPathLength from './EditPathLength';
11
12
  import MoveLink from './MoveLink';
12
13
  const modalContainer = css `
13
- overflow: auto;
14
- width: 380px;
15
- height: 230px;
14
+ width: 490px;
15
+ height: 220px;
16
16
  padding: 5px;
17
17
 
18
18
  button:focus {
19
19
  outline: none;
20
20
  }
21
+
21
22
  .header {
22
23
  height: 24px;
23
24
  border-bottom: 1px solid #f0f0f0;
@@ -61,14 +62,15 @@ const modalContainer = css `
61
62
  background-color: gray;
62
63
  }
63
64
 
64
- .select-action-container {
65
- margin-top: 10px;
65
+ .tabs-container {
66
66
  width: 100%;
67
- text-align: center;
67
+ flex: 1;
68
+ overflow: auto;
69
+ border: none;
68
70
  }
69
71
  `;
70
72
  export default function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, onClose, onEdit, }) {
71
- const [selectedAction, setSelectedActions] = useState('-');
73
+ const [activeTab, setActiveTab] = useState('move');
72
74
  const getLinkLabel = useCallback(() => {
73
75
  const linkDim = getLinkDim(link);
74
76
  if (linkDim === 1) {
@@ -79,37 +81,29 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
79
81
  }
80
82
  return '';
81
83
  }, [correlationDim1.label.origin, link, correlationDim2]);
82
- const handleOnEdit = useCallback((action, selectedCorrelationValueDim1, selectedCorrelationValueDim2) => {
84
+ const handleOnEdit = useCallback((action, selectedCorrelationIdDim1, selectedCorrelationIdDim2, editedLink) => {
83
85
  const { editedCorrelations, buildCorrelationDataOptions } = getEditedCorrelations({
84
86
  correlationDim1,
85
87
  correlationDim2,
86
- selectedCorrelationValueDim1,
87
- selectedCorrelationValueDim2,
88
+ selectedCorrelationIdDim1,
89
+ selectedCorrelationIdDim2,
88
90
  action,
89
- link,
91
+ link: editedLink || link,
90
92
  correlations,
91
93
  });
92
- onEdit(editedCorrelations, action, link, buildCorrelationDataOptions);
94
+ onEdit(editedCorrelations, action, editedLink || link, buildCorrelationDataOptions);
93
95
  onClose?.();
94
96
  }, [correlationDim1, correlationDim2, correlations, link, onClose, onEdit]);
95
- const component = useMemo(() => {
96
- switch (selectedAction) {
97
- case 'delete':
98
- return (_jsx(EditLinkConfirmation, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0));
99
- case 'move':
100
- return (_jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: handleOnEdit }, void 0));
101
- case 'unmove':
102
- return (_jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0));
103
- default:
104
- return null;
105
- }
106
- }, [
97
+ const tabsContainer = useMemo(() => (_jsx("div", { className: "tabs-container", children: _jsxs(Tabs, { position: PositionsEnum.TOP, activeTab: activeTab, onClick: (tab) => setActiveTab(tab.tabid), children: [_jsx(Tab, { tablabel: "Move", tabid: 'move', children: _jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: (correlationIdDim1, correlationIdDim2) => handleOnEdit('move', correlationIdDim1, correlationIdDim2) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Unmove", tabid: "unmove", children: _jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0) }, void 0), _jsx(Tab, { tablabel: "Remove", tabid: 'remove', children: _jsx(EditLinkConfirmation, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0) }, void 0), _jsx(Tab, { tablabel: "J Coupling", tabid: 'setPathLength', children: _jsx(EditPathLength, { signal: link.signal, experimentType: link.experimentType, onEdit: (editedSignal) => {
98
+ const editedLink = { ...link, signal: editedSignal };
99
+ handleOnEdit('setPathLength', correlationDim1, correlationDim2, editedLink);
100
+ } }, void 0) }, void 0)] }, void 0) }, void 0)), [
101
+ activeTab,
107
102
  correlationDim1,
108
103
  correlationDim2,
109
104
  correlations,
110
- link,
111
105
  handleOnEdit,
112
- selectedAction,
106
+ link,
113
107
  ]);
114
- return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }, void 0), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), _jsx("div", { className: "select-action-container", children: _jsx(Select, { data: EditLinkActions, onChange: (action) => setSelectedActions(action), defaultValue: selectedAction, style: { width: 120, height: 25, margin: 0 } }, void 0) }, void 0), component, _jsx("div", {}, void 0)] }, void 0));
108
+ return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }, void 0), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), tabsContainer] }, void 0));
115
109
  }
@@ -0,0 +1,8 @@
1
+ import { Signal2D } from '../../../../../data/types/data2d';
2
+ interface InputProps {
3
+ signal: Signal2D;
4
+ experimentType: string;
5
+ onEdit: (editedSignal: Signal2D) => void;
6
+ }
7
+ declare function EditPathLength({ signal, experimentType, onEdit }: InputProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
+ export default EditPathLength;
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import { useCallback, useEffect, useState } from 'react';
5
+ import DefaultPathLengths from '../../../../../data/constants/DefaultPathLengths';
6
+ import Button from '../../../../elements/Button';
7
+ import Input from '../../../../elements/Input';
8
+ import Label from '../../../../elements/Label';
9
+ const editPathLengthsStyles = css `
10
+ width: 100%;
11
+ height: 100%;
12
+ margin-top: 10px;
13
+ text-align: center;
14
+
15
+ .input-container {
16
+ width: 100%;
17
+ margin-top: 5px;
18
+ text-align: center;
19
+
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ justify-content: center;
24
+ }
25
+
26
+ button {
27
+ flex: 2;
28
+ padding: 5px;
29
+ border: 1px solid gray;
30
+ border-radius: 5px;
31
+ height: 30px;
32
+ margin: 0 auto;
33
+ margin-top: 15px;
34
+ display: block;
35
+ width: 60px;
36
+
37
+ color: white;
38
+ background-color: gray;
39
+ }
40
+
41
+ .warning {
42
+ margin-top: 5px;
43
+ color: red;
44
+ }
45
+ `;
46
+ function EditPathLength({ signal, experimentType, onEdit }) {
47
+ const [from, setFrom] = useState(signal.j?.pathLength !== undefined
48
+ ? signal.j.pathLength.from
49
+ : DefaultPathLengths[experimentType]?.from || 0);
50
+ const [to, setTo] = useState(signal.j?.pathLength !== undefined
51
+ ? signal.j.pathLength.to
52
+ : DefaultPathLengths[experimentType]?.to || 0);
53
+ const [isError, setIsError] = useState(false);
54
+ const handleOnEdit = useCallback(() => {
55
+ const pathLength = {
56
+ from,
57
+ to,
58
+ };
59
+ const editedSignal = {
60
+ ...signal,
61
+ j: {
62
+ ...signal.j,
63
+ pathLength,
64
+ },
65
+ };
66
+ onEdit(editedSignal);
67
+ }, [to, from, onEdit, signal]);
68
+ useEffect(() => {
69
+ setIsError(from <= 0 || from > to);
70
+ }, [to, from]);
71
+ return (_jsxs("div", { css: editPathLengthsStyles, children: [_jsx("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), _jsxs("div", { className: "input-container", children: [_jsx(Label, { title: "Min:", style: {
72
+ label: {
73
+ marginRight: '5px',
74
+ fontSize: '14px',
75
+ fontWeight: 'normal',
76
+ },
77
+ }, children: _jsx(Input, { type: "number", value: from, onChange: (e) => {
78
+ setFrom(Number(e.target.value));
79
+ }, style: { input: { color: isError ? 'red' : 'black' } } }, void 0) }, void 0), _jsx(Label, { title: "Max:", style: {
80
+ label: {
81
+ marginRight: '5px',
82
+ fontSize: '14px',
83
+ fontWeight: 'normal',
84
+ },
85
+ }, children: _jsx(Input, { type: "number", value: to, onChange: (e) => {
86
+ setTo(Number(e.target.value));
87
+ } }, void 0) }, void 0)] }, void 0), isError ? (_jsxs("p", { className: "warning", children: ["Minimum must not be 0 or higher than the maximum value.", ' '] }, void 0)) : (_jsx(Button, { type: "button", onClick: handleOnEdit, disabled: isError, children: "Set" }, void 0))] }, void 0));
88
+ }
89
+ export default EditPathLength;
@@ -1,10 +1,10 @@
1
- import { Types } from 'nmr-correlation';
1
+ import { Correlation, Link } from 'nmr-correlation';
2
2
  interface MoveLinkProps {
3
- correlationDim1: Types.Correlation;
4
- correlationDim2: Types.Correlation;
5
- link: Types.Link;
6
- correlations: Types.Correlation[];
7
- onEdit: (action: string, valueDim1: string, valueDim2: string | undefined) => void;
3
+ correlationDim1: Correlation;
4
+ correlationDim2: Correlation;
5
+ link: Link;
6
+ correlations: Correlation[];
7
+ onEdit: (correlationIdDim1: string, correlationIdDim2: string | undefined) => void;
8
8
  }
9
9
  declare function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit, }: MoveLinkProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
10
  export default MoveLink;
@@ -75,6 +75,6 @@ function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit
75
75
  border: '1px solid grey',
76
76
  } }, void 0));
77
77
  }, [correlationDim1, correlationDim2, correlations, link.atomType]);
78
- return (_jsxs("div", { css: moveLinkStyles, children: [_jsx("p", { children: "Move of signals on either one or both axes." }, void 0), _jsx("p", { children: "\"New\" means to separate into a new row or column." }, void 0), _jsxs("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), _jsx("button", { type: "button", onClick: () => onEdit('move', selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
78
+ return (_jsxs("div", { css: moveLinkStyles, children: [_jsx("p", { children: "Move of signals on either one or both axes." }, void 0), _jsx("p", { children: "\"New\" means to separate into a new row or column." }, void 0), _jsxs("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), _jsx("button", { type: "button", onClick: () => onEdit(selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
79
79
  }
80
80
  export default MoveLink;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import { getLinkDelta, getLinkDim } from 'nmr-correlation';
4
+ import { getLinkDelta, getLinkDim, } from 'nmr-correlation';
5
5
  import { memo, useCallback, useEffect, useMemo, useState } from 'react';
6
6
  import { FaFlask, FaSlidersH } from 'react-icons/fa';
7
7
  import { findRange, findSignal1D, findSignal2D, findSpectrum, findZone, } from '../../../data/utilities/FindUtilities';
@@ -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, };