nmrium 0.26.0 → 0.27.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 (425) hide show
  1. package/lib/component/1d/Chart1D.js +3 -2
  2. package/lib/component/1d/FooterBanner.js +1 -1
  3. package/lib/component/1d/Integral.d.ts +2 -1
  4. package/lib/component/1d/Integral.js +5 -12
  5. package/lib/component/1d/IntegralResizable.d.ts +2 -1
  6. package/lib/component/1d/IntegralResizable.js +10 -5
  7. package/lib/component/1d/IntegralsSeries.js +3 -3
  8. package/lib/component/1d/Line.d.ts +2 -2
  9. package/lib/component/1d/PeakAnnotation.js +5 -4
  10. package/lib/component/1d/database/DatabaseElements.d.ts +3 -0
  11. package/lib/component/1d/database/DatabaseElements.js +18 -0
  12. package/lib/component/1d/database/DatabaseSpectrum.d.ts +3 -0
  13. package/lib/component/1d/database/DatabaseSpectrum.js +58 -0
  14. package/lib/component/1d/{ResurrectedDatabaseRanges.d.ts → database/ResurrectedDatabaseRanges.d.ts} +0 -0
  15. package/lib/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
  16. package/lib/component/1d/jCouplingGraph/JGraph.js +4 -10
  17. package/lib/component/1d/multiAnalysis/AnalysisRange.js +10 -5
  18. package/lib/component/1d/ranges/Range.d.ts +2 -1
  19. package/lib/component/1d/ranges/Range.js +17 -9
  20. package/lib/component/1d/ranges/Ranges.js +6 -3
  21. package/lib/component/1d/tool/XLabelPointer.js +1 -1
  22. package/lib/component/2d/Chart2D.js +2 -1
  23. package/lib/component/2d/Contours.js +4 -1
  24. package/lib/component/2d/FooterBanner.js +1 -1
  25. package/lib/component/2d/tools/XYLabelPointer.js +1 -1
  26. package/lib/component/2d/tools/slicing/HorizontalSliceChart.d.ts +2 -2
  27. package/lib/component/2d/tools/slicing/SliceScale.d.ts +1 -1
  28. package/lib/component/2d/tools/slicing/VerticalSliceChart.d.ts +2 -2
  29. package/lib/component/EventsTrackers/KeysListenerTracker.js +10 -4
  30. package/lib/component/NMRium.d.ts +5 -1
  31. package/lib/component/NMRium.js +6 -3
  32. package/lib/component/SplitPaneWrapper.d.ts +4 -0
  33. package/lib/component/SplitPaneWrapper.js +8 -0
  34. package/lib/component/context/GlobalContext.d.ts +3 -0
  35. package/lib/component/context/GlobalContext.js +1 -1
  36. package/lib/component/context/PreferencesContext.d.ts +15 -12
  37. package/lib/component/context/PreferencesContext.js +1 -1
  38. package/lib/component/elements/Button.js +1 -1
  39. package/lib/component/elements/ColorInput.js +2 -2
  40. package/lib/component/elements/ContextMenu.d.ts +8 -3
  41. package/lib/component/elements/EditableColumn.d.ts +3 -2
  42. package/lib/component/elements/EditableColumn.js +27 -20
  43. package/lib/component/elements/Input.d.ts +9 -1
  44. package/lib/component/elements/Input.js +18 -5
  45. package/lib/component/elements/Select.d.ts +1 -0
  46. package/lib/component/elements/Select.js +21 -15
  47. package/lib/component/elements/ToggleButton.d.ts +2 -1
  48. package/lib/component/elements/ToggleButton.js +2 -2
  49. package/lib/component/elements/draggble/SVGDraggable.d.ts +17 -0
  50. package/lib/component/elements/draggble/SVGDraggable.js +33 -0
  51. package/lib/component/elements/{resizer → draggble}/useDraggable.d.ts +9 -6
  52. package/lib/component/elements/draggble/useDraggable.js +70 -0
  53. package/lib/component/elements/formik/FormikColorPicker.d.ts +1 -0
  54. package/lib/component/elements/formik/FormikColorPicker.js +10 -7
  55. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +5 -4
  56. package/lib/component/elements/formik/FormikColumnFormatField.js +2 -2
  57. package/lib/component/elements/formik/FormikInput.d.ts +1 -0
  58. package/lib/component/elements/formik/FormikInput.js +6 -3
  59. package/lib/component/elements/formik/FormikSlider.d.ts +1 -0
  60. package/lib/component/elements/formik/FormikSlider.js +6 -3
  61. package/lib/component/elements/popup/Alert/Provider.js +1 -1
  62. package/lib/component/elements/resizer/DivResizer.js +17 -62
  63. package/lib/component/elements/resizer/Resizer.d.ts +3 -1
  64. package/lib/component/elements/resizer/SVGResizer.js +24 -53
  65. package/lib/component/elements/resizer/useResizer.d.ts +11 -0
  66. package/lib/component/elements/resizer/useResizer.js +65 -0
  67. package/lib/component/hooks/useExport.d.ts +1 -1
  68. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +3 -0
  69. package/lib/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +0 -9
  70. package/lib/component/hooks/usePanelPreferences.d.ts +7 -0
  71. package/lib/component/hooks/usePanelPreferences.js +54 -0
  72. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  73. package/lib/component/loader/DefaultSpinnerComponent.d.ts +3 -1
  74. package/lib/component/loader/DefaultSpinnerComponent.js +2 -2
  75. package/lib/component/loader/SpinnerContext.d.ts +3 -3
  76. package/lib/component/loader/SpinnerContext.js +2 -2
  77. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -4
  78. package/lib/component/modal/MoleculeStructureEditorModal.js +22 -1
  79. package/lib/component/modal/editRange/EditRangeModal.js +6 -5
  80. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +2 -0
  81. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
  82. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +3 -1
  83. package/lib/component/modal/editRange/forms/components/SignalsForm.js +12 -9
  84. package/lib/component/modal/setting/DatabasesTabContent.d.ts +6 -0
  85. package/lib/component/modal/setting/DatabasesTabContent.js +75 -0
  86. package/lib/component/modal/setting/DisplayTabContent.js +11 -7
  87. package/lib/component/modal/setting/FormattingTabContent.js +5 -5
  88. package/lib/component/modal/setting/GeneralSettings.js +2 -1
  89. package/lib/component/modal/setting/settingsValidation.d.ts +48 -0
  90. package/lib/component/modal/setting/settingsValidation.js +33 -27
  91. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
  92. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +0 -1
  93. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
  94. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +2 -2
  95. package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -11
  96. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +1 -1
  97. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +26 -74
  98. package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +8 -0
  99. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +38 -0
  100. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
  101. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +10 -2
  102. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +12 -1
  103. package/lib/component/panels/MoleculesPanel/Utilities.js +11 -0
  104. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -1
  105. package/lib/component/panels/Panels.js +2 -3
  106. package/lib/component/panels/PeaksPanel/PeaksPanel.js +3 -3
  107. package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +1 -1
  108. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +29 -82
  109. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -5
  110. package/lib/component/panels/PeaksPanel/PeaksTable.js +18 -25
  111. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  112. package/lib/component/panels/RangesPanel/RangesHeader.js +15 -9
  113. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -10
  114. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +1 -1
  115. package/lib/component/panels/RangesPanel/RangesPreferences.js +55 -66
  116. package/lib/component/panels/RangesPanel/RangesTable.d.ts +11 -6
  117. package/lib/component/panels/RangesPanel/RangesTable.js +3 -7
  118. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +5 -2
  119. package/lib/component/panels/RangesPanel/RangesTableRow.js +3 -3
  120. package/lib/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -2
  121. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.d.ts +2 -1
  122. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
  123. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.d.ts +2 -1
  124. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
  125. package/lib/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -2
  126. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  127. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
  128. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
  129. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.d.ts +13 -0
  130. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +14 -0
  131. package/lib/component/panels/RangesPanel/TableColumns/format.js +2 -2
  132. package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.d.ts +18 -0
  133. package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.js +18 -0
  134. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.d.ts +1 -2
  135. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +7 -68
  136. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
  137. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.d.ts +1 -2
  138. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +7 -68
  139. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
  140. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
  141. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.d.ts +6 -0
  142. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +51 -0
  143. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  144. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +5 -1
  145. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
  146. package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +1 -1
  147. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +20 -84
  148. package/lib/component/panels/ZonesPanel/ZonesTable.js +4 -1
  149. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +5 -1
  150. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  151. package/lib/component/panels/databasePanel/DatabasePanel.js +73 -40
  152. package/lib/component/panels/databasePanel/DatabasePreferences.js +10 -42
  153. package/lib/component/panels/databasePanel/DatabaseTable.js +23 -11
  154. package/lib/component/panels/databasePanel/useDatabases.d.ts +5 -0
  155. package/lib/component/panels/databasePanel/useDatabases.js +10 -0
  156. package/lib/component/panels/extra/placeholder/NoTableData.d.ts +3 -1
  157. package/lib/component/panels/extra/placeholder/NoTableData.js +2 -2
  158. package/lib/component/panels/extra/preferences/ColumnsHelper.js +3 -3
  159. package/lib/component/panels/extra/preferences/NucleusPreferences.d.ts +13 -0
  160. package/lib/component/panels/extra/preferences/NucleusPreferences.js +22 -0
  161. package/lib/component/panels/extra/preferences/PreferencesContainer.d.ts +6 -0
  162. package/lib/component/panels/extra/preferences/PreferencesContainer.js +10 -0
  163. package/lib/component/panels/extra/preferences/PreferencesGroup.d.ts +7 -0
  164. package/lib/component/panels/extra/preferences/PreferencesGroup.js +21 -0
  165. package/lib/component/reducer/Reducer.d.ts +358 -45
  166. package/lib/component/reducer/Reducer.js +5 -1
  167. package/lib/component/reducer/actions/LoadActions.js +2 -2
  168. package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -2
  169. package/lib/component/reducer/actions/MoleculeActions.js +15 -3
  170. package/lib/component/reducer/actions/PreferencesActions.js +1 -1
  171. package/lib/component/reducer/actions/ToolsActions.js +1 -1
  172. package/lib/component/reducer/preferences/actions/addWorkspace.d.ts +3 -0
  173. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -0
  174. package/lib/component/reducer/preferences/actions/initPreferences.d.ts +3 -0
  175. package/lib/component/reducer/preferences/actions/initPreferences.js +60 -0
  176. package/lib/component/reducer/preferences/actions/removeWorkspace.d.ts +3 -0
  177. package/lib/component/reducer/preferences/actions/removeWorkspace.js +20 -0
  178. package/lib/component/reducer/preferences/actions/resetPreferences.d.ts +3 -0
  179. package/lib/component/reducer/preferences/actions/resetPreferences.js +14 -0
  180. package/lib/component/reducer/preferences/actions/setPanelsPreferences.d.ts +3 -0
  181. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +13 -0
  182. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +3 -0
  183. package/lib/component/reducer/preferences/actions/setPreferences.js +34 -0
  184. package/lib/component/reducer/preferences/actions/setWorkspace.d.ts +3 -0
  185. package/lib/component/reducer/preferences/actions/setWorkspace.js +8 -0
  186. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +7 -0
  187. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +55 -0
  188. package/lib/component/reducer/{preferencesReducer.d.ts → preferences/preferencesReducer.d.ts} +131 -7
  189. package/lib/component/reducer/preferences/preferencesReducer.js +80 -0
  190. package/lib/component/reducer/preferences/utilites/checkKeysExists.d.ts +1 -0
  191. package/lib/component/reducer/preferences/utilites/checkKeysExists.js +14 -0
  192. package/lib/component/reducer/preferences/utilites/filterObject.d.ts +1 -0
  193. package/lib/component/reducer/preferences/utilites/filterObject.js +7 -0
  194. package/lib/component/reducer/preferences/utilites/flatObject.d.ts +1 -0
  195. package/lib/component/reducer/preferences/utilites/flatObject.js +9 -0
  196. package/lib/component/reducer/preferences/utilites/getActiveWorkspace.d.ts +3 -0
  197. package/lib/component/reducer/preferences/utilites/getActiveWorkspace.js +3 -0
  198. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.d.ts +2 -0
  199. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +4 -0
  200. package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.d.ts +5 -0
  201. package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.js +8 -0
  202. package/lib/component/reducer/types/Types.d.ts +2 -0
  203. package/lib/component/reducer/types/Types.js +2 -0
  204. package/lib/component/tool/FloatMoleculeStructures/ActionsButton.d.ts +4 -0
  205. package/lib/component/tool/FloatMoleculeStructures/ActionsButton.js +7 -0
  206. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +14 -0
  207. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +43 -0
  208. package/lib/component/tool/FloatMoleculeStructures/index.d.ts +15 -0
  209. package/lib/component/tool/FloatMoleculeStructures/index.js +28 -0
  210. package/lib/component/utility/Export.js +6 -0
  211. package/lib/component/utility/PathBuilder.js +2 -1
  212. package/lib/component/utility/formatNumber.d.ts +3 -0
  213. package/lib/component/utility/formatNumber.js +10 -0
  214. package/lib/component/utility/getUniqueNuclei.d.ts +1 -0
  215. package/lib/component/utility/getUniqueNuclei.js +10 -0
  216. package/lib/component/workspaces/Workspace.d.ts +72 -1
  217. package/lib/component/workspaces/basic.js +9 -1
  218. package/lib/component/workspaces/embedded.d.ts +2 -0
  219. package/lib/component/workspaces/embedded.js +32 -0
  220. package/lib/component/workspaces/exercise.js +2 -0
  221. package/lib/component/workspaces/index.d.ts +1 -0
  222. package/lib/component/workspaces/index.js +2 -1
  223. package/lib/component/workspaces/prediction.js +2 -0
  224. package/lib/component/workspaces/process1D.js +2 -0
  225. package/lib/data/data1d/Data1DManager.js +4 -0
  226. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.d.ts +2 -0
  227. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.js +10 -0
  228. package/lib/data/data1d/Spectrum1D/get1DDataXY.d.ts +2 -2
  229. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  230. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
  231. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
  232. package/lib/data/data1d/database.d.ts +8 -13
  233. package/lib/data/data1d/database.js +14 -19
  234. package/lib/data/data1d/filter1d/absolute.d.ts +3 -2
  235. package/lib/data/data1d/filter1d/autoPhaseCorrection.d.ts +3 -2
  236. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +3 -2
  237. package/lib/data/data1d/filter1d/centerMean.d.ts +3 -2
  238. package/lib/data/data1d/filter1d/digitalFilter.d.ts +3 -2
  239. package/lib/data/data1d/filter1d/equallySpaced.d.ts +3 -2
  240. package/lib/data/data1d/filter1d/exclusionZones.js +4 -4
  241. package/lib/data/data1d/filter1d/fft.d.ts +3 -2
  242. package/lib/data/data1d/filter1d/fft.js +2 -2
  243. package/lib/data/data1d/filter1d/fromTo.d.ts +3 -2
  244. package/lib/data/data1d/filter1d/lineBroadening.d.ts +3 -2
  245. package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
  246. package/lib/data/data1d/filter1d/pareto.d.ts +3 -2
  247. package/lib/data/data1d/filter1d/pareto.js +2 -2
  248. package/lib/data/data1d/filter1d/phaseCorrection.d.ts +3 -2
  249. package/lib/data/data1d/filter1d/shiftX.d.ts +2 -1
  250. package/lib/data/data1d/filter1d/standardDeviation.d.ts +3 -2
  251. package/lib/data/data1d/filter1d/zeroFilling.d.ts +3 -2
  252. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  253. package/lib/data/data2d/Data2DManager.js +4 -0
  254. package/lib/data/data2d/filter2d/shiftX.d.ts +4 -3
  255. package/lib/data/data2d/filter2d/shiftX.js +2 -2
  256. package/lib/data/data2d/filter2d/shiftY.d.ts +4 -3
  257. package/lib/data/data2d/filter2d/shiftY.js +2 -2
  258. package/lib/data/molecules/Molecule.d.ts +3 -3
  259. package/lib/data/molecules/Molecule.js +7 -1
  260. package/lib/data/molecules/MoleculeManager.d.ts +4 -1
  261. package/lib/data/molecules/MoleculeManager.js +33 -2
  262. package/lib/data/types/data1d/Data1D.d.ts +3 -3
  263. package/lib/data/types/data1d/Info1D.d.ts +1 -0
  264. package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
  265. package/lib/versionInfo.js +1 -1
  266. package/lib-cjs/component/1d/Chart1D.js +3 -2
  267. package/lib-cjs/component/1d/FooterBanner.js +2 -2
  268. package/lib-cjs/component/1d/Integral.js +5 -12
  269. package/lib-cjs/component/1d/IntegralResizable.js +10 -5
  270. package/lib-cjs/component/1d/IntegralsSeries.js +3 -3
  271. package/lib-cjs/component/1d/PeakAnnotation.js +5 -4
  272. package/lib-cjs/component/1d/database/DatabaseElements.js +23 -0
  273. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +60 -0
  274. package/lib-cjs/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
  275. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +4 -10
  276. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +10 -5
  277. package/lib-cjs/component/1d/ranges/Range.js +17 -9
  278. package/lib-cjs/component/1d/ranges/Ranges.js +6 -3
  279. package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
  280. package/lib-cjs/component/2d/Chart2D.js +2 -1
  281. package/lib-cjs/component/2d/Contours.js +4 -1
  282. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  283. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  284. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +10 -4
  285. package/lib-cjs/component/NMRium.js +5 -2
  286. package/lib-cjs/component/SplitPaneWrapper.js +12 -0
  287. package/lib-cjs/component/context/GlobalContext.js +1 -1
  288. package/lib-cjs/component/context/PreferencesContext.js +1 -1
  289. package/lib-cjs/component/elements/Button.js +1 -1
  290. package/lib-cjs/component/elements/ColorInput.js +2 -2
  291. package/lib-cjs/component/elements/EditableColumn.js +27 -20
  292. package/lib-cjs/component/elements/Input.js +18 -5
  293. package/lib-cjs/component/elements/Select.js +20 -14
  294. package/lib-cjs/component/elements/ToggleButton.js +2 -2
  295. package/lib-cjs/component/elements/draggble/SVGDraggable.js +39 -0
  296. package/lib-cjs/component/elements/draggble/useDraggable.js +73 -0
  297. package/lib-cjs/component/elements/formik/FormikColorPicker.js +10 -7
  298. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +2 -2
  299. package/lib-cjs/component/elements/formik/FormikInput.js +6 -3
  300. package/lib-cjs/component/elements/formik/FormikSlider.js +6 -3
  301. package/lib-cjs/component/elements/popup/Alert/Provider.js +1 -1
  302. package/lib-cjs/component/elements/resizer/DivResizer.js +17 -62
  303. package/lib-cjs/component/elements/resizer/SVGResizer.js +24 -53
  304. package/lib-cjs/component/elements/resizer/useResizer.js +71 -0
  305. package/lib-cjs/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +1 -11
  306. package/lib-cjs/component/hooks/usePanelPreferences.js +62 -0
  307. package/lib-cjs/component/loader/DefaultSpinnerComponent.js +2 -2
  308. package/lib-cjs/component/loader/SpinnerContext.js +2 -2
  309. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -1
  310. package/lib-cjs/component/modal/editRange/EditRangeModal.js +6 -5
  311. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
  312. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +12 -9
  313. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +80 -0
  314. package/lib-cjs/component/modal/setting/DisplayTabContent.js +11 -7
  315. package/lib-cjs/component/modal/setting/FormattingTabContent.js +4 -4
  316. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -1
  317. package/lib-cjs/component/modal/setting/settingsValidation.js +33 -27
  318. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
  319. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
  320. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -11
  321. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +24 -72
  322. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +44 -0
  323. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
  324. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +9 -1
  325. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +11 -0
  326. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  327. package/lib-cjs/component/panels/Panels.js +2 -3
  328. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -4
  329. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +27 -80
  330. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +18 -48
  331. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +15 -9
  332. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +4 -10
  333. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +53 -64
  334. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +3 -7
  335. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
  336. package/lib-cjs/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -5
  337. package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
  338. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
  339. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -5
  340. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  341. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
  342. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +16 -0
  343. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +2 -2
  344. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/PlotChart.js +21 -0
  345. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +10 -68
  346. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
  347. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +10 -68
  348. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
  349. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
  350. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +55 -0
  351. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  352. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
  353. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +18 -82
  354. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +4 -1
  355. package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  356. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +72 -39
  357. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +10 -42
  358. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +22 -10
  359. package/lib-cjs/component/panels/databasePanel/useDatabases.js +14 -0
  360. package/lib-cjs/component/panels/extra/placeholder/NoTableData.js +2 -2
  361. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +3 -3
  362. package/lib-cjs/component/panels/extra/preferences/NucleusPreferences.js +29 -0
  363. package/lib-cjs/component/panels/extra/preferences/PreferencesContainer.js +14 -0
  364. package/lib-cjs/component/panels/extra/preferences/PreferencesGroup.js +25 -0
  365. package/lib-cjs/component/reducer/Reducer.js +5 -1
  366. package/lib-cjs/component/reducer/actions/LoadActions.js +2 -2
  367. package/lib-cjs/component/reducer/actions/MoleculeActions.js +17 -3
  368. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -1
  369. package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -1
  370. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +26 -0
  371. package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +67 -0
  372. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +24 -0
  373. package/lib-cjs/component/reducer/preferences/actions/resetPreferences.js +18 -0
  374. package/lib-cjs/component/reducer/preferences/actions/setPanelsPreferences.js +17 -0
  375. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +38 -0
  376. package/lib-cjs/component/reducer/preferences/actions/setWorkspace.js +12 -0
  377. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +62 -0
  378. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +87 -0
  379. package/lib-cjs/component/reducer/preferences/utilites/checkKeysExists.js +18 -0
  380. package/lib-cjs/component/reducer/preferences/utilites/filterObject.js +11 -0
  381. package/lib-cjs/component/reducer/preferences/utilites/flatObject.js +13 -0
  382. package/lib-cjs/component/reducer/preferences/utilites/getActiveWorkspace.js +7 -0
  383. package/lib-cjs/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +11 -0
  384. package/lib-cjs/component/reducer/preferences/utilites/mapNucleiFormatting.js +12 -0
  385. package/lib-cjs/component/reducer/types/Types.js +5 -3
  386. package/lib-cjs/component/tool/FloatMoleculeStructures/ActionsButton.js +13 -0
  387. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +50 -0
  388. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +36 -0
  389. package/lib-cjs/component/utility/Export.js +6 -0
  390. package/lib-cjs/component/utility/PathBuilder.js +2 -1
  391. package/lib-cjs/component/utility/formatNumber.js +17 -0
  392. package/lib-cjs/component/utility/getUniqueNuclei.js +14 -0
  393. package/lib-cjs/component/workspaces/basic.js +9 -1
  394. package/lib-cjs/component/workspaces/embedded.js +35 -0
  395. package/lib-cjs/component/workspaces/exercise.js +2 -0
  396. package/lib-cjs/component/workspaces/index.js +2 -1
  397. package/lib-cjs/component/workspaces/prediction.js +2 -0
  398. package/lib-cjs/component/workspaces/process1D.js +2 -0
  399. package/lib-cjs/data/data1d/Data1DManager.js +4 -0
  400. package/lib-cjs/data/data1d/Spectrum1D/convertDataToFloat64Array.js +14 -0
  401. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  402. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
  403. package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
  404. package/lib-cjs/data/data1d/database.js +15 -21
  405. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +4 -4
  406. package/lib-cjs/data/data1d/filter1d/fft.js +2 -2
  407. package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
  408. package/lib-cjs/data/data1d/filter1d/pareto.js +2 -2
  409. package/lib-cjs/data/data1d/filter1d/shiftX.js +2 -2
  410. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  411. package/lib-cjs/data/data2d/Data2DManager.js +4 -0
  412. package/lib-cjs/data/data2d/filter2d/shiftX.js +4 -4
  413. package/lib-cjs/data/data2d/filter2d/shiftY.js +4 -4
  414. package/lib-cjs/data/molecules/Molecule.js +7 -1
  415. package/lib-cjs/data/molecules/MoleculeManager.js +37 -3
  416. package/lib-cjs/versionInfo.js +1 -1
  417. package/package.json +42 -40
  418. package/lib/component/elements/resizer/useDraggable.js +0 -52
  419. package/lib/component/panels/extra/preferences/defaultValues.d.ts +0 -54
  420. package/lib/component/panels/extra/preferences/defaultValues.js +0 -54
  421. package/lib/component/reducer/preferencesReducer.js +0 -269
  422. package/lib/component/utility/FormatNumber.d.ts +0 -6
  423. package/lib-cjs/component/elements/resizer/useDraggable.js +0 -55
  424. package/lib-cjs/component/panels/extra/preferences/defaultValues.js +0 -61
  425. package/lib-cjs/component/reducer/preferencesReducer.js +0 -276
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.validation = void 0;
27
27
  const Yup = __importStar(require("yup"));
