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
@@ -9,7 +9,7 @@ import FormikInput from '../../elements/formik/FormikInput';
9
9
  import { useAlert } from '../../elements/popup/Alert';
10
10
  import useNucleus from '../../hooks/useNucleus';
11
11
  import { SET_PANELS_PREFERENCES } from '../../reducer/preferencesReducer';
12
- import { useStateWithLocalStorage, getValue as getValueByKeyPath, } from '../../utility/LocalStorage';
12
+ import { getValue as getValueByKeyPath } from '../../utility/LocalStorage';
13
13
  import { getRangeDefaultValues } from '../extra/preferences/defaultValues';
14
14
  const styles = {
15
15
  container: {
@@ -71,7 +71,6 @@ const formatFields = [
71
71
  ];
72
72
  function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
73
73
  const alert = useAlert();
74
- const [, setSettingsData] = useStateWithLocalStorage('nmr-general-settings');
75
74
  const formRef = useRef();
76
75
  const updateValues = useCallback(() => {
77
76
  if (nucleus) {
@@ -86,31 +85,19 @@ function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
86
85
  useEffect(() => {
87
86
  updateValues();
88
87
  }, [updateValues]);
89
- const saveToLocalStorgate = (values) => {
90
- setSettingsData(values, 'formatting.panels.ranges');
91
- };
92
- const saveHandler = useCallback((values, showMessage = false) => {
88
+ const saveHandler = useCallback((values) => {
93
89
  preferences.dispatch({
94
90
  type: SET_PANELS_PREFERENCES,
95
91
  payload: { key: 'ranges', value: values },
96
92
  });
97
- if (showMessage) {
98
- alert.success('ranges preferences saved successfully');
99
- }
93
+ alert.success('ranges preferences saved successfully');
100
94
  }, [alert, preferences]);
101
95
  useImperativeHandle(innerRef, () => ({
102
96
  saveSetting: () => {
103
97
  formRef.current.submitForm();
104
98
  },
105
- cancelSetting: () => {
106
- updateValues();
107
- },
108
- }), [updateValues]);
109
- const handleSubmit = (values) => {
110
- saveHandler(values, true);
111
- saveToLocalStorgate(values);
112
- };
113
- return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: handleSubmit, ref: formRef, children: nucleus?.map((nucleusLabel) => (_jsxs("div", { style: styles.groupContainer, children: [_jsx(IsotopesViewer, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => (_jsx(FormikColumnFormatField, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id))), _jsx(Label, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: _jsx(FormikInput, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }, void 0) }, void 0)] }, nucleusLabel))) }, void 0) }, void 0));
99
+ }), []);
100
+ return (_jsx("div", { style: styles.container, children: _jsx(FormikForm, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => (_jsxs("div", { style: styles.groupContainer, children: [_jsx(IsotopesViewer, { style: styles.header, value: nucleusLabel }, void 0), formatFields.map((field) => (_jsx(FormikColumnFormatField, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id))), _jsx(Label, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: _jsx(FormikInput, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }, void 0) }, void 0)] }, nucleusLabel))) }, void 0) }, void 0));
114
101
  }
115
102
  const MemoizedRangesPreferences = memo(RangesPreferencesInner);
116
103
  // TODO: remove this hacky use of ref.
@@ -7,10 +7,11 @@ import { useDispatch } from '../../context/DispatchContext';
7
7
  import Button from '../../elements/ButtonToolTip';
8
8
  import { useAlert } from '../../elements/popup/Alert';
9
9
  import { useModal } from '../../elements/popup/Modal';
10
+ import { useCheckToolsVisibility } from '../../hooks/useCheckToolsVisibility';
10
11
  import { DISPLAYER_MODE } from '../../reducer/core/Constants';
11
12
  import { ADD_MISSING_PROJECTION, CHANGE_VISIBILITY, DELETE_SPECTRA, RESET_SPECTRA_SCALE, SET_SPECTRA_SAME_TOP, AUTO_RANGES_SPECTRA_PICKING, AUTO_ZONES_SPECTRA_PICKING, } from '../../reducer/types/Types';
12
13
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
13
- function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMode, spectrums, }) {
14
+ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMode, spectrums, isAutomaticPickingVisible, }) {
14
15
  const modal = useModal();
15
16
  const alert = useAlert();
16
17
  const dispatch = useDispatch();
@@ -72,10 +73,19 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMod
72
73
  hideLoading();
73
74
  }, 0);
74
75
  }, [dispatch, alert]);
