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
@@ -0,0 +1,67 @@
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 formik_1 = require("formik");
10
+ const react_2 = require("react");
11
+ const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
12
+ const Tabs_1 = __importDefault(require("../../elements/Tab/Tabs"));
13
+ const SignalFormTab_1 = __importDefault(require("./SignalFormTab"));
14
+ const textStyles = (0, react_1.css) `
15
+ text-align: center;
16
+ width: 100%;
17
+
18
+ .errorText {
19
+ color: red;
20
+ }
21
+
22
+ .infoText {
23
+ padding: 10px;
24
+ margin: 10px 0;
25
+ font-size: 14px;
26
+ text-align: left;
27
+ color: white;
28
+ background-color: #5f5f5f;
29
+ border-radius: 5px;
30
+ }
31
+ `;
32
+ const tabStylesAddition = (0, react_1.css) `
33
+ color: red;
34
+ `;
35
+ const tabStyles = (0, react_1.css) `
36
+ display: inline-grid;
37
+ list-style: none;
38
+ padding: 0.5rem 1.5rem;
39
+ `;
40
+ function SignalsForm() {
41
+ const { values, setFieldValue, errors, } = (0, formik_1.useFormikContext)();
42
+ const tabContainsErrors = (0, react_2.useCallback)((i) => {
43
+ return errors?.signals && errors?.signals[i] ? true : false;
44
+ }, [errors]);
45
+ const signalFormTabs = (0, react_2.useMemo)(() => {
46
+ const signalTabs = values.signals.length > 0
47
+ ? values.signals.map((signal, i) => ((0, jsx_runtime_1.jsx)(Tab_1.default
48
+ // eslint-disable-next-line react/no-array-index-key
49
+ , { tabid: `${i}`, tabstyles: tabContainsErrors(i) ? tabStylesAddition : tabStyles, render: () => ((0, jsx_runtime_1.jsxs)("div", { style: {
50
+ display: 'flex',
51
+ flexDirection: 'column',
52
+ alignItems: 'center',
53
+ fontSize: '11px',
54
+ }, children: [(0, jsx_runtime_1.jsxs)("span", { children: ["\uD835\uDEC5", (0, jsx_runtime_1.jsx)("sub", { children: signal.x.nucleus }, void 0), ": ", signal.x.delta.toFixed(2)] }, void 0), (0, jsx_runtime_1.jsxs)("span", { children: ["\uD835\uDEC5", (0, jsx_runtime_1.jsx)("sub", { children: signal.y.nucleus }, void 0), ": ", signal.y.delta.toFixed(2)] }, void 0)] }, void 0)), children: (0, jsx_runtime_1.jsx)(SignalFormTab_1.default, { signalIndex: i }, void 0) }, `signalForm_zone${i}`)))
55
+ : [];
56
+ return signalTabs;
57
+ }, [tabContainsErrors, values.signals]);
58
+ const tapClickHandler = (0, react_2.useCallback)(({ tabid }) => {
59
+ setFieldValue('activeTab', tabid);
60
+ }, [setFieldValue]);
61
+ const handleDeleteSignal = (0, react_2.useCallback)(({ tabid }) => {
62
+ const _signals = values.signals.filter((_signal, i) => i !== Number(tabid));
63
+ setFieldValue('signals', _signals);
64
+ }, [setFieldValue, values.signals]);
65
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { css: textStyles }, void 0), (0, jsx_runtime_1.jsx)(Tabs_1.default, { activeTab: values.activeTab, onClick: tapClickHandler, onDelete: handleDeleteSignal, children: signalFormTabs }, void 0)] }, void 0));
66
+ }
67
+ exports.default = SignalsForm;
@@ -0,0 +1,38 @@
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
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const react_1 = require("react");
23
+ const Yup = __importStar(require("yup"));
24
+ const useValidation = () => (0, react_1.useMemo)(() => {
25
+ return Yup.object().shape({
26
+ signals: Yup.array()
27
+ .of(Yup.object().shape({
28
+ j: Yup.object().shape({
29
+ pathLength: Yup.object().shape({
30
+ from: Yup.number().required().positive().integer(),
31
+ to: Yup.number().required().positive().integer(),
32
+ }),
33
+ }),
34
+ }))
35
+ .min(1, 'There must be at least one signal in a zone!'),
36
+ });
37
+ }, []);
38
+ exports.default = useValidation;
@@ -0,0 +1,12 @@
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 DefaultPathLengths_1 = __importDefault(require("../../../../data/constants/DefaultPathLengths"));
7
+ function isDefaultPathLength(pathLength, experimentType) {
8
+ return (DefaultPathLengths_1.default[experimentType] &&
9
+ pathLength.from === DefaultPathLengths_1.default[experimentType].from &&
10
+ pathLength.to === DefaultPathLengths_1.default[experimentType].to);
11
+ }
12
+ exports.default = isDefaultPathLength;
@@ -7,6 +7,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const Label_1 = __importDefault(require("../../elements/Label"));
8
8
  const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