28
- const formattingValidation = (obj) => Object.keys(obj.formatting.nuclei).reduce((validate, key) => {
28
+ const formattingElementValidation = (obj) => Object.keys(obj.formatting.nuclei).reduce((validate, key) => {
29
29
  validate[key] = Yup.object().shape({
30
30
  name: Yup.string().trim().required('Nucleus is a required field'),
31
31
  ppm: Yup.string().trim().required('PPM format is a required field'),
@@ -33,34 +33,40 @@ const formattingValidation = (obj) => Object.keys(obj.formatting.nuclei).reduce(
33
33
  });
34
34
  return validate;
35
35
  }, {});
36
- exports.validation = Yup.lazy((obj) => Yup.object().shape({
37
- formatting: Yup.object().shape({
38
- nuclei: Yup.object()
39
- .shape(formattingValidation(obj))
40
- .test('Unique', 'Nuclei need te be unique', function check(nuclei) {
41
- let nucleusFrequencies = {};
42
- for (const key of Object.keys(nuclei)) {
43
- const _key = nuclei[key].name?.toLowerCase() || '';
44
- if (_key) {
45
- if (nucleusFrequencies[_key]) {
46
- ++nucleusFrequencies[_key].value;
47
- nucleusFrequencies[_key].fields.push(key);
48
- }
49
- else {
50
- nucleusFrequencies[_key] = { value: 1, fields: [key] };
51
- }
36
+ const formattingValidation = (obj) => Yup.object().shape({
37
+ nuclei: Yup.object()
38
+ .shape(formattingElementValidation(obj))
39
+ .test('Unique', 'Nuclei need te be unique', function check(nuclei) {
40
+ let nucleusFrequencies = {};
41
+ for (const key of Object.keys(nuclei)) {
42
+ const _key = nuclei[key].name?.toLowerCase() || '';
43
+ if (_key) {
44
+ if (nucleusFrequencies[_key]) {
45
+ ++nucleusFrequencies[_key].value;
46
+ nucleusFrequencies[_key].fields.push(key);
47
+ }
48
+ else {
49
+ nucleusFrequencies[_key] = { value: 1, fields: [key] };
52
50
  }
53
51
  }
54
- const errors = Object.keys(nucleusFrequencies).reduce((errorList, key) => {
55
- const { value, fields } = nucleusFrequencies[key];
56
- if (value > 1) {
57
- for (let field of fields) {
58
- errorList.push(new Yup.ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
59
- }
52
+ }
53
+ const errors = Object.keys(nucleusFrequencies).reduce((errorList, key) => {
54
+ const { value, fields } = nucleusFrequencies[key];
55
+ if (value > 1) {
56
+ for (let field of fields) {
57
+ errorList.push(new Yup.ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
60
58
  }
61
- return errorList;
62
- }, []);
63
- return new Yup.ValidationError(errors);
64
- }),
59
+ }
60
+ return errorList;
61
+ }, []);
62
+ return new Yup.ValidationError(errors);
65
63
  }),
64
+ });
65
+ const databasesValidation = Yup.array().of(Yup.object().shape({
66
+ label: Yup.string().trim().required('Label is a required field'),
67
+ url: Yup.string().trim().url().required('URL is a required field'),
68
+ }));
69
+ exports.validation = Yup.lazy((obj) => Yup.object().shape({
70
+ formatting: formattingValidation(obj),
71
+ databases: databasesValidation,
66
72
  }));
@@ -50,12 +50,17 @@ function useAutoAssignments() {
50
50
  spectra,
51
51
  molecule,
52
52
  }, { minScore: 0 });
53
- dispatch({
54
- type: Types_1.SET_AUTOMATIC_ASSIGNMENTS,
55
- payload: { assignments: result[0].assignment },
56
- });
57
- hideLoading();
53
+ if (result[0]?.assignment) {
54
+ dispatch({
55
+ type: Types_1.SET_AUTOMATIC_ASSIGNMENTS,
56
+ payload: { assignments: result[0].assignment },
57
+ });
58
+ }
59
+ else {
60
+ alert.error('Could not assign molecule, please check that all the ranges are defined correctly');
61
+ }
58
62
  setAssignments(result);
63
+ hideLoading();
59
64
  })();
60
65
  }, [alert, data, dispatch, molecules]);
61
66
  return (0, react_1.useMemo)(() => ({
@@ -12,7 +12,6 @@ const react_2 = require("react");
12
12
  const im_1 = require("react-icons/im");
13
13
  const ChartContext_1 = require("../../context/ChartContext");
14
14
  const DispatchContext_1 = require("../../context/DispatchContext");
15
- const PreferencesContext_1 = require("../../context/PreferencesContext");
16
15
  const ToggleButton_1 = __importDefault(require("../../elements/ToggleButton"));
17
16
  const ToolTip_1 = __importDefault(require("../../elements/ToolTip/ToolTip"));
18
17
  const Modal_1 = require("../../elements/popup/Modal");
@@ -39,7 +38,7 @@ const style = (0, react_1.css) `
39
38
  }
40
39
  }
41
40
  `;
42
- function IntegralPanelInner({ integrals, info, activeTab, xDomain, preferences, }) {
41
+ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
43
42
  const [filterIsActive, setFilterIsActive] = (0, react_2.useState)(false);
44
43
  const dispatch = (0, DispatchContext_1.useDispatch)();
45
44
  const modal = (0, Modal_1.useModal)();
@@ -113,18 +112,16 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, preferences,
113
112
  ? 'Show all integrals'
114
113
  : 'Hide integrals out of view', filterIsActive: filterIsActive, counterFiltered: filteredData.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: currentSum
115
114
  ? `Change Integrals Sum (${Number(currentSum).toFixed(2)})`
116
- : 'Change Integrals Sum', popupPlacement: "right", children: (0, jsx_runtime_1.jsx)("button", { className: "sum-button", type: "button", onClick: showChangeIntegralSumModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { className: "fix-integral-toggle-btn", popupTitle: "fix integral values", popupPlacement: "right", onClick: toggleConstantSumHandler, children: (0, jsx_runtime_1.jsx)(im_1.ImLink, {}) })] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(IntegralTable_1.default, { data: filteredData, activeTab: activeTab, preferences: preferences })) : ((0, jsx_runtime_1.jsx)(IntegralsPreferences_1.default, { ref: settingRef })) })] }) }));
115
+ : 'Change Integrals Sum', popupPlacement: "right", children: (0, jsx_runtime_1.jsx)("button", { className: "sum-button", type: "button", onClick: showChangeIntegralSumModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { className: "fix-integral-toggle-btn", popupTitle: "fix integral values", popupPlacement: "right", onClick: toggleConstantSumHandler, children: (0, jsx_runtime_1.jsx)(im_1.ImLink, {}) })] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(IntegralTable_1.default, { data: filteredData, activeTab: activeTab })) : ((0, jsx_runtime_1.jsx)(IntegralsPreferences_1.default, { ref: settingRef })) })] }) }));
117
116
  }