75
- return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectrums?.length, deleteToolTip: "Delete all spectra", children: [_jsx(Button, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: _jsx(FaEyeSlash, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: _jsx(FaEye, {}, void 0) }, void 0), activeSpectrum && activeTab && activeTab.split(',').length > 1 && (_jsx(Button, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}, void 0) }, void 0)), displayerMode === DISPLAYER_MODE.DM_1D && spectrums.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Same Top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}, void 0) }, void 0)] }, void 0)), data && data.length > 0 && (_jsx(Button, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: _jsx(SvgNmrRangePicking, {}, void 0) }, void 0))] }, void 0));
76
+ return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectrums?.length, deleteToolTip: "Delete all spectra", children: [_jsx(Button, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: _jsx(FaEyeSlash, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: _jsx(FaEye, {}, void 0) }, void 0), activeSpectrum && activeTab && activeTab.split(',').length > 1 && (_jsx(Button, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}, void 0) }, void 0)), displayerMode === DISPLAYER_MODE.DM_1D && spectrums.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}, void 0) }, void 0), _jsx(Button, { popupTitle: "Same Top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}, void 0) }, void 0)] }, void 0)), data && data.length > 0 && isAutomaticPickingVisible && (_jsx(Button, { popupTitle: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: _jsx(SvgNmrRangePicking, {}, void 0) }, void 0))] }, void 0));
76
77
  }
77
78
  const MemoizedSpectraPanelHeader = memo(SpectraPanelHeaderInner);
78
79
  export default function SpectrumsTabs({ spectrums }) {
79
80
  const { data, activeSpectrum, activeTab, displayerMode } = useChartData();
80
- return (_jsx(MemoizedSpectraPanelHeader, { ...{ data, activeSpectrum, activeTab, displayerMode, spectrums } }, void 0));
81
+ const isToolVisible = useCheckToolsVisibility();
82
+ const isAutomaticPickingVisible = isToolVisible('hideAutoRangesTool');
83
+ return (_jsx(MemoizedSpectraPanelHeader, { ...{
84
+ data,
85
+ activeSpectrum,
86
+ activeTab,
87
+ displayerMode,
88
+ spectrums,
89
+ isAutomaticPickingVisible,
90
+ } }, void 0));
81
91
  }
@@ -7,7 +7,8 @@ import generateID from '../../../../data/utilities/generateID';
7
7
  import ContextMenu from '../../../elements/ContextMenu';
8
8
  import { positions, useModal } from '../../../elements/popup/Modal';
9
9
  import { useHighlight } from '../../../highlight';
10
- import { cloneCorrelationAndEditLink, getAbbreviation } from '../Utilities';
10
+ import IsInView from '../utilities/IsInView';
11
+ import { cloneCorrelationAndEditLink, getAbbreviation, } from '../utilities/Utilities';
11
12
  import EditLinkModal from './editLink/EditLinkModal';
12
13
  function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks, correlations, spectraData, onEdit, }) {
13
14
  const contextRef = useRef();
@@ -135,6 +136,8 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
135
136
  return arr;
136
137
  }, [])
137
138
  .join('/'), [commonLinks]);
139
+ const isInViewRow = IsInView({ correlation: rowCorrelation });
140
+ const isInViewColumn = IsInView({ correlation: columnCorrelation });
138
141
  return (_jsxs("td", { onContextMenu: (e) => {
139
142
  if (contextMenu.length > 0) {
140
143
  contextMenuHandler(e);
@@ -142,7 +145,9 @@ function AdditionalColumnField({ rowCorrelation, columnCorrelation, commonLinks,
142
145
  }, style: {
143
146
  backgroundColor: highlightCommonLinks.isActive
144
147
  ? '#ff6f0057'
145
- : 'inherit',
148
+ : isInViewColumn || isInViewRow
149
+ ? '#f5f5dc'
150
+ : 'inherit',
146
151
  }, title: title, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, children: [contentLabel, _jsx(ContextMenu, { ref: contextRef, context: contextMenu }, void 0)] }, void 0));
147
152
  }
148
153
  export default AdditionalColumnField;
@@ -7,7 +7,8 @@ import { findRangeOrZoneID } from '../../../../data/utilities/FindUtilities';
7
7
  import ContextMenu from '../../../elements/ContextMenu';
8
8
  import { positions, useModal } from '../../../elements/popup/Modal';
9
9
  import { useHighlight } from '../../../highlight';
10
- import { getLabelColor } from '../Utilities';
10
+ import IsInView from '../utilities/IsInView';
11
+ import { getLabelColor } from '../utilities/Utilities';
11
12
  import EditLinkModal from './editLink/EditLinkModal';
12
13
  function AdditionalColumnHeader({ spectraData, correlationsData, correlation, onEdit, }) {
13
14
  const contextRef = useRef();
@@ -38,13 +39,16 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
38
39
  event.currentTarget.blur();
39
40
  highlightAdditionalColumn.hide();
40
41
  }, [highlightAdditionalColumn]);
42
+ const isInView = IsInView({ correlation });
41
43
  const tableHeaderProps = useMemo(() => {
42
44
  return {
43
45
  style: {
44
46
  ...{ color: getLabelColor(correlationsData, correlation) || undefined },
45
47
  backgroundColor: highlightAdditionalColumn.isActive
46
48
  ? '#ff6f0057'
47
- : 'inherit',
49
+ : isInView
50
+ ? '#f5f5dc'
51
+ : 'inherit',
48
52
  },
49
53
  title: correlation.pseudo === false &&
50
54
  correlation.link
@@ -64,6 +68,7 @@ function AdditionalColumnHeader({ spectraData, correlationsData, correlation, on
64
68
  correlation,
65
69
  correlationsData,
66
70
  highlightAdditionalColumn.isActive,
71
+ isInView,
67
72
  mouseEnterHandler,
68
73
  mouseLeaveHandler,
69
74
  ]);
@@ -16,9 +16,4 @@ declare const DefaultTolerance: {
16
16
  Si: number;
17
17
  P: number;
18
18
  };
19
- declare const EditLinkActions: {
20
- key: string;
21
- value: string;
22
- label: string;
23
- }[];
24
- export { DefaultTolerance, EditLinkActions, Errors, ErrorColors, Hybridizations, };
19
+ export { DefaultTolerance, Errors, ErrorColors, Hybridizations };
@@ -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;
@@ -4,7 +4,7 @@ interface MoveLinkProps {
4
4
  correlationDim2: Correlation;
5
5
  link: Link;
6
6
  correlations: Correlation[];
7
- onEdit: (action: string, valueDim1: string, valueDim2: string | undefined) => void;
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;