nmrium 0.40.1 → 0.42.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 (293) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  15. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  16. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  17. package/lib/component/2d/FooterBanner.js +3 -2
  18. package/lib/component/2d/Viewer2D.js +51 -29
  19. package/lib/component/2d/XAxis.js +1 -1
  20. package/lib/component/2d/YAxis.js +1 -1
  21. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  22. package/lib/component/2d/utilities/scale.d.ts +5 -5
  23. package/lib/component/2d/zones/Signal.js +1 -2
  24. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  25. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  26. package/lib/component/NMRium.d.ts +2 -2
  27. package/lib/component/NMRium.js +39 -26
  28. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  29. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  30. package/lib/component/elements/Input.js +1 -0
  31. package/lib/component/elements/InputRange.js +1 -1
  32. package/lib/component/elements/MenuButton.d.ts +1 -1
  33. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  35. package/lib/component/elements/Scroller.d.ts +15 -0
  36. package/lib/component/elements/Scroller.js +31 -0
  37. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  38. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  39. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  40. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  41. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  42. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  43. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  44. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  45. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
  46. package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
  47. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  48. package/lib/component/elements/popup/Alert/Context.js +6 -2
  49. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  50. package/lib/component/elements/popup/Alert/Provider.js +3 -3
  51. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  52. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  53. package/lib/component/elements/popup/options.d.ts +22 -19
  54. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  55. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  56. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  57. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  58. package/lib/component/highlight/index.d.ts +1 -1
  59. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  60. package/lib/component/hooks/useExport.js +2 -1
  61. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  62. package/lib/component/hooks/usePanelPreferences.js +2 -2
  63. package/lib/component/hooks/useSaveSettings.js +9 -11
  64. package/lib/component/hooks/useXScale.d.ts +1 -1
  65. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  66. package/lib/component/modal/AboutPredictionModal.js +1 -1
  67. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  68. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  69. package/lib/component/modal/AlignSpectraModal.js +11 -1
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  78. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  79. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/Panels.js +13 -0
  89. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  90. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
  91. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
  92. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  93. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  94. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  95. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  96. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  97. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  98. package/lib/component/panels/databasePanel/DatabasePanel.js +34 -27
  99. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  100. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  101. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  102. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  103. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  104. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  105. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  106. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  107. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  112. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  113. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  114. package/lib/component/reducer/Reducer.d.ts +13 -12
  115. package/lib/component/reducer/Reducer.js +253 -239
  116. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  117. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  118. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  119. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  120. package/lib/component/reducer/actions/DomainActions.js +30 -1
  121. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  122. package/lib/component/reducer/actions/LoadActions.js +1 -1
  123. package/lib/component/reducer/actions/MoleculeActions.d.ts +8 -2
  124. package/lib/component/reducer/actions/MoleculeActions.js +58 -3
  125. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  126. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  127. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  128. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  129. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  130. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
  131. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  132. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  133. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  134. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  135. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  136. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  137. package/lib/component/utility/PathBuilder.js +11 -0
  138. package/lib/component/utility/export.js +9 -9
  139. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  140. package/lib/component/utility/getUniqueNuclei.js +1 -1
  141. package/lib/component/utility/jpathToArray.js +1 -1
  142. package/lib/component/workspaces/index.d.ts +1 -0
  143. package/lib/component/workspaces/index.js +2 -0
  144. package/lib/component/workspaces/simulation.d.ts +2 -0
  145. package/lib/component/workspaces/simulation.js +68 -0
  146. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -5
  147. package/lib/data/PredictionManager.d.ts +8 -7
  148. package/lib/data/PredictionManager.js +95 -22
  149. package/lib/data/SpectraManager.js +1 -1
  150. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  151. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  152. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  153. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  154. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  156. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  157. package/lib/data/data1d/database.d.ts +9 -7
  158. package/lib/data/data1d/database.js +13 -6
  159. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  160. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  161. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  162. package/lib/data/data1d/spectrumSimulation.js +53 -0
  163. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  164. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  165. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  166. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  167. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  168. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  169. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  170. package/lib/data/matrixGeneration.js +1 -1
  171. package/lib/data/molecules/MoleculeManager.d.ts +2 -1
  172. package/lib/data/molecules/MoleculeManager.js +21 -7
  173. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  174. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  175. package/lib/data/utilities/FindUtilities.js +4 -4
  176. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  177. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  178. package/lib/data/utilities/calculateSanPlot.js +3 -3
  179. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  180. package/lib/utils/clipboard/clipboard.d.ts +1 -1
  181. package/lib/versionInfo.js +1 -1
  182. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  183. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  184. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  185. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  186. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  187. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  188. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  189. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  190. package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  191. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  192. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  193. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  194. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  195. package/lib-cjs/component/2d/XAxis.js +1 -1
  196. package/lib-cjs/component/2d/YAxis.js +1 -1
  197. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  198. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  199. package/lib-cjs/component/NMRium.js +37 -24
  200. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  201. package/lib-cjs/component/elements/Input.js +1 -0
  202. package/lib-cjs/component/elements/InputRange.js +1 -1
  203. package/lib-cjs/component/elements/Scroller.js +35 -0
  204. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  205. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
  206. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  207. package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
  208. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  209. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  210. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  211. package/lib-cjs/component/hooks/useExport.js +2 -1
  212. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  213. package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
  214. package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
  215. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  216. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  217. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  218. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  219. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  220. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  221. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  222. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  223. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  224. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  225. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  226. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  227. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  228. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  229. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  230. package/lib-cjs/component/panels/Panels.js +13 -0
  231. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  232. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
  233. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
  234. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  235. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  236. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  237. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +34 -27
  238. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  239. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  240. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  241. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  242. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  243. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  244. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  245. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  246. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  247. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  248. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  249. package/lib-cjs/component/reducer/Reducer.js +253 -239
  250. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  251. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  252. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  253. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  254. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  255. package/lib-cjs/component/reducer/actions/MoleculeActions.js +62 -3
  256. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  257. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  258. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  259. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
  260. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  261. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  262. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  263. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  264. package/lib-cjs/component/utility/PathBuilder.js +11 -0
  265. package/lib-cjs/component/utility/export.js +9 -9
  266. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  267. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  268. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  269. package/lib-cjs/component/workspaces/index.js +2 -0
  270. package/lib-cjs/component/workspaces/simulation.js +71 -0
  271. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +9 -5
  272. package/lib-cjs/data/PredictionManager.js +96 -22
  273. package/lib-cjs/data/SpectraManager.js +1 -1
  274. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  275. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  276. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  277. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  278. package/lib-cjs/data/data1d/database.js +13 -6
  279. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  280. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  281. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  282. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  283. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  284. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  285. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  286. package/lib-cjs/data/matrixGeneration.js +1 -1
  287. package/lib-cjs/data/molecules/MoleculeManager.js +23 -8
  288. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  289. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  290. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  291. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  292. package/lib-cjs/versionInfo.js +1 -1
  293. package/package.json +21 -20
