nmrium 0.27.0 → 0.28.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 (307) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -1
  2. package/lib/component/1d/IntegralsSeries.js +2 -6
  3. package/lib/component/1d/PeakAnnotation.js +2 -2
  4. package/lib/component/1d/PeakAnnotations.js +2 -4
  5. package/lib/component/1d/SpectraTracker.js +2 -2
  6. package/lib/component/1d/Viewer1D.js +1 -1
  7. package/lib/component/1d/database/DatabaseSpectrum.js +28 -26
  8. package/lib/component/1d/ranges/Range.d.ts +1 -2
  9. package/lib/component/1d/ranges/Range.js +3 -4
  10. package/lib/component/1d/ranges/Ranges.js +3 -4
  11. package/lib/component/1d/tool/BaseLineZones.js +3 -6
  12. package/lib/component/1d/tool/VerticalIndicator.js +1 -1
  13. package/lib/component/2d/Contours.js +1 -5
  14. package/lib/component/2d/SignalDeltaLine.js +1 -1
  15. package/lib/component/2d/Viewer2D.js +1 -1
  16. package/lib/component/2d/YAxis.js +2 -2
  17. package/lib/component/2d/zones/IndicationLines.js +2 -3
  18. package/lib/component/EventsTrackers/KeysListenerTracker.js +59 -41
  19. package/lib/component/NMRium.d.ts +14 -49
  20. package/lib/component/NMRium.js +14 -6
  21. package/lib/component/SplitPaneWrapper.js +2 -2
  22. package/lib/component/context/PreferencesContext.d.ts +3 -43
  23. package/lib/component/elements/Button.js +1 -1
  24. package/lib/component/elements/Logo.js +1 -1
  25. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
  26. package/lib/component/elements/Tab/Tabs.js +2 -1
  27. package/lib/component/elements/ToggleButton.js +2 -2
  28. package/lib/component/elements/accordion/Accordion.js +2 -6
  29. package/lib/component/elements/formik/Input.js +1 -1
  30. package/lib/component/elements/popup/Modal/Modal.js +1 -1
  31. package/lib/component/elements/popup/Modal/ModalContent.js +1 -1
  32. package/lib/component/elements/toggle/ToggleButtonGroup.js +2 -2
  33. package/lib/component/header/BaseLineCorrectionPanel.js +7 -4
  34. package/lib/component/header/Header.js +2 -2
  35. package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
  36. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  37. package/lib/component/hooks/useCheckToolsVisibility.d.ts +2 -1
  38. package/lib/component/hooks/useCheckToolsVisibility.js +2 -1
  39. package/lib/component/hooks/useExport.js +2 -2
  40. package/lib/component/hooks/useFormatNumberByNucleus.js +3 -4
  41. package/lib/component/loader/DropZone.js +8 -2
  42. package/lib/component/loader/NoData.d.ts +3 -2
  43. package/lib/component/loader/NoData.js +31 -30
  44. package/lib/component/modal/MoleculeStructureEditorModal.js +2 -2
  45. package/lib/component/modal/editRange/EditRangeModal.d.ts +3 -3
  46. package/lib/component/modal/editRange/EditRangeModal.js +49 -54
  47. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
  48. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
  49. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +2 -0
  50. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +34 -0
  51. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +1 -1
  52. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +11 -14
  53. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +2 -1
  54. package/lib/component/modal/editRange/forms/components/SignalsForm.js +18 -29
  55. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  56. package/lib/component/modal/setting/DatabasesTabContent.d.ts +2 -1
  57. package/lib/component/modal/setting/DatabasesTabContent.js +28 -30
  58. package/lib/component/modal/setting/settingsValidation.d.ts +150 -42
  59. package/lib/component/modal/setting/settingsValidation.js +6 -4
  60. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +13 -15
  61. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
  62. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
  63. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +2 -2
  64. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
  65. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  66. package/lib/component/panels/Panels.js +1 -1
  67. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  68. package/lib/component/panels/RangesPanel/RangesHeader.js +12 -3
  69. package/lib/component/panels/RangesPanel/RangesPanel.js +19 -19
  70. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  71. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +1 -1
  72. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +4 -4
  73. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +48 -30
  74. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -3
  75. package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
  76. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
  77. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
  78. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  79. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -8
  80. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
  81. package/lib/component/panels/SummaryPanel/utilities/{IsInView.d.ts → useInView.d.ts} +2 -2
  82. package/lib/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
  83. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  84. package/lib/component/panels/ZonesPanel/ZonesPanel.js +13 -13
  85. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +4 -0
  86. package/lib/component/panels/databasePanel/DatabasePanel.js +80 -26
  87. package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
  88. package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.d.ts +7 -0
  89. package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +8 -0
  90. package/lib/component/panels/databasePanel/DatabaseTable.js +14 -9
  91. package/lib/component/panels/extra/preferences/ColumnsHelper.js +2 -4
  92. package/lib/component/panels/header/DefaultPanelHeader.js +1 -3
  93. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  94. package/lib/component/reducer/Reducer.d.ts +8 -66
  95. package/lib/component/reducer/Reducer.js +13 -8
  96. package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
  97. package/lib/component/reducer/actions/DatabaseActions.js +21 -3
  98. package/lib/component/reducer/actions/DomainActions.js +1 -1
  99. package/lib/component/reducer/actions/FiltersActions.d.ts +2 -1
  100. package/lib/component/reducer/actions/FiltersActions.js +25 -4
  101. package/lib/component/reducer/actions/PreferencesActions.js +32 -20
  102. package/lib/component/reducer/actions/RangesActions.d.ts +2 -2
  103. package/lib/component/reducer/actions/RangesActions.js +45 -11
  104. package/lib/component/reducer/actions/SpectrumsActions.js +6 -9
  105. package/lib/component/reducer/actions/ToolsActions.js +66 -53
  106. package/lib/component/reducer/helper/getSpectrum.d.ts +5 -0
  107. package/lib/component/reducer/helper/getSpectrum.js +14 -0
  108. package/lib/component/reducer/preferences/actions/initPreferences.js +1 -1
  109. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
  110. package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -10
  111. package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
  112. package/lib/component/reducer/types/Types.d.ts +3 -1
  113. package/lib/component/reducer/types/Types.js +3 -1
  114. package/lib/component/tool/BrushX.js +1 -1
  115. package/lib/component/tool/BrushXY.js +1 -1
  116. package/lib/component/tool/CrossLinePointer.js +1 -1
  117. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +4 -3
  118. package/lib/component/toolbar/BasicToolBar.js +0 -1
  119. package/lib/component/toolbar/FunctionToolBar.js +9 -13
  120. package/lib/component/toolbar/ToolTypes.d.ts +1 -1
  121. package/lib/component/toolbar/ToolTypes.js +3 -3
  122. package/lib/component/utility/Export.d.ts +7 -1
  123. package/lib/component/utility/Export.js +3 -3
  124. package/lib/component/utility/formatNumber.d.ts +1 -1
  125. package/lib/component/utility/formatNumber.js +4 -2
  126. package/lib/component/utility/isGoogleDocument.d.ts +1 -0
  127. package/lib/component/utility/isGoogleDocument.js +3 -0
  128. package/lib/component/utility/nmredataToNmrium.js +1 -2
  129. package/lib/component/utility/nmriumToNmredata.d.ts +2 -2
  130. package/lib/component/utility/nmriumToNmredata.js +2 -2
  131. package/lib/component/utility/util/nmredata/addSource.js +2 -2
  132. package/lib/component/workspaces/Workspace.d.ts +9 -4
  133. package/lib/component/workspaces/basic.js +15 -8
  134. package/lib/component/workspaces/exercise.js +2 -2
  135. package/lib/component/workspaces/process1D.js +1 -1
  136. package/lib/data/FiltersManager.js +1 -1
  137. package/lib/data/PredictionManager.js +7 -9
  138. package/lib/data/SpectraManager.d.ts +4 -12
  139. package/lib/data/SpectraManager.js +14 -23
  140. package/lib/data/data1d/Data1DManager.js +8 -1
  141. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
  142. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
  143. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
  144. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
  145. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +36 -2
  146. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +38 -15
  147. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
  148. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
  149. package/lib/data/data1d/database.d.ts +5 -3
  150. package/lib/data/data1d/database.js +54 -4
  151. package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
  152. package/lib/data/data2d/Processing2D.js +1 -1
  153. package/lib/data/molecules/Molecule.d.ts +4 -5
  154. package/lib/data/molecules/Molecule.js +3 -1
  155. package/lib/data/utilities/FindUtilities.js +1 -3
  156. package/lib/data/utilities/RangeUtilities.js +5 -6
  157. package/lib/data/utilities/ZoneUtilities.js +1 -1
  158. package/lib/data/utilities/getSum.js +1 -3
  159. package/lib/data/utilities/isMolFileEmpty.d.ts +1 -0
  160. package/lib/data/utilities/isMolFileEmpty.js +6 -0
  161. package/lib/types/NMRiumDataReturn.d.ts +15 -0
  162. package/lib/types/NMRiumDataReturn.js +1 -0
  163. package/lib/types/NMRiumGeneralPreferences.d.ts +10 -0
  164. package/lib/types/NMRiumGeneralPreferences.js +1 -0
  165. package/lib/types/NMRiumPanelPreferences.d.ts +16 -0
  166. package/lib/types/NMRiumPanelPreferences.js +1 -0
  167. package/lib/types/NMRiumToolBarPreferences.d.ts +20 -0
  168. package/lib/types/NMRiumToolBarPreferences.js +1 -0
  169. package/lib/types/Preferences.d.ts +5 -0
  170. package/lib/types/Preferences.js +1 -0
  171. package/lib/versionInfo.js +1 -1
  172. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -1
  173. package/lib-cjs/component/1d/IntegralsSeries.js +2 -6
  174. package/lib-cjs/component/1d/PeakAnnotation.js +2 -2
  175. package/lib-cjs/component/1d/PeakAnnotations.js +2 -4
  176. package/lib-cjs/component/1d/SpectraTracker.js +2 -2
  177. package/lib-cjs/component/1d/Viewer1D.js +1 -1
  178. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +30 -25
  179. package/lib-cjs/component/1d/ranges/Range.js +3 -4
  180. package/lib-cjs/component/1d/ranges/Ranges.js +3 -4
  181. package/lib-cjs/component/1d/tool/BaseLineZones.js +3 -6
  182. package/lib-cjs/component/1d/tool/VerticalIndicator.js +1 -1
  183. package/lib-cjs/component/2d/Contours.js +1 -5
  184. package/lib-cjs/component/2d/SignalDeltaLine.js +1 -1
  185. package/lib-cjs/component/2d/Viewer2D.js +1 -1
  186. package/lib-cjs/component/2d/YAxis.js +1 -1
  187. package/lib-cjs/component/2d/zones/IndicationLines.js +2 -3
  188. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +59 -41
  189. package/lib-cjs/component/NMRium.js +13 -5
  190. package/lib-cjs/component/SplitPaneWrapper.js +2 -2
  191. package/lib-cjs/component/elements/Button.js +1 -1
  192. package/lib-cjs/component/elements/Logo.js +1 -1
  193. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
  194. package/lib-cjs/component/elements/Tab/Tabs.js +2 -1
  195. package/lib-cjs/component/elements/ToggleButton.js +2 -2
  196. package/lib-cjs/component/elements/accordion/Accordion.js +2 -6
  197. package/lib-cjs/component/elements/formik/Input.js +1 -1
  198. package/lib-cjs/component/elements/popup/Modal/Modal.js +1 -1
  199. package/lib-cjs/component/elements/popup/Modal/ModalContent.js +1 -1
  200. package/lib-cjs/component/elements/toggle/ToggleButtonGroup.js +2 -2
  201. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -3
  202. package/lib-cjs/component/header/Header.js +2 -2
  203. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +1 -1
  204. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  205. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -1
  206. package/lib-cjs/component/hooks/useExport.js +2 -2
  207. package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +2 -3
  208. package/lib-cjs/component/loader/DropZone.js +8 -2
  209. package/lib-cjs/component/loader/NoData.js +31 -30
  210. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -2
  211. package/lib-cjs/component/modal/editRange/EditRangeModal.js +47 -52
  212. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
  213. package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
  214. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +38 -0
  215. package/lib-cjs/component/modal/editRange/forms/components/SignalFormTab.js +13 -16
  216. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +18 -29
  217. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  218. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +31 -33
  219. package/lib-cjs/component/modal/setting/settingsValidation.js +6 -4
  220. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +12 -14
  221. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
  222. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
  223. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
  224. package/lib-cjs/component/panels/Panels.js +1 -1
  225. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  226. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -1
  227. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +18 -18
  228. package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  229. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +47 -29
  230. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
  231. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
  232. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
  233. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
  234. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  235. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +6 -8
  236. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
  237. package/lib-cjs/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
  238. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  239. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -12
  240. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +78 -24
  241. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +1 -1
  242. package/lib-cjs/component/panels/databasePanel/DatabaseStructureSearchModal.js +15 -0
  243. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +14 -9
  244. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +2 -4
  245. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -3
  246. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  247. package/lib-cjs/component/reducer/Reducer.js +13 -8
  248. package/lib-cjs/component/reducer/actions/DatabaseActions.js +22 -3
  249. package/lib-cjs/component/reducer/actions/DomainActions.js +1 -1
  250. package/lib-cjs/component/reducer/actions/FiltersActions.js +26 -4
  251. package/lib-cjs/component/reducer/actions/PreferencesActions.js +30 -18
  252. package/lib-cjs/component/reducer/actions/RangesActions.js +46 -12
  253. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +4 -7
  254. package/lib-cjs/component/reducer/actions/ToolsActions.js +63 -73
  255. package/lib-cjs/component/reducer/helper/getSpectrum.js +18 -0
  256. package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +1 -1
  257. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
  258. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
  259. package/lib-cjs/component/reducer/types/Types.js +5 -3
  260. package/lib-cjs/component/tool/BrushX.js +1 -1
  261. package/lib-cjs/component/tool/BrushXY.js +1 -1
  262. package/lib-cjs/component/tool/CrossLinePointer.js +1 -1
  263. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +3 -2
  264. package/lib-cjs/component/toolbar/BasicToolBar.js +0 -1
  265. package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -13
  266. package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
  267. package/lib-cjs/component/utility/Export.js +4 -3
  268. package/lib-cjs/component/utility/formatNumber.js +3 -1
  269. package/lib-cjs/component/utility/isGoogleDocument.js +7 -0
  270. package/lib-cjs/component/utility/nmredataToNmrium.js +1 -2
  271. package/lib-cjs/component/utility/util/nmredata/addSource.js +2 -2
  272. package/lib-cjs/component/workspaces/basic.js +15 -8
  273. package/lib-cjs/component/workspaces/exercise.js +2 -2
  274. package/lib-cjs/component/workspaces/process1D.js +1 -1
  275. package/lib-cjs/data/FiltersManager.js +1 -1
  276. package/lib-cjs/data/PredictionManager.js +7 -9
  277. package/lib-cjs/data/SpectraManager.js +14 -23
  278. package/lib-cjs/data/data1d/Data1DManager.js +8 -1
  279. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
  280. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
  281. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
  282. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
  283. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +40 -16
  284. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
  285. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
  286. package/lib-cjs/data/data1d/database.js +55 -5
  287. package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
  288. package/lib-cjs/data/data2d/Processing2D.js +1 -1
  289. package/lib-cjs/data/molecules/Molecule.js +3 -1
  290. package/lib-cjs/data/utilities/FindUtilities.js +1 -3
  291. package/lib-cjs/data/utilities/RangeUtilities.js +8 -6
  292. package/lib-cjs/data/utilities/ZoneUtilities.js +1 -1
  293. package/lib-cjs/data/utilities/getSum.js +1 -3
  294. package/lib-cjs/data/utilities/isMolFileEmpty.js +10 -0
  295. package/lib-cjs/types/NMRiumDataReturn.js +2 -0
  296. package/lib-cjs/types/NMRiumGeneralPreferences.js +2 -0
  297. package/lib-cjs/types/NMRiumPanelPreferences.js +2 -0
  298. package/lib-cjs/types/NMRiumToolBarPreferences.js +2 -0
  299. package/lib-cjs/types/Preferences.js +2 -0
  300. package/lib-cjs/versionInfo.js +1 -1
  301. package/package.json +31 -31
  302. package/lib/component/1d/multiplicityTree/TempMultiplicityTree.d.ts +0 -2
  303. package/lib/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -14
  304. package/lib/component/panels/databasePanel/useDatabases.d.ts +0 -5
  305. package/lib/component/panels/databasePanel/useDatabases.js +0 -10
  306. package/lib-cjs/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -20
  307. package/lib-cjs/component/panels/databasePanel/useDatabases.js +0 -14