118
117
  const MemoizedIntegralPanel = (0, react_2.memo)(IntegralPanelInner);
119
118
  const emptyData = { integrals: {}, info: {} };
120
119
  function IntegralPanel() {
121
120
  const { xDomain, activeTab } = (0, ChartContext_1.useChartData)();
122
- const preferences = (0, PreferencesContext_1.usePreferences)();
123
121
  const { integrals, info } = (0, useSpectrum_1.default)(emptyData);
124
122
  return ((0, jsx_runtime_1.jsx)(MemoizedIntegralPanel, { ...{
125
123
  integrals,
126
124
  info,
127
- preferences: preferences.current,
128
125
  xDomain,
129
126
  activeTab,
130
127
  } }));
@@ -14,13 +14,12 @@ const EditableColumn_1 = __importDefault(require("../../elements/EditableColumn"
14
14
  const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
15
15
  const addCustomColumn_1 = __importDefault(require("../../elements/ReactTable/utility/addCustomColumn"));
16
16
  const Select_1 = __importDefault(require("../../elements/Select"));
17
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
17
18
  const Types_1 = require("../../reducer/types/Types");
18
- const FormatNumber_1 = __importDefault(require("../../utility/FormatNumber"));
19
- const LocalStorage_1 = require("../../utility/LocalStorage");
19
+ const formatNumber_1 = require("../../utility/formatNumber");
20
20
  const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
21
- const defaultValues_1 = require("../extra/preferences/defaultValues");
22
21
  const selectStyle = { marginLeft: 10, marginRight: 10, border: 'none' };
23
- function IntegralTable({ activeTab, data, preferences }) {
22
+ function IntegralTable({ activeTab, data }) {
24
23
  const dispatch = (0, DispatchContext_1.useDispatch)();
25
24
  const deleteIntegralHandler = (0, react_1.useCallback)((e, row) => {
26
25
  e.preventDefault();
@@ -81,16 +80,16 @@ function IntegralTable({ activeTab, data, preferences }) {
81
80
  payload: { data },
82
81
  });
83
82
  }, [dispatch]);
84
- const integralsPreferences = (0, react_1.useMemo)(() => (0, LocalStorage_1.getValue)(preferences.current, `formatting.panels.integrals.[${activeTab}]`, defaultValues_1.integralDefaultValues), [activeTab, preferences]);
83
+ const integralsPreferences = (0, usePanelPreferences_1.usePanelPreferences)('integrals', activeTab);
85
84
  const COLUMNS = (0, react_1.useMemo)(() => [
86
85
  {
87
- showWhen: 'showAbsolute',
86
+ showWhen: 'absolute.show',
88
87
  index: 4,
89
88
  Header: 'Absolute',
90
- accessor: (row) => (0, FormatNumber_1.default)(row.absolute, (0, get_1.default)(integralsPreferences, 'absoluteFormat', defaultValues_1.integralDefaultValues.absoluteFormat)),
89
+ accessor: (row) => (0, formatNumber_1.formatNumber)(row.absolute, integralsPreferences.absolute.format),
91
90
  },
92
91
  {
93
- showWhen: 'showRelative',
92
+ showWhen: 'relative.show',
94
93
  index: 5,
95
94
  id: 'relative',
96
95
  Header: () => {
@@ -98,10 +97,10 @@ function IntegralTable({ activeTab, data, preferences }) {
98
97
  return (0, jsx_runtime_1.jsx)("span", { children: `Relative ${n}` });
99
98
  },
100
99
  accessor: (row) => {
101
- return (0, FormatNumber_1.default)(row.integral, (0, get_1.default)(integralsPreferences, 'relativeFormat', defaultValues_1.integralDefaultValues.relativeFormat));
100
+ return (0, formatNumber_1.formatNumber)(row.integral, integralsPreferences.relative.format);
102
101
  },
103
102
  Cell: ({ row }) => {
104
- const value = (0, FormatNumber_1.default)(row.original.integral, (0, get_1.default)(integralsPreferences, 'relativeFormat', defaultValues_1.integralDefaultValues.relativeFormat));
103
+ const value = (0, formatNumber_1.formatNumber)(row.original.integral, integralsPreferences.relative.format);
105
104
  const flag = (0, Spectrum1D_1.checkIntegralKind)(row.original);
106
105
  const integral = flag ? value : `[ ${value} ]`;
107
106
  return ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
@@ -112,7 +111,7 @@ function IntegralTable({ activeTab, data, preferences }) {
112
111
  let columns = [...initialColumns];
113
112
  for (const col of COLUMNS) {
114
113
  const { showWhen, ...colParams } = col;
115
- if (integralsPreferences[showWhen]) {
114
+ if ((0, get_1.default)(integralsPreferences, showWhen)) {
116
115
  (0, addCustomColumn_1.default)(columns, colParams);
117
116
  }
118
117
  }
@@ -5,82 +5,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
- const react_mf_1 = require("react-mf");
9
8
  const PreferencesContext_1 = require("../../context/PreferencesContext");
10
9
  const FormikColorInput_1 = __importDefault(require("../../elements/formik/FormikColorInput"));
11
- const FormikColumnFormatField_1 = __importDefault(require("../../elements/formik/FormikColumnFormatField"));
12
10
  const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
13
11
  const FormikNumberInput_1 = __importDefault(require("../../elements/formik/FormikNumberInput"));
14
12
  const Alert_1 = require("../../elements/popup/Alert");
15
13
  const useNucleus_1 = __importDefault(require("../../hooks/useNucleus"));
16
- const LocalStorage_1 = require("../../utility/LocalStorage");
17
- const defaultValues_1 = require("../extra/preferences/defaultValues");
18
- const styles = {
19
- container: {
20
- padding: 10,
21
- backgroundColor: '#f1f1f1',
22
- height: '100%',
23
- overflowY: 'auto',
24
- },
25
- groupContainer: {
26
- padding: '5px',
27
- borderRadius: '5px',
28
- margin: '10px 0px',
29
- backgroundColor: 'white',
30
- },
31
- row: {
32
- display: 'flex',
33
- margin: '5px 0px',
34
- },
35
- header: {
36
- borderBottom: '1px solid #e8e8e8',
37
- paddingBottom: '5px',
38
- fontWeight: 'bold',
39
- color: '#4a4a4a',
40
- },
41
- inputLabel: {
42
- flex: 2,
43
- fontSize: '11px',
44
- fontWeight: 'bold',
45
- color: '#232323',
46
- },
47
- input: {
48
- width: '30%',
49
- textAlign: 'center',
50
- },
51
- };
14
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
15
+ const getUniqueNuclei_1 = require("../../utility/getUniqueNuclei");
16
+ const NucleusPreferences_1 = require("../extra/preferences/NucleusPreferences");
17
+ const PreferencesContainer_1 = require("../extra/preferences/PreferencesContainer");
52
18
  const formatFields = [
53
19
  {
54
20
  id: 1,
55
21
  label: 'Absolute :',
56
- checkController: 'showAbsolute',
57
- formatController: 'absoluteFormat',
22
+ checkControllerName: 'absolute.show',
23
+ formatControllerName: 'absolute.format',
58
24
  },
59
25
  {
60
26
  id: 2,
61
27
  label: 'Relative :',
62
- checkController: 'showRelative',
63
- formatController: 'relativeFormat',
28
+ checkControllerName: 'relative.show',
29
+ formatControllerName: 'relative.format',
64
30
  },
65
31
  ];
66
- function IntegralsPreferencesInner({ nucleus, preferences, innerRef, }) {
32
+ function IntegralsPreferences(props, ref) {
67
33
  const alert = (0, Alert_1.useAlert)();
34
+ const preferences = (0, PreferencesContext_1.usePreferences)();
35
+ const nucleus = (0, useNucleus_1.default)();
36
+ const nuclei = (0, react_1.useMemo)(() => (0, getUniqueNuclei_1.getUniqueNuclei)(nucleus), [nucleus]);
37
+ const preferencesByNuclei = (0, usePanelPreferences_1.usePanelPreferencesByNuclei)('integrals', nuclei);
68
38
  const formRef = (0, react_1.useRef)();
69
- const updateValues = (0, react_1.useCallback)(() => {
70
- if (nucleus) {
71
- const { color, strokeWidth, ...restProps } = defaultValues_1.integralDefaultValues;
72
- const integralPreferences = (0, LocalStorage_1.getValue)(preferences.current, `formatting.panels.integrals`);
73
- let defaultValues = nucleus.reduce((acc, nucleusLabel) => {
74
- acc[nucleusLabel] = restProps;
75
- return acc;
76
- }, {});
77
- defaultValues = Object.assign(defaultValues, { color, strokeWidth });
78
- formRef.current.setValues(integralPreferences ? integralPreferences : defaultValues);
79
- }
80
- }, [nucleus, preferences]);
81
39
  (0, react_1.useEffect)(() => {
82
- updateValues();
83
- }, [updateValues]);
40
+ formRef.current.setValues(preferencesByNuclei);
41
+ }, [preferencesByNuclei]);
84
42
  const saveHandler = (0, react_1.useCallback)((values) => {
85
43
  preferences.dispatch({
86
44
  type: 'SET_PANELS_PREFERENCES',
@@ -88,28 +46,22 @@ function IntegralsPreferencesInner({ nucleus, preferences, innerRef, }) {
88
46
  });
89
47
  alert.success('Integrals preferences saved successfully');
90
48
  }, [alert, preferences]);
91
- (0, react_1.useImperativeHandle)(innerRef, () => ({
49
+ (0, react_1.useImperativeHandle)(ref, () => ({
92
50
  saveSetting: () => {
93
51
  formRef.current.submitForm();
94
52
  },
95
53
  }));
96
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: [(0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)("p", { style: styles.header, children: "General" }), (0, jsx_runtime_1.jsx)(FormikColorInput_1.default, { name: "color" }), (0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "strokeWidth", label: "stroke width :", style: {
97
- label: { fontSize: '11px', fontWeight: 'bold', color: '#232323' },
54
+ return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nuclei?.map((n) => ((0, jsx_runtime_1.jsx)(NucleusPreferences_1.NucleusPreferences, { nucleus: n, fields: formatFields, renderTop: () => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FormikColorInput_1.default, { name: `nuclei.${n}.color` }), (0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: `nuclei.${n}.strokeWidth`, label: "stroke width :", style: {
55
+ label: {
56
+ fontSize: '11px',
57
+ fontWeight: 'bold',
58
+ color: '#232323',
59
+ },
98
60
  input: {
99
61
  width: '60%',
100
62
  textAlign: 'center',
101
63
  borderRadius: '5px',
102
64
  },
103
- }, min: 1, max: 9, pattern: "[1-9]+" })] }), nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)("p", { style: styles.header, children: (0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: nucleusLabel }) }), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id)))] }, nucleusLabel)))] }) }));
104
- }
105
- const MemoizedIntegralsPreferences = (0, react_1.memo)(IntegralsPreferencesInner);
106
- // TODO: remove this hacky use of ref.
107
- function IntegralsPreferences(props, ref) {
108
- const preferences = (0, PreferencesContext_1.usePreferences)();
109
- const nucleus = (0, useNucleus_1.default)();
110
- return ((0, jsx_runtime_1.jsx)(MemoizedIntegralsPreferences, { innerRef: ref, ...{
111
- nucleus,
112
- preferences,
113
- } }));
65
+ }, min: 1, max: 9, pattern: "[1-9]+" })] })) }, n))) }) }));
114
66
  }
