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
@@ -76,8 +76,8 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
76
76
  to,
77
77
  });
78
78
  const dataToClipboard = {
79
- x: x.slice(fromIndex, toIndex),
80
- y: re.slice(fromIndex, toIndex),
79
+ x: Array.from(x.slice(fromIndex, toIndex)),
80
+ y: Array.from(re.slice(fromIndex, toIndex)),
81
81
  ...value,
82
82
  };
83
83
  const success = await (0, Export_1.copyTextToClipboard)(JSON.stringify(dataToClipboard, undefined, 2));
@@ -105,9 +105,6 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
105
105
  }, [isFilterActive]);
106
106
  const settingsPanelHandler = (0, react_2.useCallback)(() => {
107
107
  setFlipStatus(!isFlipped);
108
- if (!isFlipped) {
109
- settingRef.current.cancelSetting();
110
- }
111
108
  }, [isFlipped]);
112
109
  const saveSettingHandler = (0, react_2.useCallback)(() => {
113
110
  settingRef.current.saveSetting();
@@ -76,7 +76,6 @@ const formatFields = [
76
76
  ];
77
77
  function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
78
78
  const alert = (0, Alert_1.useAlert)();
79
- const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
80
79
  const formRef = (0, react_1.useRef)();
81
80
  const updateValues = (0, react_1.useCallback)(() => {
82
81
  if (nucleus) {
@@ -91,31 +90,19 @@ function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
91
90
  (0, react_1.useEffect)(() => {
92
91
  updateValues();
93
92
  }, [updateValues]);
94
- const saveToLocalStorgate = (values) => {
95
- setSettingsData(values, 'formatting.panels.ranges');
96
- };
97
- const saveHandler = (0, react_1.useCallback)((values, showMessage = false) => {
93
+ const saveHandler = (0, react_1.useCallback)((values) => {
98
94
  preferences.dispatch({
99
95
  type: preferencesReducer_1.SET_PANELS_PREFERENCES,
100
96
  payload: { key: 'ranges', value: values },
101
97
  });
102
- if (showMessage) {
103
- alert.success('ranges preferences saved successfully');
104
- }
98
+ alert.success('ranges preferences saved successfully');
105
99
  }, [alert, preferences]);
106
100
  (0, react_1.useImperativeHandle)(innerRef, () => ({
107
101
  saveSetting: () => {
108
102
  formRef.current.submitForm();
109
103
  },
110
- cancelSetting: () => {
111
- updateValues();
112
- },
113
- }), [updateValues]);
114
- const handleSubmit = (values) => {
115
- saveHandler(values, true);
116
- saveToLocalStorgate(values);
117
- };
118
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: handleSubmit, ref: formRef, children: nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id))), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }, void 0) }, void 0)] }, nucleusLabel))) }, void 0) }, void 0));
104
+ }), []);
105
+ return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id))), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }, void 0) }, void 0)] }, nucleusLabel))) }, void 0) }, void 0));
119
106
  }
120
107
  const MemoizedRangesPreferences = (0, react_1.memo)(RangesPreferencesInner);
121
108
  // TODO: remove this hacky use of ref.
@@ -12,10 +12,11 @@ const DispatchContext_1 = require("../../context/DispatchContext");
12
12
  const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
13
13
  const Alert_1 = require("../../elements/popup/Alert");
14
14
  const Modal_1 = require("../../elements/popup/Modal");
15
+ const useCheckToolsVisibility_1 = require("../../hooks/useCheckToolsVisibility");
15
16
  const Constants_1 = require("../../reducer/core/Constants");
16
17
  const Types_1 = require("../../reducer/types/Types");
17
18
  const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
18
- function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMode, spectrums, }) {
19
+ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMode, spectrums, isAutomaticPickingVisible, }) {
19
20
  const modal = (0, Modal_1.useModal)();
20
21
  const alert = (0, Alert_1.useAlert)();
21
22
  const dispatch = (0, DispatchContext_1.useDispatch)();
@@ -77,11 +78,20 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMod
77
78
  hideLoading();
78
79
  }, 0);
79
80
  }, [dispatch, alert]);