@@ -61,26 +61,22 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
61
61
  });
62
62
  dispatch({ type: Types_1.SET_SELECTED_FILTER, selectedFilter: null });
63
63
  }, [dispatch]);
64
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('zoomTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: "zoomIn", title: `${ToolTypes_1.options.zoom.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}) }) }, ToolTypes_1.options.zoom.id)), isButtonVisible('zoomOutTool') && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}) }) })), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && isButtonVisible('peakTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "peakPicking", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}) }, ToolTypes_1.options.peakPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
65
- isButtonVisible('integralTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "integralPicking", title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}) }, ToolTypes_1.options.integral.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
66
- isButtonVisible('zonePickingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zone2D.id, id: "zone2d", isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${ToolTypes_1.options.zone2D.label} ( Press r )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaDiceFour, {}) }, ToolTypes_1.options.zone2D.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
67
- isButtonVisible('slicingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.slicingTool.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "slic", title: `${ToolTypes_1.options.slicingTool.label}`, children: (0, jsx_runtime_1.jsx)("p", { children: "Slic" }) }, ToolTypes_1.options.slicingTool.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
68
- isButtonVisible('autoRangesTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.rangesPicking.id, isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${ToolTypes_1.options.rangesPicking.label} ( Press r )`, id: "ranges-pick", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}) }, ToolTypes_1.options.rangesPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
64
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('zoomTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: "zoomIn", title: `${ToolTypes_1.options.zoom.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}) }) }, ToolTypes_1.options.zoom.id)), isButtonVisible('zoomOutTool') && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 14 }, children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}) }) })), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && isButtonVisible('peakTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, isVisible: !!(activeSpectrum && !info?.isFid), id: "peakPicking", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}) }, ToolTypes_1.options.peakPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
65
+ isButtonVisible('integralTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, isVisible: !!(activeSpectrum && !info?.isFid), id: "integralPicking", title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}) }, ToolTypes_1.options.integral.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
66
+ isButtonVisible('zonePickingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zone2D.id, id: "zone2d", isVisible: !!(activeSpectrum && !info?.isFid), title: `${ToolTypes_1.options.zone2D.label} ( Press r )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaDiceFour, {}) }, ToolTypes_1.options.zone2D.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
67
+ isButtonVisible('slicingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.slicingTool.id, isVisible: !!(activeSpectrum && !info?.isFid), id: "slic", title: `${ToolTypes_1.options.slicingTool.label}`, children: (0, jsx_runtime_1.jsx)("p", { children: "Slic" }) }, ToolTypes_1.options.slicingTool.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
68
+ isButtonVisible('rangePickingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.rangesPicking.id, isVisible: !!(activeSpectrum && !info?.isFid), title: `${ToolTypes_1.options.rangesPicking.label} ( Press r )`, id: "ranges-pick", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}) }, ToolTypes_1.options.rangesPicking.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
69
69
  isButtonVisible('multipleSpectraAnalysisTool') &&
70
70
  ftCounter > 1 &&
71
71
  mode === 'RTL' && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.multipleSpectraAnalysis.id, id: "multipleSpectraAnalysis", title: ToolTypes_1.options.multipleSpectraAnalysis.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }, ToolTypes_1.options.multipleSpectraAnalysis.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
72
72
  isButtonVisible('zeroFillingTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zeroFilling.id, isVisible: Filters.zeroFilling.isApplicable({ info }), id: "zeroFilling", title: ToolTypes_1.options.zeroFilling.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrZeroFilling, {}) }, ToolTypes_1.options.zeroFilling.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
73
- isButtonVisible('phaseCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: "phaseCorrection", title: `${ToolTypes_1.options.phaseCorrection.label} ( Press a )`, isVisible: activeSpectrum &&
73
+ isButtonVisible('phaseCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: "phaseCorrection", title: `${ToolTypes_1.options.phaseCorrection.label} ( Press a )`, isVisible: !!(activeSpectrum &&
74
74
  info &&
75
75
  Filters.phaseCorrection.isApplicable({ info }) &&
76
- datum.im
77
- ? true
78
- : false, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPhaseCorrection, {}) }, ToolTypes_1.options.phaseCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
79
- isButtonVisible('baseLineCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baseLineCorrection.id, id: "baseLineCorrection", title: `${ToolTypes_1.options.baseLineCorrection.label} ( Press b )`, isVisible: activeSpectrum &&
76
+ datum.im), children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPhaseCorrection, {}) }, ToolTypes_1.options.phaseCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
77
+ isButtonVisible('baselineCorrectionTool') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baselineCorrection.id, id: "baselineCorrection", title: `${ToolTypes_1.options.baselineCorrection.label} ( Press b )`, isVisible: !!(activeSpectrum &&
80
78
  info &&
81
- Filters.baselineCorrection.isApplicable({ info })
82
- ? true
83
- : false, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}) }, ToolTypes_1.options.baseLineCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
79
+ Filters.baselineCorrection.isApplicable({ info })), children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}) }, ToolTypes_1.options.baselineCorrection.id)), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
84
80
  isButtonVisible('exclusionZonesTool') &&
