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
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
+ /** @jsxImportSource @emotion/react */
8
+ const react_1 = require("@emotion/react");
9
+ const fa_1 = require("react-icons/fa");
10
+ const ui_1 = require("react-science/ui");
11
+ const Button_1 = __importDefault(require("../elements/Button"));
12
+ const styles = (0, react_1.css) `
13
+ width: 600px;
14
+
15
+ .content {
16
+ padding: 2em;
17
+ }
18
+
19
+ ul {
20
+ list-style-type: disc;
21
+ margin-left: 25px;
22
+ }
23
+
24
+ p,
25
+ li {
26
+ user-select: text;
27
+ font-size: 1.1em;
28
+ }
29
+
30
+ a {
31
+ color: #00bcd4;
32
+ }
33
+
34
+ a:hover,
35
+ a:focus {
36
+ text-decoration: underline;
37
+ }
38
+
39
+ .header span {
40
+ color: #464646;
41
+ font-size: 15px;
42
+ flex: 1;
43
+ user-select: none;
44
+ }
45
+
46
+ p {
47
+ padding: 0.8em 0;
48
+ }
49
+ `;
50
+ function AboutSpectrumSimulationModal() {
51
+ const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
52
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: openDialog, tooltipOrientation: "horizontal", toolTip: "About Prediction", children: (0, jsx_runtime_1.jsx)(fa_1.FaInfo, {}) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About spectrum simulation" }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsxs)("div", { className: "content", children: [(0, jsx_runtime_1.jsx)("p", { children: "If you are using our tools please cite us:" }), (0, jsx_runtime_1.jsx)("ul", { children: (0, jsx_runtime_1.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.", (0, jsx_runtime_1.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" })] }) })] }) })] }) })] }));
53
+ }
54
+ exports.default = AboutSpectrumSimulationModal;
@@ -11,6 +11,9 @@ const ui_1 = require("react-science/ui");
11
11
  const versionInfo_1 = __importDefault(require("../../versionInfo"));
12
12
  const Logo_1 = __importDefault(require("../elements/Logo"));
13
13
  const styles = (0, react_1.css) `
14
+ width: 40vw;
15
+ min-width: 500px;
16
+
14
17
  button:focus {
15
18
  outline: none;
16
19
  }
@@ -87,7 +90,6 @@ const styles = (0, react_1.css) `
87
90
  display: flex;
88
91
  flex-direction: column;
89
92
  user-select: none;
90
- width: 500px;
91
93
  `;
92
94
  function AboutUsModal() {
93
95
  const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
@@ -95,7 +97,7 @@ function AboutUsModal() {
95
97
  display: 'flex',
96
98
  alignItems: 'center',
97
99
  justifyContent: 'center',
98
- }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.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)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
100
+ }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.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)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
99
101
  }
100
102
  exports.default = AboutUsModal;
101
103
  function VersionInfo() {
@@ -16,6 +16,16 @@ const Select_1 = __importDefault(require("../elements/Select"));
16
16
  const FormikInput_1 = __importDefault(require("../elements/formik/FormikInput"));
17
17
  const Events_1 = __importDefault(require("../utility/Events"));
18
18
  const ModalStyle_1 = require("./ModalStyle");
19
+ const labelStyle = {
20
+ label: { flex: 4, fontWeight: '500' },
21
+ wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
22
+ container: { padding: '5px 0' },
23
+ };
24
+ const inputStyle = {
25
+ input: {
26
+ padding: '5px',
27
+ },
28
+ };
19
29
  const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
20
30
  function AlignSpectraModal({ onClose = () => null, nucleus, }) {
21
31
  const refForm = (0, react_1.useRef)();
@@ -55,6 +65,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
55
65
  ...resValues,
56
66
  });
57
67
  }, [nucleus]);
58
- return ((0, jsx_runtime_1.jsxs)("div", { css: ModalStyle_1.ModalStyles, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Spectra calibration" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsx)("div", { className: "inner-content", style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Options :" }), (0, jsx_runtime_1.jsx)(Select_1.default, { items: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Range :" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "From : ", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "from", type: "number" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To : ", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "to", type: "number" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: " margin-10", children: (0, jsx_runtime_1.jsx)(Label_1.default, { className: "custom-label", title: "Number of Peaks : ", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "nbPeaks", type: "number" }) }) }), (0, jsx_runtime_1.jsx)("div", { className: " margin-10", children: (0, jsx_runtime_1.jsx)(Label_1.default, { className: "custom-label", title: "Target PPM :", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "targetX", type: "number" }) }) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, children: "Done" }) })] }));
68
+ return ((0, jsx_runtime_1.jsxs)("div", { css: ModalStyle_1.ModalStyles, children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Spectra calibration" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsx)("div", { className: "inner-content", style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Options", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Range", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Peaks", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "nbPeaks", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Target PPM", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "targetX", type: "number", style: inputStyle }) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, children: "Done" }) })] }));
59
69
  }
60
70
  exports.default = AlignSpectraModal;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LogsHistory = void 0;
6
+ exports.LogsHistoryModal = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const fa_1 = require("react-icons/fa");
@@ -53,9 +53,10 @@ function getMaxLevelLogs(logs, lastReadLogId) {
53
53
  }
54
54
  return { backgroundColor, count: logsCounts[maxLevel] };
55
55
  }
56
- function LogsHistory() {
56
+ function LogsHistoryModal(props) {
57
+ const { autoOpen = false, onClose } = props;
57
58
  const { logsHistory, logger, markAsRead, lastReadLogId } = (0, LoggerContext_1.useLogger)();
58
- const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
59
+ const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(autoOpen);
59
60
  const { count, backgroundColor } = getMaxLevelLogs(logsHistory, lastReadLogId);
60
61
  const COLUMNS = (0, react_1.useMemo)(() => [
61
62
  {
@@ -94,7 +95,7 @@ function LogsHistory() {
94
95
  },
95
96
  ], [lastReadLogId]);
96
97
  const sortedLogs = logsHistory.slice().sort((a, b) => b.time - a.time);
97
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: () => {
98
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!autoOpen && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: () => {
98
99
  openDialog();
99
100
  }, children: (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative' }, children: [(0, jsx_runtime_1.jsx)(io5_1.IoBugOutline, { fontSize: "1.4em" }), count && ((0, jsx_runtime_1.jsx)("span", { style: {
100
101
  position: 'absolute',
@@ -105,9 +106,10 @@ function LogsHistory() {
105
106
  minWidth: '14px',
106
107
  fontSize: '0.75em',
107
108
  color: 'white',
108
- }, children: count }))] }) }), (0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
109
+ }, children: count }))] }) })), (0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
109
110
  markAsRead();
110
111
  closeDialog();
112
+ onClose?.();
111
113
  }, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: "Logs History " }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)("div", { style: { width: '50vw', height: '50vh', padding: '0.5em' }, children: (0, jsx_runtime_1.jsx)(ReactTable_1.default, { columns: COLUMNS, data: sortedLogs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Footer, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Danger, { onClick: () => logger.clear(), fill: "outline", children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '5px' }, children: "Clear Logs" })] }) }) })] })] }));
112
114
  }
113
- exports.LogsHistory = LogsHistory;
115
+ exports.LogsHistoryModal = LogsHistoryModal;
@@ -156,7 +156,8 @@ function MultipletAnalysisModal({ data, activeSpectrum, scaleX, startX, endX, on
156
156
  return (
157
157
  // eslint-disable-next-line react/no-array-index-key
158
158
  (0, jsx_runtime_1.jsxs)("div", { className: "row", children: [(0, jsx_runtime_1.jsxs)(react_plot_1.Plot, { width: 400, height: 200, svgStyle: { overflow: 'visible' }, seriesViewportStyle: { stroke: 'black' }, children: [(0, jsx_runtime_1.jsx)(react_plot_1.LineSeries, { data: (0, ml_spectra_processing_1.xyToXYObject)(d.multiplet) }), (0, jsx_runtime_1.jsx)(react_plot_1.Axis, { id: "y", position: "left", tickPosition: "inner", displayPrimaryGridLines: true, hiddenTicks: true, paddingStart: 0.1, paddingEnd: 0.1 }), (0, jsx_runtime_1.jsx)(react_plot_1.Axis, { id: "x", position: "bottom", tickPosition: "inner", displayPrimaryGridLines: true })] }), (0, jsx_runtime_1.jsx)("div", { className: "multiplicity", children: (0, jsx_runtime_1.jsx)("p", { children: analysisData.js[index]
159
- ? `${analysisData.js[index]?.multiplicity}: ${analysisData.js[index]?.coupling.toFixed(3)} Hz`
159
+ ? `${analysisData.js[index]
160
+ ?.multiplicity}: ${analysisData.js[index]?.coupling.toFixed(3)} Hz`
160
161
  : '' }) }), (0, jsx_runtime_1.jsxs)(react_plot_1.Plot, { width: 400, height: 200, seriesViewportStyle: { stroke: 'black' }, children: [(0, jsx_runtime_1.jsx)(react_plot_1.LineSeries, { data: (0, ml_spectra_processing_1.xyToXYObject)(d.errorFunction), lineStyle: { strokeWidth: 1 } }), (0, jsx_runtime_1.jsx)(react_plot_1.Axis, { id: "y", position: "left", tickPosition: "inner", displayPrimaryGridLines: true, hiddenTicks: true, paddingStart: 0.1, paddingEnd: 0.1 }), (0, jsx_runtime_1.jsx)(react_plot_1.Axis, { id: "x", position: "bottom", tickPosition: "inner", displayPrimaryGridLines: true })] })] }, index));
161
162
  }) })] }));
162
163
  }
@@ -3,21 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.usePredictSpectraModal = void 0;
6
+ exports.PredictSpectraModal = void 0;
7
7
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
8
  /** @jsxImportSource @emotion/react */
9
9
  const react_1 = require("@emotion/react");
10
+ const cheminfo_font_1 = require("cheminfo-font");
10
11
  const react_2 = require("react");
12
+ const ui_1 = require("react-science/ui");
11
13
  const PredictionManager_1 = require("../../data/PredictionManager");
12
14
  const ChartContext_1 = require("../context/ChartContext");
13
15
  const DispatchContext_1 = require("../context/DispatchContext");
14
16
  const LoggerContext_1 = require("../context/LoggerContext");
15
17
  const Button_1 = __importDefault(require("../elements/Button"));
16
- const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
17
- const CloseButton_1 = __importDefault(require("../elements/CloseButton"));
18
18
  const Alert_1 = require("../elements/popup/Alert");
19
- const Modal_1 = require("../elements/popup/Modal");
20
- const options_1 = require("../elements/popup/options");
21
19
  const PredictionOptionsPanel_1 = __importDefault(require("../panels/predictionPanel/PredictionOptionsPanel"));
22
20
  const LocalStorage_1 = require("../utility/LocalStorage");
23
21
  const ModalStyle_1 = require("./ModalStyle");
@@ -42,24 +40,30 @@ const styles = (0, react_1.css) `
42
40
  margin: 5px 5px 5px 0;
43
41
  }