80
- return ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { onDelete: handleDelete, counter: spectrums?.length, deleteToolTip: "Delete all spectra", children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaEyeSlash, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaEye, {}, void 0) }, void 0), activeSpectrum && activeTab && activeTab.split(',').length > 1 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaCreativeCommonsSamplingPlus, {}, void 0) }, void 0)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && spectrums.length > 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrResetScale, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Same Top", onClick: setSameTopHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSameTop, {}, void 0) }, void 0)] }, void 0)), data && data.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}, void 0) }, void 0))] }, void 0));
81
+ return ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { onDelete: handleDelete, counter: spectrums?.length, deleteToolTip: "Delete all spectra", children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaEyeSlash, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaEye, {}, void 0) }, void 0), activeSpectrum && activeTab && activeTab.split(',').length > 1 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaCreativeCommonsSamplingPlus, {}, void 0) }, void 0)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && spectrums.length > 1 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrResetScale, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Same Top", onClick: setSameTopHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSameTop, {}, void 0) }, void 0)] }, void 0)), data && data.length > 0 && isAutomaticPickingVisible && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}, void 0) }, void 0))] }, void 0));
81
82
  }
82
83
  const MemoizedSpectraPanelHeader = (0, react_1.memo)(SpectraPanelHeaderInner);
83
84
  function SpectrumsTabs({ spectrums }) {
84
85
  const { data, activeSpectrum, activeTab, displayerMode } = (0, ChartContext_1.useChartData)();
85
- return ((0, jsx_runtime_1.jsx)(MemoizedSpectraPanelHeader, { ...{ data, activeSpectrum, activeTab, displayerMode, spectrums } }, void 0));
86
+ const isToolVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
87
+ const isAutomaticPickingVisible = isToolVisible('hideAutoRangesTool');
88
+ return ((0, jsx_runtime_1.jsx)(MemoizedSpectraPanelHeader, { ...{
89
+ data,
90
+ activeSpectrum,
91
+ activeTab,
92
+ displayerMode,
93
+ spectrums,
94
+ isAutomaticPickingVisible,
95
+ } }, void 0));
86
96
  }
87
97
  exports.default = SpectrumsTabs;
@@ -12,7 +12,8 @@ const generateID_1 = __importDefault(require("../../../../data/utilities/generat
12
12
  const ContextMenu_1 = __importDefault(require("../../../elements/ContextMenu"));
13
13
  const Modal_1 = require("../../../elements/popup/Modal");
14
14
  const highlight_1 = require("../../../highlight");
15
- const Utilities_1 = require("../Utilities");
15
+ const IsInView_1 = __importDefault(require("../utilities/IsInView"));
16
+ const Utilities_1 = require("../utilities/Utilities");
16
17
  const EditLinkModal_1 = __importDefault(require("./editLink/EditLinkModal"));
17
18
  function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks, correlations, spectraData, onEdit, }) {
18
19
  const contextRef = (0, react_1.useRef)();
@@ -140,6 +141,8 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
140
141
  return arr;
141
142
  }, [])
142
143
  .join('/'), [commonLinks]);
144
+ const isInViewRow = (0, IsInView_1.default)({ correlation: rowCorrelation });
145
+ const isInViewColumn = (0, IsInView_1.default)({ correlation: columnCorrelation });
143
146
  return ((0, jsx_runtime_1.jsxs)("td", { onContextMenu: (e) => {
144
147
  if (contextMenu.length > 0) {
145
148
  contextMenuHandler(e);
@@ -147,7 +150,9 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
147
150
  }, style: {
148
151
  backgroundColor: highlightCommonLinks.isActive
149
152
  ? '#ff6f0057'
150
- : 'inherit',
153
+ : isInViewColumn || isInViewRow
154
+ ? '#f5f5dc'
155
+ : 'inherit',
151
156
  }, title: title, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, children: [contentLabel, (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: contextMenu }, void 0)] }, void 0));
152
157
  }
153
158
  exports.default = AdditionalColumnField;
@@ -12,7 +12,8 @@ const FindUtilities_1 = require("../../../../data/utilities/FindUtilities");
12
12
  const ContextMenu_1 = __importDefault(require("../../../elements/ContextMenu"));
13
13
  const Modal_1 = require("../../../elements/popup/Modal");
14
14
  const highlight_1 = require("../../../highlight");
15
- const Utilities_1 = require("../Utilities");
15
+ const IsInView_1 = __importDefault(require("../utilities/IsInView"));
16
+ const Utilities_1 = require("../utilities/Utilities");
16
17
  const EditLinkModal_1 = __importDefault(require("./editLink/EditLinkModal"));