@@ -3,21 +3,19 @@ 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.usePredictSpectraModal = void 0;
6
+ exports.PredictSpectraModal = void 0;
7
7
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
8
  /** @jsxImportSource @emotion/react */
9
9
  const react_1 = require("@emotion/react");
10
+ const cheminfo_font_1 = require("cheminfo-font");
10
11
  const react_2 = require("react");
12
+ const ui_1 = require("react-science/ui");
11
13
  const PredictionManager_1 = require("../../data/PredictionManager");
12
14
  const ChartContext_1 = require("../context/ChartContext");
13
15
  const DispatchContext_1 = require("../context/DispatchContext");
14
16
  const LoggerContext_1 = require("../context/LoggerContext");
15
17
  const Button_1 = __importDefault(require("../elements/Button"));
16
- const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
17
- const CloseButton_1 = __importDefault(require("../elements/CloseButton"));
18
18
  const Alert_1 = require("../elements/popup/Alert");
19
- const Modal_1 = require("../elements/popup/Modal");
20
- const options_1 = require("../elements/popup/options");
21
19
  const PredictionOptionsPanel_1 = __importDefault(require("../panels/predictionPanel/PredictionOptionsPanel"));
22
20
  const LocalStorage_1 = require("../utility/LocalStorage");
23
21
  const ModalStyle_1 = require("./ModalStyle");
@@ -42,24 +40,30 @@ const styles = (0, react_1.css) `
42
40
  margin: 5px 5px 5px 0;
43
41
  }
44
42
  }
43
+
44
+ .header {
45
+ padding: 0;
46
+ margin: 0 30%;
47
+ width: 40%;
48
+ }
45
49
  `;