115
- exports.default = (0, react_1.forwardRef)(IntegralsPreferences);
67
+ exports.default = (0, react_1.memo)((0, react_1.forwardRef)(IntegralsPreferences));
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const react_mf_1 = require("react-mf");
9
+ const MoleculeManager_1 = require("../../../data/molecules/MoleculeManager");
10
+ const DispatchContext_1 = require("../../context/DispatchContext");
11
+ const EditableColumn_1 = __importDefault(require("../../elements/EditableColumn"));
12
+ const Types_1 = require("../../reducer/types/Types");
13
+ const styles = {
14
+ toolbar: {
15
+ display: 'flex',
16
+ borderBottom: '0.55px solid rgb(240, 240, 240)',
17
+ padding: '5px 10px',
18
+ justifyContent: 'space-between',
19
+ height: '35px',
20
+ },
21
+ labelInput: {
22
+ width: '150px',
23
+ border: '1px solid #f4f4f4',
24
+ borderRadius: '5px',
25
+ cursor: 'pointer',
26
+ textAlign: 'center',
27
+ marginLeft: '5px',
28
+ },
29
+ };
30
+ function MoleculeHeader(props) {
31
+ const { currentMolecule, molecules } = props;
32
+ const dispatch = (0, DispatchContext_1.useDispatch)();
33
+ const validateLabel = (0, react_1.useCallback)((value) => {
34
+ const reservedNumbers = (0, MoleculeManager_1.extractLabelsNumbers)(molecules);
35
+ const number = (0, MoleculeManager_1.extractNumber)(value);
36
+ return value && !reservedNumbers.includes(Number(number));
37
+ }, [molecules]);
38
+ const saveLabelHandler = (0, react_1.useCallback)((key, event) => {
39
+ const label = event.target.value;
40
+ dispatch({ type: Types_1.CHANGE_MOLECULE_LABEL, payload: { label, key } });
41
+ }, [dispatch]);
42
+ return ((0, jsx_runtime_1.jsxs)("div", { style: styles.toolbar, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)("span", { children: "Label" }), (0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.key, event) })] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
43
+ }
44
+ exports.default = MoleculeHeader;
@@ -9,15 +9,14 @@ const react_1 = require("@emotion/react");
9
9
  const full_1 = __importDefault(require("openchemlib/full"));