17
18
  function AdditionalColumnHeader({ spectraData, correlationsData, correlation, onEdit, }) {
18
19
  const contextRef = (0, react_1.useRef)();
@@ -43,13 +44,16 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
43
44
  event.currentTarget.blur();
44
45
  highlightAdditionalColumn.hide();
45
46
  }, [highlightAdditionalColumn]);
47
+ const isInView = (0, IsInView_1.default)({ correlation });
46
48
  const tableHeaderProps = (0, react_1.useMemo)(() => {
47
49
  return {
48
50
  style: {
49
51
  ...{ color: (0, Utilities_1.getLabelColor)(correlationsData, correlation) || undefined },
50
52
  backgroundColor: highlightAdditionalColumn.isActive
51
53
  ? '#ff6f0057'
52
- : 'inherit',
54
+ : isInView
55
+ ? '#f5f5dc'
56
+ : 'inherit',
53
57
  },
54
58
  title: correlation.pseudo === false &&
55
59
  correlation.link
@@ -69,6 +73,7 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
69
73
  correlation,
70
74
  correlationsData,
71
75
  highlightAdditionalColumn.isActive,
76
+ isInView,
72
77
  mouseEnterHandler,
73
78
  mouseLeaveHandler,
74
79
  ]);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hybridizations = exports.ErrorColors = exports.Errors = exports.EditLinkActions = exports.DefaultTolerance = void 0;
3
+ exports.Hybridizations = exports.ErrorColors = exports.Errors = exports.DefaultTolerance = void 0;
4
4
  // error colors in priority order
5
5
  const ErrorColors = [
6
6
  { key: 'outOfLimit', color: 'red' },
@@ -43,10 +43,3 @@ const DefaultTolerance = {
43
43
  P: 0.25,
44
44
  };
45
45
  exports.DefaultTolerance = DefaultTolerance;
46
- const EditLinkActions = [
47
- { key: '-', value: '-', label: 'Select Action' },
48
- { key: 'delete', value: 'delete', label: 'Delete' },
49
- { key: 'move', value: 'move', label: 'Move' },
50
- { key: 'unmove', value: 'unmove', label: 'Unmove' },
51
- ];
52
- exports.EditLinkActions = EditLinkActions;
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
7
  /** @jsxImportSource @emotion/react */
8
8
  const react_1 = require("@emotion/react");
9
9
  const react_2 = require("react");
10
- const Utilities_1 = require("../Utilities");
10
+ const Utilities_1 = require("../utilities/Utilities");
11
11
  const AdditionalColumnHeader_1 = __importDefault(require("./AdditionalColumnHeader"));
12
12
  const CorrelationTableRow_1 = __importDefault(require("./CorrelationTableRow"));
13
13
  const tableStyle = (0, react_1.css) `
@@ -55,7 +55,7 @@ const tableStyle = (0, react_1.css) `
55
55
  }
56
56
  }
