nmrium 0.39.0 → 0.41.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 (306) 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/tools/BrushXY.js +10 -7
  15. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  16. package/lib/component/2d/FooterBanner.js +3 -2
  17. package/lib/component/2d/Viewer2D.js +51 -29
  18. package/lib/component/2d/XAxis.js +1 -1
  19. package/lib/component/2d/YAxis.js +1 -1
  20. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  21. package/lib/component/2d/utilities/scale.d.ts +5 -5
  22. package/lib/component/2d/zones/Signal.js +1 -2
  23. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  24. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  25. package/lib/component/NMRium.d.ts +2 -2
  26. package/lib/component/NMRium.js +39 -26
  27. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  28. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  29. package/lib/component/context/LoggerContext.js +11 -6
  30. package/lib/component/elements/InputRange.js +1 -1
  31. package/lib/component/elements/MenuButton.d.ts +1 -1
  32. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  33. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  34. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  35. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  36. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  37. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  38. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  39. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  40. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  41. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  42. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +8 -0
  43. package/lib/component/elements/popup/Alert/AlertBlock.js +30 -0
  44. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  45. package/lib/component/elements/popup/Alert/Context.js +6 -2
  46. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  47. package/lib/component/elements/popup/Alert/Provider.js +5 -23
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  49. package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  50. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  51. package/lib/component/elements/popup/options.d.ts +22 -19
  52. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  53. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  54. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  55. package/lib/component/header/Header.js +2 -2
  56. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  57. package/lib/component/highlight/index.d.ts +1 -1
  58. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  59. package/lib/component/hooks/useExport.js +2 -1
  60. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  61. package/lib/component/hooks/usePanelPreferences.js +2 -2
  62. package/lib/component/hooks/useXScale.d.ts +1 -1
  63. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  64. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  65. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  66. package/lib/component/modal/AboutUsModal.js +4 -2
  67. package/lib/component/modal/AlignSpectraModal.js +11 -1
  68. package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
  69. package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
  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/GeneralSettings.js +28 -27
  78. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  79. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  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 +19 -19
  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/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  89. package/lib/component/panels/Panels.js +13 -0
  90. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  91. package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
  92. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
  93. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  94. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  95. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  96. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  97. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  99. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  100. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  101. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  102. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  103. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  104. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  105. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  106. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  107. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  112. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  113. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  114. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  115. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  116. package/lib/component/reducer/Reducer.d.ts +13 -12
  117. package/lib/component/reducer/Reducer.js +251 -239
  118. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  119. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  120. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  121. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  122. package/lib/component/reducer/actions/DomainActions.js +30 -1
  123. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
  126. package/lib/component/reducer/actions/MoleculeActions.js +51 -2
  127. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  128. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  129. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  130. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  131. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  132. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  133. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  134. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  135. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  136. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  137. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  138. package/lib/component/utility/export.d.ts +5 -4
  139. package/lib/component/utility/export.js +33 -61
  140. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  141. package/lib/component/utility/getUniqueNuclei.js +1 -1
  142. package/lib/component/utility/jpathToArray.js +1 -1
  143. package/lib/component/workspaces/index.d.ts +1 -0
  144. package/lib/component/workspaces/index.js +2 -0
  145. package/lib/component/workspaces/simulation.d.ts +2 -0
  146. package/lib/component/workspaces/simulation.js +68 -0
  147. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  148. package/lib/data/PredictionManager.d.ts +8 -7
  149. package/lib/data/PredictionManager.js +95 -22
  150. package/lib/data/SpectraManager.js +1 -1
  151. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  152. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  154. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  156. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  157. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  158. package/lib/data/data1d/database.d.ts +5 -5
  159. package/lib/data/data1d/database.js +3 -3
  160. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  161. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  162. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  163. package/lib/data/data1d/spectrumSimulation.js +53 -0
  164. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  165. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  166. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  167. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  168. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  169. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  170. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  171. package/lib/data/matrixGeneration.js +1 -1
  172. package/lib/data/molecules/MoleculeManager.d.ts +1 -1
  173. package/lib/data/molecules/MoleculeManager.js +7 -7
  174. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  175. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  176. package/lib/data/utilities/FindUtilities.js +4 -4
  177. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  178. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  179. package/lib/data/utilities/calculateSanPlot.js +3 -3
  180. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  181. package/lib/utils/clipboard/clipboard.d.ts +12 -0
  182. package/lib/utils/clipboard/clipboard.js +15 -0
  183. package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
  184. package/lib/utils/clipboard/clipboardComponents.js +150 -0
  185. package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
  186. package/lib/utils/clipboard/clipboardHooks.js +142 -0
  187. package/lib/utils/clipboard/types.d.ts +1 -0
  188. package/lib/utils/clipboard/types.js +1 -0
  189. package/lib/versionInfo.js +1 -1
  190. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  191. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  192. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  193. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  194. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  195. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  196. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  197. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  198. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  199. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  200. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  201. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  202. package/lib-cjs/component/2d/XAxis.js +1 -1
  203. package/lib-cjs/component/2d/YAxis.js +1 -1
  204. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  205. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  206. package/lib-cjs/component/NMRium.js +37 -24
  207. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  208. package/lib-cjs/component/context/LoggerContext.js +10 -5
  209. package/lib-cjs/component/elements/InputRange.js +1 -1
  210. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  211. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +36 -0
  212. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  213. package/lib-cjs/component/elements/popup/Alert/Provider.js +4 -22
  214. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  215. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  216. package/lib-cjs/component/header/Header.js +2 -2
  217. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  218. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  219. package/lib-cjs/component/hooks/useExport.js +2 -1
  220. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  221. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  222. package/lib-cjs/component/modal/AboutUsModal.js +4 -2
  223. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  224. package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
  225. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  226. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  227. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  228. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  229. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +28 -27
  232. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  233. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  235. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  236. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -18
  237. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  238. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  239. package/lib-cjs/component/panels/Panels.js +13 -0
  240. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  241. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
  242. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
  243. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  244. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  245. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  246. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  247. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  248. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  249. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  250. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  251. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  252. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  253. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  254. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  255. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  256. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  257. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  258. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  259. package/lib-cjs/component/reducer/Reducer.js +251 -239
  260. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  261. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  262. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  263. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  264. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  265. package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
  266. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  267. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  268. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  269. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  270. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  271. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  272. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  273. package/lib-cjs/component/utility/export.js +33 -63
  274. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  275. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  276. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  277. package/lib-cjs/component/workspaces/index.js +2 -0
  278. package/lib-cjs/component/workspaces/simulation.js +71 -0
  279. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
  280. package/lib-cjs/data/PredictionManager.js +96 -22
  281. package/lib-cjs/data/SpectraManager.js +1 -1
  282. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  283. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  284. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  285. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  286. package/lib-cjs/data/data1d/database.js +3 -3
  287. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  288. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  289. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  290. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  291. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  292. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  293. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  294. package/lib-cjs/data/matrixGeneration.js +1 -1
  295. package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
  296. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  297. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  298. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  299. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  300. package/lib-cjs/utils/clipboard/clipboard.js +23 -0
  301. package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
  302. package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
  303. package/lib-cjs/utils/clipboard/types.js +2 -0
  304. package/lib-cjs/versionInfo.js +1 -1
  305. package/package.json +26 -25
  306. package/lib/component/header/LogsHistory.d.ts +0 -1