10
10
  const react_2 = require("react");
11
11
  const react_d3_utils_1 = require("react-d3-utils");
12
- const react_mf_1 = require("react-mf");
13
12
  const react_ocl_nmr_1 = __importDefault(require("react-ocl-nmr"));
14
13
  const ChartContext_1 = require("../../context/ChartContext");
15
14
  const DispatchContext_1 = require("../../context/DispatchContext");
16
15
  const NextPrev_1 = __importDefault(require("../../elements/NextPrev"));
17
- const Modal_1 = require("../../elements/popup/Modal");
18
16
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
19
- const MoleculeStructureEditorModal_1 = __importDefault(require("../../modal/MoleculeStructureEditorModal"));
17
+ const MoleculeStructureEditorModal_1 = require("../../modal/MoleculeStructureEditorModal");
20
18
  const Types_1 = require("../../reducer/types/Types");
19
+ const MoleculeHeader_1 = __importDefault(require("./MoleculeHeader"));
21
20
  const MoleculePanelHeader_1 = __importDefault(require("./MoleculePanelHeader"));
22
21
  const useAtomAssignment_1 = __importDefault(require("./useAtomAssignment"));
23
22
  const styles = {
@@ -39,13 +38,6 @@ const styles = {
39
38
  display: 'flex',
40
39
  flex: '1',
41
40
  }),