46
50
  function PredictSpectraModal({ onClose = () => null, molecule, }) {
51
+ const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
47
52
  const refForm = (0, react_2.useRef)();
48
53
  const dispatch = (0, DispatchContext_1.useDispatch)();
49
54
  const alert = (0, Alert_1.useAlert)();
50
- const [isApproved, setApproved] = (0, react_2.useState)(false);
51
55
  const [predictionPreferences, setPredictionPreferences] = (0, LocalStorage_1.useStateWithLocalStorage)('nmrium-prediction-preferences');
56
+ const { isApproved: isAgree = false, ...options } = predictionPreferences;
57
+ const [isApproved, setApproved] = (0, react_2.useState)(isAgree);
52
58
  const { toolOptions: { data: { predictionIndex }, }, } = (0, ChartContext_1.useChartData)();
53
59
  const handleSave = (0, react_2.useCallback)(() => {
54
60
  refForm.current.submitForm();
55
61
  }, []);
56
62
  const initValues = (0, react_2.useMemo)(() => {
57
- const { isApproved: isAgree, ...options } = predictionPreferences;
58
- setApproved(isAgree);
59
- return Object.assign(PredictionManager_1.defaultPredictionOptions, options, {
63
+ return Object.assign((0, PredictionManager_1.getDefaultPredictionOptions)(), options, {
60
64
  name: `Prediction ${predictionIndex + 1}`,
61
65
  });
62
- }, [predictionPreferences, predictionIndex]);
66
+ }, [options, predictionIndex]);
63
67
  const { logger } = (0, LoggerContext_1.useLogger)();
64
68
  const submitHandler = (0, react_2.useCallback)((values) => {
65
69
  void (async () => {
@@ -72,12 +76,15 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
72
76
  predictedSpectra.push(key);
73
77
  }
74
78
  }
79
+ onClose();
80
+ closeDialog();
75
81
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
76
82
  try {
77
- const data = await (0, PredictionManager_1.predictSpectra)(molfile, logger);
83
+ const data = await (0, PredictionManager_1.predictSpectra)(molfile);
78
84
  dispatch({
79
85
  type: 'PREDICT_SPECTRA',
80
86
  payload: {
87
+ logger,
81
88
  predictedSpectra: data.spectra,
82
89
  options: values,
83
90
  molecule,
@@ -89,7 +96,6 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
89
96
  }
90
97
  finally {
91
98
  hideLoading();
92
- onClose();
93
99
  }
94
100
  }
95
101
  })();
@@ -101,21 +107,12 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
101
107
  onClose,
102
108
  logger,
103
109
  setPredictionPreferences,
110
+ closeDialog,
104
111
  ]);
105
- const approveCheckHandler = (0, react_2.useCallback)((e) => {
106
- setApproved(e.target.checked);
107
- }, []);
108
- return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsx)(PredictionOptionsPanel_1.default, { onSubmit: submitHandler, options: initValues, ref: refForm }), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), (0, jsx_runtime_1.jsxs)("div", { className: "warning-container", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), (0, jsx_runtime_1.jsx)("p", { children: "I confirm that the chemical structure is not confidential." })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }));
109
- }
110
- function usePredictSpectraModal() {
111
- const modal = (0, Modal_1.useModal)();
112
- return (molecule) => {
113
- modal.show((0, jsx_runtime_1.jsx)(PredictSpectraModal, { molecule: molecule }), {
114
- position: options_1.positions.TOP_CENTER,
115
- enableResizing: true,
116
- width: 600,
117
- });
118
- };
112
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: openDialog, toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
113
+ onClose();
114
+ closeDialog();
115
+ }, width: 600, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header handle", children: (0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsx)(PredictionOptionsPanel_1.default, { onSubmit: submitHandler, options: initValues, ref: refForm }), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), (0, jsx_runtime_1.jsx)("div", { className: "warning-container", children: (0, jsx_runtime_1.jsx)(ui_1.Checkbox, { onChange: setApproved, checked: isApproved, label: "I confirm that the chemical structure is not confidential." }, String(isApproved)) })] }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }) })] }));
119
116
  }
120
- exports.usePredictSpectraModal = usePredictSpectraModal;
117
+ exports.PredictSpectraModal = PredictSpectraModal;
121
118
  exports.default = PredictSpectraModal;
@@ -117,7 +117,7 @@ function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
117
117
  }
118
118
  else {
119
119
  setActiveOption(SumSetOptions.Manual);
120
- formRef.current.setValues({ sum: sumOptions?.sum || '', molecule: null });
120
+ formRef.current.setValues({ sum: sumOptions?.sum ?? '', molecule: null });
121
121
  }
122
122
  }, [panels?.structuresPanel, sumOptions]);
123
123
  function saveHandler(values) {
@@ -96,7 +96,7 @@ function SignalsForm({ range, preferences }) {
96
96
  : 'addSignalTab');
97
97
  }, [setFieldValue, values.signals.length]);
98
98
  const tabContainsErrors = (0, react_2.useCallback)((i) => {
99
- return !!(errors?.signals && errors?.signals[i]);
99
+ return !!errors?.signals?.[i];
100
100
  }, [errors]);