@@ -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;
@@ -12,6 +12,7 @@ import { Header } from '../elements/Header';
12
12
  import DropDownButton from '../elements/dropDownButton/DropDownButton';
13
13
  import { useSaveSettings } from '../hooks/useSaveSettings';
14
14
  import AboutUsModal from '../modal/AboutUsModal';
15
+ import { LogsHistoryModal } from '../modal/LogsHistoryModal';
15
16
  import GeneralSettingsModal from '../modal/setting/GeneralSettings';
16
17
  import WorkspaceItem from '../modal/setting/WorkspaceItem';
17
18
  import { options } from '../toolbar/ToolTypes';
@@ -19,7 +20,6 @@ import ApodizationOptionsPanel from './ApodizationOptionsPanel';
19
20
  import AutoPeakPickingOptionPanel from './AutoPeakPickingOptionPanel';
20
21
  import BaseLineCorrectionPanel from './BaseLineCorrectionPanel';
21
22
  import { HeaderContainer } from './HeaderContainer';
22
- import { LogsHistory } from './LogsHistory';
23
23
  import PhaseCorrectionPanel from './PhaseCorrectionPanel';
24
24
  import RangesPickingOptionPanel from './RangesPickingOptionPanel';
25
25
  import ZeroFillingOptionsPanel from './ZeroFillingOptionsPanel';