9
9
  function ControllersTabContent() {
10
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "section-header", children: "Mouse Scroll Wheel Sensitivity" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Low", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "controllers.mws.low" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "high", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "controllers.mws.high" }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("p", { className: "section-header", style: { marginTop: '40px' }, children: "Spectra" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Transparency of Dimmed Spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "controllers.dimmedSpectraTransparency", checkValue: (value) => value >= 0 && value <= 1, type: "number" }, void 0) }, void 0)] }, void 0));
10
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "section-header", children: "Spectra" }, void 0), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Transparency of Dimmed Spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "controllers.dimmedSpectraTransparency", checkValue: (value) => value >= 0 && value <= 1, type: "number" }, void 0) }, void 0)] }, void 0));
11
11
  }
12
12
  exports.default = ControllersTabContent;
@@ -51,9 +51,13 @@ const LIST = [
51
51
  label: 'Database Panel',
52
52
  name: 'display.panels.hideDatabasePanel',
53
53
  },
54
+ {
55
+ label: 'Prediction Panel',
56
+ name: 'display.panels.hidePredictionPanel',
57
+ },
54
58
  {
55
59
  label: 'Experimental Features',
56
- name: 'display.hideExperimentalFeatures',
60
+ name: 'display.general.hideExperimentalFeatures',
57
61
  },
58
62
  ];