101
101
  const signalFormTabs = (0, react_2.useMemo)(() => {
102
102
  const signalTabs = values.signals.length > 0
@@ -30,7 +30,7 @@ const tabStyles = (0, react_1.css) `
30
30
  function SignalsForm() {
31
31
  const { values, setFieldValue, errors, } = (0, formik_1.useFormikContext)();
32
32
  const tabContainsErrors = (0, react_2.useCallback)((i) => {
33
- return !!(errors?.signals && errors?.signals[i]);
33
+ return !!errors?.signals?.[i];
34
34
  }, [errors]);
35
35
  const signalFormTabs = (0, react_2.useMemo)(() => {
36
36
  const signalTabs = values.signals.length > 0
@@ -143,7 +143,7 @@ function MetaImportationModal({ onClose, file }) {
143
143
  return columns;
144
144
  }, [parseResult?.meta.fields]);
145
145
  function handleLinkSpectra(fields) {
146
- let { source, target } = fields;
146
+ const { source, target } = fields;
147
147
  if (data && parseResult) {
148
148
  try {
149
149
  const { compareResult, matches } = (0, parseMeta_1.linkMetaWithSpectra)({
@@ -63,6 +63,10 @@ const LIST = [
63
63
  label: 'Matrix generation Panel',
64
64
  name: 'panels.matrixGenerationPanel',
65
65
  },
66
+ {
67
+ label: 'Simulation panel',
68
+ name: 'panels.simulationPanel',
69
+ },
66
70
  ];
67
71
  const COLUMNS = [
68
72
  {
@@ -58,7 +58,7 @@ function FormattingTabContent() {
58
58
  const { values, setFieldValue } = (0, formik_1.useFormikContext)();
59
59
  const nuclei = (0, get_1.default)(values, 'formatting.nuclei', {});
60
60
  function deleteHandler(key) {
61
- let _nuclei = {};
61
+ const _nuclei = {};
62
62
  for (const nucleus in nuclei) {
63
63
  if (nucleus !== key) {
64
64
  _nuclei[nucleus] = nuclei[nucleus];
@@ -69,6 +69,13 @@ function InfoBlockTabContent() {
69
69
  return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => (0, convertPathArrayToString_1.convertPathArrayToString)(paths), datalist: datalist }));
70
70
  },
71
71
  },
72
+ {
73
+ Header: 'Format',
74
+ style: { padding: 0, ...styles.column },
75
+ Cell: ({ row }) => {
76
+ return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `infoBlock.fields.${row.index}.format`, style: { input: styles.input } }));
77
+ },
78
+ },
72
79
  {
73
80
  Header: 'Visible',
74
81
  style: { width: '30px', ...styles.column },
@@ -76,11 +83,11 @@ function InfoBlockTabContent() {
76
83
  },
77
84
  {
78
85
  Header: '',
79
- style: { width: '30px', ...styles.column },
86
+ style: { width: '70px', ...styles.column },
80
87
  id: 'add-button',
81
88
  Cell: ({ data, row }) => {
82
89
  const record = row.original;
83
- return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(Button_1.default.Done, { fill: "outline", onClick: () => addHandler(data, row.index + 1), children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }), !record?.name && ((0, jsx_runtime_1.jsx)(Button_1.default.Danger, { fill: "outline", onClick: () => deleteHandler(data, row.index), children: (0, jsx_runtime_1.jsx)(fa_1.FaTimes, {}) }))] }));
90
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [(0, jsx_runtime_1.jsx)(Button_1.default.Done, { fill: "outline", onClick: () => addHandler(data, row.index + 1), children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }), !record?.name && ((0, jsx_runtime_1.jsx)(Button_1.default.Danger, { fill: "outline", onClick: () => deleteHandler(data, row.index), children: (0, jsx_runtime_1.jsx)(fa_1.FaTimes, {}) }))] }));
84
91
  },
85
92
  },
86
93
  ], [addHandler, datalist, deleteHandler, paths]);
@@ -16,7 +16,7 @@ const formattingValidation = (obj) => (0, yup_1.object)().shape({
16
16
  nuclei: (0, yup_1.object)()
17
17
  .shape(formattingElementValidation(obj))
18
18
  .test('Unique', 'Nuclei need te be unique', function check(nuclei) {
19
- let nucleusFrequencies = {};
19
+ const nucleusFrequencies = {};
20
20
  for (const key of Object.keys(nuclei)) {
21
21
  const _key = nuclei[key].name?.toLowerCase() || '';
22
22
  if (_key) {
@@ -33,7 +33,7 @@ const formattingValidation = (obj) => (0, yup_1.object)().shape({
33
33
  for (const key in nucleusFrequencies) {
34
34
  const { value, fields } = nucleusFrequencies[key];
35
35
  if (value > 1) {
36
- for (let field of fields) {
36
+ for (const field of fields) {
37
37
  errors.push(new yup_1.ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
38
38
  }
39
39
  }
@@ -89,12 +89,9 @@ function IntegralTable({ activeTab, data }) {
89
89
  },
90
90
  accessor: 'integral',
91
91
  Cell: ({ row }) => {
92
- let integral = '';
93
- if (row.original?.integral) {
94
- const value = (0, formatNumber_1.formatNumber)(row.original.integral, integralsPreferences.relative.format);
95
- const flag = (0, Spectrum1D_1.checkIntegralKind)(row.original);
96
- integral = flag ? value : `[ ${value} ]`;
97
- }
92
+ const value = (0, formatNumber_1.formatNumber)(row.original.integral || 0, integralsPreferences.relative.format);
93
+ const flag = (0, Spectrum1D_1.checkIntegralKind)(row.original);
94
+ const integral = flag ? value : `[ ${value} ]`;
98
95
  return ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
99
96
  },
100
97
  },
@@ -114,7 +111,7 @@ function IntegralTable({ activeTab, data }) {
114
111
  saveRelativeHandler,
115
112
  ]);
116
113
  const tableColumns = (0, react_1.useMemo)(() => {
117
- let columns = [...initialColumns];
114
+ const columns = [...initialColumns];
118
115
  for (const col of COLUMNS) {
119
116
  const { showWhen, ...colParams } = col;
120
117
  if ((0, get_1.default)(integralsPreferences, showWhen)) {
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const cheminfo_font_1 = require("cheminfo-font");
8
7
  const full_1 = require("openchemlib/full");
9
8
  const react_1 = require("react");
10
9
  const fa_1 = require("react-icons/fa");
11
10
  const io5_1 = require("react-icons/io5");
12
11
  const ui_1 = require("react-science/ui");
12
+ const MoleculeManager_1 = require("../../../data/molecules/MoleculeManager");
13
13
  const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
14
14
  const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
15
15
  const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
@@ -19,7 +19,7 @@ const ActiveButton_1 = __importDefault(require("../../elements/ActiveButton"));
19
19
  const Button_1 = __importDefault(require("../../elements/Button"));
20
20
  const Alert_1 = require("../../elements/popup/Alert");
21
21
  const AboutPredictionModal_1 = __importDefault(require("../../modal/AboutPredictionModal"));
22
- const PredictSpectraModal_1 = require("../../modal/PredictSpectraModal");
22
+ const PredictSpectraModal_1 = __importDefault(require("../../modal/PredictSpectraModal"));
23
23
  const export_1 = require("../../utility/export");
24
24
  const PanelHeader_1 = __importDefault(require("../header/PanelHeader"));
25
25
  const styles = {
@@ -82,7 +82,6 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
82
82
  const dispatch = (0, DispatchContext_1.useDispatch)();
83
83
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
84
84
  const moleculeKey = molecules?.[currentIndex]?.id;
85
- const openPredictSpectraModal = (0, PredictSpectraModal_1.usePredictSpectraModal)();
86
85
  const saveAsSVGHandler = (0, react_1.useCallback)(() => {
87
86
  if (!rootRef)
88
87
  return;
@@ -131,10 +130,11 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
131
130
  function handlePasteMolfileAction() {
132
131
  void readText().then(handlePasteMolfile);
133
132
  }
134
- function handlePasteMolfile(molfile) {
133
+ async function handlePasteMolfile(molfile) {
135
134
  if (!molfile)
136
135
  return;
137
- dispatch({ type: 'ADD_MOLECULE', payload: { molfile } });
136
+ const molecules = await (0, MoleculeManager_1.getMolecules)(molfile);
137
+ dispatch({ type: 'ADD_MOLECULES', payload: { molecules } });
138
138
  cleanShouldFallback();
139
139
  }
140
140
  const handleDelete = (0, react_1.useCallback)(() => {
@@ -165,7 +165,7 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
165
165
  });
166
166
  }
167
167
  const hasMolecules = molecules && molecules.length > 0;
168
- return ((0, jsx_runtime_1.jsxs)(PanelHeader_1.default, { children: [renderSource === 'predictionPanel' && (0, jsx_runtime_1.jsx)(AboutPredictionModal_1.default, {}), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }) })), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) }), hasMolecules && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: () => openPredictSpectraModal(molecules[currentIndex]), toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}) }))] })), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(io5_1.IoOpenOutline, {}) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)("p", { style: styles.atomLabel, children: "#" }) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: children }), (0, jsx_runtime_1.jsxs)("p", { style: styles.counter, children: [molecules &&
168
+ return ((0, jsx_runtime_1.jsxs)(PanelHeader_1.default, { children: [renderSource === 'predictionPanel' && (0, jsx_runtime_1.jsx)(AboutPredictionModal_1.default, {}), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }) })), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) }), hasMolecules && ((0, jsx_runtime_1.jsx)(PredictSpectraModal_1.default, { molecule: molecules[currentIndex] }))] })), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(io5_1.IoOpenOutline, {}) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)("p", { style: styles.atomLabel, children: "#" }) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: children }), (0, jsx_runtime_1.jsxs)("p", { style: styles.counter, children: [molecules &&
169
169
  molecules.length > 0 &&
170
170
  `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: (0, jsx_runtime_1.jsx)(fa_1.FaCog, {}) })), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
