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
@@ -7,7 +7,7 @@ interface AlertButtonOptions {
7
7
  }
8
8
  interface ConfirmationDialogProps {
9
9
  style?: CSSProperties;
10
- buttons: Array<AlertButtonOptions>;
10
+ buttons: AlertButtonOptions[];
11
11
  onClose: () => void;
12
12
  message: ReactNode;
13
13
  render?: (data: {
@@ -119,7 +119,9 @@ function Provider({ children, style, offset = '0px', position = positions.MIDDLE
119
119
  .rnd-container {
120
120
  box-sizing: initial;
121
121
  background-color: #fff;
122
- box-shadow: 0 0 0 0, 0 8px 16px rgb(0 0 0 / 30%);
122
+ box-shadow:
123
+ 0 0 0 0,
124
+ 0 8px 16px rgb(0 0 0 / 30%);
123
125
  border-radius: 5px;
124
126
  }
125
127
  `;
@@ -1,25 +1,28 @@
1
1
  export declare const positions: {
2
- TOP_LEFT: string;
3
- TOP_CENTER: string;
4
- TOP_RIGHT: string;
5
- MIDDLE_LEFT: string;
6
- MIDDLE: string;
7
- MIDDLE_RIGHT: string;
8
- BOTTOM_LEFT: string;
9
- BOTTOM_CENTER: string;
10
- BOTTOM_RIGHT: string;
2
+ readonly TOP_LEFT: "top left";
3
+ readonly TOP_CENTER: "top center";
4
+ readonly TOP_RIGHT: "top right";
5
+ readonly MIDDLE_LEFT: "middle left";
6
+ readonly MIDDLE: "middle";
7
+ readonly MIDDLE_RIGHT: "middle right";
8
+ readonly BOTTOM_LEFT: "bottom left";
9
+ readonly BOTTOM_CENTER: "bottom center";
10
+ readonly BOTTOM_RIGHT: "bottom right";
11
11
  };
12
+ export type Position = (typeof positions)[keyof typeof positions];
12
13
  export declare const types: {
13
- INFO: string;
14
- SUCCESS: string;
15
- ERROR: string;
16
- PROGRESS_INDICATOR: string;
14
+ readonly INFO: "info";
15
+ readonly SUCCESS: "success";
16
+ readonly ERROR: "error";
17
+ readonly PROGRESS_INDICATOR: "progress_indicator";
17
18
  };
19
+ export type Type = (typeof types)[keyof typeof types];
18
20
  export declare const transitions: {
19
- FADE: string;
20
- SCALE: string;
21
- SLIDE_RIGHT: string;
22
- SLIDE_LEFT: string;
23
- SLIDE_TOP: string;
24
- SLIDE_BOTTOM: string;
21
+ readonly FADE: "fade";
22
+ readonly SCALE: "scale";
23
+ readonly SLIDE_RIGHT: "slide_right";
24
+ readonly SLIDE_LEFT: "slide_left";
25
+ readonly SLIDE_TOP: "slide_top";
26
+ readonly SLIDE_BOTTOM: "slide_bottom";
25
27
  };
28
+ export type Transition = (typeof transitions)[keyof typeof transitions];
@@ -1,9 +1,9 @@
1
- import { ReactFragment } from 'react';
1
+ /// <reference types="react" />
2
2
  export interface Position {
3
3
  x1: number;
4
4
  x2: number;
5
5
  }
6
- type ChildType = Array<React.ReactElement> | React.ReactElement | ReactFragment | boolean | null;
6
+ type ChildType = React.ReactElement[] | React.ReactElement | boolean | null;
7
7
  export interface ResizerProps {
8
8
  children?: ChildType | ((position: Position, isActive: boolean) => ChildType);
9
9
  initialPosition?: Position;
@@ -1,9 +1,9 @@
1
- import { ReactElement, JSXElementConstructor } from 'react';
1
+ import { ReactElement } from 'react';
2
2
  interface ToggleButtonProps {
3
3
  isActive?: boolean;
4
4
  value?: any;
5
5
  onChange?: (value: any) => null;
6
- children: ReactElement<any, string | JSXElementConstructor<any>>;
6
+ children: ReactElement;
7
7
  isVisible?: boolean;
8
8
  }
9
9
  export default function ToggleButton(props: ToggleButtonProps & {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCallback, useState, useEffect, } from 'react';
2
+ import { useCallback, useState, useEffect } from 'react';
3
3
  import { Toolbar } from 'react-science/ui';
4
4
  export default function ToggleButton(props) {
5
5
  const { children, value = null, isActive = false, onChange = () => null, isVisible = true, id, title, } = props;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Filters } from 'nmr-processing';
3
3
  import { useEffect, useState, memo } from 'react';
4
+ import { Checkbox } from 'react-science/ui';
4
5
  import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
5
6
  import { useDispatch } from '../context/DispatchContext';
6
7
  import ActionButtons from '../elements/ActionButtons';
7
- import CheckBox from '../elements/CheckBox';
8
8
  import Label from '../elements/Label';
9
9
  import Select from '../elements/Select';
10
10
  import { useFilter } from '../hooks/useFilter';
@@ -50,19 +50,14 @@ function ZeroFillingOptionsInnerPanel(props) {
50
50
  }
51
51
  function handleChangeSizeHandler(value) {
52
52
  setSize(value);
53
- dispatchLiveChanges(value);
54
53
  }
55
54
  useEffect(() => {
56
55
  if (livePreview && size) {
57
56
  dispatchLiveChanges(size);
58
57
  }
59
58
  // eslint-disable-next-line react-hooks/exhaustive-deps
60
- }, []);
61
- function checkChangeHandler(event) {
62
- const checked = event.target.checked;
63
- setLivePreview(checked);
64
- }
65
- return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(Select, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", style: headerLabelStyle, children: _jsx(CheckBox, { name: "livePreview", defaultChecked: true, onChange: checkChangeHandler }) }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
59
+ }, [size, livePreview]);
60
+ return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(Select, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), _jsx(Checkbox, { label: "Live preview", checked: livePreview, onChange: setLivePreview }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
66
61
  }
67
62
  const MemoizedZeroFillingOptionsPanel = memo(ZeroFillingOptionsInnerPanel);
68
63
  export default function ZeroFillingOptionsPanel() {
@@ -53,7 +53,7 @@ export declare function useHighlightData(): HighlightContextProps;
53
53
  * @param {Array<string | number>} highlights
54
54
  * @param {SourceData = null} sourceData
55
55
  */
56
- export declare function useHighlight(highlights: (string | number)[], sourceData?: SourceData | null): {
56
+ export declare function useHighlight(highlights: Array<string | number>, sourceData?: SourceData | null): {
57
57
  isActive: boolean;
58
58
  defaultActiveStyle: CSSProperties;
59
59
  onHover: {
@@ -10,7 +10,7 @@ export function useCheckToolsVisibility() {
10
10
  const spectrum = useSpectrum(null);
11
11
  return useCallback((toolKey, checkOptions = {}) => {
12
12
  const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
13
- let flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
13
+ const flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
14
14
  const { spectraOptions, mode } = options[toolKey];
15
15
  const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
16
16
  const spectrumCheckFlag = !checkSpectrumType ||
@@ -31,7 +31,7 @@ function checkSpectrum(spectrum, options) {
31
31
  let innerConditionFlag = true;
32
32
  if (option.active) {
33
33
  if (spectrum) {
34
- for (let { key, value } of option.info || []) {
34
+ for (const { key, value } of option.info || []) {
35
35
  if (spectrum.info[key] !== value) {
36
36
  innerConditionFlag = false;
37
37
  }
@@ -41,7 +41,8 @@ export default function useExport() {
41
41
  setTimeout(() => {
42
42
  void handle();
43
43
  }, 0);
44
- });
44
+ })
45
+ .catch(reportError);
45
46
  }, [alert, preferencesState, state]);
46
47
  const saveAsSVGHandler = useCallback(async () => {
47
48
  if (state.data.length > 0 && rootRef) {
@@ -1,3 +1,3 @@
1
1
  export type ReturnFunction = (value?: number | string, formatKey?: string, prefix?: string, suffix?: string) => string;
2
- export declare function useFormatNumberByNucleus(nucleus?: Array<string>): Array<ReturnFunction>;
2
+ export declare function useFormatNumberByNucleus(nucleus?: string[]): ReturnFunction[];
3
3
  export declare function useFormatNumberByNucleus(nucleus?: string): ReturnFunction;
@@ -1,6 +1,6 @@
1
1
  import has from 'lodash/has';
2
2
  import { useMemo } from 'react';
3
- import { defaultPredictionOptions } from '../../data/PredictionManager';
3
+ import { getDefaultPredictionOptions } from '../../data/PredictionManager';
4
4
  import { usePreferences } from '../context/PreferencesContext';
5
5
  import { getIntegralDefaultValues, getPeaksDefaultValues, getZoneDefaultValues, getRangeDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getSpectraDefaultValues, } from '../reducer/preferences/panelsPreferencesDefaultValues';
6
6
  import { getValue } from '../utility/LocalStorage';
@@ -22,7 +22,7 @@ function getDefaultPreferences(panelKey, nucleus) {
22
22
  case 'multipleSpectraAnalysis':
23
23
  return getMultipleSpectraAnalysisDefaultValues(nucleus);
24
24
  case 'prediction':
25
- return defaultPredictionOptions;
25
+ return getDefaultPredictionOptions();
26
26
  default:
27
27
  return {};
28
28
  }
@@ -27,17 +27,15 @@ export function useSaveSettings() {
27
27
  const { dispatch, current } = usePreferences();
28
28
  const formRef = useRef(null);
29
29
  function addNewWorkspace({ workspaceName }) {
30
- if (settingsRef.current) {
31
- dispatch({
32
- type: 'ADD_WORKSPACE',
33
- payload: {
34
- workspaceKey: workspaceName,
35
- data: settingsRef.current,
36
- },
37
- });
38
- closeDialog();
39
- alert.success('Preferences saved successfully');
40
- }
30
+ dispatch({
31
+ type: 'ADD_WORKSPACE',
32
+ payload: {
33
+ workspaceKey: workspaceName,
34
+ data: settingsRef.current,
35
+ },
36
+ });
37
+ closeDialog();
38
+ alert.success('Preferences saved successfully');
41
39
  }
42
40
  return {
43
41
  saveSettings: (values) => {
@@ -1,2 +1,2 @@
1
1
  import { ScaleLinear } from 'd3';
2
- export declare function useXScale(): ScaleLinear<any, any, never>;
2
+ export declare function useXScale(): ScaleLinear<any, any>;
@@ -1,4 +1,4 @@
1
- import { DataXY, DoubleArray } from 'cheminfo-types';
1
+ import { DataXY } from 'cheminfo-types';
2
2
  export declare enum XYReducerDomainAxis {
3
3
  XAxis = "XAxis",
4
4
  YAxis = "YAxis"
@@ -7,5 +7,5 @@ type XYReducerDomainAxisType = keyof typeof XYReducerDomainAxis;
7
7
  export default function useXYReduce(domainAxis: XYReducerDomainAxisType): (data: {
8
8
  x: Float64Array;
9
9
  y: Float64Array;
10
- }) => DataXY<DoubleArray>;
10
+ }) => DataXY;
11
11
  export {};
@@ -44,6 +44,6 @@ const styles = css `
44
44
  `;
45
45
  function AboutPredictionModal() {
46
46
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
47
- return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About Prediction" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Banfi, D.; Patiny, L.", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', "Chimia, 2008, 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist.", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ". Journal of Magnetic Resonance 2011."] })] }), _jsx("p", { children: "1H NMR prediction was possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Y. Binev, M.M. Marques, J. Aires-de-Sousa,", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: "Prediction of 1H NMR coupling constants with associative neural networks trained for chemical shifts" }), ' ', "J. Chem. Inf. Model. 2007, 47/(6), 2089-2097."] }), _jsxs("li", { children: ["Aires-de-Sousa, M. Hemmer, J. Gasteiger,", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: "\u201C Prediction of 1H NMR Chemical Shifts Using Neural Networks\u201D" }), ", Analytical Chemistry, 2002, 74(1), 80-90."] })] }), _jsx("p", { children: "13 NMR prediction was possible thanks to NMRshiftDB:" }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn.", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components." }), ' ', "Journal of chemical information and computer sciences, 2003, 43(6): 1733-1739."] }) })] }) })] }) })] }));
47
+ return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About Prediction" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }) })] }));
48
48
  }
49
49
  export default AboutPredictionModal;
@@ -0,0 +1,2 @@
1
+ declare function AboutSpectrumSimulationModal(): import("@emotion/react/jsx-runtime").JSX.Element;
2
+ export default AboutSpectrumSimulationModal;
@@ -0,0 +1,49 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import { FaInfo } from 'react-icons/fa';
5
+ import { Modal, useOnOff } from 'react-science/ui';
6
+ import Button from '../elements/Button';
7
+ const styles = css `
8
+ width: 600px;
9
+
10
+ .content {
11
+ padding: 2em;
12
+ }
13
+
14
+ ul {
15
+ list-style-type: disc;
16
+ margin-left: 25px;
17
+ }
18
+
19
+ p,
20
+ li {
21
+ user-select: text;
22
+ font-size: 1.1em;
23
+ }
24
+
25
+ a {
26
+ color: #00bcd4;
27
+ }
28
+
29
+ a:hover,
30
+ a:focus {
31
+ text-decoration: underline;
32
+ }
33
+
34
+ .header span {
35
+ color: #464646;
36
+ font-size: 15px;
37
+ flex: 1;
38
+ user-select: none;
39
+ }
40
+
41
+ p {
42
+ padding: 0.8em 0;
43
+ }
44
+ `;
45
+ function AboutSpectrumSimulationModal() {
46
+ const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
47
+ return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: _jsx(FaInfo, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About spectrum simulation" }) }) }), _jsx(Modal.Body, { children: _jsxs("div", { className: "content", children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }) })] }));
48
+ }
49
+ export default AboutSpectrumSimulationModal;
@@ -11,6 +11,16 @@ import Select from '../elements/Select';
11
11
  import FormikInput from '../elements/formik/FormikInput';
12
12
  import Events from '../utility/Events';
13
13
  import { ModalStyles } from './ModalStyle';
14
+ const labelStyle = {
15
+ label: { flex: 4, fontWeight: '500' },
16
+ wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
17
+ container: { padding: '5px 0' },
18
+ };
19
+ const inputStyle = {
20
+ input: {
21
+ padding: '5px',
22
+ },
23
+ };
14
24
  const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
15
25
  function AlignSpectraModal({ onClose = () => null, nucleus, }) {
16
26
  const refForm = useRef();
@@ -50,6 +60,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
50
60
  ...resValues,
51
61
  });
52
62
  }, [nucleus]);
53
- return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsx(Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, { items: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Number of Peaks : ", children: _jsx(FormikInput, { name: "nbPeaks", type: "number" }) }) }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Target PPM :", children: _jsx(FormikInput, { name: "targetX", type: "number" }) }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
63
+ return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsx(Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of Peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
54
64
  }
55
65
  export default AlignSpectraModal;
@@ -151,7 +151,8 @@ export default function MultipletAnalysisModal({ data, activeSpectrum, scaleX, s
151
151
  return (
152
152
  // eslint-disable-next-line react/no-array-index-key
153
153
  _jsxs("div", { className: "row", children: [_jsxs(Plot, { width: 400, height: 200, svgStyle: { overflow: 'visible' }, seriesViewportStyle: { stroke: 'black' }, children: [_jsx(LineSeries, { data: xyToXYObject(d.multiplet) }), _jsx(Axis, { id: "y", position: "left", tickPosition: "inner", displayPrimaryGridLines: true, hiddenTicks: true, paddingStart: 0.1, paddingEnd: 0.1 }), _jsx(Axis, { id: "x", position: "bottom", tickPosition: "inner", displayPrimaryGridLines: true })] }), _jsx("div", { className: "multiplicity", children: _jsx("p", { children: analysisData.js[index]
154
- ? `${analysisData.js[index]?.multiplicity}: ${analysisData.js[index]?.coupling.toFixed(3)} Hz`
154
+ ? `${analysisData.js[index]
155
+ ?.multiplicity}: ${analysisData.js[index]?.coupling.toFixed(3)} Hz`
155
156
  : '' }) }), _jsxs(Plot, { width: 400, height: 200, seriesViewportStyle: { stroke: 'black' }, children: [_jsx(LineSeries, { data: xyToXYObject(d.errorFunction), lineStyle: { strokeWidth: 1 } }), _jsx(Axis, { id: "y", position: "left", tickPosition: "inner", displayPrimaryGridLines: true, hiddenTicks: true, paddingStart: 0.1, paddingEnd: 0.1 }), _jsx(Axis, { id: "x", position: "bottom", tickPosition: "inner", displayPrimaryGridLines: true })] })] }, index));
156
157
  }) })] }));
157
158
  }
@@ -3,6 +3,5 @@ interface PredictSpectraModalProps {
3
3
  onClose?: (element?: string) => void;
4
4
  molecule: StateMoleculeExtended;
5
5
  }
6
- declare function PredictSpectraModal({ onClose, molecule, }: PredictSpectraModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
- export declare function usePredictSpectraModal(): (molecule: StateMoleculeExtended) => void;
6
+ export declare function PredictSpectraModal({ onClose, molecule, }: PredictSpectraModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
7
  export default PredictSpectraModal;
@@ -1,17 +1,15 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
+ import { SvgNmrFt } from 'cheminfo-font';
4
5
  import { useCallback, useRef, useState, useMemo } from 'react';
5
- import { defaultPredictionOptions, predictSpectra, } from '../../data/PredictionManager';
6
+ import { Checkbox, Modal, useOnOff } from 'react-science/ui';
7
+ import { getDefaultPredictionOptions, predictSpectra, } from '../../data/PredictionManager';
6
8
  import { useChartData } from '../context/ChartContext';
7
9
  import { useDispatch } from '../context/DispatchContext';
8
10
  import { useLogger } from '../context/LoggerContext';
9
11
  import Button from '../elements/Button';
10
- import CheckBox from '../elements/CheckBox';
11
- import CloseButton from '../elements/CloseButton';
12
12
  import { useAlert } from '../elements/popup/Alert';
13
- import { useModal } from '../elements/popup/Modal';
14
- import { positions } from '../elements/popup/options';
15
13
  import PredictionPreferences from '../panels/predictionPanel/PredictionOptionsPanel';
16
14
  import { useStateWithLocalStorage } from '../utility/LocalStorage';
17
15
  import { ModalStyles } from './ModalStyle';
@@ -36,24 +34,30 @@ const styles = css `
36
34
  margin: 5px 5px 5px 0;
37
35
  }
38
36
  }
37
+
38
+ .header {
39
+ padding: 0;
40
+ margin: 0 30%;
41
+ width: 40%;
42
+ }
39
43
  `;
40
- function PredictSpectraModal({ onClose = () => null, molecule, }) {
44
+ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
45
+ const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
41
46
  const refForm = useRef();
42
47
  const dispatch = useDispatch();
43
48
  const alert = useAlert();
44
- const [isApproved, setApproved] = useState(false);
45
49
  const [predictionPreferences, setPredictionPreferences] = useStateWithLocalStorage('nmrium-prediction-preferences');
50
+ const { isApproved: isAgree = false, ...options } = predictionPreferences;
51
+ const [isApproved, setApproved] = useState(isAgree);
46
52
  const { toolOptions: { data: { predictionIndex }, }, } = useChartData();
47
53
  const handleSave = useCallback(() => {
48
54
  refForm.current.submitForm();
49
55
  }, []);
50
56
  const initValues = useMemo(() => {
51
- const { isApproved: isAgree, ...options } = predictionPreferences;
52
- setApproved(isAgree);
53
- return Object.assign(defaultPredictionOptions, options, {
57
+ return Object.assign(getDefaultPredictionOptions(), options, {
54
58
  name: `Prediction ${predictionIndex + 1}`,
55
59
  });
56
- }, [predictionPreferences, predictionIndex]);
60
+ }, [options, predictionIndex]);
57
61
  const { logger } = useLogger();
58
62
  const submitHandler = useCallback((values) => {
59
63
  void (async () => {
@@ -66,12 +70,15 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
66
70
  predictedSpectra.push(key);
67
71
  }
68
72
  }
73
+ onClose();
74
+ closeDialog();
69
75
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
70
76
  try {
71
- const data = await predictSpectra(molfile, logger);
77
+ const data = await predictSpectra(molfile);
72
78
  dispatch({
73
79
  type: 'PREDICT_SPECTRA',
74
80
  payload: {
81
+ logger,
75
82
  predictedSpectra: data.spectra,
76
83
  options: values,
77
84
  molecule,
@@ -83,7 +90,6 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
83
90
  }
84
91
  finally {
85
92
  hideLoading();
86
- onClose();
87
93
  }
88
94
  }
89
95
  })();
@@ -95,20 +101,11 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
95
101
  onClose,
96
102
  logger,
97
103
  setPredictionPreferences,
104
+ closeDialog,
98
105
  ]);
99
- const approveCheckHandler = useCallback((e) => {
100
- setApproved(e.target.checked);
101
- }, []);
102
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Prediction of NMR spectrum" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content", children: [_jsx(PredictionPreferences, { onSubmit: submitHandler, options: initValues, ref: refForm }), _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." }), _jsxs("div", { className: "warning-container", children: [_jsx(CheckBox, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), _jsx("p", { children: "I confirm that the chemical structure is not confidential." })] })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }));
103
- }
104
- export function usePredictSpectraModal() {
105
- const modal = useModal();
106
- return (molecule) => {
107
- modal.show(_jsx(PredictSpectraModal, { molecule: molecule }), {
108
- position: positions.TOP_CENTER,
109
- enableResizing: true,
110
- width: 600,
111
- });
112
- };
106
+ return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: openDialog, toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: _jsx(SvgNmrFt, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
107
+ onClose();
108
+ closeDialog();
109
+ }, width: 600, maxWidth: 1000, children: _jsxs("div", { css: [ModalStyles, styles], children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header handle", children: _jsx("span", { children: "Prediction of NMR spectrum" }) }) }), _jsxs("div", { className: "inner-content", children: [_jsx(PredictionPreferences, { onSubmit: submitHandler, options: initValues, ref: refForm }), _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." }), _jsx("div", { className: "warning-container", children: _jsx(Checkbox, { onChange: setApproved, checked: isApproved, label: "I confirm that the chemical structure is not confidential." }, String(isApproved)) })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }) })] }));
113
110
  }
114
111
  export default PredictSpectraModal;
@@ -89,7 +89,7 @@ export default function ChangeSumModal({ onSave, onClose, header, sumOptions, })
89
89
  }
90
90
  else {
91
91
  setActiveOption(SumSetOptions.Manual);
92
- formRef.current.setValues({ sum: sumOptions?.sum || '', molecule: null });
92
+ formRef.current.setValues({ sum: sumOptions?.sum ?? '', molecule: null });
93
93
  }
94
94
  }, [panels?.structuresPanel, sumOptions]);
95
95
  function saveHandler(values) {
@@ -91,7 +91,7 @@ function SignalsForm({ range, preferences }) {
91
91
  : 'addSignalTab');
92
92
  }, [setFieldValue, values.signals.length]);
93
93
  const tabContainsErrors = useCallback((i) => {
94
- return !!(errors?.signals && errors?.signals[i]);
94
+ return !!errors?.signals?.[i];
95
95
  }, [errors]);
96
96
  const signalFormTabs = useMemo(() => {
97
97
  const signalTabs = values.signals.length > 0
@@ -25,7 +25,7 @@ const tabStyles = css `
25
25
  function SignalsForm() {
26
26
  const { values, setFieldValue, errors, } = useFormikContext();
27
27
  const tabContainsErrors = useCallback((i) => {
28
- return !!(errors?.signals && errors?.signals[i]);
28
+ return !!errors?.signals?.[i];
29
29
  }, [errors]);
30
30
  const signalFormTabs = useMemo(() => {
31
31
  const signalTabs = values.signals.length > 0
@@ -115,7 +115,7 @@ function MetaImportationModal({ onClose, file }) {
115
115
  return columns;
116
116
  }, [parseResult?.meta.fields]);
117
117
  function handleLinkSpectra(fields) {
118
- let { source, target } = fields;
118
+ const { source, target } = fields;
119
119
  if (data && parseResult) {
120
120
  try {
121
121
  const { compareResult, matches } = linkMetaWithSpectra({
@@ -58,6 +58,10 @@ const LIST = [
58
58
  label: 'Matrix generation Panel',
59
59
  name: 'panels.matrixGenerationPanel',
60
60
  },
61
+ {
62
+ label: 'Simulation panel',
63
+ name: 'panels.simulationPanel',
64
+ },
61
65
  ];
62
66
  const COLUMNS = [
63
67
  {
@@ -53,7 +53,7 @@ function FormattingTabContent() {
53
53
  const { values, setFieldValue } = useFormikContext();
54
54
  const nuclei = lodashGet(values, 'formatting.nuclei', {});
55
55
  function deleteHandler(key) {
56
- let _nuclei = {};
56
+ const _nuclei = {};
57
57
  for (const nucleus in nuclei) {
58
58
  if (nucleus !== key) {
59
59
  _nuclei[nucleus] = nuclei[nucleus];
@@ -64,6 +64,13 @@ function InfoBlockTabContent() {
64
64
  return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
65
65
  },
66
66
  },
67
+ {
68
+ Header: 'Format',
69
+ style: { padding: 0, ...styles.column },
70
+ Cell: ({ row }) => {
71
+ return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.format`, style: { input: styles.input } }));
72
+ },
73
+ },
67
74
  {
68
75
  Header: 'Visible',
69
76
  style: { width: '30px', ...styles.column },
@@ -71,11 +78,11 @@ function InfoBlockTabContent() {
71
78
  },
72
79
  {
73
80
  Header: '',
74
- style: { width: '30px', ...styles.column },
81
+ style: { width: '70px', ...styles.column },
75
82
  id: 'add-button',
76
83
  Cell: ({ data, row }) => {
77
84
  const record = row.original;
78
- return (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => addHandler(data, row.index + 1), children: _jsx(FaPlus, {}) }), !record?.name && (_jsx(Button.Danger, { fill: "outline", onClick: () => deleteHandler(data, row.index), children: _jsx(FaTimes, {}) }))] }));
85
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => addHandler(data, row.index + 1), children: _jsx(FaPlus, {}) }), !record?.name && (_jsx(Button.Danger, { fill: "outline", onClick: () => deleteHandler(data, row.index), children: _jsx(FaTimes, {}) }))] }));
79
86
  },
80
87
  },
81
88
  ], [addHandler, datalist, deleteHandler, paths]);
@@ -13,7 +13,7 @@ const formattingValidation = (obj) => object().shape({
13
13
  nuclei: object()
14
14
  .shape(formattingElementValidation(obj))
15
15
  .test('Unique', 'Nuclei need te be unique', function check(nuclei) {
16
- let nucleusFrequencies = {};
16
+ const nucleusFrequencies = {};
17
17
  for (const key of Object.keys(nuclei)) {
18
18
  const _key = nuclei[key].name?.toLowerCase() || '';
19
19
  if (_key) {
@@ -30,7 +30,7 @@ const formattingValidation = (obj) => object().shape({
30
30
  for (const key in nucleusFrequencies) {
31
31
  const { value, fields } = nucleusFrequencies[key];
32
32
  if (value > 1) {
33
- for (let field of fields) {
33
+ for (const field of fields) {
34
34
  errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
35
35
  }
36
36
  }
@@ -3,6 +3,6 @@ export interface IntegralPanelInnerProps {
3
3
  integrals: Integrals;
4
4
  info: Info1D;
5
5
  activeTab: string;
6
- xDomain: Array<number>;
6
+ xDomain: number[];
7
7
  }
8
8
  export default function IntegralPanel(): import("@emotion/react/jsx-runtime").JSX.Element;