59
63
  function DisplayTabContent({ preferences }) {
@@ -31,8 +31,8 @@ const CloseButton_1 = __importDefault(require("../../elements/CloseButton"));
31
31
  const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
32
32
  const Tabs_1 = __importStar(require("../../elements/Tab/Tabs"));
33
33
  const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
34
+ const Alert_1 = require("../../elements/popup/Alert");
34
35
  const preferencesReducer_1 = require("../../reducer/preferencesReducer");
35
- const LocalStorage_1 = require("../../utility/LocalStorage");
36
36
  const ControllersTabContent_1 = __importDefault(require("./ControllersTabContent"));
37
37
  const DisplayTabContent_1 = __importDefault(require("./DisplayTabContent"));
38
38
  const FormattingTabContent_1 = __importDefault(require("./FormattingTabContent"));
@@ -163,23 +163,27 @@ const styles = (0, react_1.css) `
163
163
  margin-bottom: 5px;
164
164
  }
165
165
  `;
166
- function GeneralSettings({ onClose, onSave }) {
166
+ function GeneralSettings({ onClose }) {
167
167
  const [activeTab, setActiveTab] = (0, react_2.useState)('controllers');
168
168
  const preferences = (0, PreferencesContext_1.usePreferences)();
169
- const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
169
+ const alert = (0, Alert_1.useAlert)();
170
170
  const refForm = (0, react_2.useRef)();
171
171
  const handleSave = (0, react_2.useCallback)(() => {
172
172
  refForm.current.submitForm();
173
173
  }, []);
174
+ const handleReset = (0, react_2.useCallback)(() => {
175
+ preferences.dispatch({ type: preferencesReducer_1.RESET_PREFERENCES });
176
+ alert.success('Settings saved successfully');
177
+ onClose?.();
178
+ }, [alert, onClose, preferences]);
174
179
  const submitHandler = (0, react_2.useCallback)((values) => {
175
- const { dispatch, basePreferences, ...resValues } = values;
176
- setSettingsData(resValues);
177
180
  preferences.dispatch({ type: preferencesReducer_1.SET_PREFERENCES, payload: values });
178
- onSave?.();
179
- }, [onSave, preferences, setSettingsData]);
181
+ alert.success('Settings saved successfully');
182
+ onClose?.();
183
+ }, [alert, onClose, preferences]);
180
184
  const tabChangeHandler = (0, react_2.useCallback)((tab) => {
181
185
  setActiveTab(tab.tabid);
182
186
  }, []);
183
- return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "General Settings" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "main-content", children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { ref: refForm, initialValues: preferences, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Controllers", tabid: "controllers", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(ControllersTabContent_1.default, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Formatting", tabid: "formatting", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(FormattingTabContent_1.default, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Display", tabid: "display", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(DisplayTabContent_1.default, { preferences: preferences }, void 0) }, void 0) }, void 0)] }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", children: "Save" }, void 0) }, void 0)] }, void 0));
187
+ return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "General Settings" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "main-content", children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { ref: refForm, initialValues: preferences, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Controllers", tabid: "controllers", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(ControllersTabContent_1.default, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Formatting", tabid: "formatting", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(FormattingTabContent_1.default, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Display", tabid: "display", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(DisplayTabContent_1.default, { preferences: preferences }, void 0) }, void 0) }, void 0)] }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleReset, className: "btn", children: "Reset" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn", children: "Save" }, void 0)] }, void 0)] }, void 0));
184
188
  }
185
189
  exports.default = GeneralSettings;
@@ -0,0 +1,18 @@
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 cheminfo_font_1 = require("cheminfo-font");
9
+ const react_1 = require("react");
10
+ const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
11
+ const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
12
+ const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
13
+ function AutomaticAssignment() {
14
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
15
+ const automaticAssignmentHandler = (0, react_1.useCallback)(() => { }, []);
16
+ return ((0, jsx_runtime_1.jsxs)("div", { css: BasicPanelStyle_1.tablePanelStyle, children: [(0, jsx_runtime_1.jsx)(DefaultPanelHeader_1.default, { showSettingButton: false, canDelete: false, children: (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "automatic assignment", onClick: automaticAssignmentHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAssignment2, { style: { fontSize: '18px' } }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "inner-container" }, void 0)] }, void 0));
17
+ }
18
+ exports.default = AutomaticAssignment;
@@ -0,0 +1,43 @@
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("react/jsx-runtime");
7
+ const cheminfo_font_1 = require("cheminfo-font");
8
+ const react_1 = require("react");
9
+ const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
10
+ const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
11
+ function PeaksTable({ data }) {
12
+ const assignHandler = (0, react_1.useCallback)((e, row) => {
13
+ e.preventDefault();
14
+ e.stopPropagation();
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ const params = row.original;
17
+ }, []);
18
+ const COLUMNS = (0, react_1.useMemo)(() => [
19
+ {
20
+ index: 1,
21
+ Header: '#',
22
+ Cell: ({ row }) => row.index + 1,
23
+ style: { width: '1%', maxWidth: '40px', minWidth: '40px' },
24
+ },
25
+ {
26
+ index: 2,
27
+ Header: 'Score',
28
+ },
29
+ {
30
+ index: 3,
31
+ Header: '',
32
+ style: {
33
+ width: '1%',
34
+ maxWidth: '24px',
35
+ minWidth: '24px',
36
+ },
37
+ id: 'assign-button',
38
+ Cell: ({ row }) => ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "assign-button", onClick: (e) => assignHandler(e, row), children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAssignment, {}, void 0) }, void 0)),
39
+ },
40
+ ], [assignHandler]);
41
+ return data && data.length > 0 ? ((0, jsx_runtime_1.jsx)(ReactTable_1.default, { data: data, columns: COLUMNS }, void 0)) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {}, void 0));
42
+ }
43
+ exports.default = (0, react_1.memo)(PeaksTable);
@@ -68,9 +68,6 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, preferences,
68
68
  }, [changeIntegralSumHandler, currentSum, integrals?.options, modal]);