171
171
  }
@@ -46,12 +46,10 @@ function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }
46
46
  }, [onAtomHoverAction, onAtomHoverHighlights, highlightData]);
47
47
  const data = (0, react_1.useMemo)(() => {
48
48
  if (zones || ranges) {
49
- if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && ranges && ranges.values) {
49
+ if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && ranges?.values) {
50
50
  return ranges.values;
51
51
  }
52
- else if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
53
- zones &&
54
- zones.values) {
52
+ else if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && zones?.values) {
55
53
  return zones.values;
56
54
  }
57
55
  }
@@ -63,7 +61,7 @@ function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }
63
61
  y: [],
64
62
  };
65
63
  const assignment = assignments.data.assignments;
66
- for (let id in assignment) {
64
+ for (const id in assignment) {
67
65
  if (assignment[id].x) {
68
66
  assignedDiaID.x.push(...assignment[id].x);
69
67
  }
@@ -26,6 +26,7 @@ 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
28
  const PredictionPanel_1 = __importDefault(require("./predictionPanel/PredictionPanel"));
29
+ const SpectrumSimulation_1 = __importDefault(require("./spectrumSimulation/SpectrumSimulation"));
29
30
  const accordionItems = [
30
31
  {
31
32
  title: 'Spectra',
@@ -112,6 +113,12 @@ const accordionItems = [
112
113
  hidePreferenceKey: 'predictionPanel',
113
114
  mode: null,
114
115
  },
116
+ {
117
+ title: 'Spectrum Simulation',
118
+ component: (0, jsx_runtime_1.jsx)(SpectrumSimulation_1.default, {}),
119
+ hidePreferenceKey: 'simulationPanel',
120
+ mode: Constants_1.DISPLAYER_MODE.DM_1D,
121
+ },
115
122
  ];
116
123
  exports.TOOLS_PANELS_ACCORDION = {
117
124
  null: 'Spectra',
@@ -128,6 +135,12 @@ function usePanelPreferences() {
128
135
  display: false,
129
136
  open: false,
130
137
  };
138
+ if (item?.isExperimental && !item.hidePreferenceKey) {
139
+ return {
140
+ display: true,
141
+ open: false,
142
+ };
143
+ }
131
144
  return (0, get_1.default)(preferences.current, `display.panels.${item.hidePreferenceKey}`, defaultValue);
132
145
  }, [preferences]);
133
146
  }
@@ -131,7 +131,7 @@ function PeaksTable({ activeTab, data }) {
131
131
  },
132
132
  ], [deletePeakHandler, editPeakHandler]);