85
81
  !info?.isFid &&
86
82
  ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: "exclusionZones", children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }) }, ToolTypes_1.options.exclusionZones.id))] }), displayerMode === Constants_1.DISPLAYER_MODE.DM_1D &&
@@ -86,9 +86,9 @@ exports.options = {
86
86
  hasOptionPanel: true,
87
87
  isFilter: true,
88
88
  },
89
- baseLineCorrection: {
90
- id: 'baseLineCorrection',
91
- label: 'baseline correction',
89
+ baselineCorrection: {
90
+ id: Filters.baselineCorrection.id,
91
+ label: Filters.baselineCorrection.name,
92
92
  hasOptionPanel: true,
93
93
  isFilter: true,
94
94
  },
@@ -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.exportAsMatrix = exports.exportAsMol = exports.copyHTMLToClipboard = exports.copyTextToClipboard = exports.copyPNGToClipboard = exports.exportAsPng = exports.exportAsNMRE = exports.exportAsJSON = exports.exportAsSVG = void 0;
6
+ exports.getBlob = exports.exportAsMatrix = exports.exportAsMol = exports.copyHTMLToClipboard = exports.copyTextToClipboard = exports.copyPNGToClipboard = exports.exportAsPng = exports.exportAsNMRE = exports.exportAsJSON = exports.exportAsSVG = void 0;
7
7
  const file_saver_1 = require("file-saver");
8
8
  const jszip_1 = __importDefault(require("jszip"));
9
9
  function copyFormattedHtml(html) {
@@ -221,8 +221,8 @@ function getBlob(rootRef, elementID) {
221
221
  let _svg = rootRef.getRootNode()
222
222
  .getElementById(elementID)
223
223
  ?.cloneNode(true);
224
- const width = _svg?.getAttribute('width').replace('px', '');
225
- const height = _svg?.getAttribute('height').replace('px', '');
224
+ const width = Number(_svg?.getAttribute('width').replace('px', ''));
225
+ const height = Number(_svg?.getAttribute('height').replace('px', ''));
226
226
  _svg
227
227
  .querySelectorAll('[data-no-export="true"]')
228
228
  .forEach((element) => element.remove());
@@ -250,3 +250,4 @@ function getBlob(rootRef, elementID) {
250
250
  const blob = new Blob([svg], { type: 'image/svg+xml' });
251
251
  return { blob, width, height };
252
252
  }
253
+ exports.getBlob = getBlob;
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getNumberOfDecimals = exports.formatNumber = void 0;
7
7
  const numeral_1 = __importDefault(require("numeral"));
8
8
  function formatNumber(value, format, prefix = '', suffix = '') {
9
- return prefix + (0, numeral_1.default)(value).format(format) + suffix;
9
+ return (value || value === 0) && !isNaN(value)
10
+ ? prefix + (0, numeral_1.default)(value).format(format) + suffix
11
+ : value;
10
12
  }
11
13
  exports.formatNumber = formatNumber;
12
14
  function getNumberOfDecimals(value) {
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGoogleDocument = void 0;
4
+ function isGoogleDocument(url) {
5
+ return /https:\/\/docs\.google\.com\/(?<type>document|spreadsheets)\/d/.test(url);
6
+ }
7
+ exports.isGoogleDocument = isGoogleDocument;
@@ -51,8 +51,7 @@ async function getSpectra(file, options = {}, usedColors = {}) {
51
51
  return (0, SpectraManager_1.addBruker)({ xy, noContours, keepOriginal }, file.binary, usedColors);
52
52
  default:
53
53
  if (!jcampURL) {
54
- new Error('file extension is not supported');
55
- return;
54
+ throw new Error('file extension is not supported');
56
55
  }
57
56
  }
58
57
  }
@@ -32,14 +32,14 @@ async function addSource(nmrRecord, options = {}) {
32
32
  default:
33
33
  if (!jcampURL)
34
34
  break;
35
- void (await fetch(jcampURL).then(async (jcamp) => {
35
+ await fetch(jcampURL).then(async (jcamp) => {
36
36
  if (!jcamp)
37
37
  return;
38
38
  let name = jcampURL.split('/').slice(-1);
39
39
  const path = `jcamp/${dimension}/${name}`;
40
40
  tag += `\nJcamp_Location=file:${path}\\`;
41
41
  nmrRecord.file(path, await jcamp.arrayBuffer());
42
- }));
42
+ });
43
43
  }
44
44
  return tag;
45
45
  }
@@ -14,7 +14,7 @@ exports.basic = {
14
14
  panels: {
15
15
  spectraPanel: { display: true, open: true },
16
16
  informationPanel: { display: true, open: false },
17
- peaksPanel: { display: true, open: false },
17
+ peaksPanel: { display: false, open: false },
18
18
  integralsPanel: { display: true, open: false },
19
19
  rangesPanel: { display: true, open: false },
20
20
  structuresPanel: { display: true, open: false },
@@ -26,6 +26,9 @@ exports.basic = {
26
26
  predictionPanel: { display: false, open: false },
27
27
  automaticAssignmentPanel: { display: false, open: false },
28
28
  },
29
+ toolBarButtons: {
30
+ peakTool: false,
31
+ },
29
32
  },
30
33
  controllers: {
31
34
  dimmedSpectraTransparency: 0.1,
@@ -41,11 +44,15 @@ exports.basic = {
41
44
  },
42
45
  panels: {},
43
46
  },
44
- databases: [
45
- {
46
- label: 'Toc',
47
- url: 'https://data.cheminfo.org/nmr/database/toc.json',
48
- enabled: true,
49
- },
50
- ],
47
+ databases: {
48
+ defaultDatabase: '',
49
+ data: [
50
+ {
51
+ key: 'toc',
52
+ label: 'Toc',
53
+ url: 'https://data.cheminfo.org/nmr/database/toc.json',
54
+ enabled: true,
55
+ },
56
+ ],
57
+ },
51
58
  };
@@ -39,10 +39,10 @@ exports.exercise = {
39
39
  integralTool: true,
40
40
  zonePickingTool: false,
41
41
  slicingTool: false,
42
- autoRangesTool: false,
42
+ rangePickingTool: false,
43
43
  zeroFillingTool: false,
44
44
  phaseCorrectionTool: false,
45
- baseLineCorrectionTool: false,
45
+ baselineCorrectionTool: false,
46
46
  FFTTool: false,
47
47
  multipleSpectraAnalysisTool: false,
48
48
  exclusionZonesTool: false,
@@ -27,7 +27,7 @@ exports.process1D = {
27
27
  toolBarButtons: {
28
28
  import: false,
29
29
  exportAs: false,
30
- autoRangesTool: false,
30
+ rangePickingTool: false,
31
31
  multipleSpectraAnalysisTool: false,
32
32
  exclusionZonesTool: false,
33
33
  },
@@ -156,7 +156,7 @@ function addFilter(datum, filter, isDeleteAllow = true) {
156
156
  delete filter.isSnapshot;
157
157
  datum.filters.push({
158
158
  ...filter,
159
- id: id,
159
+ id,
160
160
  flag: true,
161
161
  isDeleteAllow,
162
162
  });
@@ -187,15 +187,13 @@ function calculateFrequency(nucleus, frequency) {
187
187
  if (typeof nucleus === 'string') {
188
188
  return (0, nmr_processing_1.getFrequency)(nucleus, { nucleus: '1H', frequency });
189
189
  }
190
+ else if (nucleus[0] === nucleus[1]) {
191
+ return `${frequency},${frequency}`;
192
+ }
190
193
  else {
191
- if (nucleus[0] === nucleus[1]) {
192
- return `${frequency},${frequency}`;
193
- }
194
- else {
195
- return `${frequency},${(0, nmr_processing_1.getFrequency)(nucleus[1], {
196
- nucleus: nucleus[0],
197
- frequency,
198
- })}`;
199
- }
194
+ return `${frequency},${(0, nmr_processing_1.getFrequency)(nucleus[1], {
195
+ nucleus: nucleus[0],
196
+ frequency,
197
+ })}`;
200
198
  }
201
199
  }
@@ -109,7 +109,7 @@ function addJDF(spectra, jdf, options = {}, usedColors = {}) {
109
109
  spectra.push(Data1DManager.fromCSD(converted, {
110
110
  ...options,
111
111
  display: { ...options.display },
112
- info: info,
112
+ info,
113
113
  meta: metadata,
114
114
  }, usedColors));
115
115
  }
@@ -145,9 +145,9 @@ exports.fromJSON = fromJSON;
145
145
  async function addBruker(options, data, usedColors) {
146
146
  const spectra = [];
147
147
  let result = await (0, nmr_parser_1.fromBruker)(data, {
148
- xy: true,
149
- noContours: true,
150
- keepOriginal: true,
148
+ converter: {
149
+ xy: true,
150
+ },
151
151
  });
152
152
  let entries = result;
153
153
  for (let entry of entries) {
@@ -161,16 +161,11 @@ async function addBruker(options, data, usedColors) {
161
161
  }
162
162
  }
163
163
  else if (info.dimension === 2) {
164
- if (info.isFt) {
165
- spectra.push(Data2DManager.fromBruker(entry, {
166
- ...options,
167
- info,
168
- display: { ...options.display },
169
- }, usedColors));
170
- }
171
- else {
172
- // in case of 2D FID spectrum
173
- }
164
+ spectra.push(Data2DManager.fromBruker(entry, {
165
+ ...options,
166
+ info,
167
+ display: { ...options.display },
168
+ }, usedColors));
174
169
  }
175
170
  }
176
171
  return spectra;
@@ -226,17 +221,13 @@ function getPreferences(state) {
226
221
  : {}),
227
222
  };
228
223
  }
229
- /**
230
- *
231
- * @param {object} state
232
- */
233
- function toJSON(state, dataExportOption = DataExportOptions.DATA_SOURCE) {
234
- const { data, molecules: mols, correlations, multipleAnalysis, toolOptions: { data: { exclusionZones }, }, } = state || {
224
+ function toJSON(state, target, dataExportOption = DataExportOptions.DATA_SOURCE) {
225
+ const { data, molecules: mols, correlations, multipleAnalysis, actionType, } = state || {
235
226
  data: [],
236
227
  molecules: [],
237
228
  correlations: {},
238
229
  multipleAnalysis: {},
239
- exclusionZones: {},
230
+ actionType: '',
240
231
  };
241
232
  const spectra = data.map((ob) => {
242
233
  return ob.info.dimension === 1
@@ -246,12 +237,12 @@ function toJSON(state, dataExportOption = DataExportOptions.DATA_SOURCE) {
246
237
  const preferences = getPreferences(state);
247
238
  const molecules = mols.map((mol) => Molecule.toJSON(mol));
248
239
  return {
240
+ ...(target === 'onDataChange' ? { actionType } : {}),
241
+ version: MigrationManager_1.CURRENT_EXPORT_VERSION,
249
242
  spectra,
250
243
  molecules,
251
244
  correlations,
252
245
  multipleAnalysis,
253
- exclusionZones,
254
- version: MigrationManager_1.CURRENT_EXPORT_VERSION,
255
246
  preferences,
256
247
  };
257
248
  }
@@ -4,7 +4,14 @@ exports.fromParsedJcamp = exports.fromCSD = exports.fromBruker = void 0;
4
4
  const Spectrum1D_1 = require("./Spectrum1D");
5
5
  function fromBruker(result, options = {}, usedColors = {}) {
6
6
  const { dependentVariables, info, meta, source } = result;
7
- let data = getData(dependentVariables[0].components);
7
+ let { data } = dependentVariables[0].components[0];
8
+ const { x, re, im } = data;
9
+ if (x[0] > x[1]) {
10
+ x.reverse();
11
+ re.reverse();
12
+ if (im)
13
+ im.reverse();
14
+ }
8
15
  if (data.im)
9
16
  info.isComplex = true;
10
17
  if (Array.isArray(info.nucleus))
@@ -71,17 +71,15 @@ function createLinks(ranges, jGraphTolerance = 0) {
71
71
  }
72
72
  end++;
73
73
  }
74
+ else if (Math.abs(couplings[end - 1].coupling - nextCoupling.coupling) <
75
+ jGraphTolerance) {
76
+ start = end - 1;
77
+ }
74
78
  else {
75
- if (Math.abs(couplings[end - 1].coupling - nextCoupling.coupling) <
76
- jGraphTolerance) {
77
- start = end - 1;
78
- }
79
- else {
80
- index++;
81
- links[index] = initLink(couplings[end]);
82
- start = end;
83
- end = end + 1;
84
- }
79
+ index++;
80
+ links[index] = initLink(couplings[end]);
81
+ start = end;
82
+ end = end + 1;
85
83
  }
86
84
  }
87
85
  return links;
@@ -22,7 +22,7 @@ const References_1 = require("../../constants/References");
22
22
  function getReferenceShift(datum1D, options) {
23
23
  let { from, to, nbPeaks, targetX, reference } = options;
24
24
  if (reference) {
25
- let data = (0, References_1.getRange)({ reference: reference, nucleus: datum1D.nucleus });
25
+ let data = (0, References_1.getRange)({ reference, nucleus: datum1D.nucleus });
26
26
  from = data.from;
27
27
  to = data.to;
28
28
  nbPeaks = data.nbPeaks;
@@ -10,13 +10,11 @@ function updateRelatives(data, key, check, forceCalculateIntegral = false) {
10
10
  if (data.options.isSumConstant || forceCalculateIntegral) {
11
11
  factor = currentSum > 0 ? options.sum / currentSum : 0.0;
12
12
  }
13
- else {
14
- if (data.values?.[0]) {
15
- const item = data.values[0];
16
- factor =
17
- (item[key] ? item[key] : options.sum) /
18
- item.absolute;
19
- }
13
+ else if (data.values?.[0]) {
14
+ const item = data.values[0];
15
+ factor =
16
+ (item[key] ? item[key] : options.sum) /
17
+ item.absolute;
20
18
  }
21
19
  }
22
20
  data.values = data.values.map((value) => {
@@ -19,7 +19,7 @@ function autoPeakPicking(datum1D, options) {
19
19
  let peaks = (0, nmr_processing_1.xyAutoPeaksPicking)({ x, y: re }, {
20
20
  lookNegative,
21
21
  noiseLevel: noise * noiseFactor,
22
- minMaxRatio: minMaxRatio,
22
+ minMaxRatio,
23
23
  realTopDetection: true,
24
24
  smoothY: false,
25
25
  sgOptions: { windowSize: 15, polynomial: 3 },
@@ -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.addRange = void 0;
6
+ exports.addRange = exports.createRangeObj = void 0;
7
7
  const ml_spectra_processing_1 = require("ml-spectra-processing");
8
8
  const SignalsKinds_1 = require("../../../constants/SignalsKinds");
9
9
  const generateID_1 = __importDefault(require("../../../utilities/generateID"));
@@ -11,30 +11,54 @@ const SumManager_1 = require("../SumManager");
11
11
  const detectSignal_1 = __importDefault(require("./detectSignal"));
12
12
  const mapRanges_1 = require("./mapRanges");
13
13
  const updateRangesRelativeValues_1 = require("./updateRangesRelativeValues");
14
+ function createRangeObj({ from, to, absolute, id, signal, }) {
15
+ return {
16
+ id: id ? id : (0, generateID_1.default)(),
17
+ from,
18
+ to,
19
+ absolute,
20
+ signals: [{ id: (0, generateID_1.default)(), ...signal }],
21
+ kind: SignalsKinds_1.DatumKind.signal,
22
+ integration: 0,
23
+ };
24
+ }
25
+ exports.createRangeObj = createRangeObj;
14
26
  function addRange(datum, options) {
15
- const { from, to, molecules, nucleus } = options;
27
+ const { from, to, id, molecules, nucleus } = options;
16
28
  const { x, re } = datum.data;
17
29
  const absolute = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
18
30
  // detectSignal use the advance multiplet-analysis that can crash if too many points
19
31
  const signal = (0, detectSignal_1.default)(x, re, from, to, datum.info.originFrequency);
20
- if (!signal)
21
- return;
22
- try {
23
- const range = {
24
- id: (0, generateID_1.default)(),
32
+ let range;
33
+ if (!signal) {
34
+ if (id === 'new') {
35
+ range = createRangeObj({
36
+ from,
37
+ to,
38
+ id,
39
+ absolute,
40
+ signal: { multiplicity: 's', kind: 'signal', delta: 0, js: [] },
41
+ });
42
+ }
43
+ }
44
+ else {
45
+ range = createRangeObj({
25
46
  from,
26
47
  to,
48
+ id,
27
49
  absolute,
28
- signals: [{ id: (0, generateID_1.default)(), ...signal }],
29
- kind: SignalsKinds_1.DatumKind.signal,
30
- integration: 0,
31
- };
32
- datum.ranges.options = (0, SumManager_1.initSumOptions)(datum.ranges.options, {
33
- molecules,
34
- nucleus,
50
+ signal,
35
51
  });
36
- datum.ranges.values = datum.ranges.values.concat((0, mapRanges_1.mapRanges)([range], datum));
37
- (0, updateRangesRelativeValues_1.updateRangesRelativeValues)(datum);
52
+ }
53
+ try {
54
+ if (range) {
55
+ datum.ranges.options = (0, SumManager_1.initSumOptions)(datum.ranges.options, {
56
+ molecules,
57
+ nucleus,
58
+ });
59
+ datum.ranges.values = datum.ranges.values.concat((0, mapRanges_1.mapRanges)([range], datum));
60
+ (0, updateRangesRelativeValues_1.updateRangesRelativeValues)(datum);
61
+ }
38
62
  }
39
63
  catch (e) {
40
64
  throw new Error('Could not calculate the multiplicity');
@@ -6,8 +6,8 @@ const multiplet_analysis_1 = require("multiplet-analysis");
6
6
  exports.MAX_LENGTH = 2048;
7
7
  function detectSignal(x, re, from, to, frequency) {
8
8
  const { fromIndex, toIndex } = (0, ml_spectra_processing_1.xGetFromToIndex)(x, {
9
- from: from,
10
- to: to,
9
+ from,
10
+ to,
11
11
  });
12
12
  if (toIndex - fromIndex <= exports.MAX_LENGTH) {
13
13
  const data = {
@@ -15,7 +15,7 @@ function detectSignal(x, re, from, to, frequency) {
15
15
  y: re.subarray(fromIndex, toIndex),
16
16
  };
17
17
  const result = (0, multiplet_analysis_1.analyseMultiplet)(data, {
18
- frequency: frequency,
18
+ frequency,
19
19
  takeBestPartMultiplet: true,
20
20
  symmetrizeEachStep: true,
21
21
  });
@@ -23,7 +23,7 @@ function mapRanges(ranges, datum) {
23
23
  const shiftX = (0, getShiftX_1.getShiftX)(datum);
24
24
  const error = (0, getSpectrumErrorValue_1.getSpectrumErrorValue)(datum);
25
25
  return ranges.reduce((acc, newRange) => {
26
- if (checkRange(newRange, datum, error))
26
+ if (checkRange(newRange, datum, error) && newRange.id !== 'new')
27
27
  return acc;
28
28
  const absolute = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from: newRange.from, to: newRange.to, reverse: true });
29
29
  const signals = newRange.signals.map((signal) => {
@@ -3,23 +3,35 @@ 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.prepareData = exports.initiateDatabase = exports.databases = void 0;
6
+ exports.prepareData = exports.initiateDatabase = exports.DATA_BASES = void 0;
7
7
  const nmr_processing_1 = require("nmr-processing");
8
+ const openchemlib_utils_1 = require("openchemlib-utils");
9
+ const full_1 = __importDefault(require("openchemlib/full"));
8
10
  const smart_array_filter_1 = require("smart-array-filter");
9
11
  const generateID_1 = __importDefault(require("../utilities/generateID"));
10
- exports.databases = [
12
+ exports.DATA_BASES = [
11
13
  {
14
+ key: 'local_solvent',
12
15
  label: 'Solvent database',
13
16
  value: prepareDataBase([...nmr_processing_1.protonImpurities, ...nmr_processing_1.carbonImpurities]),
14
17
  },
15
18
  ];
16
19
  function initiateDatabase(databases, nucleus) {
17
20
  const data = databases.filter((datum) => datum.nucleus === nucleus);
21
+ const moleculesDB = prepareMoleculesDB(data);
18
22
  const getSolvents = () => prepareGetSolvents(data);
19
23
  const search = (keywords = []) => (0, smart_array_filter_1.filter)(data, { keywords });
20
- return { data, getSolvents, search };
24
+ const searchByStructure = (idCode) => processSearchByStructure(moleculesDB, idCode);
25
+ return { searchByStructure, data, getSolvents, search };
21
26
  }
22
27
  exports.initiateDatabase = initiateDatabase;
28
+ function processSearchByStructure(moleculesDB, idCode) {
29
+ // default format { format: 'idCode' }
30
+ // https://github.com/cheminfo/openchemlib-utils/blob/ef3a9c30be7efe225a24de04ea9cefc9299674aa/src/db/MoleculesDB.js#L102-L115
31
+ // todo: idCode may be null and the current version of search requires a string or molecule. `|| ''` will become useless in next release of openchemlib-util
32
+ const result = moleculesDB.search(idCode || '');
33
+ return result.map((entry) => entry.data, []);
34
+ }
23
35
  function prepareGetSolvents(data) {
24
36
  const result = [];
25
37
  const map = new Map();
@@ -37,6 +49,44 @@ function prepareGetSolvents(data) {
37
49
  // return { id: index, name: label };
38
50
  // });
39
51
  // }
52
+ function prepareMoleculesDB(array) {
53
+ let moleculesDB = new openchemlib_utils_1.MoleculesDB(full_1.default);
54
+ for (let entry of array) {
55
+ //@ts-expect-error property will be defined in next release of nmr-processing
56
+ if (entry.ocl) {
57
+ try {
58
+ const molecule = full_1.default.Molecule.fromIDCode(
59
+ //@ts-expect-error property will be defined in next release of nmr-processing
60
+ entry.ocl.idCode,
61
+ //@ts-expect-error property will be defined in next release of nmr-processing
62
+ entry.ocl.coordinates);
63
+ moleculesDB.pushEntry(molecule, entry, {}, {
64
+ //@ts-expect-error property will be defined in next release of nmr-processing
65
+ idCode: entry.ocl.idCode,
66
+ //@ts-expect-error property will be defined in next release of nmr-processing
67
+ index: entry.ocl.index,
68
+ });
69
+ }
70
+ catch (e) {
71
+ // eslint-disable-next-line no-console
72
+ console.log(`Could not parse idCode: ${JSON.stringify(
73
+ //@ts-expect-error property will be defined in next release of nmr-processing
74
+ entry.ocl)}`, e);
75
+ }
76
+ }
77
+ else if (entry.smiles) {
78
+ try {
79
+ const molecule = full_1.default.Molecule.fromSmiles(entry.smiles);
80
+ moleculesDB.pushEntry(molecule, entry);
81
+ }
82
+ catch (e) {
83
+ // eslint-disable-next-line no-console
84
+ console.log(`Could not parse smiles: ${entry.smiles}`, e);
85
+ }
86
+ }
87
+ }
88
+ return moleculesDB;
89
+ }
40
90
  function prepareDataBase(array) {
41
91
  return array.map((item) => {
42
92
  item.ranges = item.ranges.map((range) => ({
@@ -78,13 +128,13 @@ exports.prepareData = prepareData;
78
128
  function mapJs(js) {
79
129
  if (js && js.length > 0) {
80
130
  const { coupling, multiplicity } = js.reduce((acc, { coupling, multiplicity }) => {
81
- acc.coupling.push(coupling.toFixed(1));
131
+ acc.coupling.push(coupling);
82
132
  acc.multiplicity += multiplicity;
83
133
  return acc;
84
134
  }, { coupling: [], multiplicity: '' });
85
135
  return { multiplicity, coupling: coupling.join(',') };
86
136
  }
87
137
  else {
88
- return { multiplicity: 's', coupling: '' };
138
+ return { multiplicity: '', coupling: '' };
89
139
  }
90
140
  }
@@ -57,7 +57,7 @@ exports.isApplicable = isApplicable;
57
57
  function reduce(previousValue, newValue) {
58
58
  return {
59
59
  once: true,
60
- reduce: previousValue + newValue,
60
+ reduce: newValue,
61
61
  };
62
62
  }
63
63
  exports.reduce = reduce;
@@ -103,7 +103,7 @@ class Processing2D {
103
103
  contours = this.conrec.drawContour({
104
104
  contourDrawer: 'basic',
105
105
  levels: _range,
106
- timeout: timeout,
106
+ timeout,
107
107
  });
108
108
  }
109
109
  catch (e) {