@@ -100,7 +100,7 @@ function HeaderInner(props) {
100
100
  alignItems: 'center',
101
101
  }, children: [_jsx("div", { children: _jsx(Toolbar, { orientation: "horizontal", children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
102
102
  alignItems: 'center',
103
- }, children: [!hideGeneralSettings && (_jsxs(_Fragment, { children: [_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), _jsx(SaveButton, {})] })), !general?.hideLogs && _jsx(LogsHistory, {}), _jsx("div", { children: _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
103
+ }, children: [!hideGeneralSettings && (_jsxs(_Fragment, { children: [_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), _jsx(SaveButton, {})] })), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
104
104
  }
105
105
  function SaveButton() {
106
106
  const { workspace, workspaces, originalWorkspaces } = usePreferences();
@@ -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
  }
@@ -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 {};
@@ -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: ["Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems. Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist Journal of Magnetic Resonance 2011.", _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "10.1016/j.jmr.2010.12.008" })] }) })] }) })] }) })] }));
48
+ }
49
+ export default AboutSpectrumSimulationModal;
@@ -6,6 +6,9 @@ import { Modal, Toolbar, useOnOff } from 'react-science/ui';
6
6
  import versionInfo from '../../versionInfo';
7
7
  import Logo from '../elements/Logo';
8
8
  const styles = css `
9
+ width: 40vw;
10
+ min-width: 500px;
11
+
9
12
  button:focus {
10
13
  outline: none;
11
14
  }
@@ -82,7 +85,6 @@ const styles = css `
82
85
  display: flex;
83
86
  flex-direction: column;
84
87
  user-select: none;
85
- width: 500px;
86
88
  `;
87
89
  function AboutUsModal() {
88
90
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
@@ -90,7 +92,7 @@ function AboutUsModal() {
90
92
  display: 'flex',
91
93
  alignItems: 'center',
92
94
  justifyContent: 'center',
93
- }, children: _jsx(SvgLogoNmrium, {}) }) }), _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 NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
95
+ }, children: _jsx(SvgLogoNmrium, {}) }) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
94
96
  }
95
97
  export default AboutUsModal;
96
98
  function VersionInfo() {
@@ -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;
@@ -0,0 +1,6 @@
1
+ interface LogsHistoryModalProps {
2
+ autoOpen?: boolean;
3
+ onClose?: () => void;
4
+ }
5
+ export declare function LogsHistoryModal(props: LogsHistoryModalProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -47,9 +47,10 @@ function getMaxLevelLogs(logs, lastReadLogId) {
47
47
  }
48
48
  return { backgroundColor, count: logsCounts[maxLevel] };
49
49
  }
50
- export function LogsHistory() {
50
+ export function LogsHistoryModal(props) {
51
+ const { autoOpen = false, onClose } = props;
51
52
  const { logsHistory, logger, markAsRead, lastReadLogId } = useLogger();
52
- const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
53
+ const [isOpenDialog, openDialog, closeDialog] = useOnOff(autoOpen);
53
54
  const { count, backgroundColor } = getMaxLevelLogs(logsHistory, lastReadLogId);
54
55
  const COLUMNS = useMemo(() => [
55
56
  {
@@ -88,7 +89,7 @@ export function LogsHistory() {
88
89
  },
89
90
  ], [lastReadLogId]);
90
91
  const sortedLogs = logsHistory.slice().sort((a, b) => b.time - a.time);
91
- return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: () => {
92
+ return (_jsxs(_Fragment, { children: [!autoOpen && (_jsx(Button.BarButton, { onClick: () => {
92
93
  openDialog();
93
94
  }, children: _jsxs("div", { style: { position: 'relative' }, children: [_jsx(IoBugOutline, { fontSize: "1.4em" }), count && (_jsx("span", { style: {
94
95
  position: 'absolute',
@@ -99,8 +100,9 @@ export function LogsHistory() {
99
100
  minWidth: '14px',
100
101
  fontSize: '0.75em',
101
102
  color: 'white',
102
- }, children: count }))] }) }), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
103
+ }, children: count }))] }) })), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
103
104
  markAsRead();
104
105
  closeDialog();
106
+ onClose?.();
105
107
  }, children: [_jsx(Modal.Header, { children: "Logs History " }), _jsx(Modal.Body, { children: _jsx("div", { style: { width: '50vw', height: '50vh', padding: '0.5em' }, children: _jsx(ReactTable, { columns: COLUMNS, data: sortedLogs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle }) }) }), _jsx(Modal.Footer, { children: _jsx(Button.Danger, { onClick: () => logger.clear(), fill: "outline", children: _jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(FaRegTrashAlt, {}), _jsx("span", { style: { paddingLeft: '5px' }, children: "Clear Logs" })] }) }) })] })] }));
106
108
  }
@@ -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({