133
133
  const tableColumns = (0, react_1.useMemo)(() => {
134
- let columns = [...initialColumns];
134
+ const columns = [...initialColumns];
135
135
  for (const col of COLUMNS) {
136
136
  const { showWhen, ...colParams } = col;
137
137
  if ((0, get_1.default)(peaksPreferences, showWhen)) {
@@ -8,6 +8,7 @@ const formik_1 = require("formik");
8
8
  const react_1 = require("react");
9
9
  const ChartContext_1 = require("../../context/ChartContext");
10
10
  const PreferencesContext_1 = require("../../context/PreferencesContext");
11
+ const Scroller_1 = require("../../elements/Scroller");
11
12
  const useNucleus_1 = __importDefault(require("../../hooks/useNucleus"));
12
13
  const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
13
14
  const convertPathArrayToString_1 = require("../../utility/convertPathArrayToString");
@@ -17,7 +18,7 @@ const PreferencesContainer_1 = require("../extra/preferences/PreferencesContaine
17
18
  const SpectraColumnsManager_1 = require("./base/SpectraColumnsManager");
18
19
  function SpectraPreferences(props, ref) {
19
20
  const formRef = (0, react_1.useRef)(null);
20
- const { data } = (0, ChartContext_1.useChartData)();
21
+ const { data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
21
22
  const preferences = (0, PreferencesContext_1.usePreferences)();
22
23
  const nuclei = (0, useNucleus_1.default)();
23
24
  const preferencesByNuclei = (0, usePanelPreferences_1.usePanelPreferencesByNuclei)('spectra', nuclei);
@@ -72,6 +73,6 @@ function SpectraPreferences(props, ref) {
72
73
  }, []);
73
74
  const mapOnChangeValueHandler = (0, react_1.useCallback)((key) => paths[key], [paths]);
74
75
  const mapValue = (0, react_1.useCallback)((value) => (0, convertPathArrayToString_1.convertPathArrayToString)(value), []);
75
- return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: nuclei?.map((n) => ((0, jsx_runtime_1.jsx)(NucleusGroup_1.NucleusGroup, { nucleus: n, children: (0, jsx_runtime_1.jsx)(SpectraColumnsManager_1.SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }, n))) }) }) }));
76
+ return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: (0, jsx_runtime_1.jsx)(Scroller_1.Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => ((0, jsx_runtime_1.jsx)(Scroller_1.Scroller.Item, { elementKey: n, children: (0, jsx_runtime_1.jsx)(NucleusGroup_1.NucleusGroup, { nucleus: n, children: (0, jsx_runtime_1.jsx)(SpectraColumnsManager_1.SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }, n))) }) }) }));
76
77
  }
77
78
  exports.default = (0, react_1.memo)((0, react_1.forwardRef)(SpectraPreferences));
@@ -168,7 +168,7 @@ function SpectraTable(props) {
168
168
  return activeSpectraObj?.[row?.original.id] || false;
169
169
  }