69
69
  const settingsPanelHandler = (0, react_2.useCallback)(() => {
70
70
  setFlipStatus(!isFlipped);
71
- if (!isFlipped) {
72
- settingRef.current.cancelSetting();
73
- }
74
71
  }, [isFlipped]);
75
72
  const saveSettingHandler = (0, react_2.useCallback)(() => {
76
73
  settingRef.current.saveSetting();
@@ -66,7 +66,6 @@ const formatFields = [
66
66
  ];
67
67
  function IntegralsPreferencesInner({ nucleus, preferences, innerRef, }) {
68
68
  const alert = (0, Alert_1.useAlert)();
69
- const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
70
69
  const formRef = (0, react_1.useRef)();
71
70
  const updateValues = (0, react_1.useCallback)(() => {
72
71
  if (nucleus) {
@@ -83,31 +82,19 @@ function IntegralsPreferencesInner({ nucleus, preferences, innerRef, }) {
83
82
  (0, react_1.useEffect)(() => {
84
83
  updateValues();
85
84
  }, [updateValues]);
86
- const saveToLocalStorgate = (values) => {
87
- setSettingsData(values, 'formatting.panels.integrals');
88
- };
89
- const saveHandler = (0, react_1.useCallback)((values, showMessage = false) => {
85
+ const saveHandler = (0, react_1.useCallback)((values) => {
90
86
  preferences.dispatch({
91
87
  type: preferencesReducer_1.SET_PANELS_PREFERENCES,
92
88
  payload: { key: 'integrals', value: values },
93
89
  });
94
- if (showMessage) {
95
- alert.success('Integrals preferences saved successfully');
96
- }
90
+ alert.success('Integrals preferences saved successfully');
97
91
  }, [alert, preferences]);
98
92
  (0, react_1.useImperativeHandle)(innerRef, () => ({
99
93
  saveSetting: () => {
100
94
  formRef.current.submitForm();
101
95
  },
102
- cancelSetting: () => {
103
- updateValues();
104
- },
105
96
  }));
106
- const handleSubmit = (values) => {
107
- saveHandler(values, true);
108
- saveToLocalStorgate(values);
109
- };
110
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { onSubmit: handleSubmit, ref: formRef, children: [(0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)("p", { style: styles.header, children: "General" }, void 0), (0, jsx_runtime_1.jsx)(FormikColorInput_1.default, { name: "color" }, void 0), (0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "strokeWidth", label: "stroke width :", style: {
97
+ return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: [(0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)("p", { style: styles.header, children: "General" }, void 0), (0, jsx_runtime_1.jsx)(FormikColorInput_1.default, { name: "color" }, void 0), (0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "strokeWidth", label: "stroke width :", style: {
111
98
  label: { fontSize: '11px', fontWeight: 'bold', color: '#232323' },
112
99
  input: {
113
100
  width: '60%',
@@ -23,16 +23,21 @@ const useAtomAssignment_1 = __importDefault(require("./useAtomAssignment"));
23
23
  const styles = {
24
24
  panel: (0, react_1.css)({
25
25
  display: 'flex',
26
+ overflow: 'auto',
26
27
  flexGrow: 1,
27
28
  width: '100%',
28
29
  height: '100%',
29
30
  flexDirection: 'column',
30
31
  }),
31
- molecule: (0, react_1.css)({
32
+ innerPanel: (0, react_1.css)({
32
33
  display: 'flex',
33
- flex: '1 1 0%',
34
+ flex: '1',
34
35
  flexDirection: 'column',
35
- minHeight: 0,
36
+ overflow: 'auto',
37
+ }),
38
+ molecule: (0, react_1.css)({
39
+ display: 'flex',
40
+ flex: '1',
36
41
  }),
37
42
  toolbar: (0, react_1.css)({
38
43
  display: 'flex',
@@ -57,7 +62,7 @@ const styles = {
57
62
  minHeight: 0,
58
63
  }),
59
64
  };
60
- function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, }) {
65
+ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, onMoleculeChange, actionsOptions, children, }) {
61
66
  const [currentIndex, setCurrentIndex] = (0, react_2.useState)(0);
62
67
  const [molecules, setMolecules] = (0, react_2.useState)([]);
63
68
  const dispatch = (0, DispatchContext_1.useDispatch)();
@@ -73,6 +78,9 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
73
78
  });
74
79
  }
75
80
  }, [molecules.length, moleculesProp]);
81
+ (0, react_2.useEffect)(() => {
82
+ onMoleculeChange?.(molecules[currentIndex] || null);
83
+ }, [currentIndex, molecules, onMoleculeChange]);
76
84
  const handleReplaceMolecule = (0, react_2.useCallback)((key, molfile) => {
77
85
  dispatch({ type: Types_1.SET_MOLECULE, molfile, key });
78
86
  }, [dispatch]);
@@ -86,21 +94,21 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
86
94
  const moleculeIndexHandler = (0, react_2.useCallback)((index) => {
87
95
  setCurrentIndex(index);
88
96
  }, []);
89
- return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsxs)("span", { css: styles.toolbar, children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
90
- backgroundColor: (index + 1) % 2 !== 0 ? '#fafafa' : 'white',
91
- }, children: (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ height, width }) => {
92
- return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol.key, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
93
- currentDiaIDsToHighlight.length > 0
94
- ? 'red'
95
- : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight &&
96
- currentDiaIDsToHighlight.length > 0
97
- ? currentDiaIDsToHighlight
98
- : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }, void 0));
99
- } }, void 0) }, void 0)] }, mol.key)))) : ((0, jsx_runtime_1.jsx)("div", { style: { width: '100%', height: '100%' }, onClick: () => openMoleculeEditorHandler() }, void 0)) }, void 0) }, void 0)] }, void 0));
97
+ return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler, actionsOptions: actionsOptions }, void 0), (0, jsx_runtime_1.jsxs)("div", { css: styles.innerPanel, children: [(0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsxs)("span", { css: styles.toolbar, children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
98
+ backgroundColor: (index + 1) % 2 !== 0 ? '#fafafa' : 'white',
99
+ }, children: (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ height, width }) => {
100
+ return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol.key, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
101
+ currentDiaIDsToHighlight.length > 0
102
+ ? 'red'
103
+ : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight &&
104
+ currentDiaIDsToHighlight.length > 0
105
+ ? currentDiaIDsToHighlight
106
+ : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }, void 0));
107
+ } }, void 0) }, void 0)] }, mol.key)))) : ((0, jsx_runtime_1.jsx)("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditorHandler(), children: (0, jsx_runtime_1.jsx)("span", { children: "Click to draw molecule" }, void 0) }, void 0)) }, void 0) }, void 0), children] }, void 0)] }, void 0));
100
108
  }
101
109
  const MemoizedMoleculePanel = (0, react_2.memo)(MoleculePanelInner);
102
110
  const emptyData = { ranges: {}, zones: {} };
103
- function MoleculePanel() {
111
+ function MoleculePanel({ onMoleculeChange, children, actionsOptions, }) {
104
112
  const { molecules, displayerMode, activeTab } = (0, ChartContext_1.useChartData)();
105
113
  const data = (0, useSpectrum_1.default)(emptyData);
106
114
  const ranges = data?.ranges || {};
@@ -111,6 +119,8 @@ function MoleculePanel() {
111
119
  activeTab,
112
120
  ranges,
113
121
  zones,
114
- } }, void 0));
122
+ onMoleculeChange,
123
+ actionsOptions,
124
+ }, children: children }, void 0));
115
125
  }