57
57
  `;
58
- function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, changeHybridizationSaveHandler, editProtonsCountSaveHandler, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
58
+ function CorrelationTable({ correlationsData, filteredCorrelationsData, additionalColumnData, editEquivalencesSaveHandler, onSaveEditNumericValues, onEditCorrelationTableCellHandler, showProtonsAsRows, spectraData, }) {
59
59
  const rows = (0, react_2.useMemo)(() => {
60
60
  if (!filteredCorrelationsData) {
61
61
  return [];
@@ -68,15 +68,14 @@ function CorrelationTable({ correlationsData, filteredCorrelationsData, addition
68
68
  ? {
69
69
  color: (0, Utilities_1.getLabelColor)(correlationsData, correlation),
70
70
  }
71
- : {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onChangeHybridization: changeHybridizationSaveHandler, onSaveEditProtonsCount: editProtonsCountSaveHandler, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
71
+ : {}, onSaveEditEquivalences: editEquivalencesSaveHandler, onSaveEditNumericValues: onSaveEditNumericValues, onEditCorrelationTableCellHandler: onEditCorrelationTableCellHandler, spectraData: spectraData }, `correlation${correlation.atomType}${correlation.id}`)));
72
72
  }, [
73
73
  filteredCorrelationsData,
74
74
  showProtonsAsRows,
75
75
  additionalColumnData,
76
76
  correlationsData,
77
77
  editEquivalencesSaveHandler,
78
- changeHybridizationSaveHandler,
79
- editProtonsCountSaveHandler,
78
+ onSaveEditNumericValues,
80
79
  onEditCorrelationTableCellHandler,
81
80
  spectraData,
82
81
  ]);
@@ -10,19 +10,13 @@ const Concatenation_1 = require("../../../../data/utilities/Concatenation");
10
10
  const FindUtilities_1 = require("../../../../data/utilities/FindUtilities");
11
11
  const ContextMenu_1 = __importDefault(require("../../../elements/ContextMenu"));
12
12
  const EditableColumn_1 = __importDefault(require("../../../elements/EditableColumn"));
13
- const Select_1 = __importDefault(require("../../../elements/Select"));
14
13
  const Modal_1 = require("../../../elements/popup/Modal");
15
14
  const highlight_1 = require("../../../highlight");
15
+ const IsInView_1 = __importDefault(require("../utilities/IsInView"));
16
+ const Utilities_1 = require("../utilities/Utilities");
16
17
  const AdditionalColumnField_1 = __importDefault(require("./AdditionalColumnField"));
17
- const Constants_1 = require("./Constants");
18
18
  const EditLinkModal_1 = __importDefault(require("./editLink/EditLinkModal"));
19
- const selectBoxStyle = {
20
- marginLeft: 2,
21
- marginRight: 2,
22
- border: 'none',
23
- height: '20px',
24
- };
25
- function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onChangeHybridization, onSaveEditProtonsCount, onEditCorrelationTableCellHandler, spectraData, }) {
19
+ function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }) {
26
20
  const contextRef = (0, react_1.useRef)();
27
21
  const modal = (0, Modal_1.useModal)();
28
22
  const highlightIDsRow = (0, react_1.useMemo)(() => {
@@ -46,9 +40,13 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
46
40
  const onSaveEquivalencesHandler = (0, react_1.useCallback)((e) => {
47
41
  onSaveEditEquivalences(correlation, e.target.value);
48
42
  }, [correlation, onSaveEditEquivalences]);
49
- const onSaveProtonsCountHandler = (0, react_1.useCallback)((e) => {
50
- onSaveEditProtonsCount(correlation, e.target.value);
51
- }, [correlation, onSaveEditProtonsCount]);
43
+ const onSaveEditNumericValuesHandler = (0, react_1.useCallback)((e, key) => {
44
+ onSaveEditNumericValues({
45
+ correlation,
46
+ values: (0, Utilities_1.convertValuesString)(e.target.value, key),
47
+ key,
48
+ });
49
+ }, [correlation, onSaveEditNumericValues]);
52
50
  const additionalColumnFields = (0, react_1.useMemo)(() => {
53
51
  return additionalColumnData.map((_correlation) => {
54
52
  const commonLinks = [];
@@ -80,9 +78,6 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
80
78
  onEditCorrelationTableCellHandler,
81
79
  spectraData,
82
80
  ]);
83
- const onChangeHybridizationHandler = (0, react_1.useCallback)((value) => {
84
- onChangeHybridization(correlation, value);
85
- }, [correlation, onChangeHybridization]);
86
81
  const equivalenceCellStyle = (0, react_1.useMemo)(() => {
87
82
  return correlation.edited.equivalence
88
83
  ? { color: 'blue' }
@@ -98,11 +93,16 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
98
93
  event.currentTarget.blur();
99
94
  highlightRow.hide();
100
95
  }, [highlightRow]);
96
+ const isInView = (0, IsInView_1.default)({ correlation });
101
97
  const tableDataProps = (0, react_1.useMemo)(() => {
102
98
  return {
103
99
  style: {
104
100
  ...styleRow,
105
- backgroundColor: highlightRow.isActive ? '#ff6f0057' : 'inherit',
101
+ backgroundColor: highlightRow.isActive
102
+ ? '#ff6f0057'
103
+ : isInView
104
+ ? '#f5f5dc'
105
+ : 'inherit',
106
106
  },
107
107
  title: correlation.pseudo === false &&
108
108
  correlation.link
@@ -122,6 +122,7 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
122
122
  correlation.link,
123
123
  correlation.pseudo,
124
124
  highlightRow.isActive,
125
+ isInView,
125
126
  mouseEnterHandler,
126
127
  mouseLeaveHandler,
127
128
  styleRow,
@@ -185,16 +186,11 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
185
186
  }
186
187
  }, children: [(0, nmr_correlation_1.getLabel)(correlations, correlation), (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: contextMenu }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: (0, nmr_correlation_1.getCorrelationDelta)(correlation)
187
188
  ? (0, nmr_correlation_1.getCorrelationDelta)(correlation)?.toFixed(2)
188
- : '' }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : ((0, jsx_runtime_1.jsx)("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: onSaveProtonsCountHandler }, void 0)) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...{
189
+ : '' }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.pseudo === false ? (correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler }, void 0)) : ((0, jsx_runtime_1.jsx)("text", { style: equivalenceCellStyle, children: correlation.equivalence }, void 0))) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount') }, void 0)) : ('') }, void 0), (0, jsx_runtime_1.jsx)("td", { title: t, ...{
189
190
  ...otherTableDataProps,
190
191
  style: { ...tableDataProps.style, borderRight: '1px solid' },
191
- }, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(Select_1.default, { onChange: onChangeHybridizationHandler, data: Constants_1.Hybridizations, defaultValue: correlation.hybridization, style: {
192
- ...selectBoxStyle,
193
- color: correlation.edited.hybridization ? 'blue' : 'black',
194
- backgroundColor: correlation.edited.hybridization
195
- ? 'inherit'
196
- : styleRow.backgroundColor,
197
- width: '50px',
198
- } }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
192
+ }, children: correlation.atomType !== 'H' ? ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { type: "text", value: correlation.hybridization
193
+ .map((hybrid) => `sp${hybrid}`)
194
+ .join(','), style: correlation.edited.hybridization ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'hybridization') }, void 0)) : ('') }, void 0), additionalColumnFields] }, void 0));
199
195
  }
200
196
  exports.default = CorrelationTableRow;
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
@@ -9,20 +28,21 @@ const react_1 = require("@emotion/react");
9
28
  const nmr_correlation_1 = require("nmr-correlation");
10
29
  const react_2 = require("react");
11
30
  const CloseButton_1 = __importDefault(require("../../../../elements/CloseButton"));
12
- const Select_1 = __importDefault(require("../../../../elements/Select"));
13
- const Utilities_1 = require("../../Utilities");
14
- const Constants_1 = require("../Constants");
31
+ const Tab_1 = __importDefault(require("../../../../elements/Tab/Tab"));
32
+ const Tabs_1 = __importStar(require("../../../../elements/Tab/Tabs"));
33
+ const Utilities_1 = require("../../utilities/Utilities");
15
34
  const Confirmation_1 = __importDefault(require("./Confirmation"));
35
+ const EditPathLength_1 = __importDefault(require("./EditPathLength"));
16
36
  const MoveLink_1 = __importDefault(require("./MoveLink"));
17
37
  const modalContainer = (0, react_1.css) `