42
- toolbar: (0, react_1.css)({
43
- display: 'flex',
44
- borderBottom: '0.55px solid rgb(240, 240, 240)',
45
- padding: '0px 10px',
46
- justifyContent: 'end',
47
- height: 22,
48
- }),
49
41
  slider: (0, react_1.css)({
50
42
  display: 'flex',
51
43
  flexDirection: 'column',
@@ -66,7 +58,7 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
66
58
  const [currentIndex, setCurrentIndex] = (0, react_2.useState)(0);
67
59
  const [molecules, setMolecules] = (0, react_2.useState)([]);
68
60
  const dispatch = (0, DispatchContext_1.useDispatch)();
69
- const modal = (0, Modal_1.useModal)();
61
+ const openMoleculeEditor = (0, MoleculeStructureEditorModal_1.useMoleculeEditor)();
70
62
  const { currentDiaIDsToHighlight, handleOnAtomHover, handleOnClickAtom, assignedDiaIDsMerged, } = (0, useAtomAssignment_1.default)({ zones, ranges, activeTab, displayerMode });
71
63
  (0, react_2.useEffect)(() => {
72
64
  if (moleculesProp) {
@@ -81,30 +73,27 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
81
73
  (0, react_2.useEffect)(() => {
82
74
  onMoleculeChange?.(molecules[currentIndex] || null);
83
75
  }, [currentIndex, molecules, onMoleculeChange]);
84
- const handleReplaceMolecule = (0, react_2.useCallback)((key, molfile) => {
85
- dispatch({ type: Types_1.SET_MOLECULE, molfile, key });
86
- }, [dispatch]);
87
- const openMoleculeEditorHandler = (0, react_2.useCallback)((moleclue = null) => {
88
- modal.show((0, jsx_runtime_1.jsx)(MoleculeStructureEditorModal_1.default, { selectedMolecule: moleclue }), {
89
- position: Modal_1.positions.TOP_CENTER,
90
- width: 700,
91
- height: 500,
76
+ const handleReplaceMolecule = (0, react_2.useCallback)((molecule, molfile) => {
77
+ const { key, label, isFloat } = molecule;
78
+ dispatch({
79
+ type: Types_1.SET_MOLECULE,
80
+ payload: { molfile, key, label, isFloat },
92
81
  });
93
- }, [modal]);
82
+ }, [dispatch]);
94
83
  const moleculeIndexHandler = (0, react_2.useCallback)((index) => {
95
84
  setCurrentIndex(index);
96
85
  }, []);
97
- return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler, actionsOptions: actionsOptions }), (0, jsx_runtime_1.jsxs)("div", { css: styles.innerPanel, children: [(0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsxs)("span", { css: styles.toolbar, children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: mol.mf }), " - ", mol.mw?.toFixed(2)] }), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
86
+ return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditor(), onMoleculeIndexChange: moleculeIndexHandler, actionsOptions: actionsOptions }), (0, jsx_runtime_1.jsxs)("div", { css: styles.innerPanel, children: [(0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsx)(MoleculeHeader_1.default, { currentMolecule: mol, molecules: molecules }), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditor(mol), style: {
98
87
  backgroundColor: (index + 1) % 2 !== 0 ? '#fafafa' : 'white',
99
88
  }, children: (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ height, width }) => {
100
- return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol.key, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
89
+ return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
101
90
  currentDiaIDsToHighlight.length > 0
102
91
  ? 'red'
103
92
  : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight &&
104
93
  currentDiaIDsToHighlight.length > 0
105
94
  ? currentDiaIDsToHighlight
106
95
  : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }));
107
- } }) })] }, mol.key)))) : ((0, jsx_runtime_1.jsx)("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditorHandler(), children: (0, jsx_runtime_1.jsx)("span", { children: "Click to draw molecule" }) })) }) }), children] })] }));
96
+ } }) })] }, mol.key)))) : ((0, jsx_runtime_1.jsx)("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditor(), children: (0, jsx_runtime_1.jsx)("span", { children: "Click to draw molecule" }) })) }) }), children] })] }));
108
97
  }
109
98
  const MemoizedMoleculePanel = (0, react_2.memo)(MoleculePanelInner);
110
99
  const emptyData = { ranges: {}, zones: {} };
@@ -9,11 +9,13 @@ const react_1 = require("@emotion/react");
9
9
  const cheminfo_font_1 = require("cheminfo-font");
10
10
  const react_2 = require("react");
11
11
  const fa_1 = require("react-icons/fa");
12
+ const io5_1 = require("react-icons/io5");
12
13
  const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
13
14
  const DispatchContext_1 = require("../../context/DispatchContext");
14
15
  const GlobalContext_1 = require("../../context/GlobalContext");
15
16
  const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
16
17
  const MenuButton_1 = __importDefault(require("../../elements/MenuButton"));
18
+ const ToggleButton_1 = __importDefault(require("../../elements/ToggleButton"));
17
19
  const ToolTip_1 = __importDefault(require("../../elements/ToolTip/ToolTip"));
18
20
  const Alert_1 = require("../../elements/popup/Alert");
19
21
  const Modal_1 = require("../../elements/popup/Modal");
@@ -132,7 +134,13 @@ function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange =
132
134
  width: 600,
133
135
  });