116
126
  exports.default = MoleculePanel;
@@ -60,7 +60,7 @@ const MOL_EXPORT_MENU = [
60
60
  label: 'Export as SVG',
61
61
  },
62
62
  ];
63
- function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, }) {
63
+ function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, actionsOptions = {}, }) {
64
64
  const alert = (0, Alert_1.useAlert)();
65
65
  const dispatch = (0, DispatchContext_1.useDispatch)();
66
66
  const modal = (0, Modal_1.useModal)();
@@ -126,7 +126,7 @@ function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange =
126
126
  width: 600,
127
127
  });
128
128
  }, [modal, molecules, currentIndex]);
129
- return ((0, jsx_runtime_1.jsxs)("div", { css: toolbarStyle, children: [(0, jsx_runtime_1.jsx)(MenuButton_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}, void 0), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler }, void 0), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Paste molfile", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Add Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Delete Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handleDelete, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}, void 0) }, void 0) }, void 0), molecules && molecules.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}, void 0) }, void 0)), (0, jsx_runtime_1.jsxs)("p", { children: [molecules &&
129
+ return ((0, jsx_runtime_1.jsxs)("div", { css: toolbarStyle, children: [!actionsOptions.hideExport && ((0, jsx_runtime_1.jsx)(MenuButton_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}, void 0), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler }, void 0)), !actionsOptions.hidePast && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Paste molfile", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hideAdd && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Add Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hideDelete && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Delete Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handleDelete, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}, void 0) }, void 0) }, void 0)), !actionsOptions.hidePredict && molecules && molecules.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}, void 0) }, void 0)), (0, jsx_runtime_1.jsxs)("p", { children: [molecules &&
130
130
  molecules.length > 0 &&
131
131
  `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }, void 0)] }, void 0));
132
132
  }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PANELS_ACCORDION = void 0;
6
+ exports.TOOLS_PANELS_ACCORDION = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const analysis_ui_components_1 = require("analysis-ui-components");
9
9
  const get_1 = __importDefault(require("lodash/get"));
@@ -12,7 +12,7 @@ const ChartContext_1 = require("../context/ChartContext");
12
12
  const PreferencesContext_1 = require("../context/PreferencesContext");
13
13
  const useCheckExperimentalFeature_1 = __importDefault(require("../hooks/useCheckExperimentalFeature"));
14
14
  const Constants_1 = require("../reducer/core/Constants");
15
- const ToolTypes_1 = require("../toolbar/ToolTypes");
15
+ const AutomaticAssignment_1 = __importDefault(require("./AutomaticAssignment/AutomaticAssignment"));
16
16
  const InformationPanel_1 = __importDefault(require("./InformationPanel"));
17
17
  const IntegralPanel_1 = __importDefault(require("./IntegralsPanel/IntegralPanel"));
18
18
  const MatrixGenerationPanel_1 = __importDefault(require("./MatrixGenerationPanel/MatrixGenerationPanel"));
@@ -25,18 +25,17 @@ const SummaryPanel_1 = __importDefault(require("./SummaryPanel/SummaryPanel"));
25
25
  const ZonesPanel_1 = __importDefault(require("./ZonesPanel/ZonesPanel"));
26
26
  const DatabasePanel_1 = __importDefault(require("./databasePanel/DatabasePanel"));
27
27
  const FilterPanel_1 = __importDefault(require("./filtersPanel/FilterPanel"));
28
+ const PredictionPanel_1 = __importDefault(require("./predictionPanel/PredictionPanel"));
28
29
  const accordionItems = [
29
30
  {
30
31
  title: 'Spectra',
31
32
  component: (0, jsx_runtime_1.jsx)(SpectrumListPanel_1.default, {}, void 0),
32
- openWhen: null,
33
33
  hidePreferenceKey: 'hideSpectraPanel',
34
34
  mode: null,
35
35
  },
36
36
  {
37
37
  title: 'Information',
38
38
  component: (0, jsx_runtime_1.jsx)(InformationPanel_1.default, {}, void 0),
39
- openWhen: null,
40
39
  style: { overflow: 'hidden' },
41
40
  hidePreferenceKey: 'hideInformationPanel',
42
41
  mode: null,
@@ -44,42 +43,36 @@ const accordionItems = [
44
43
  {
45
44
  title: 'Peaks',
46
45
  component: (0, jsx_runtime_1.jsx)(PeaksPanel_1.default, {}, void 0),
47
- openWhen: [ToolTypes_1.options.peakPicking.id],
48
46
  hidePreferenceKey: 'hidePeaksPanel',
49
47
  mode: null,
50
48
  },
51
49
  {
52
50
  title: 'Filters',
53
51
  component: (0, jsx_runtime_1.jsx)(FilterPanel_1.default, {}, void 0),
54
- openWhen: null,
55
52
  hidePreferenceKey: 'hideFiltersPanel',
56
53
  mode: null,
57
54
  },
58
55
  {
59
56
  title: 'Integrals',
60
57
  component: (0, jsx_runtime_1.jsx)(IntegralPanel_1.default, {}, void 0),
61
- openWhen: [ToolTypes_1.options.integral.id],
62
58
  hidePreferenceKey: 'hideIntegralsPanel',
63
59
  mode: null,
64
60
  },
65
61
  {
66
62
  title: 'Ranges',
67
63
  component: (0, jsx_runtime_1.jsx)(RangesPanel_1.default, {}, void 0),
68
- openWhen: [ToolTypes_1.options.rangesPicking.id],
69
64
  hidePreferenceKey: 'hideRangesPanel',
70
65
  mode: Constants_1.DISPLAYER_MODE.DM_1D,
71
66
  },
72
67
  {
73
68
  title: 'Multiple Spectra Analysis',
74
69
  component: (0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisPanel_1.default, {}, void 0),
75
- openWhen: [ToolTypes_1.options.multipleSpectraAnalysis.id],
76
70
  hidePreferenceKey: 'hideMultipleSpectraAnalysisPanel',
77
71
  mode: null,
78
72
  },
79
73
  {
80
74
  title: 'Matrix Generation',
81
75
  component: (0, jsx_runtime_1.jsx)(MatrixGenerationPanel_1.default, {}, void 0),
82
- openWhen: [],
83
76
  hidePreferenceKey: '',
84
77
  mode: null,
85
78
  isExperimental: true,
@@ -87,38 +80,48 @@ const accordionItems = [
87
80
  {
88
81
  title: 'Zones',
89
82
  component: (0, jsx_runtime_1.jsx)(ZonesPanel_1.default, {}, void 0),
90
- openWhen: [ToolTypes_1.options.zone2D.id],
91
83
  hidePreferenceKey: 'hideZonesPanel',
92
84
  mode: Constants_1.DISPLAYER_MODE.DM_2D,
93
85
  },
94
86
  {
95
87
  title: 'Summary',
96
88
  component: (0, jsx_runtime_1.jsx)(SummaryPanel_1.default, {}, void 0),
97
- openWhen: [],
98
89
  hidePreferenceKey: 'hideSummaryPanel',
99
90
  mode: null,
100
91
  },
101
92
  {
102
93
  title: 'Structures',
103
94
  component: (0, jsx_runtime_1.jsx)(MoleculePanel_1.default, {}, void 0),
104
- openWhen: [ToolTypes_1.options.rangesPicking.id],
105
95
  hidePreferenceKey: 'hideStructuresPanel',
106
96
  mode: null,
107
97
  },
108
98
  {
109
99
  title: 'Database',
110
100
  component: (0, jsx_runtime_1.jsx)(DatabasePanel_1.default, {}, void 0),
111
- openWhen: [],
112
101
  hidePreferenceKey: 'hideDatabasePanel',
113
102
  mode: null,
114
103
  },
104
+ {
105
+ title: 'Automatic Assignment',
106
+ component: (0, jsx_runtime_1.jsx)(AutomaticAssignment_1.default, {}, void 0),
107
+ hidePreferenceKey: '',
108
+ mode: null,
109
+ isExperimental: true,
110
+ },
111
+ {
112
+ title: 'Prediction',
113
+ component: (0, jsx_runtime_1.jsx)(PredictionPanel_1.default, {}, void 0),
114
+ hidePreferenceKey: 'hidePredictionPanel',
115
+ mode: null,
116
+ },
115
117
  ];
116
- exports.PANELS_ACCORDION = {
118
+ exports.TOOLS_PANELS_ACCORDION = {
117
119
  null: 'Spectra',
118
120
  peakPicking: 'Peaks',
119
121
  integral: 'Integrals',
120
122
  rangesPicking: 'Ranges',
121
123
  zone2D: 'Zones',
124
+ multipleSpectraAnalysis: 'Multiple Spectra Analysis',
122
125
  };
123
126
  function PanelsInner({ displayerMode }) {
124
127
  const preferences = (0, PreferencesContext_1.usePreferences)();
@@ -37,9 +37,6 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, preferences, }) {
37
37
  }, [modal, yesHandler]);
38
38
  const settingsPanelHandler = (0, react_2.useCallback)(() => {
39
39
  setFlipStatus(!isFlipped);
40
- if (!isFlipped) {
41
- settingRef.current.cancelSetting();
42
- }
43
40
  }, [isFlipped]);
44
41
  const saveSettingHandler = (0, react_2.useCallback)(() => {
45
42
  settingRef.current.saveSetting();
@@ -88,7 +88,6 @@ const formatFields = [
88
88
  ];
89
89
  function PeaksPreferencesInner({ nucleus, preferences, innerRef, }) {
90
90
  const alert = (0, Alert_1.useAlert)();
91
- const [, setSettingsData] = (0, LocalStorage_1.useStateWithLocalStorage)('nmr-general-settings');
92
91
  const formRef = (0, react_1.useRef)(null);
93
92
  const updateValues = (0, react_1.useCallback)(() => {
94
93
  if (nucleus) {
@@ -103,27 +102,19 @@ function PeaksPreferencesInner({ nucleus, preferences, innerRef, }) {
103
102
  (0, react_1.useEffect)(() => {
104
103
  updateValues();
105
104
  }, [updateValues]);
106
- const saveHandler = (0, react_1.useCallback)((values, showMessage = false) => {
105
+ const saveHandler = (0, react_1.useCallback)((values) => {
107
106
  preferences.dispatch({
108
107
  type: preferencesReducer_1.SET_PANELS_PREFERENCES,
109
108
  payload: { key: 'peaks', value: values },
110
109
  });
111
- if (showMessage)
112
- alert.success('Peaks preferences saved successfully');
110
+ alert.success('Peaks preferences saved successfully');
113
111
  }, [alert, preferences]);
114
112
  (0, react_1.useImperativeHandle)(innerRef, () => ({
115
113
  saveSetting: () => {
116
114
  formRef.current.submitForm();
117
115
  },
118
- cancelSetting: () => {
119
- updateValues();
120
- },
121
- }), [updateValues]);
122
- const handleSubmit = (0, react_1.useCallback)((values) => {
123
- saveHandler(values, true);
124
- setSettingsData(values, 'formatting.panels.peaks');
125
- }, [saveHandler, setSettingsData]);
126
- 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}`, hideFormat: field.formatController === 'deltaPPMFormat' }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
116
+ }), []);
117
+ 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}`, hideFormat: field.formatController === 'deltaPPMFormat' }, field.id)))] }, nucleusLabel))) }, void 0) }, void 0));
127
118
  }
128
119
  const MemoizedPeaksPreferences = (0, react_1.memo)(PeaksPreferencesInner);
129
120
  // TODO: remove this hacky use of ref.