18
- overflow: auto;
19
- width: 380px;
20
- height: 230px;
38
+ width: 490px;
39
+ height: 220px;
21
40
  padding: 5px;
22
41
 
23
42
  button:focus {
24
43
  outline: none;
25
44
  }
45
+
26
46
  .header {
27
47
  height: 24px;
28
48
  border-bottom: 1px solid #f0f0f0;
@@ -66,14 +86,15 @@ const modalContainer = (0, react_1.css) `
66
86
  background-color: gray;
67
87
  }
68
88
 
69
- .select-action-container {
70
- margin-top: 10px;
89
+ .tabs-container {
71
90
  width: 100%;
72
- text-align: center;
91
+ flex: 1;
92
+ overflow: auto;
93
+ border: none;
73
94
  }
74
95
  `;
75
96
  function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, onClose, onEdit, }) {
76
- const [selectedAction, setSelectedActions] = (0, react_2.useState)('-');
97
+ const [activeTab, setActiveTab] = (0, react_2.useState)('move');
77
98
  const getLinkLabel = (0, react_2.useCallback)(() => {
78
99
  const linkDim = (0, nmr_correlation_1.getLinkDim)(link);
79
100
  if (linkDim === 1) {
@@ -84,38 +105,30 @@ function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, o
84
105
  }
85
106
  return '';
86
107
  }, [correlationDim1.label.origin, link, correlationDim2]);
87
- const handleOnEdit = (0, react_2.useCallback)((action, selectedCorrelationValueDim1, selectedCorrelationValueDim2) => {
108
+ const handleOnEdit = (0, react_2.useCallback)((action, selectedCorrelationIdDim1, selectedCorrelationIdDim2, editedLink) => {
88
109
  const { editedCorrelations, buildCorrelationDataOptions } = (0, Utilities_1.getEditedCorrelations)({
89
110
  correlationDim1,
90
111
  correlationDim2,
91
- selectedCorrelationValueDim1,
92
- selectedCorrelationValueDim2,
112
+ selectedCorrelationIdDim1,
113
+ selectedCorrelationIdDim2,
93
114
  action,
94
- link,
115
+ link: editedLink || link,
95
116
  correlations,
96
117
  });
97
- onEdit(editedCorrelations, action, link, buildCorrelationDataOptions);
118
+ onEdit(editedCorrelations, action, editedLink || link, buildCorrelationDataOptions);
98
119
  onClose?.();
99
120
  }, [correlationDim1, correlationDim2, correlations, link, onClose, onEdit]);
100
- const component = (0, react_2.useMemo)(() => {
101
- switch (selectedAction) {
102
- case 'delete':
103
- return ((0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0));
104
- case 'move':
105
- return ((0, jsx_runtime_1.jsx)(MoveLink_1.default, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: handleOnEdit }, void 0));
106
- case 'unmove':
107
- return ((0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0));
108
- default:
109
- return null;
110
- }
111
- }, [
121
+ const tabsContainer = (0, react_2.useMemo)(() => ((0, jsx_runtime_1.jsx)("div", { className: "tabs-container", children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.TOP, activeTab: activeTab, onClick: (tab) => setActiveTab(tab.tabid), children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Move", tabid: 'move', children: (0, jsx_runtime_1.jsx)(MoveLink_1.default, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: (correlationIdDim1, correlationIdDim2) => handleOnEdit('move', correlationIdDim1, correlationIdDim2) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Unmove", tabid: "unmove", children: (0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Remove", tabid: 'remove', children: (0, jsx_runtime_1.jsx)(Confirmation_1.default, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "J Coupling", tabid: 'setPathLength', children: (0, jsx_runtime_1.jsx)(EditPathLength_1.default, { signal: link.signal, experimentType: link.experimentType, onEdit: (editedSignal) => {
122
+ const editedLink = { ...link, signal: editedSignal };
123
+ handleOnEdit('setPathLength', correlationDim1, correlationDim2, editedLink);
124
+ } }, void 0) }, void 0)] }, void 0) }, void 0)), [
125
+ activeTab,
112
126
  correlationDim1,
113
127
  correlationDim2,
114
128
  correlations,
115
- link,
116
129
  handleOnEdit,
117
- selectedAction,
130
+ link,
118
131
  ]);