134
136
  }, [modal, molecules, currentIndex]);
135
- return ((0, jsx_runtime_1.jsxs)("div", { css: toolbarStyle, children: [!actionsOptions.hideExport && ((0, jsx_runtime_1.jsx)(MenuButton_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler })), !actionsOptions.hidePast && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Paste molfile", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) }) })), !actionsOptions.hideAdd && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Add Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }) })), !actionsOptions.hideDelete && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Delete Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handleDelete, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) }) })), !actionsOptions.hidePredict && molecules && molecules.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}) })), (0, jsx_runtime_1.jsxs)("p", { children: [molecules &&
137
+ const floatMoleculeHandler = (0, react_2.useCallback)(() => {
138
+ dispatch({
139
+ type: Types_1.FLOAT_MOLECULE_OVER_SPECTRUM,
140
+ payload: { key: molecules[currentIndex].key },
141
+ });
142
+ }, [currentIndex, dispatch, molecules]);
143
+ return ((0, jsx_runtime_1.jsxs)("div", { css: toolbarStyle, children: [!actionsOptions.hideExport && ((0, jsx_runtime_1.jsx)(MenuButton_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}), toolTip: "Export As", items: MOL_EXPORT_MENU, onClick: exportHandler })), !actionsOptions.hidePast && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Paste molfile", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handlePaste, children: (0, jsx_runtime_1.jsx)(fa_1.FaPaste, {}) }) })), !actionsOptions.hideAdd && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Add Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: onOpenMoleculeEditor, "data-test-id": "panel-structures-button-add", children: (0, jsx_runtime_1.jsx)(fa_1.FaPlus, {}) }) })), !actionsOptions.hideDelete && ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Delete Molecule", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { className: "bar-button", type: "button", onClick: handleDelete, children: (0, jsx_runtime_1.jsx)(fa_1.FaRegTrashAlt, {}) }) })), !actionsOptions.hidePredict && molecules && molecules.length > 0 && ((0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Predict Spectra", popupPlacement: "left", onClick: openPredictSpectraModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFt, {}) })), molecules?.[currentIndex] && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { defaultValue: molecules[currentIndex].isFloat, popupTitle: "Float Molecule", popupPlacement: "left", onClick: floatMoleculeHandler, children: (0, jsx_runtime_1.jsx)(io5_1.IoOpenOutline, {}) }, molecules[currentIndex].isFloat)), (0, jsx_runtime_1.jsxs)("p", { children: [molecules &&
136
144
  molecules.length > 0 &&
137
145
  `${+(currentIndex + 1)} / ${molecules.length}`, ' '] })] }));
