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
@@ -4,14 +4,13 @@ import { applyFilter } from '../../../data/FiltersManager';
4
4
  import { generateSpectrumFromPublicationString, getReferenceShift, } from '../../../data/data1d/Spectrum1D';
5
5
  import { getMissingProjection } from '../../../data/data2d/Spectrum2D';
6
6
  import { options } from '../../toolbar/ToolTypes';
7
- import GroupByInfoKey from '../../utility/GroupByInfoKey';
7
+ import groupByInfoKey from '../../utility/GroupByInfoKey';
8
8
  import { setZoom } from '../helper/Zoom1DManager';
9
9
  import { setDomain, setMode } from './DomainActions';
10
10
  import { resetSpectrumByFilter } from './FiltersActions';
11
11
  import { setTab, setActiveTab } from './ToolsActions';
12
12
  function checkIsVisible2D(datum) {
13
- if (datum.display.isPositiveVisible === false &&
14
- datum.display.isNegativeVisible === false) {
13
+ if (!datum.display.isPositiveVisible && !datum.display.isNegativeVisible) {
15
14
  return false;
16
15
  }
17
16
  return true;
@@ -75,10 +74,8 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
75
74
  newActiveSpectrum.display.isVisible = true;
76
75
  if (oldIndex !== -1) {
77
76
  refreshDomain =
78
- draft.data[oldIndex].info.isFid ===
79
- newActiveSpectrum.info.isFid
80
- ? false
81
- : true;
77
+ draft.data[oldIndex].info.isFid !==
78
+ newActiveSpectrum.info.isFid;
82
79
  }
83
80
  else {
84
81
  refreshDomain = newActiveSpectrum.info.isFid || false;
@@ -101,7 +98,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
101
98
  }
102
99
  if (options[draft.toolOptions.selectedTool].isFilter) {
103
100
  draft.toolOptions.selectedTool = options.zoom.id;
104
- draft.toolOptions.data.baseLineZones = [];
101
+ draft.toolOptions.data.baselineCorrection = { zones: [], options: {} };
105
102
  draft.toolOptions.selectedOptionPanel = null;
106
103
  draft.tempData = null;
107
104
  }
@@ -151,7 +148,7 @@ function addMissingProjectionHandler(draft, action) {
151
148
  const datum1D = getMissingProjection(state.data[index], n, draft.usedColors);
152
149
  draft.data.push(datum1D);
153
150
  }
154
- const groupByNucleus = GroupByInfoKey('nucleus');
151
+ const groupByNucleus = groupByInfoKey('nucleus');
155
152
  const dataGroupByNucleus = groupByNucleus(draft.data);
156
153
  setTab(draft, dataGroupByNucleus, draft.activeTab, true);
157
154
  setDomain(draft);
@@ -1,19 +1,17 @@
1
1
  import { max } from 'd3';
2
2
  import { original, current } from 'immer';
3
3
  import { xFindClosestIndex } from 'ml-spectra-processing';
4
- import * as Filters from '../../../data/Filters';
5
4
  import generateID from '../../../data/utilities/generateID';
6
5
  import { getYScale, getXScale } from '../../1d/utilities/scale';
7
6
  import { LAYOUT } from '../../2d/utilities/DimensionLayout';
8
7
  import { get2DYScale } from '../../2d/utilities/scale';
9
8
  import { options } from '../../toolbar/ToolTypes';
10
- import GroupByInfoKey from '../../utility/GroupByInfoKey';
11
- import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
9
+ import groupByInfoKey from '../../utility/GroupByInfoKey';
12
10
  import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
13
11
  import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
14
12
  import zoomHistoryManager from '../helper/ZoomHistoryManager';
15
13
  import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
16
- import { resetSpectrumByFilter } from './FiltersActions';
14
+ import { calculateBaseLineCorrection, resetSpectrumByFilter, } from './FiltersActions';
17
15
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
18
16
  function getStrongestPeak(draft) {
19
17
  const { activeSpectrum, data } = draft;
@@ -24,47 +22,66 @@ function getStrongestPeak(draft) {
24
22
  return {
25
23
  xValue: activeData.x[index],
26
24
  yValue: strongestPeakValue,
27
- index: index,
25
+ index,
28
26
  };
29
27
  }
30
28
  }
31
- function setFilterChanges(draft, selectedFilter) {
29
+ function checkFilterHasTempData(selectedToolId) {
30
+ return [options.phaseCorrection.id, options.baselineCorrection.id].includes(selectedToolId);
31
+ }
32
+ function setFilterChanges(draft, selectedFilterID) {
32
33
  const activeSpectrumId = draft.activeSpectrum?.id;
33
- //save reduced snapshot
34
- //select the equalizer tool when you enable manual phase correction filter
35
- if (selectedFilter === Filters.phaseCorrection.id) {
36
- const datumAfterPhaseCorrection = resetSpectrumByFilter(draft, Filters.phaseCorrection.id, {
34
+ // If the user selects the filter from the filters list or selects its tool and has a record in the filter list for preview and edit
35
+ if (checkFilterHasTempData(selectedFilterID)) {
36
+ //return back the spectra data to point of time before applying a specific filter
37
+ const dataSavePoint = resetSpectrumByFilter(draft, selectedFilterID, {
38
+ updateDomain: false,
37
39
  rollback: true,
38
40
  searchBy: 'name',
39
41
  returnCurrentDatum: true,
40
42
  });
43
+ // create a temporary clone of the data
41
44
  draft.tempData = current(draft).data;
42
- if (datumAfterPhaseCorrection) {
43
- draft.tempData[datumAfterPhaseCorrection?.index] =
44
- datumAfterPhaseCorrection?.datum;
45
+ if (dataSavePoint) {
46
+ draft.tempData[dataSavePoint?.index] = dataSavePoint?.datum;
45
47
  }
46
- const { xValue, index } = getStrongestPeak(draft) || {
47
- xValue: 0,
48
- index: 0,
49
- };
50
- draft.toolOptions.data.pivot = { value: xValue, index };
51
- }
52
- else {
53
- if (draft.toolOptions.selectedTool === options.phaseCorrection.id) {
54
- draft.toolOptions.data.activeFilterID = null;
55
- const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === activeSpectrumId);
56
- draft.data[spectrumIndex].data = draft.tempData[spectrumIndex].data;
48
+ switch (selectedFilterID) {
49
+ case options.phaseCorrection.id: {
50
+ // look for the strongest peak to set it as a pivot
51
+ const { xValue, index } = getStrongestPeak(draft) || {
52
+ xValue: 0,
53
+ index: 0,
54
+ };
55
+ draft.toolOptions.data.pivot = { value: xValue, index };
56
+ break;
57
+ }
58
+ case options.baselineCorrection.id: {
59
+ if (draft.activeSpectrum?.id) {
60
+ const baselineCorrectionFilter = current(draft).data[draft.activeSpectrum.index].filters.find((filter) => filter.name === options.baselineCorrection.id);
61
+ draft.toolOptions.data.baselineCorrection.zones =
62
+ baselineCorrectionFilter
63
+ ? baselineCorrectionFilter.value.zones
64
+ : [];
65
+ }
66
+ break;
67
+ }
68
+ default:
69
+ break;
57
70
  }
58
71
  }
72
+ else if (checkFilterHasTempData(draft.toolOptions.selectedTool)) {
73
+ draft.toolOptions.data.activeFilterID = null;
74
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === activeSpectrumId);
75
+ draft.data[spectrumIndex].data = draft.tempData[spectrumIndex].data;
76
+ }
59
77
  }
60
78
  function resetTool(draft, setDefaultTool = true) {
61
79
  // reset temp range
62
- draft.toolOptions.data.tempRange = null;
63
80
  setSelectedOptionPanel(draft, null);
64
81
  if (setDefaultTool) {
65
82
  draft.toolOptions.selectedTool = options.zoom.id;
66
83
  }
67
- draft.toolOptions.data.baseLineZones = [];
84
+ draft.toolOptions.data.baselineCorrection = { zones: [], options: [] };
68
85
  if (draft.toolOptions.data.activeFilterID) {
69
86
  resetSpectrumByFilter(draft);
70
87
  }
@@ -86,10 +103,7 @@ function setSelectedTool(draft, action) {
86
103
  if (selectedTool) {
87
104
  // start Range edit mode
88
105
  if (selectedTool === options.editRange.id) {
89
- draft.toolOptions.data.tempRange = action.payload.tempRange;
90
- }
91
- else {
92
- draft.toolOptions.data.tempRange = null;
106
+ draft.toolOptions.data.showMultiplicityTrees = true;
93
107
  }
94
108
  if (selectedTool !== draft.toolOptions.selectedTool) {
95
109
  resetTool(draft, false);
@@ -132,18 +146,20 @@ function handleAddBaseLineZone(draft, { from, to }) {
132
146
  else {
133
147
  zone = [start, end];
134
148
  }
135
- const zones = draft.toolOptions.data.baseLineZones.slice();
149
+ const zones = draft.toolOptions.data.baselineCorrection.zones;
136
150
  zones.push({
137
151
  id: generateID(),
138
152
  from: zone[0],
139
153
  to: zone[1],
140
154
  });
141
- draft.toolOptions.data.baseLineZones = zones;
155
+ draft.toolOptions.data.baselineCorrection.zones = zones.slice();
156
+ calculateBaseLineCorrection(draft);
142
157
  }
143
158
  function handleDeleteBaseLineZone(draft, id) {
144
159
  const state = original(draft);
145
- draft.toolOptions.data.baseLineZones =
146
- state.toolOptions.data.baseLineZones.baseLineZones.filter((zone) => zone.id !== id);
160
+ draft.toolOptions.data.baselineCorrection.zones =
161
+ state.toolOptions.data.baselineCorrection.zones.filter((zone) => zone.id !== id);
162
+ calculateBaseLineCorrection(draft);
147
163
  }
148
164
  function handleToggleRealImaginaryVisibility(draft) {
149
165
  if (draft.activeSpectrum != null) {
@@ -216,24 +232,21 @@ function handleZoom(draft, action) {
216
232
  }
217
233
  }
218
234
  }
219
- else {
220
- if (activeSpectrum?.id) {
221
- if ((showRangesIntegrals || selectedTool === options.integral.id) &&
222
- event.shiftKey) {
223
- const domain = draft.integralsYDomains[activeSpectrum?.id];
224
- draft.integralsYDomains[activeSpectrum?.id] = wheelZoom(event, domain);
225
- }
226
- else {
227
- const domain = draft.yDomains[activeSpectrum?.id];
228
- draft.yDomains[activeSpectrum?.id] = wheelZoom(event, domain);
229
- }
235
+ else if (activeSpectrum?.id) {
236
+ if ((showRangesIntegrals || selectedTool === options.integral.id) &&
237
+ event.shiftKey) {
238
+ const domain = draft.integralsYDomains[activeSpectrum?.id];
239
+ draft.integralsYDomains[activeSpectrum?.id] = wheelZoom(event, domain);
230
240
  }
231
241
  else {
232
- const spectra = getSpectraByNucleus(draft.activeTab, draft.data);
233
- for (const spectrum of spectra) {
234
- const domain = draft.yDomains[spectrum.id];
235
- draft.yDomains[spectrum.id] = wheelZoom(event, domain);
236
- }
242
+ const domain = draft.yDomains[activeSpectrum?.id];
243
+ draft.yDomains[activeSpectrum?.id] = wheelZoom(event, domain);
244
+ }
245
+ }
246
+ else {
247
+ for (const key of Object.keys(draft.yDomains)) {
248
+ const domain = draft.yDomains[key];
249
+ draft.yDomains[key] = wheelZoom(event, domain);
237
250
  }
238
251
  }
239
252
  }
@@ -306,7 +319,7 @@ function setMargin(draft) {
306
319
  draft.margin = MARGIN['1D'];
307
320
  }
308
321
  }
309
- function Processing2DData(draft, data) {
322
+ function processing2DData(draft, data) {
310
323
  if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
311
324
  let _data = {};
312
325
  for (const datum of data[draft.activeTab]) {
@@ -382,13 +395,13 @@ function setTab(draft, dataGroupByTab, tab, refresh = false) {
382
395
  }
383
396
  function setActiveTab(draft, options) {
384
397
  const { tab = null, refreshActiveTab = false, domainOptions = {}, } = options || {};
385
- const groupByNucleus = GroupByInfoKey('nucleus');
398
+ const groupByNucleus = groupByInfoKey('nucleus');
386
399
  const dataGroupByNucleus = groupByNucleus(draft.data, true);
387
400
  const tabs = Object.keys(dataGroupByNucleus);
388
401
  const currentTab = !tab || !tabs.includes(tab || '') ? tabs[0] : tab;
389
402
  setTab(draft, dataGroupByNucleus, currentTab, refreshActiveTab);
390
403
  resetTool(draft);
391
- Processing2DData(draft, dataGroupByNucleus);
404
+ processing2DData(draft, dataGroupByNucleus);
392
405
  setDomain(draft, domainOptions);
393
406
  setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
394
407
  const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.activeTab);
@@ -0,0 +1,5 @@
1
+ import { Draft } from 'immer';
2
+ import { State } from '../Reducer';
3
+ export declare function getSpectrum(state: Draft<State>): any;
4
+ export declare function getSpectrum(state: Draft<State>, index: number): any;
5
+ export declare function getSpectrum(state: Draft<State>, id: string): any;
@@ -0,0 +1,14 @@
1
+ export function getSpectrum(state, value) {
2
+ if (value === undefined) {
3
+ if (state.activeSpectrum?.id) {
4
+ const index = state.activeSpectrum.index;
5
+ return state.data[index];
6
+ }
7
+ }
8
+ if (typeof value === 'number') {
9
+ return state.data[value] || undefined;
10
+ }
11
+ if (typeof value === 'string') {
12
+ return state.data.find((spectrum) => spectrum.id === value);
13
+ }
14
+ }
@@ -53,7 +53,7 @@ export function initPreferences(draft, action) {
53
53
  storeData('nmr-general-settings', JSON.stringify(data));
54
54
  }
55
55
  else {
56
- currentWorkspacePreferences.display = lodashMerge({}, workspacePreferences.display, currentWorkspacePreferences.display);
56
+ draft.workspaces[draft.workspace.current] = lodashMerge({}, currentWorkspacePreferences, resProps);
57
57
  }
58
58
  draft.dispatch = dispatch;
59
59
  }
@@ -44,12 +44,12 @@ const databaseDefaultValues = {
44
44
  showSmiles: true,
45
45
  showSolvent: false,
46
46
  showNames: true,
47
- showRange: false,
48
- showDelta: true,
47
+ range: { show: false, format: '0.00' },
48
+ delta: { show: true, format: '0.00' },
49
49
  showAssignment: false,
50
- showCoupling: true,
50
+ coupling: { show: true, format: '0.0' },
51
51
  showMultiplicity: true,
52
- color: 'black',
52
+ color: '#C0B000',
53
53
  marginBottom: 30,
54
54
  };
55
55
  export { getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, };
@@ -160,10 +160,10 @@ declare const preferencesReducer: (base: {
160
160
  readonly integralTool?: boolean | undefined;
161
161
  readonly zonePickingTool?: boolean | undefined;
162
162
  readonly slicingTool?: boolean | undefined;
163
- readonly autoRangesTool?: boolean | undefined;
163
+ readonly rangePickingTool?: boolean | undefined;
164
164
  readonly zeroFillingTool?: boolean | undefined;
165
165
  readonly phaseCorrectionTool?: boolean | undefined;
166
- readonly baseLineCorrectionTool?: boolean | undefined;
166
+ readonly baselineCorrectionTool?: boolean | undefined;
167
167
  readonly FFTTool?: boolean | undefined;
168
168
  readonly multipleSpectraAnalysisTool?: boolean | undefined;
169
169
  readonly exclusionZonesTool?: boolean | undefined;
@@ -282,21 +282,34 @@ declare const preferencesReducer: (base: {
282
282
  readonly showSmiles: boolean;
283
283
  readonly showSolvent: boolean;
284
284
  readonly showNames: boolean;
285
- readonly showRange: boolean;
286
- readonly showDelta: boolean;
285
+ readonly range: {
286
+ readonly show: boolean;
287
+ readonly format: string;
288
+ };
289
+ readonly delta: {
290
+ readonly show: boolean;
291
+ readonly format: string;
292
+ };
287
293
  readonly showAssignment: boolean;
288
- readonly showCoupling: boolean;
294
+ readonly coupling: {
295
+ readonly show: boolean;
296
+ readonly format: string;
297
+ };
289
298
  readonly showMultiplicity: boolean;
290
299
  readonly color: string;
291
300
  readonly marginBottom: number;
292
301
  } | undefined;
293
302
  };
294
303
  };
295
- readonly databases: readonly {
296
- readonly label: string;
297
- readonly url: string;
298
- readonly enabled: boolean;
299
- }[];
304
+ readonly databases: {
305
+ readonly data: readonly {
306
+ readonly key: string;
307
+ readonly label: string;
308
+ readonly url: string;
309
+ readonly enabled: boolean;
310
+ }[];
311
+ readonly defaultDatabase: string;
312
+ };
300
313
  };
301
314
  };
302
315
  readonly dispatch: (action?: PreferencesActions) => void;
@@ -8,7 +8,7 @@ import { resetPreferences } from './actions/resetPreferences';
8
8
  import { setPanelsPreferences } from './actions/setPanelsPreferences';
9
9
  import { setPreferences } from './actions/setPreferences';
10
10
  import { setWorkspace } from './actions/setWorkspace';
11
- const LOCAL_STORAGE_VERSION = 8;
11
+ const LOCAL_STORAGE_VERSION = 9;
12
12
  export const WORKSPACES = [
13
13
  {
14
14
  key: 'default',
@@ -55,6 +55,7 @@ export declare const DELETE_SPECTRA_FILTER = "DELETE_SPECTRA_FILTER";
55
55
  export declare const APPLY_ZERO_FILLING_FILTER = "APPLY_ZERO_FILLING_FILTER";
56
56
  export declare const APPLY_FFT_FILTER = "APPLY_FFT_FILTER";
57
57
  export declare const CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = "CALCULATE_MANUAL_PHASE_CORRECTION_FILTER";
58
+ export declare const CALCULATE_BASE_LINE_CORRECTION_FILTER = "CALCULATE_BASE_LINE_CORRECTION_FILTER";
58
59
  export declare const APPLY_MANUAL_PHASE_CORRECTION_FILTER = "APPLY_MANUAL_PHASE_CORRECTION_FILTER";
59
60
  export declare const APPLY_AUTO_PHASE_CORRECTION_FILTER = "APPLY_AUTO_PHASE_CORRECTION_FILTER";
60
61
  export declare const APPLY_ABSOLUTE_FILTER = "APPLY_ABSOLUTE_FILTER";
@@ -115,12 +116,13 @@ export declare const DELETE_EXCLUSION_ZONE = "DELETE_EXCLUSION_ZONE";
115
116
  export declare const CHANGE_RANGES_SUM_FLAG = "CHANGE_RANGES_SUM_FLAG";
116
117
  export declare const CHANGE_INTEGRALS_SUM_FLAG = "CHANGE_INTEGRALS_SUM_FLAG";
117
118
  export declare const CHANGE_ZONES_NOISE_FACTOR = "CHANGE_ZONES_NOISE_FACTOR";
118
- export declare const CHANGE_TEMP_RANGE = "CHANGE_TEMP_RANGE";
119
+ export declare const UPDATE_RANGE = "UPDATE_RANGE";
119
120
  export declare const SHOW_MULTIPLICTY_TREES = "SHOW_MULTIPLICTY_TREES";
120
121
  export declare const SHOW_RANGES_INTEGRALS = "SHOW_RANGES_INTEGRALS";
121
122
  export declare const AUTO_RANGES_SPECTRA_PICKING = "AUTO_RANGES_SPECTRA_PICKING";
122
123
  export declare const AUTO_ZONES_SPECTRA_PICKING = "AUTO_ZONES_SPECTRA_PICKING";
123
124
  export declare const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = "GENERATE_SPECTRUM_FROM_PUBLICATION_STRING";
124
125
  export declare const RESURRECTING_SPECTRUM_FROM_RANGES = "RESURRECTING_SPECTRUM_FROM_RANGES";
126
+ export declare const RESURRECTING_SPECTRUM_FROM_JCAMP = "RESURRECTING_SPECTRUM_FROM_JCAMP";
125
127
  export declare const SHOW_J_GRAPH = "SHOW_J_GRAPH";
126
128
  export declare const SET_AUTOMATIC_ASSIGNMENTS = "SET_AUTOMATIC_ASSIGNMENTS";
@@ -49,6 +49,7 @@ export const DELETE_SPECTRA_FILTER = 'DELETE_SPECTRA_FILTER';
49
49
  export const APPLY_ZERO_FILLING_FILTER = 'APPLY_ZERO_FILLING_FILTER';
50
50
  export const APPLY_FFT_FILTER = 'APPLY_FFT_FILTER';
51
51
  export const CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER';
52
+ export const CALCULATE_BASE_LINE_CORRECTION_FILTER = 'CALCULATE_BASE_LINE_CORRECTION_FILTER';
52
53
  export const APPLY_MANUAL_PHASE_CORRECTION_FILTER = 'APPLY_MANUAL_PHASE_CORRECTION_FILTER';
53
54
  export const APPLY_AUTO_PHASE_CORRECTION_FILTER = 'APPLY_AUTO_PHASE_CORRECTION_FILTER';
54
55
  export const APPLY_ABSOLUTE_FILTER = 'APPLY_ABSOLUTE_FILTER';
@@ -109,12 +110,13 @@ export const DELETE_EXCLUSION_ZONE = 'DELETE_EXCLUSION_ZONE';
109
110
  export const CHANGE_RANGES_SUM_FLAG = 'CHANGE_RANGES_SUM_FLAG';
110
111
  export const CHANGE_INTEGRALS_SUM_FLAG = 'CHANGE_INTEGRALS_SUM_FLAG';
111
112
  export const CHANGE_ZONES_NOISE_FACTOR = 'CHANGE_ZONES_NOISE_FACTOR';
112
- export const CHANGE_TEMP_RANGE = 'CHANGE_TEMP_RANGE';
113
+ export const UPDATE_RANGE = 'UPDATE_RANGE';
113
114
  export const SHOW_MULTIPLICTY_TREES = 'SHOW_MULTIPLICTY_TREES';
114
115
  export const SHOW_RANGES_INTEGRALS = 'SHOW_RANGES_INTEGRALS';
115
116
  export const AUTO_RANGES_SPECTRA_PICKING = 'AUTO_RANGES_SPECTRA_PICKING';
116
117
  export const AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
117
118
  export const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
118
119
  export const RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
120
+ export const RESURRECTING_SPECTRUM_FROM_JCAMP = 'RESURRECTING_SPECTRUM_FROM_JCAMP';
119
121
  export const SHOW_J_GRAPH = 'SHOW_J_GRAPH';
120
122
  export const SET_AUTOMATIC_ASSIGNMENTS = 'SET_AUTOMATIC_ASSIGNMENTS';
@@ -17,7 +17,7 @@ const allowTools = [
17
17
  options.peakPicking.id,
18
18
  options.integral.id,
19
19
  options.phaseCorrection.id,
20
- options.baseLineCorrection.id,
20
+ options.baselineCorrection.id,
21
21
  options.rangesPicking.id,
22
22
  options.exclusionZones.id,
23
23
  ];
@@ -18,7 +18,7 @@ const allowTools = [
18
18
  options.peakPicking.id,
19
19
  options.integral.id,
20
20
  options.phaseCorrection.id,
21
- options.baseLineCorrection.id,
21
+ options.baselineCorrection.id,
22
22
  options.rangesPicking.id,
23
23
  options.zone2D.id,
24
24
  options.slicingTool.id,
@@ -16,7 +16,7 @@ const styles = {
16
16
  const allowTools = [
17
17
  options.zoom.id,
18
18
  options.equalizerTool.id,
19
- options.baseLineCorrection.id,
19
+ options.baselineCorrection.id,
20
20
  options.zone2D.id,
21
21
  options.slicingTool.id,
22
22
  options.integral.id,
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import OCL from 'openchemlib/full';
5
- import { useCallback } from 'react';
5
+ import { useCallback, useState } from 'react';
6
6
  import OCLnmr from 'react-ocl-nmr';
7
7
  import { useDispatch } from '../../context/DispatchContext';
8
8
  import { useGlobal } from '../../context/GlobalContext';
@@ -27,6 +27,7 @@ const style = css `
27
27
  `;
28
28
  export function DraggableStructure(props) {
29
29
  const { zones, ranges, molecule, activeTab, displayerMode, index } = props;
30
+ const [molfile, setMolFile] = useState(molecule.molfile);
30
31
  const { viewerRef } = useGlobal();
31
32
  const dispatch = useDispatch();
32
33
  const openMoleculeEditor = useMoleculeEditor();
@@ -37,7 +38,7 @@ export function DraggableStructure(props) {
37
38
  payload: { key: molecule.key },
38
39
  });
39
40
  }, [dispatch, molecule]);
40
- return (_jsx(SVGDraggable, { width: 150, height: 100, initialPosition: { x: 100, y: 50 }, dragHandleClassName: "handle", parentElement: viewerRef, children: (width, height) => (_jsxs("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
41
+ return (_jsx(SVGDraggable, { width: 150, height: 100, initialPosition: { x: 100, y: 50 }, dragHandleClassName: "handle", parentElement: viewerRef, children: (width, height) => (_jsxs("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(OCLnmr, { OCL: OCL, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
41
42
  ? currentDiaIDsToHighlight
42
- : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: () => null })] })) }, molecule.key));
43
+ : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: setMolFile })] })) }, molecule.key));
43
44
  }
@@ -112,7 +112,6 @@ function BasicToolBarInner({ info, verticalAlign, displayerMode, ftCounter, fidC
112
112
  openImportPublicationStringModal();
113
113
  break;
114
114
  default:
115
- return;
116
115
  }
117
116
  }, [openLoader, importJCAMPFile, openImportPublicationStringModal]);
118
117
  const exportHandler = useCallback(({ id }) => {
@@ -33,26 +33,22 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
33
33
  });
34
34
  dispatch({ type: SET_SELECTED_FILTER, selectedFilter: null });
35
35
  }, [dispatch]);
36
- return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('zoomTool') && (_jsx(ToggleButton, { value: options.zoom.id, id: "zoomIn", title: `${options.zoom.label} ( Press z )`, children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaSearchPlus, {}) }) }, options.zoom.id)), isButtonVisible('zoomOutTool') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaExpand, {}) }) })), displayerMode === DISPLAYER_MODE.DM_1D && isButtonVisible('peakTool') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "peakPicking", children: _jsx(SvgNmrPeakPicking, {}) }, options.peakPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
37
- isButtonVisible('integralTool') && (_jsx(ToggleButton, { value: options.integral.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "integralPicking", title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}) }, options.integral.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
38
- isButtonVisible('zonePickingTool') && (_jsx(ToggleButton, { value: options.zone2D.id, id: "zone2d", isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${options.zone2D.label} ( Press r )`, children: _jsx(FaDiceFour, {}) }, options.zone2D.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
39
- isButtonVisible('slicingTool') && (_jsx(ToggleButton, { value: options.slicingTool.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "slic", title: `${options.slicingTool.label}`, children: _jsx("p", { children: "Slic" }) }, options.slicingTool.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
40
- isButtonVisible('autoRangesTool') && (_jsx(ToggleButton, { value: options.rangesPicking.id, isVisible: activeSpectrum && !info?.isFid ? true : false, title: `${options.rangesPicking.label} ( Press r )`, id: "ranges-pick", children: _jsx(SvgNmrRangePicking, {}) }, options.rangesPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
36
+ return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('zoomTool') && (_jsx(ToggleButton, { value: options.zoom.id, id: "zoomIn", title: `${options.zoom.label} ( Press z )`, children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaSearchPlus, {}) }) }, options.zoom.id)), isButtonVisible('zoomOutTool') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaExpand, {}) }) })), displayerMode === DISPLAYER_MODE.DM_1D && isButtonVisible('peakTool') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, isVisible: !!(activeSpectrum && !info?.isFid), id: "peakPicking", children: _jsx(SvgNmrPeakPicking, {}) }, options.peakPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
37
+ isButtonVisible('integralTool') && (_jsx(ToggleButton, { value: options.integral.id, isVisible: !!(activeSpectrum && !info?.isFid), id: "integralPicking", title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}) }, options.integral.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
38
+ isButtonVisible('zonePickingTool') && (_jsx(ToggleButton, { value: options.zone2D.id, id: "zone2d", isVisible: !!(activeSpectrum && !info?.isFid), title: `${options.zone2D.label} ( Press r )`, children: _jsx(FaDiceFour, {}) }, options.zone2D.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
39
+ isButtonVisible('slicingTool') && (_jsx(ToggleButton, { value: options.slicingTool.id, isVisible: !!(activeSpectrum && !info?.isFid), id: "slic", title: `${options.slicingTool.label}`, children: _jsx("p", { children: "Slic" }) }, options.slicingTool.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
40
+ isButtonVisible('rangePickingTool') && (_jsx(ToggleButton, { value: options.rangesPicking.id, isVisible: !!(activeSpectrum && !info?.isFid), title: `${options.rangesPicking.label} ( Press r )`, id: "ranges-pick", children: _jsx(SvgNmrRangePicking, {}) }, options.rangesPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
41
41
  isButtonVisible('multipleSpectraAnalysisTool') &&
42
42
  ftCounter > 1 &&
43
43
  mode === 'RTL' && (_jsx(ToggleButton, { value: options.multipleSpectraAnalysis.id, id: "multipleSpectraAnalysis", title: options.multipleSpectraAnalysis.label, children: _jsx(SvgNmrMultipleAnalysis, {}) }, options.multipleSpectraAnalysis.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
44
44
  isButtonVisible('zeroFillingTool') && (_jsx(ToggleButton, { value: options.zeroFilling.id, isVisible: Filters.zeroFilling.isApplicable({ info }), id: "zeroFilling", title: options.zeroFilling.label, children: _jsx(SvgNmrZeroFilling, {}) }, options.zeroFilling.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
45
- isButtonVisible('phaseCorrectionTool') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: "phaseCorrection", title: `${options.phaseCorrection.label} ( Press a )`, isVisible: activeSpectrum &&
45
+ isButtonVisible('phaseCorrectionTool') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: "phaseCorrection", title: `${options.phaseCorrection.label} ( Press a )`, isVisible: !!(activeSpectrum &&
46
46
  info &&
47
47
  Filters.phaseCorrection.isApplicable({ info }) &&
48
- datum.im
49
- ? true
50
- : false, children: _jsx(SvgNmrPhaseCorrection, {}) }, options.phaseCorrection.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
51
- isButtonVisible('baseLineCorrectionTool') && (_jsx(ToggleButton, { value: options.baseLineCorrection.id, id: "baseLineCorrection", title: `${options.baseLineCorrection.label} ( Press b )`, isVisible: activeSpectrum &&
48
+ datum.im), children: _jsx(SvgNmrPhaseCorrection, {}) }, options.phaseCorrection.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
49
+ isButtonVisible('baselineCorrectionTool') && (_jsx(ToggleButton, { value: options.baselineCorrection.id, id: "baselineCorrection", title: `${options.baselineCorrection.label} ( Press b )`, isVisible: !!(activeSpectrum &&
52
50
  info &&
53
- Filters.baselineCorrection.isApplicable({ info })
54
- ? true
55
- : false, children: _jsx(SvgNmrBaselineCorrection, {}) }, options.baseLineCorrection.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
51
+ Filters.baselineCorrection.isApplicable({ info })), children: _jsx(SvgNmrBaselineCorrection, {}) }, options.baselineCorrection.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
56
52
  isButtonVisible('exclusionZonesTool') &&
57
53
  !info?.isFid &&
58
54
  ftCounter > 0 && (_jsx(ToggleButton, { value: options.exclusionZones.id, title: `${options.exclusionZones.label} ( Press e )`, id: "exclusionZones", children: _jsx("div", { style: { fontSize: 18 }, children: _jsx(SvgNmrMultipleAnalysis, {}) }) }, options.exclusionZones.id))] }), displayerMode === DISPLAYER_MODE.DM_1D &&
@@ -4,6 +4,6 @@ interface OptionItem {
4
4
  hasOptionPanel: boolean;
5
5
  isFilter: boolean;
6
6
  }
7
- declare type RecordOptions = Record<'zoom' | 'peakPicking' | 'integral' | 'zone2D' | 'slicingTool' | 'HMove' | 'equalizerTool' | 'rangesPicking' | 'zeroFilling' | 'phaseCorrection' | 'baseLineCorrection' | 'generalSelector' | 'editRange' | 'multipleSpectraAnalysis' | 'exclusionZones' | 'databaseRangesSelection', OptionItem>;
7
+ declare type RecordOptions = Record<'zoom' | 'peakPicking' | 'integral' | 'zone2D' | 'slicingTool' | 'HMove' | 'equalizerTool' | 'rangesPicking' | 'zeroFilling' | 'phaseCorrection' | 'baselineCorrection' | 'generalSelector' | 'editRange' | 'multipleSpectraAnalysis' | 'exclusionZones' | 'databaseRangesSelection', OptionItem>;
8
8
  export declare const options: RecordOptions;
9
9
  export {};
@@ -60,9 +60,9 @@ export const options = {
60
60
  hasOptionPanel: true,
61
61
  isFilter: true,
62
62
  },
63
- baseLineCorrection: {
64
- id: 'baseLineCorrection',
65
- label: 'baseline correction',
63
+ baselineCorrection: {
64
+ id: Filters.baselineCorrection.id,
65
+ label: Filters.baselineCorrection.name,
66
66
  hasOptionPanel: true,
67
67
  isFilter: true,
68
68
  },
@@ -14,4 +14,10 @@ declare function exportAsMol(data: any, fileName?: string): void;
14
14
  declare function exportAsSVG(rootRef: HTMLDivElement, elementID: string, fileName?: string): void;
15
15
  declare function exportAsPng(rootRef: HTMLDivElement, elementID: string, fileName?: string): void;
16
16
  declare function copyPNGToClipboard(rootRef: HTMLDivElement, elementID: string): void;
17
- export { exportAsSVG, exportAsJSON, exportAsNMRE, exportAsPng, copyPNGToClipboard, copyTextToClipboard, copyHTMLToClipboard, exportAsMol, exportAsMatrix, };
17
+ export interface BlobObject {
18
+ blob: Blob;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ declare function getBlob(rootRef: HTMLDivElement, elementID: string): BlobObject;
23
+ export { exportAsSVG, exportAsJSON, exportAsNMRE, exportAsPng, copyPNGToClipboard, copyTextToClipboard, copyHTMLToClipboard, exportAsMol, exportAsMatrix, getBlob, };
@@ -206,8 +206,8 @@ function getBlob(rootRef, elementID) {
206
206
  let _svg = rootRef.getRootNode()
207
207
  .getElementById(elementID)
208
208
  ?.cloneNode(true);
209
- const width = _svg?.getAttribute('width').replace('px', '');
210
- const height = _svg?.getAttribute('height').replace('px', '');
209
+ const width = Number(_svg?.getAttribute('width').replace('px', ''));
210
+ const height = Number(_svg?.getAttribute('height').replace('px', ''));
211
211
  _svg
212
212
  .querySelectorAll('[data-no-export="true"]')
213
213
  .forEach((element) => element.remove());
@@ -235,4 +235,4 @@ function getBlob(rootRef, elementID) {
235
235
  const blob = new Blob([svg], { type: 'image/svg+xml' });
236
236
  return { blob, width, height };
237
237
  }
238
- export { exportAsSVG, exportAsJSON, exportAsNMRE, exportAsPng, copyPNGToClipboard, copyTextToClipboard, copyHTMLToClipboard, exportAsMol, exportAsMatrix, };
238
+ export { exportAsSVG, exportAsJSON, exportAsNMRE, exportAsPng, copyPNGToClipboard, copyTextToClipboard, copyHTMLToClipboard, exportAsMol, exportAsMatrix, getBlob, };
@@ -1,3 +1,3 @@
1
- declare function formatNumber(value: any, format: any, prefix?: string, suffix?: string): string;
1
+ declare function formatNumber(value: any, format: any, prefix?: string, suffix?: string): any;
2
2
  declare function getNumberOfDecimals(value: number | string): number;
3
3
  export { formatNumber, getNumberOfDecimals };
@@ -1,6 +1,8 @@
1
- import Numeral from 'numeral';
1
+ import numeral from 'numeral';
2
2
  function formatNumber(value, format, prefix = '', suffix = '') {
3
- return prefix + Numeral(value).format(format) + suffix;
3
+ return (value || value === 0) && !isNaN(value)
4
+ ? prefix + numeral(value).format(format) + suffix
5
+ : value;
4
6
  }
5
7
  function getNumberOfDecimals(value) {
6
8
  value = String(value).trim();
@@ -0,0 +1 @@
1
+ export declare function isGoogleDocument(url: string): boolean;
@@ -0,0 +1,3 @@
1
+ export function isGoogleDocument(url) {
2
+ return /https:\/\/docs\.google\.com\/(?<type>document|spreadsheets)\/d/.test(url);
3
+ }