119
- return ((0, jsx_runtime_1.jsxs)("div", { css: modalContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "select-action-container", children: (0, jsx_runtime_1.jsx)(Select_1.default, { data: Constants_1.EditLinkActions, onChange: (action) => setSelectedActions(action), defaultValue: selectedAction, style: { width: 120, height: 25, margin: 0 } }, void 0) }, void 0), component, (0, jsx_runtime_1.jsx)("div", {}, void 0)] }, void 0));
132
+ return ((0, jsx_runtime_1.jsxs)("div", { css: modalContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` }, void 0)] }, void 0), tabsContainer] }, void 0));
120
133
  }
121
134
  exports.default = EditLinkModal;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
+ /** @jsxImportSource @emotion/react */
8
+ const react_1 = require("@emotion/react");
9
+ const react_2 = require("react");
10
+ const DefaultPathLengths_1 = __importDefault(require("../../../../../data/constants/DefaultPathLengths"));
11
+ const Button_1 = __importDefault(require("../../../../elements/Button"));
12
+ const Input_1 = __importDefault(require("../../../../elements/Input"));
13
+ const Label_1 = __importDefault(require("../../../../elements/Label"));
14
+ const editPathLengthsStyles = (0, react_1.css) `
15
+ width: 100%;
16
+ height: 100%;
17
+ margin-top: 10px;
18
+ text-align: center;
19
+
20
+ .input-container {
21
+ width: 100%;
22
+ margin-top: 5px;
23
+ text-align: center;
24
+
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ justify-content: center;
29
+ }
30
+
31
+ button {
32
+ flex: 2;
33
+ padding: 5px;
34
+ border: 1px solid gray;
35
+ border-radius: 5px;
36
+ height: 30px;
37
+ margin: 0 auto;
38
+ margin-top: 15px;
39
+ display: block;
40
+ width: 60px;
41
+
42
+ color: white;
43
+ background-color: gray;
44
+ }
45
+
46
+ .warning {
47
+ margin-top: 5px;
48
+ color: red;
49
+ }
50
+ `;
51
+ function EditPathLength({ signal, experimentType, onEdit }) {
52
+ const [from, setFrom] = (0, react_2.useState)(signal.j?.pathLength !== undefined
53
+ ? signal.j.pathLength.from
54
+ : DefaultPathLengths_1.default[experimentType]?.from || 0);
55
+ const [to, setTo] = (0, react_2.useState)(signal.j?.pathLength !== undefined
56
+ ? signal.j.pathLength.to
57
+ : DefaultPathLengths_1.default[experimentType]?.to || 0);
58
+ const [isError, setIsError] = (0, react_2.useState)(false);
59
+ const handleOnEdit = (0, react_2.useCallback)(() => {
60
+ const pathLength = {
61
+ from,
62
+ to,
63
+ };
64
+ const editedSignal = {
65
+ ...signal,
66
+ j: {
67
+ ...signal.j,
68
+ pathLength,
69
+ },
70
+ };
71
+ onEdit(editedSignal);
72
+ }, [to, from, onEdit, signal]);
73
+ (0, react_2.useEffect)(() => {
74
+ setIsError(from <= 0 || from > to);
75
+ }, [to, from]);
76
+ return ((0, jsx_runtime_1.jsxs)("div", { css: editPathLengthsStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Setting of the minimum and maximum path length (J coupling)." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "input-container", children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Min:", style: {
77
+ label: {
78
+ marginRight: '5px',
79
+ fontSize: '14px',
80
+ fontWeight: 'normal',
81
+ },
82
+ }, children: (0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", value: from, onChange: (e) => {
83
+ setFrom(Number(e.target.value));
84
+ }, style: { input: { color: isError ? 'red' : 'black' } } }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Max:", style: {
85
+ label: {
86
+ marginRight: '5px',
87
+ fontSize: '14px',
88
+ fontWeight: 'normal',
89
+ },
90
+ }, children: (0, jsx_runtime_1.jsx)(Input_1.default, { type: "number", value: to, onChange: (e) => {
91
+ setTo(Number(e.target.value));
92
+ } }, void 0) }, void 0)] }, void 0), isError ? ((0, jsx_runtime_1.jsxs)("p", { className: "warning", children: ["Minimum must not be 0 or higher than the maximum value.", ' '] }, void 0)) : ((0, jsx_runtime_1.jsx)(Button_1.default, { type: "button", onClick: handleOnEdit, disabled: isError, children: "Set" }, void 0))] }, void 0));
93
+ }
94
+ exports.default = EditPathLength;
@@ -80,6 +80,6 @@ function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit
80
80
  border: '1px solid grey',
81
81
  } }, void 0));
82
82
  }, [correlationDim1, correlationDim2, correlations, link.atomType]);
83
- return ((0, jsx_runtime_1.jsxs)("div", { css: moveLinkStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Move of signals on either one or both axes." }, void 0), (0, jsx_runtime_1.jsx)("p", { children: "\"New\" means to separate into a new row or column." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onEdit('move', selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
83
+ return ((0, jsx_runtime_1.jsxs)("div", { css: moveLinkStyles, children: [(0, jsx_runtime_1.jsx)("p", { children: "Move of signals on either one or both axes." }, void 0), (0, jsx_runtime_1.jsx)("p", { children: "\"New\" means to separate into a new row or column." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "selection-container", children: [getSelection(correlationDim1, 0), correlationDim2 && getSelection(correlationDim2, 1)] }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => onEdit(selectedCorrelationIdDim1, selectedCorrelationIdDim2), children: "Move" }, void 0)] }, void 0));
84
84
  }
85
85
  exports.default = MoveLink;