138
146
  }
@@ -5,6 +5,17 @@ function getElements(activeTab) {
5
5
  const nuclei = activeTab.split(',');
6
6
  return nuclei.map((nucleus) => nucleus.replace(/[0-9]/g, ''));
7
7
  }
8
+ /**
9
+ * Returns the OCL id(s) and number of atoms of an atom when hovering over
10
+ * or clicking on it. This is depending on an optional given axis.
11
+ * In case of an heavy atom with bonded hydrogens the OCL id(s)
12
+ * and number of these hydrogens are added as well.
13
+ *
14
+ * @param {Atom} atom - atom returned by OCLnmr component
15
+ * @param {string} activeTab - active tab
16
+ * @param {Axis} axis - current axis
17
+ *
18
+ */
8
19
  function extractFromAtom(atom, activeTab, axis) {
9
20
  const elements = getElements(activeTab);
10
21
  if (elements.length > 0 && Object.keys(atom).length > 0) {
@@ -9,13 +9,13 @@ const react_1 = require("react");
9
9
  const DispatchContext_1 = require("../../context/DispatchContext");
10
10
  const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
11
11
  const addCustomColumn_1 = __importDefault(require("../../elements/ReactTable/utility/addCustomColumn"));
12
+ const useFormatNumberByNucleus_1 = require("../../hooks/useFormatNumberByNucleus");
12
13
  const Types_1 = require("../../reducer/types/Types");
13
14
  const Evaluate_1 = __importDefault(require("../../utility/Evaluate"));
14
- const FormatNumber_1 = require("../../utility/FormatNumber");
15
15
  const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
16
16
  const ColumnHeader_1 = __importDefault(require("./ColumnHeader"));
17
17
  function MultipleSpectraAnalysisTable({ data, activeTab, }) {
18
- const format = (0, FormatNumber_1.useFormatNumberByNucleus)(activeTab);
18
+ const format = (0, useFormatNumberByNucleus_1.useFormatNumberByNucleus)(activeTab);
19
19
  const codeEvaluation = (0, react_1.useMemo)(() => {
20
20
  const code = (0, get_1.default)(data, 'code', '');
21
21
  return (0, Evaluate_1.default)(code, data);
@@ -96,7 +96,7 @@ const accordionItems = [
96
96
  mode: null,
97
97
  },
98
98
  {
99
- title: 'Database',
99
+ title: 'Databases',
100
100
  component: (0, jsx_runtime_1.jsx)(DatabasePanel_1.default, {}),
101
101
  hidePreferenceKey: 'databasePanel',
102
102
  mode: null,
@@ -104,9 +104,8 @@ const accordionItems = [
104
104
  {
105
105
  title: 'Automatic Assignment',
106
106
  component: (0, jsx_runtime_1.jsx)(AutomaticAssignment_1.default, {}),
107
- hidePreferenceKey: '',
107
+ hidePreferenceKey: 'automaticAssignmentPanel',
108
108
  mode: null,
109
- isExperimental: true,
110
109
  },
111
110
  {
112
111
  title: 'Prediction',
@@ -11,18 +11,18 @@ const ChartContext_1 = require("../../context/ChartContext");
11
11
  const DispatchContext_1 = require("../../context/DispatchContext");
12
12
  const PreferencesContext_1 = require("../../context/PreferencesContext");
13
13
  const Modal_1 = require("../../elements/popup/Modal");
14
+ const useFormatNumberByNucleus_1 = require("../../hooks/useFormatNumberByNucleus");
14
15
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
15
16
  const Types_1 = require("../../reducer/types/Types");
16
- const FormatNumber_1 = require("../../utility/FormatNumber");
17
17
  const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
18
18
  const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
19
19
  const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
20
20
  const PeaksPreferences_1 = __importDefault(require("./PeaksPreferences"));
21
21
  const PeaksTable_1 = __importDefault(require("./PeaksTable"));
22
- function PeaksPanelInner({ peaks, info, xDomain, activeTab, preferences, }) {
22
+ function PeaksPanelInner({ peaks, info, xDomain, activeTab, }) {
23
23
  const [filterIsActive, setFilterIsActive] = (0, react_2.useState)(false);
24
24
  const [isFlipped, setFlipStatus] = (0, react_2.useState)(false);
25
- const format = (0, FormatNumber_1.useFormatNumberByNucleus)(info.nucleus);
25
+ const format = (0, useFormatNumberByNucleus_1.useFormatNumberByNucleus)(info.nucleus);
26
26
  const dispatch = (0, DispatchContext_1.useDispatch)();
27
27
  const modal = (0, Modal_1.useModal)();
28
28
  const settingRef = (0, react_2.useRef)();
@@ -84,7 +84,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, preferences, }) {
84
84
  }
85
85
  }
86
86
  `,
87
- ], children: [!isFlipped && ((0, jsx_runtime_1.jsx)(DefaultPanelHeader_1.default, { counter: peaks?.values?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Peaks", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all peaks' : 'Hide peaks out of view', filterIsActive: filterIsActive, counterFiltered: filteredPeaks.length, showSettingButton: true, onSettingClick: settingsPanelHandler })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(PeaksTable_1.default, { data: filteredPeaks, activeTab: activeTab, preferences: preferences, info: info })) : ((0, jsx_runtime_1.jsx)(PeaksPreferences_1.default, { ref: settingRef })) })] }));
87
+ ], children: [!isFlipped && ((0, jsx_runtime_1.jsx)(DefaultPanelHeader_1.default, { counter: peaks?.values?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Peaks", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all peaks' : 'Hide peaks out of view', filterIsActive: filterIsActive, counterFiltered: filteredPeaks.length, showSettingButton: true, onSettingClick: settingsPanelHandler })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(PeaksTable_1.default, { data: filteredPeaks, activeTab: activeTab })) : ((0, jsx_runtime_1.jsx)(PeaksPreferences_1.default, { ref: settingRef })) })] }));
88
88
  }
89
89
  const MemoizedPeaksPanel = (0, react_2.memo)(PeaksPanelInner);
90
90
  const emptyData = { peaks: null, info: {} };