44
42
  }
43
+
44
+ .header {
45
+ padding: 0;
46
+ margin: 0 30%;
47
+ width: 40%;
48
+ }
45
49
  `;
46
50
  function PredictSpectraModal({ onClose = () => null, molecule, }) {
51
+ const [isOpenDialog, openDialog, closeDialog] = (0, ui_1.useOnOff)(false);
47
52
  const refForm = (0, react_2.useRef)();
48
53
  const dispatch = (0, DispatchContext_1.useDispatch)();
49
54
  const alert = (0, Alert_1.useAlert)();
50
- const [isApproved, setApproved] = (0, react_2.useState)(false);
51
55
  const [predictionPreferences, setPredictionPreferences] = (0, LocalStorage_1.useStateWithLocalStorage)('nmrium-prediction-preferences');
56
+ const { isApproved: isAgree = false, ...options } = predictionPreferences;
57
+ const [isApproved, setApproved] = (0, react_2.useState)(isAgree);
52
58
  const { toolOptions: { data: { predictionIndex }, }, } = (0, ChartContext_1.useChartData)();
53
59
  const handleSave = (0, react_2.useCallback)(() => {
54
60
  refForm.current.submitForm();
55
61
  }, []);
56
62
  const initValues = (0, react_2.useMemo)(() => {
57
- const { isApproved: isAgree, ...options } = predictionPreferences;
58
- setApproved(isAgree);
59
- return Object.assign(PredictionManager_1.defaultPredictionOptions, options, {
63
+ return Object.assign((0, PredictionManager_1.getDefaultPredictionOptions)(), options, {
60
64
  name: `Prediction ${predictionIndex + 1}`,
61
65
  });
62
- }, [predictionPreferences, predictionIndex]);
66
+ }, [options, predictionIndex]);
63
67
  const { logger } = (0, LoggerContext_1.useLogger)();
64
68
  const submitHandler = (0, react_2.useCallback)((values) => {
65
69
  void (async () => {
@@ -72,12 +76,15 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
72
76
  predictedSpectra.push(key);
73
77
  }
74
78
  }
79
+ onClose();
80
+ closeDialog();
75
81
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
76
82
  try {
77
- const data = await (0, PredictionManager_1.predictSpectra)(molfile, logger);
83
+ const data = await (0, PredictionManager_1.predictSpectra)(molfile);
78
84
  dispatch({
79
85
  type: 'PREDICT_SPECTRA',
80
86
  payload: {
87
+ logger,
81
88
  predictedSpectra: data.spectra,
82
89
  options: values,
83
90
  molecule,
@@ -89,7 +96,6 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
89
96
  }
90
97
  finally {
91
98
  hideLoading();
92
- onClose();
93
99
  }
94
100
  }
95
101
  })();
@@ -101,21 +107,12 @@ function PredictSpectraModal({ onClose = () => null, molecule, }) {
101
107
  onClose,
102
108
  logger,
103
109
  setPredictionPreferences,
110
+ closeDialog,
104
111
  ]);
105
- const approveCheckHandler = (0, react_2.useCallback)((e) => {
106
- setApproved(e.target.checked);
107
- }, []);
108
- return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsx)(PredictionOptionsPanel_1.default, { onSubmit: submitHandler, options: initValues, ref: refForm }), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), (0, jsx_runtime_1.jsxs)("div", { className: "warning-container", children: [(0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), (0, jsx_runtime_1.jsx)("p", { children: "I confirm that the chemical structure is not confidential." })] })] }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }));
109
- }
110
- function usePredictSpectraModal() {
111
- const modal = (0, Modal_1.useModal)();
112
- return (molecule) => {
113
- modal.show((0, jsx_runtime_1.jsx)(PredictSpectraModal, { molecule: molecule }), {
114
- position: options_1.positions.TOP_CENTER,
115
- enableResizing: true,
116
- width: 600,
117
- });
118
- };
112
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: openDialog, toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
113
+ onClose();
114
+ closeDialog();
115
+ }, width: 600, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header handle", children: (0, jsx_runtime_1.jsx)("span", { children: "Prediction of NMR spectrum" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", children: [(0, jsx_runtime_1.jsx)(PredictionOptionsPanel_1.default, { onSubmit: submitHandler, options: initValues, ref: refForm }), (0, jsx_runtime_1.jsx)("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), (0, jsx_runtime_1.jsx)("div", { className: "warning-container", children: (0, jsx_runtime_1.jsx)(ui_1.Checkbox, { onChange: setApproved, checked: isApproved, label: "I confirm that the chemical structure is not confidential." }, String(isApproved)) })] }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }) })] }));
119
116
  }
120
- exports.usePredictSpectraModal = usePredictSpectraModal;
117
+ exports.PredictSpectraModal = PredictSpectraModal;
121
118
  exports.default = PredictSpectraModal;
@@ -117,7 +117,7 @@ function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
117
117
  }
118
118
  else {
119
119
  setActiveOption(SumSetOptions.Manual);
120
- formRef.current.setValues({ sum: sumOptions?.sum || '', molecule: null });
120
+ formRef.current.setValues({ sum: sumOptions?.sum ?? '', molecule: null });
121
121
  }
122
122
  }, [panels?.structuresPanel, sumOptions]);
123
123
  function saveHandler(values) {
@@ -96,7 +96,7 @@ function SignalsForm({ range, preferences }) {
96
96
  : 'addSignalTab');
97
97
  }, [setFieldValue, values.signals.length]);
98
98
  const tabContainsErrors = (0, react_2.useCallback)((i) => {
99
- return !!(errors?.signals && errors?.signals[i]);
99
+ return !!errors?.signals?.[i];
100
100
  }, [errors]);
101
101
  const signalFormTabs = (0, react_2.useMemo)(() => {
102
102
  const signalTabs = values.signals.length > 0
@@ -30,7 +30,7 @@ const tabStyles = (0, react_1.css) `
30
30
  function SignalsForm() {
31
31
  const { values, setFieldValue, errors, } = (0, formik_1.useFormikContext)();
32
32
  const tabContainsErrors = (0, react_2.useCallback)((i) => {
33
- return !!(errors?.signals && errors?.signals[i]);
33
+ return !!errors?.signals?.[i];
34
34
  }, [errors]);
35
35
  const signalFormTabs = (0, react_2.useMemo)(() => {
36
36
  const signalTabs = values.signals.length > 0
@@ -143,7 +143,7 @@ function MetaImportationModal({ onClose, file }) {
143
143
  return columns;
144
144
  }, [parseResult?.meta.fields]);
145
145
  function handleLinkSpectra(fields) {
146
- let { source, target } = fields;
146
+ const { source, target } = fields;
147
147
  if (data && parseResult) {
148
148
  try {
149
149
  const { compareResult, matches } = (0, parseMeta_1.linkMetaWithSpectra)({
@@ -33,6 +33,8 @@ const formik_1 = require("formik");
33
33
  const react_2 = require("react");
34
34
  const fa_1 = require("react-icons/fa");
35
35
  const ui_1 = require("react-science/ui");
36
+ const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
37
+ const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
36
38
  const PreferencesContext_1 = require("../../context/PreferencesContext");
37
39
  const ActionButtons_1 = __importDefault(require("../../elements/ActionButtons"));
38
40
  const Button_1 = __importDefault(require("../../elements/Button"));
@@ -43,7 +45,6 @@ const DropDownButton_1 = __importDefault(require("../../elements/dropDownButton/
43
45
  const Alert_1 = require("../../elements/popup/Alert");
44
46
  const useSaveSettings_1 = require("../../hooks/useSaveSettings");
45
47
  const getPreferencesByWorkspace_1 = require("../../reducer/preferences/utilities/getPreferencesByWorkspace");
46
- const export_1 = require("../../utility/export");
47
48
  const workspaces_1 = __importDefault(require("../../workspaces"));
48
49
  const WorkspaceItem_1 = __importDefault(require("./WorkspaceItem"));
49
50
  const DatabasesTabContent_1 = __importDefault(require("./settings-tabs/DatabasesTabContent"));
@@ -56,7 +57,8 @@ const OnLoadProcessingTabContent_1 = __importDefault(require("./settings-tabs/On
56
57
  const ToolsTabContent_1 = __importDefault(require("./settings-tabs/ToolsTabContent"));
57
58
  const settingsValidation_1 = require("./settingsValidation");
58
59
  const styles = (0, react_1.css) `
59
- width: 800px;
60
+ width: 50vw;
61
+ min-width: 800px;
60
62
 
61
63
  .main-content {
62
64
  width: 100%;
@@ -203,20 +205,16 @@ function GeneralSettingsModal({ height }) {
203
205
  function handleDisabledRestButton(values) {
204
206
  setRestDisabled(isRestButtonDisable(values, workspaceName, originalWorkspaces));
205
207
  }
208
+ const { readText, rawWriteWithType, shouldFallback, cleanShouldFallback, text, } = (0, clipboardHooks_1.useClipboard)();
206
209
  function handleCopyWorkspace() {
207
210
  const data = { [workspaceName]: refForm.current?.values };
208
- void (0, export_1.copyTextToClipboard)(JSON.stringify(data)).then((flag) => {
209
- if (flag) {
210
- alert.success('Workspace copied to clipboard');
211
- }
212
- else {
213
- alert.error('copied not completed');
214
- }
211
+ void rawWriteWithType(JSON.stringify(data)).then(() => {
212
+ alert.success('Workspace copied to clipboard');
215
213
  });
216
214
  }
217
215
  const setWorkspaceSetting = (0, react_2.useCallback)((inputWorkspace) => {
218
216
  const parseWorkspaceName = Object.keys(inputWorkspace)[0];
219
- if (preferences?.workspace.current === parseWorkspaceName) {
217
+ if (preferences.workspace.current === parseWorkspaceName) {
220
218
  refForm.current?.setValues(inputWorkspace[parseWorkspaceName]);
221
219
  }
222
220
  else if (preferences.workspaces[parseWorkspaceName]) {
@@ -229,41 +227,44 @@ function GeneralSettingsModal({ height }) {
229
227
  },
230
228
  });
231
229
  }
232
- }, [dispatch, preferences?.workspace, preferences.workspaces]);
233
- function handlePastWorkspace() {
234
- void navigator.clipboard.readText().then((text) => {
235
- try {
236
- const parseWorkspaces = JSON.parse(text);
237
- setWorkspaceSetting(parseWorkspaces);
238
- }
239
- catch {
240
- alert.error('object parse error');
241
- }
242
- });
243
- }
230
+ }, [dispatch, preferences.workspace, preferences.workspaces]);
244
231
  (0, react_2.useEffect)(() => {
245
232
  if (pastRef.current) {
246
233
  setWorkspaceSetting(pastRef.current);
247
234
  pastRef.current = null;
248
235
  }
249
236
  }, [setWorkspaceSetting]);
250
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}) }), (0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
237
+ function handlePastWorkspace(text) {
238
+ if (!text)
239
+ return;
240
+ try {
241
+ const parseWorkspaces = JSON.parse(text);
242
+ setWorkspaceSetting(parseWorkspaces);
243
+ }
244
+ catch {
245
+ alert.error('object parse error');
246
+ }
247
+ cleanShouldFallback();
248
+ }
249
+ function handlePastWorkspaceAction() {
250
+ void readText().then(handlePastWorkspace);
251
+ }
252
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}) }), (0, jsx_runtime_1.jsxs)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsxs)("div", { style: {
251
253
  display: 'flex',
252
254
  flexDirection: 'column',
253
- width: '100%',
254
255
  }, children: [(0, jsx_runtime_1.jsx)("span", { children: "General Settings" }), (0, jsx_runtime_1.jsxs)("div", { style: {
255
256
  display: 'flex',
256
257
  alignItems: 'center',
257
258
  cursor: 'default',
258
259
  paddingTop: '10px',
259
- }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Workspace", children: (0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, renderItem: renderItem, selectedKey: preferences?.workspace.current, onSelect: ChangeWorkspaceHandler }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Action, { size: "xSmall", onClick: handleReset, toolTip: "Reset workspace preferences", tooltipOrientation: "horizontal", style: {
260
+ }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Workspace", children: (0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, renderItem: renderItem, selectedKey: preferences.workspace.current, onSelect: ChangeWorkspaceHandler }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Action, { size: "xSmall", onClick: handleReset, toolTip: "Reset workspace preferences", tooltipOrientation: "horizontal", style: {
260
261
  marginLeft: '10px',
261
262
  }, disabled: isRestDisabled, children: (0, jsx_runtime_1.jsx)(fa_1.FaBolt, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.Done, { size: "xSmall", fill: "outline", onClick: handleCopyWorkspace, toolTip: "Copy workspace preferences", tooltipOrientation: "horizontal", style: {
262
263
  marginLeft: '10px',
263
- }, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegCopy, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.Action, { size: "xSmall", fill: "outline", onClick: handlePastWorkspace, toolTip: "Past workspace preferences", tooltipOrientation: "horizontal", style: {
264
+ }, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegCopy, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.Action, { size: "xSmall", fill: "outline", onClick: handlePastWorkspaceAction, toolTip: "Past workspace preferences", tooltipOrientation: "horizontal", style: {
264
265
  marginLeft: '10px',
265
266
  }, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) })] })] }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)("div", { css: styles, style: { height }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: settingsValidation_1.validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { title: "General", tabid: "general", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(GeneralTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Formatting", tabid: "formatting", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(FormattingTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Panels", tabid: "display", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(DisplayTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Tools", tabid: "tools", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(ToolsTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Databases", tabid: "databases", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(DatabasesTabContent_1.default, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Import filters", tabid: "importation-filters", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(ImportationFiltersTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Title Block", tabid: "title-block", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(InfoBlockTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "On Load Processing", tabid: "on-load-processing", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(OnLoadProcessingTabContent_1.default, {}) }) })] }) }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Footer, { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [(0, jsx_runtime_1.jsx)(ActionButtons_1.default, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
266
267
  closeDialog?.();
267
- } }), (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), (0, jsx_runtime_1.jsx)(SaveSettingsModal, {})] }));
268
+ } }), (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), (0, jsx_runtime_1.jsx)(SaveSettingsModal, {}), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePastWorkspace, text: text, label: "Workspace" })] }));
268
269
  }
269
270
  exports.default = GeneralSettingsModal;
@@ -63,6 +63,10 @@ const LIST = [
63
63
  label: 'Matrix generation Panel',
64
64
  name: 'panels.matrixGenerationPanel',
65
65
  },
66
+ {
67
+ label: 'Simulation panel',
68
+ name: 'panels.simulationPanel',
69
+ },
66
70
  ];
67
71
  const COLUMNS = [
68
72
  {
@@ -58,7 +58,7 @@ function FormattingTabContent() {
58
58
  const { values, setFieldValue } = (0, formik_1.useFormikContext)();
59
59
  const nuclei = (0, get_1.default)(values, 'formatting.nuclei', {});
60
60
  function deleteHandler(key) {
61
- let _nuclei = {};
61
+ const _nuclei = {};
62
62
  for (const nucleus in nuclei) {
63
63
  if (nucleus !== key) {
64
64
  _nuclei[nucleus] = nuclei[nucleus];
@@ -16,7 +16,7 @@ const formattingValidation = (obj) => (0, yup_1.object)().shape({
16
16
  nuclei: (0, yup_1.object)()
17
17
  .shape(formattingElementValidation(obj))
18
18
  .test('Unique', 'Nuclei need te be unique', function check(nuclei) {
19
- let nucleusFrequencies = {};
19
+ const nucleusFrequencies = {};
20
20
  for (const key of Object.keys(nuclei)) {
21
21
  const _key = nuclei[key].name?.toLowerCase() || '';
22
22
  if (_key) {
@@ -33,7 +33,7 @@ const formattingValidation = (obj) => (0, yup_1.object)().shape({
33
33
  for (const key in nucleusFrequencies) {
34
34
  const { value, fields } = nucleusFrequencies[key];
35
35
  if (value > 1) {
36
- for (let field of fields) {
36
+ for (const field of fields) {
37
37
  errors.push(new yup_1.ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
38
38
  }
39
39
  }
@@ -89,12 +89,9 @@ function IntegralTable({ activeTab, data }) {
89
89
  },
90
90
  accessor: 'integral',
91
91
  Cell: ({ row }) => {
92
- let integral = '';
93
- if (row.original?.integral) {
94
- const value = (0, formatNumber_1.formatNumber)(row.original.integral, integralsPreferences.relative.format);
95
- const flag = (0, Spectrum1D_1.checkIntegralKind)(row.original);
96
- integral = flag ? value : `[ ${value} ]`;
97
- }
92
+ const value = (0, formatNumber_1.formatNumber)(row.original.integral || 0, integralsPreferences.relative.format);
93
+ const flag = (0, Spectrum1D_1.checkIntegralKind)(row.original);
94
+ const integral = flag ? value : `[ ${value} ]`;
98
95
  return ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
99
96
  },
100
97
  },
@@ -114,7 +111,7 @@ function IntegralTable({ activeTab, data }) {
114
111
  saveRelativeHandler,
115
112
  ]);
116
113
  const tableColumns = (0, react_1.useMemo)(() => {
117
- let columns = [...initialColumns];
114
+ const columns = [...initialColumns];
118
115
  for (const col of COLUMNS) {
119
116
  const { showWhen, ...colParams } = col;
120
117
  if ((0, get_1.default)(integralsPreferences, showWhen)) {
@@ -4,12 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const cheminfo_font_1 = require("cheminfo-font");
8
7
  const full_1 = require("openchemlib/full");
9
8
  const react_1 = require("react");
10
9
  const fa_1 = require("react-icons/fa");
11
10
  const io5_1 = require("react-icons/io5");
12
11
  const ui_1 = require("react-science/ui");
12
+ const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
13
+ const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
13
14
  const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
14
15
  const DispatchContext_1 = require("../../context/DispatchContext");
15
16
  const GlobalContext_1 = require("../../context/GlobalContext");
@@ -17,7 +18,7 @@ const ActiveButton_1 = __importDefault(require("../../elements/ActiveButton"));
17
18
  const Button_1 = __importDefault(require("../../elements/Button"));
18
19
  const Alert_1 = require("../../elements/popup/Alert");
19
20
  const AboutPredictionModal_1 = __importDefault(require("../../modal/AboutPredictionModal"));
20
- const PredictSpectraModal_1 = require("../../modal/PredictSpectraModal");
21
+ const PredictSpectraModal_1 = __importDefault(require("../../modal/PredictSpectraModal"));
21
22
  const export_1 = require("../../utility/export");
22
23
  const PanelHeader_1 = __importDefault(require("../header/PanelHeader"));
23
24
  const styles = {
@@ -80,7 +81,6 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
80
81
  const dispatch = (0, DispatchContext_1.useDispatch)();
81
82
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
82
83
  const moleculeKey = molecules?.[currentIndex]?.id;
83
- const openPredictSpectraModal = (0, PredictSpectraModal_1.usePredictSpectraModal)();
84
84
  const saveAsSVGHandler = (0, react_1.useCallback)(() => {
85
85
  if (!rootRef)
86
86
  return;
@@ -92,16 +92,12 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
92
92
  (0, export_1.copyPNGToClipboard)(rootRef, `molSVG${currentIndex} `);
93
93
  alert.success('MOL copied as PNG to clipboard');
94
94
  }, [rootRef, alert, currentIndex]);
95
+ const { rawWriteWithType, readText, shouldFallback, cleanShouldFallback, text, } = (0, clipboardHooks_1.useClipboard)();
95
96
  const saveAsMolHandler = (0, react_1.useCallback)((molfile) => {
96
- void (0, export_1.copyTextToClipboard)(molfile).then((flag) => {
97
- if (flag) {
98
- alert.success('MOLFile copied to clipboard');
99
- }
100
- else {
101
- alert.error('copied not completed');
102
- }
97
+ void rawWriteWithType(molfile).then(() => {
98
+ alert.success('MOLFile copied to clipboard');
103
99
  });
104
- }, [alert]);
100
+ }, [alert, rawWriteWithType]);
105
101
  const exportHandler = (0, react_1.useCallback)((selected) => {
106
102
  const molecule = molecules?.[currentIndex];
107
103
  if (molecule) {
@@ -130,11 +126,15 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
130
126
  saveAsPNGHandler,
131
127
  saveAsSVGHandler,
132
128
  ]);
133
- const handlePaste = (0, react_1.useCallback)(() => {
134
- void navigator.clipboard.readText().then((molfile) => {
135
- dispatch({ type: 'ADD_MOLECULE', payload: { molfile } });
136
- });
137
- }, [dispatch]);
129
+ function handlePasteMolfileAction() {
130
+ void readText().then(handlePasteMolfile);
131
+ }
132
+ function handlePasteMolfile(molfile) {
133
+ if (!molfile)
134
+ return;
135
+ dispatch({ type: 'ADD_MOLECULE', payload: { molfile } });
136
+ cleanShouldFallback();
137
+ }
138
138
  const handleDelete = (0, react_1.useCallback)(() => {
139
139
  if (molecules[currentIndex]?.id) {
140
140
  onMoleculeIndexChange?.(0);
@@ -163,8 +163,8 @@ function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMolecul
163
163
  });
164
164
  }
165
165
  const hasMolecules = molecules && molecules.length > 0;
166
- return ((0, jsx_runtime_1.jsxs)(PanelHeader_1.default, { children: [renderSource === 'predictionPanel' && (0, jsx_runtime_1.jsx)(AboutPredictionModal_1.default, {}), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }) })), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handlePaste, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) }), hasMolecules && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: () => openPredictSpectraModal(molecules[currentIndex]), toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}) }))] })), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(io5_1.IoOpenOutline, {}) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)("p", { style: styles.atomLabel, children: "#" }) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: children }), (0, jsx_runtime_1.jsxs)("p", { style: styles.counter, children: [molecules &&
166
+ return ((0, jsx_runtime_1.jsxs)(PanelHeader_1.default, { children: [renderSource === 'predictionPanel' && (0, jsx_runtime_1.jsx)(AboutPredictionModal_1.default, {}), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsx)(ui_1.DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }) })), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }), renderSource === 'moleculePanel' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) }), hasMolecules && ((0, jsx_runtime_1.jsx)(PredictSpectraModal_1.default, { molecule: molecules[currentIndex] }))] })), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)(io5_1.IoOpenOutline, {}) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: (0, jsx_runtime_1.jsx)("p", { style: styles.atomLabel, children: "#" }) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: children }), (0, jsx_runtime_1.jsxs)("p", { style: styles.counter, children: [molecules &&
167
167
  molecules.length > 0 &&
168
- `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: (0, jsx_runtime_1.jsx)(fa_1.FaCog, {}) }))] }));
168
+ `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && ((0, jsx_runtime_1.jsx)(Button_1.default.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: (0, jsx_runtime_1.jsx)(fa_1.FaCog, {}) })), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
169
169
  }
170
170
  exports.default = MoleculePanelHeader;