170
170
  const tableColumns = (0, react_1.useMemo)(() => {
171
- let columns = [];
171
+ const columns = [];
172
172
  let index = 0;
173
173
  const visibleColumns = spectraPreferences.columns.filter((col) => col.visible);
174
174
  for (const col of visibleColumns) {
@@ -24,7 +24,9 @@ const style = (0, react_1.css) `
24
24
  flex-direction: row-reverse;
25
25
  border-radius: 4px;
26
26
  background-color: white;
27
- box-shadow: rgb(0 0 0 / 15%) 0 0 0 1px, rgb(0 0 0 / 15%) 0 8px 16px;
27
+ box-shadow:
28
+ rgb(0 0 0 / 15%) 0 0 0 1px,
29
+ rgb(0 0 0 / 15%) 0 8px 16px;
28
30
  overflow: auto;
29
31
  height: 350px;
30
32
  }
@@ -7,9 +7,9 @@ function processSnapPlot(dimension, data, yLogBase) {
7
7
  const sanResult = (0, calculateSanPlot_1.calculateSanPlot)(dimension, data);
8
8
  const sanPlot = {};
9
9
  const lines = {};
10
- for (let plotKey in sanResult.sanplot) {
10
+ for (const plotKey in sanResult.sanplot) {
11
11
  const { x, y } = (0, ml_spectra_processing_1.xyReduce)(sanResult.sanplot[plotKey]);
12
- let result = new Array(x.length);
12
+ const result = new Array(x.length);
13
13
  for (let i = 0; i < x.length; i++) {
14
14
  result[i] = { x: x[i], y: y[i] };
15
15
  }
@@ -19,7 +19,7 @@ exports.getAtomType = getAtomType;
19
19
  function getLabelColor(correlationData, correlation) {
20
20
  const error = (0, get_1.default)(correlationData, `state.${correlation.atomType}.error`, null);
21
21
  if (error) {
22
- for (let { key, color } of Constants_2.ErrorColors) {
22
+ for (const { key, color } of Constants_2.ErrorColors) {
23
23
  if (key !== 'incomplete' && // do not consider this for a single atom type
24
24
  (key === 'notAttached' || key === 'ambiguousAttachment') &&
25
25
  (0, get_1.default)(error, `${key}`, []).some((index) => correlationData.values[index].id === correlation.id)) {
@@ -45,6 +45,13 @@ const emptyKeywords = {
45
45
  solvent: '-1',
46
46
  searchKeywords: '',
47
47
  };
48
+ function mapKeywordsToArray(searchKeywords, solvent) {
49
+ const values = searchKeywords ? searchKeywords.split(' ') : [];
50
+ if (solvent !== '-1') {
51
+ values.unshift(`solvent:${solvent}`);
52
+ }
53
+ return values;
54
+ }
48
55
  function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase, }) {
49
56
  const dispatch = (0, DispatchContext_1.useDispatch)();
50
57
  const alert = (0, Alert_1.useAlert)();
@@ -82,28 +89,34 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
82
89
  }));
83
90
  }
84
91
  }, []);
92
+ const search = (0, react_2.useCallback)((solvents) => {
93
+ const { solvent, searchKeywords } = keywords;
94
+ if (databaseInstance.current) {
95
+ const keywords = mapKeywordsToArray(searchKeywords, solvent);
96
+ const data = databaseInstance.current.search({ keywords, idCode });
97
+ setResult((prevResult) => ({
98
+ ...prevResult,
99
+ data,
100
+ ...(solvents && { solvents }),
101
+ }));
102
+ }
103
+ }, [idCode, keywords]);
85
104
  (0, react_2.useEffect)(() => {
86
105
  const { solvent, searchKeywords } = keywords;
87
106
  setTimeout(async () => {
88
107
  if (databaseInstance.current) {
89
108
  const hideLoading = await alert.showLoading(`Preparing of the Result`);
90
109
  if (solvent === '-1' && !searchKeywords) {
91
- const data = databaseInstance.current.data;
92
110
  const solvents = mapSolventsToSelect(databaseInstance.current.getSolvents());
93
- setResult((prevResult) => ({ ...prevResult, data, solvents }));
111
+ search(solvents);
94
112
  }
95
113
  else {
96
- const values = searchKeywords.split(' ');
97
- if (solvent !== '-1') {
98
- values.unshift(`solvent:${solvent}`);
99
- }
100
- const data = databaseInstance.current.search(values.join(' '));
101
- setResult((prevResult) => ({ ...prevResult, data }));
114
+ search();
102
115
  }
103
116
  hideLoading();
104
117
  }
105
118
  }, 0);
106
- }, [alert, keywords]);
119
+ }, [alert, idCode, keywords, search]);
107
120
  (0, react_2.useEffect)(() => {
108
121
  function handle(event) {
109
122
  if (selectedTool === ToolTypes_1.options.databaseRangesSelection.id) {
@@ -125,6 +138,16 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
125
138
  Events_1.default.off('brushEnd', handle);
126
139
  };
127
140
  }, [format, selectedTool]);
141
+ (0, react_2.useEffect)(() => {
142
+ setTimeout(async () => {
143
+ if (databaseInstance.current) {
144
+ const hideLoading = await alert.showLoading(`Loading the database`);
145
+ databaseInstance.current = (0, database_1.initiateDatabase)(databaseDataRef.current, nucleus);
146
+ hideLoading();
147
+ setKeywords({ ...emptyKeywords });
148
+ }
149
+ }, 0);
150
+ }, [alert, nucleus]);
128
151
  const handleChangeDatabase = (0, react_2.useCallback)((databaseKey) => {
129
152
  const database = databases.find((item) => item.key === databaseKey);
130
153
  setTimeout(async () => {
@@ -156,16 +179,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
156
179
  hideLoading();
157
180
  }, 0);
158
181
  }, [alert, databases, nucleus]);
159
- (0, react_2.useEffect)(() => {
160
- setTimeout(async () => {
161
- if (databaseInstance.current) {
162
- const hideLoading = await alert.showLoading(`Loading the database`);
163
- databaseInstance.current = (0, database_1.initiateDatabase)(databaseDataRef.current, nucleus);
164
- hideLoading();
165
- setKeywords({ ...emptyKeywords });
166
- }
167
- }, 0);
168
- }, [alert, nucleus]);
169
182
  (0, react_2.useEffect)(() => {
170
183
  if (item?.isOpen && defaultDatabase && !databaseInstance.current) {
171
184
  handleChangeDatabase(defaultDatabase);
@@ -175,7 +188,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
175
188
  return (0, database_1.prepareData)(result.data);
176
189
  }, [result.data]);
177
190
  const resurrectHandler = (0, react_2.useCallback)((rowData) => {
178
- let { index, baseURL, jcampURL: jcampRelativeURL } = rowData;
191
+ const { index, baseURL, jcampURL: jcampRelativeURL } = rowData;
179
192
  const { ranges, solvent, names = [] } = result.data[index];
180
193
  if (jcampRelativeURL) {
181
194
  const url = new URL(jcampRelativeURL, baseURL);
@@ -236,13 +249,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
236
249
  handleChangeOption(tool);
237
250
  }, [handleChangeOption]);
238
251
  const searchByStructureHandler = (idCodeValue) => {
239
- setTimeout(async () => {
240
- const hideLoading = await alert.showLoading(`Searching in progress...`);
241
- const data = databaseInstance.current?.searchByStructure(idCodeValue) || [];
242
- setResult((prevResult) => ({ ...prevResult, data }));
243
- setIdCode(idCodeValue);
244
- hideLoading();
245
- }, 0);
252
+ setIdCode(idCodeValue);
246
253
  };
247
254
  const openSearchByStructure = () => {
248
255
  modal.show((0, jsx_runtime_1.jsx)(DatabaseStructureSearchModal_1.DatabaseStructureSearchModal, { onChange: searchByStructureHandler, idCode: idCode }), {
@@ -147,7 +147,7 @@ function DatabaseTable({ data, onAdd, onSave, totalCount, }) {
147
147
  },
148
148
  ], [databasePreferences?.allowSaveAsNMRium, onAdd, onSave]);
149
149
  const tableColumns = (0, react_1.useMemo)(() => {
150
- let columns = [...initialColumns];
150
+ const columns = [...initialColumns];
151
151
  for (const col of databaseTableColumns(databasePreferences)) {
152
152
  const { showWhen, ...colParams } = col;
153
153
  if ((0, get_1.default)(databasePreferences, showWhen, false)) {
@@ -18,14 +18,14 @@ exports.hasCouplingConstant = hasCouplingConstant;
18
18
  function getPascal(n, spin) {
19
19
  if (n === undefined || n === 0 || spin === undefined)
20
20
  return [1];
21
- let mult = 2 * spin + 1;
21
+ const mult = 2 * spin + 1;
22
22
  let previousLine = [];
23
23
  for (let j = 0; j < mult - 1; j++)
24
24
  previousLine.push(1);
25
25
  // complete with "1 1" or "1 1 1" for spin 1/2 and 1 respectively
26
26
  for (let i = 0; i < n - 1; i++) {
27
27
  // copy the line
28
- let _line = previousLine.slice();
28
+ const _line = previousLine.slice();
29
29
  for (let j = 1; j < mult; j++) {
30
30
  for (let k = 0; k < previousLine.length - 1; k++) {
31
31
  _line[k + j] += previousLine[k];
@@ -10,7 +10,7 @@ function useToggleStatus(key, data) {
10
10
  const [status, setStatus] = (0, react_1.useState)({});
11
11
  const oldIdRef = (0, react_1.useRef)();
12
12
  (0, react_1.useEffect)(() => {
13
- let statusflags = {};
13
+ const statusflags = {};
14
14
  if (data && Array.isArray(data)) {
15
15
  for (const item of data) {
16
16
  statusflags[item[key]] = false;