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
@@ -11,6 +11,7 @@ const DispatchContext_1 = require("../context/DispatchContext");
11
11
  const LoaderContext_1 = require("../context/LoaderContext");
12
12
  const Alert_1 = require("../elements/popup/Alert");
13
13
  const index_1 = require("../highlight/index");
14
+ const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
14
15
  const useExport_1 = __importDefault(require("../hooks/useExport"));
15
16
  const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
16
17
  const Constants_1 = require("../reducer/core/Constants");
@@ -23,6 +24,7 @@ function KeysListenerTracker() {
23
24
  const openLoader = (0, LoaderContext_1.useLoader)();
24
25
  const { handleChangeOption, handleFullZoomOut, alignSpectrumsVerticallyHandler, changeDisplayViewModeHandler, } = (0, useToolsFunctions_1.default)();
25
26
  const { saveToClipboardHandler, saveAsJSONHandler, saveAsHandler } = (0, useExport_1.default)();
27
+ const isToolVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
26
28
  const { highlight, remove } = (0, index_1.useHighlightData)();
27
29
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
28
30
  const allow1DTool = (0, react_1.useMemo)(() => {
@@ -102,21 +104,19 @@ function KeysListenerTracker() {
102
104
  });
103
105
  alert.show(`Configuration Reset, press '${num}' again to reload it.`);
104
106
  }
105
- else {
106
- if (!(0, checkModifierKeyActivated_1.default)(e)) {
107
- if (keysPreferences?.[num]) {
108
- dispatch({
109
- type: Types_1.APPLY_KEY_PREFERENCES,
110
- keyCode: num,
111
- });
112
- }
113
- else {
114
- dispatch({
115
- type: Types_1.SET_KEY_PREFERENCES,
116
- keyCode: num,
117
- });
118
- alert.show(`Configuration saved, press '${num}' again to reload it.`);
119
- }
107
+ else if (!(0, checkModifierKeyActivated_1.default)(e)) {
108
+ if (keysPreferences?.[num]) {
109
+ dispatch({
110
+ type: Types_1.APPLY_KEY_PREFERENCES,
111
+ keyCode: num,
112
+ });
113
+ }
114
+ else {
115
+ dispatch({
116
+ type: Types_1.SET_KEY_PREFERENCES,
117
+ keyCode: num,
118
+ });
119
+ alert.show(`Configuration saved, press '${num}' again to reload it.`);
120
120
  }
121
121
  }
122
122
  }
@@ -142,46 +142,62 @@ function KeysListenerTracker() {
142
142
  if (!e.shiftKey && !e.metaKey) {
143
143
  switch (e.key) {
144
144
  case 'f':
145
- handleFullZoomOut();
145
+ if (isToolVisible('zoomOutTool')) {
146
+ handleFullZoomOut();
147
+ }
146
148
  break;
147
149
  case 'z':
148
150
  case 'Escape':
149
- handleChangeOption(ToolTypes_1.options.zoom.id);
151
+ if (isToolVisible('zoomTool')) {
152
+ handleChangeOption(ToolTypes_1.options.zoom.id);
153
+ }
150
154
  break;
151
155
  case 'r': {
152
156
  if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
153
- check2DModeWithActiveSpectrum(ToolTypes_1.options.zone2D.label, false);
154
- handleChangeOption(ToolTypes_1.options.zone2D.id);
157
+ if (isToolVisible('zonePickingTool')) {
158
+ check2DModeWithActiveSpectrum(ToolTypes_1.options.zone2D.label, false);
159
+ handleChangeOption(ToolTypes_1.options.zone2D.id);
160
+ }
155
161
  }
156
- else {
162
+ else if (isToolVisible('rangePickingTool')) {
157
163
  check1DModeWithActiveSpectrum(ToolTypes_1.options.rangesPicking.label, false);
158
164
  handleChangeOption(ToolTypes_1.options.rangesPicking.id);
159
165
  }
160
166
  break;
161
167
  }
162
168
  case 'a': {
163
- check1DModeWithActiveSpectrum(ToolTypes_1.options.phaseCorrection.label);
164
- handleChangeOption(ToolTypes_1.options.phaseCorrection.id);
169
+ if (isToolVisible('phaseCorrectionTool')) {
170
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.phaseCorrection.label);
171
+ handleChangeOption(ToolTypes_1.options.phaseCorrection.id);
172
+ }
165
173
  break;
166
174
  }
167
175
  case 'b': {
168
- check1DModeWithActiveSpectrum(ToolTypes_1.options.baseLineCorrection.label);
169
- handleChangeOption(ToolTypes_1.options.baseLineCorrection.id);
176
+ if (isToolVisible('baselineCorrectionTool')) {
177
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.baselineCorrection.label);
178
+ handleChangeOption(ToolTypes_1.options.baselineCorrection.id);
179
+ }
170
180
  break;
171
181
  }
172
182
  case 'p': {
173
- check1DModeWithActiveSpectrum(ToolTypes_1.options.peakPicking.label);
174
- handleChangeOption(ToolTypes_1.options.peakPicking.id);
183
+ if (isToolVisible('peakTool')) {
184
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.peakPicking.label);
185
+ handleChangeOption(ToolTypes_1.options.peakPicking.id);
186
+ }
175
187
  break;
176
188
  }
177
189
  case 'i': {
178
- check1DModeWithActiveSpectrum(ToolTypes_1.options.integral.label);
179
- handleChangeOption(ToolTypes_1.options.integral.id);
190
+ if (isToolVisible('integralTool')) {
191
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.integral.label);
192
+ handleChangeOption(ToolTypes_1.options.integral.id);
193
+ }
180
194
  break;
181
195
  }
182
196
  case 'e': {
183
- check1DModeWithActiveSpectrum(ToolTypes_1.options.exclusionZones.label);
184
- handleChangeOption(ToolTypes_1.options.exclusionZones.id);
197
+ if (isToolVisible('exclusionZonesTool')) {
198
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.exclusionZones.label);
199
+ handleChangeOption(ToolTypes_1.options.exclusionZones.id);
200
+ }
185
201
  break;
186
202
  }
187
203
  default:
@@ -190,13 +206,13 @@ function KeysListenerTracker() {
190
206
  if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
191
207
  switch (e.key) {
192
208
  case 'c': {
193
- if (allow1DTool) {
209
+ if (allow1DTool && isToolVisible('spectraCenterAlignments')) {
194
210
  alignSpectrumsVerticallyHandler();
195
211
  }
196
212
  break;
197
213
  }
198
214
  case 's': {
199
- if (allow1DTool) {
215
+ if (allow1DTool && isToolVisible('spectraStackAlignments')) {
200
216
  changeDisplayViewModeHandler();
201
217
  }
202
218
  break;
@@ -211,8 +227,10 @@ function KeysListenerTracker() {
211
227
  e.preventDefault();
212
228
  break;
213
229
  case 's':
214
- void saveAsJSONHandler();
215
- e.preventDefault();
230
+ if (isToolVisible('exportAs')) {
231
+ void saveAsJSONHandler();
232
+ e.preventDefault();
233
+ }
216
234
  break;
217
235
  case 'o':
218
236
  openLoader();
@@ -244,6 +262,7 @@ function KeysListenerTracker() {
244
262
  displayerMode,
245
263
  handleChangeOption,
246
264
  handleFullZoomOut,
265
+ isToolVisible,
247
266
  openLoader,
248
267
  saveAsHandler,
249
268
  saveAsJSONHandler,
@@ -262,14 +281,13 @@ function KeysListenerTracker() {
262
281
  if (num > 0) {
263
282
  keysPreferencesListenerHandler(e, num);
264
283
  }
284
+ else if (['Delete', 'Backspace'].includes(e.key) &&
285
+ highlight.sourceData) {
286
+ e.preventDefault();
287
+ void deleteHandler(highlight.sourceData);
288
+ }
265
289
  else {
266
- if (['Delete', 'Backspace'].includes(e.key) && highlight.sourceData) {
267
- e.preventDefault();
268
- void deleteHandler(highlight.sourceData);
269
- }
270
- else {
271
- toolsListenerHandler(e);
272
- }
290
+ toolsListenerHandler(e);
273
291
  }
274
292
  }
275
293
  }, [
@@ -33,6 +33,7 @@ const analysis_ui_components_1 = require("analysis-ui-components");
33
33
  const react_2 = require("react");
34
34
  const react_error_boundary_1 = require("react-error-boundary");
35
35
  const react_use_1 = require("react-use");
36
+ const SpectraManager_1 = require("../data/SpectraManager");
36
37
  const checkModifierKeyActivated_1 = __importDefault(require("../data/utilities/checkModifierKeyActivated"));
37
38
  const Viewer1D_1 = __importDefault(require("./1d/Viewer1D"));
38
39
  const Viewer2D_1 = __importDefault(require("./2d/Viewer2D"));
@@ -57,6 +58,7 @@ const Constants_1 = require("./reducer/core/Constants");
57
58
  const preferencesReducer_1 = __importStar(require("./reducer/preferences/preferencesReducer"));
58
59
  const Types_1 = require("./reducer/types/Types");
59
60
  const ToolBar_1 = __importDefault(require("./toolbar/ToolBar"));
61
+ const Export_1 = require("./utility/Export");
60
62
  const viewerContainerStyle = (0, react_1.css) `
61
63
  border: 0.55px #e6e6e6 solid;
62
64
  display: flex;
@@ -90,6 +92,7 @@ const containerStyles = (0, react_1.css) `
90
92
  button {
91
93
  outline: none !important;
92
94
  }
95
+
93
96
  * {
94
97
  -webkit-user-drag: none;
95
98
  -moz-user-drag: none;
@@ -109,10 +112,10 @@ const defaultPreferences = {};
109
112
  const defaultData = {
110
113
  spectra: [],
111
114
  };
112
- function NMRium(props) {
113
- return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props }) }) }));
114
- }
115
- function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, }) {
115
+ const NMRium = (0, react_2.forwardRef)(function NMRium(props, ref) {
116
+ return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props, innerRef: ref }) }) }));
117
+ });
118
+ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, innerRef, }) {
116
119
  const rootRef = (0, react_2.useRef)(null);
117
120
  const elementsWrapperRef = (0, react_2.useRef)(null);
118
121
  const viewerRef = (0, react_2.useRef)(null);
@@ -127,7 +130,7 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
127
130
  const { displayerMode, data: spectraData } = state;
128
131
  (0, react_2.useEffect)(() => {
129
132
  if ((0, IgnoreActions_1.default)(state.actionType)) {
130
- onDataChange?.(state);
133
+ onDataChange?.((0, SpectraManager_1.toJSON)(state, 'onDataChange'));
131
134
  }
132
135
  }, [onDataChange, state]);
133
136
  const dispatchMiddleWare = (0, react_2.useMemo)(() => {
@@ -146,6 +149,11 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
146
149
  },
147
150
  });
148
151
  }, [preferences, workspace]);
152
+ (0, react_2.useImperativeHandle)(innerRef, () => ({
153
+ getSpectraViewerAsBlob: () => {
154
+ return rootRef?.current ? (0, Export_1.getBlob)(rootRef.current, 'nmrSVG') : null;
155
+ },
156
+ }), []);
149
157
  (0, react_2.useEffect)(() => {
150
158
  dispatchMiddleWare({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
151
159
  if (dataProp) {
@@ -6,7 +6,7 @@ const analysis_ui_components_1 = require("analysis-ui-components");
6
6
  const PreferencesContext_1 = require("./context/PreferencesContext");
7
7
  function SplitPaneWrapper({ children }) {
8
8
  const { current } = (0, PreferencesContext_1.usePreferences)();
9
- const general = current?.display?.general || {};
10
- return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.SplitPane, { initialSeparation: general?.initialPanelWidth || '560px', orientation: "horizontal", sideSeparation: "end", initialClosed: general?.hidePanelOnLoad || false, children: children }));
9
+ const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
10
+ return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.SplitPane, { initialSeparation: initialPanelWidth, orientation: "horizontal", sideSeparation: "end", ...(hidePanelOnLoad ? { initialClosed: true } : { minimumSize: 600 }), children: children }, hidePanelOnLoad ? 'true' : 'false'));
11
11
  }
12
12
  exports.SplitPaneWrapper = SplitPaneWrapper;
@@ -136,7 +136,7 @@ function ThemeButton(props) {
136
136
  const { colorTheme, ...buttonProps } = props;
137
137
  const { base, shade, tint } = colorPalettes[props.colorTheme];
138
138
  const { color = { base: shade, hover: 'white' }, backgroundColor = {
139
- base: base,
139
+ base,
140
140
  hover: shade,
141
141
  active: tint,
142
142
  }, fill = 'solid', ...restProps } = buttonProps;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  function Logo({ width = 100, height = 100 }) {
5
- return ((0, jsx_runtime_1.jsxs)("svg", { style: { width: width, height: height }, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 752.34 221.73", children: [(0, jsx_runtime_1.jsx)("path", { fill: "#ea580c", fillRule: "evenodd", d: "M.64,31.7A31.67,31.67,0,0,1,54.72,9.29l0,0A31.66,31.66,0,0,1,64,31.7V190a13.39,13.39,0,0,0,26.77,0V54a31.7,31.7,0,0,1,31.7-31.7V40.58A13.38,13.38,0,0,0,109.13,54V190a31.71,31.71,0,0,1-63.41,0V31.7a13.29,13.29,0,0,0-3.88-9.46l0,0A13.41,13.41,0,0,0,19,31.7V164.82H.64Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M154.21,54v68.17a13.34,13.34,0,0,0,3.89,9.47h0A13.39,13.39,0,0,0,181,122.14V99.32h-.06a31.63,31.63,0,0,1,9.29-22.38l0,0a31.65,31.65,0,0,1,44.8,0l0,0a31.58,31.58,0,0,1,9.3,22.39V118H226V99.32a13.3,13.3,0,0,0-3.89-9.46h0a13.44,13.44,0,0,0-18.93,0l0,0a13.3,13.3,0,0,0-3.83,8.19v24.09a31.7,31.7,0,0,1-54.11,22.42v0a31.66,31.66,0,0,1-9.3-22.4V54Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M729.19,96.34c-8.65,0-14.26,3.17-17.67,8-3.41-5.12-8.78-8-16-8-8.16,0-13.52,3.17-16.32,7.31v-5.6H661V159h18.28V124.62c0-7.19,3.41-11.46,9.5-11.46,5.85,0,8.78,3.9,8.78,10V159h18.27V124.62c0-7.19,3.42-11.46,9.51-11.46,5.85,0,8.77,3.9,8.77,10V159h18.28V121.57C752.34,106.33,743.2,96.34,729.19,96.34Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M629.26,98.05v33.26c0,8.66-4.63,12.56-11.33,12.56-5.85,0-10.6-3.54-10.6-11.09V98.05H589.05v37.41c0,16.45,10.48,25.22,22.79,25.22,8,0,14.13-2.92,17.42-7.43V159h18.28V98.05Z" }), (0, jsx_runtime_1.jsx)("rect", { fill: "#2b143e", x: "558.22", y: "98.05", width: "18.28", height: "60.93" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M567.36,92.68a11,11,0,1,0-11-11A11.08,11.08,0,0,0,567.36,92.68Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#ea580c", fillRule: "evenodd", d: "M478.77,159H498V116.57L525.66,159H549.2l-22.3-34.75c5.45-2.13,8.12-4.14,11.48-8.86a31.07,31.07,0,0,0,6.07-18.26V94.62c0-10.61-3.45-15.93-9.28-21.78S520.75,63.09,510,63.09H478.71l.06,95.89Zm33.1-50.27h-6.46v-.06H498V82.19h10.87c4.67,0,9.44,1.38,11.94,3.81a12.84,12.84,0,0,1,3.81,9.2C524.58,102.52,518.92,108.71,511.87,108.71Z" }), (0, jsx_runtime_1.jsx)("polygon", { fill: "#ea580c", fillRule: "evenodd", points: "372.91 60.8 372.91 158.98 392.16 158.98 392.16 119.23 419.91 157.41 447.61 119.23 447.61 158.98 466.87 158.98 466.87 60.8 419.91 125.22 372.91 60.8" }), (0, jsx_runtime_1.jsx)("polygon", { fill: "#ea580c", fillRule: "evenodd", points: "283.89 61.04 283.89 159.1 303.14 159.1 303.14 105.85 361.01 160.93 361.01 62.83 341.67 62.83 341.67 116.08 283.89 61.04" })] }));
5
+ return ((0, jsx_runtime_1.jsxs)("svg", { style: { width, height }, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 752.34 221.73", children: [(0, jsx_runtime_1.jsx)("path", { fill: "#ea580c", fillRule: "evenodd", d: "M.64,31.7A31.67,31.67,0,0,1,54.72,9.29l0,0A31.66,31.66,0,0,1,64,31.7V190a13.39,13.39,0,0,0,26.77,0V54a31.7,31.7,0,0,1,31.7-31.7V40.58A13.38,13.38,0,0,0,109.13,54V190a31.71,31.71,0,0,1-63.41,0V31.7a13.29,13.29,0,0,0-3.88-9.46l0,0A13.41,13.41,0,0,0,19,31.7V164.82H.64Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M154.21,54v68.17a13.34,13.34,0,0,0,3.89,9.47h0A13.39,13.39,0,0,0,181,122.14V99.32h-.06a31.63,31.63,0,0,1,9.29-22.38l0,0a31.65,31.65,0,0,1,44.8,0l0,0a31.58,31.58,0,0,1,9.3,22.39V118H226V99.32a13.3,13.3,0,0,0-3.89-9.46h0a13.44,13.44,0,0,0-18.93,0l0,0a13.3,13.3,0,0,0-3.83,8.19v24.09a31.7,31.7,0,0,1-54.11,22.42v0a31.66,31.66,0,0,1-9.3-22.4V54Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M729.19,96.34c-8.65,0-14.26,3.17-17.67,8-3.41-5.12-8.78-8-16-8-8.16,0-13.52,3.17-16.32,7.31v-5.6H661V159h18.28V124.62c0-7.19,3.41-11.46,9.5-11.46,5.85,0,8.78,3.9,8.78,10V159h18.27V124.62c0-7.19,3.42-11.46,9.51-11.46,5.85,0,8.77,3.9,8.77,10V159h18.28V121.57C752.34,106.33,743.2,96.34,729.19,96.34Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M629.26,98.05v33.26c0,8.66-4.63,12.56-11.33,12.56-5.85,0-10.6-3.54-10.6-11.09V98.05H589.05v37.41c0,16.45,10.48,25.22,22.79,25.22,8,0,14.13-2.92,17.42-7.43V159h18.28V98.05Z" }), (0, jsx_runtime_1.jsx)("rect", { fill: "#2b143e", x: "558.22", y: "98.05", width: "18.28", height: "60.93" }), (0, jsx_runtime_1.jsx)("path", { fill: "#2b143e", fillRule: "evenodd", d: "M567.36,92.68a11,11,0,1,0-11-11A11.08,11.08,0,0,0,567.36,92.68Z" }), (0, jsx_runtime_1.jsx)("path", { fill: "#ea580c", fillRule: "evenodd", d: "M478.77,159H498V116.57L525.66,159H549.2l-22.3-34.75c5.45-2.13,8.12-4.14,11.48-8.86a31.07,31.07,0,0,0,6.07-18.26V94.62c0-10.61-3.45-15.93-9.28-21.78S520.75,63.09,510,63.09H478.71l.06,95.89Zm33.1-50.27h-6.46v-.06H498V82.19h10.87c4.67,0,9.44,1.38,11.94,3.81a12.84,12.84,0,0,1,3.81,9.2C524.58,102.52,518.92,108.71,511.87,108.71Z" }), (0, jsx_runtime_1.jsx)("polygon", { fill: "#ea580c", fillRule: "evenodd", points: "372.91 60.8 372.91 158.98 392.16 158.98 392.16 119.23 419.91 157.41 447.61 119.23 447.61 158.98 466.87 158.98 466.87 60.8 419.91 125.22 372.91 60.8" }), (0, jsx_runtime_1.jsx)("polygon", { fill: "#ea580c", fillRule: "evenodd", points: "283.89 61.04 283.89 159.1 303.14 159.1 303.14 105.85 361.01 160.93 361.01 62.83 341.67 62.83 341.67 116.08 283.89 61.04" })] }));
6
6
  }
7
7
  exports.default = Logo;
@@ -71,6 +71,7 @@ function ReactTableRow(props, ref) {
71
71
  clickHandler,
72
72
  highlight.isActive,
73
73
  highlight.onHover,
74
+ isRowActive,
74
75
  onClick,
75
76
  onContextMenu,
76
77
  ref,
@@ -16,6 +16,7 @@ const topStyles = (0, react_1.css) `
16
16
  border-bottom: 1px solid #ccc;
17
17
  padding-left: 0;
18
18
  margin: 0;
19
+ display: inline-flex;
19
20
  }
20
21
 
21
22
  .tab-list li:first-of-type {
@@ -27,7 +28,7 @@ const topStyles = (0, react_1.css) `
27
28
  }
28
29
 
29
30
  .tab-list-item {
30
- display: inline-block;
31
+ display: inline-flex;
31
32
  list-style: none;
32
33
  padding: 0.5rem 2rem;
33
34
  }
@@ -24,10 +24,10 @@ const styles = (0, react_1.css) `
24
24
  }
25
25
  `;
26
26
  function ToggleButton({ children, style = {}, onClick = () => null, popupTitle = '', popupPlacement = 'right', defaultValue = false, disabled = false, className = '', testID, }) {
27
- const [flag, Toggle] = (0, react_2.useState)(defaultValue);
27
+ const [flag, toggle] = (0, react_2.useState)(defaultValue);
28
28
  const toggleHandler = (0, react_2.useCallback)(() => {
29
29
  onClick(!flag);
30
- Toggle(!flag);
30
+ toggle(!flag);
31
31
  }, [onClick, flag]);
32
32
  return ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: popupTitle, popupPlacement: popupPlacement, children: (0, jsx_runtime_1.jsx)("button", { "data-test-id": testID, disabled: disabled, css: styles, style: style, className: (flag ? 'toggle toggle-active ' : 'toggle ') + className, type: "button", onClick: toggleHandler, children: children }) }));
33
33
  }
@@ -22,7 +22,7 @@ function Accordion({ children, defaultOpenIndex = 0 }) {
22
22
  el = el.map((e, i) => i === index && alwaysOpenIndexRef.current !== index ? !e : e);
23
23
  }
24
24
  else {
25
- el = el.map((e, i) => (i === index ? true : false));
25
+ el = el.map((e, i) => i === index);
26
26
  if (trigger.shiftKey) {
27
27
  if (alwaysOpenIndexRef.current === index) {
28
28
  alwaysOpenIndexRef.current = null;
@@ -52,11 +52,7 @@ function Accordion({ children, defaultOpenIndex = 0 }) {
52
52
  if (defaultOpenIndex != null) {
53
53
  setElements((prevState) => {
54
54
  if (prevState.length > 0) {
55
- return prevState.map((e, i) => !forcedOpenedElementsRef.current[i]
56
- ? i === defaultOpenIndex
57
- ? true
58
- : false
59
- : e);
55
+ return prevState.map((e, i) => !forcedOpenedElementsRef.current[i] ? i === defaultOpenIndex : e);
60
56
  }
61
57
  forcedOpenedElementsRef.current = Array(children.length)
62
58
  .fill(false)
@@ -9,6 +9,6 @@ const ErrorMessage_1 = __importDefault(require("./ErrorMessage"));
9
9
  function Input(props) {
10
10
  const { onFocus = () => null, onBlur = () => null, enableErrorMessage, ...inputProps } = props;
11
11
  const [field] = (0, formik_1.useField)(inputProps);
12
- return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ...field, ...props, onFocus: () => onFocus(field.name), onBlur: () => onBlur(field.name) }), enableErrorMessage && enableErrorMessage === true ? ((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { ...inputProps })) : null] }));
12
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ...field, ...props, onFocus: () => onFocus(field.name), onBlur: () => onBlur(field.name) }), enableErrorMessage ? (0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { ...inputProps }) : null] }));
13
13
  }
14
14
  exports.default = Input;
@@ -32,7 +32,7 @@ const Modal = ({ children, open = false, onClose = () => null, style, }) => {
32
32
  onClose(e);
33
33
  }, [onClose]);
34
34
  (0, react_1.useEffect)(() => {
35
- if (open === false) {
35
+ if (!open) {
36
36
  handleClose();
37
37
  }
38
38
  }, [handleClose, open]);
@@ -12,7 +12,7 @@ const ModalContent = ({ modal, onClose, onLayout }) => {
12
12
  overflow: 'auto',
13
13
  }, children: (0, react_1.cloneElement)(modal.component, {
14
14
  ...modal.options,
15
- onClose: onClose,
15
+ onClose,
16
16
  style: { cursor: 'default' },
17
17
  }) }));
18
18
  });
@@ -13,7 +13,7 @@ function ToggleButtonGroup({ children, value, onChange = () => null, }) {
13
13
  const toggles = _toggles.map((toggle) => {
14
14
  return {
15
15
  value: toggle.value,
16
- isActive: toggle.value === val ? true : false,
16
+ isActive: toggle.value === val,
17
17
  };
18
18
  });
19
19
  setToggleButtons(toggles);
@@ -43,7 +43,7 @@ function ToggleButtonGroup({ children, value, onChange = () => null, }) {
43
43
  if (child && child.type === ToggleButton_1.default) {
44
44
  return {
45
45
  value: child.props.value,
46
- isActive: child.props.value === value ? true : false,
46
+ isActive: child.props.value === value,
47
47
  };
48
48
  }
49
49
  });
@@ -36,6 +36,7 @@ const Label_1 = __importDefault(require("../elements/Label"));
36
36
  const Select_1 = __importDefault(require("../elements/Select"));
37
37
  const FormikForm_1 = __importDefault(require("../elements/formik/FormikForm"));
38
38
  const FormikInput_1 = __importDefault(require("../elements/formik/FormikInput"));
39
+ const FormikOnChange_1 = __importDefault(require("../elements/formik/FormikOnChange"));
39
40
  const Types_1 = require("../reducer/types/Types");
40
41
  const styles = {
41
42
  container: {
@@ -54,7 +55,7 @@ function BaseLineCorrectionPanel() {
54
55
  const formRef = (0, react_1.useRef)();
55
56
  const algorithmRef = (0, react_1.useRef)();
56
57
  const [algorithm, setAlgorithm] = (0, react_1.useState)('polynomial');
57
- const handleApplyFilter = (0, react_1.useCallback)((values) => {
58
+ const handleApplyFilter = (0, react_1.useCallback)((values, liveUpdate = false) => {
58
59
  let options = {};
59
60
  switch (algorithm) {
60
61
  case 'airpls':
@@ -73,7 +74,9 @@ function BaseLineCorrectionPanel() {
73
74
  break;
74
75
  }
75
76
  dispatch({
76
- type: Types_1.APPLY_BASE_LINE_CORRECTION_FILTER,
77
+ type: liveUpdate
78
+ ? Types_1.CALCULATE_BASE_LINE_CORRECTION_FILTER
79
+ : Types_1.APPLY_BASE_LINE_CORRECTION_FILTER,
77
80
  options,
78
81
  });
79
82
  }, [algorithm, dispatch]);
@@ -113,6 +116,6 @@ function BaseLineCorrectionPanel() {
113
116
  return { validation: {}, initialValue: {} };
114
117
  }
115
118
  }, [algorithm]);
116
- return ((0, jsx_runtime_1.jsxs)("div", { style: styles.container, children: [(0, jsx_runtime_1.jsx)("span", { style: styles.label, children: "Algorithm: " }), (0, jsx_runtime_1.jsx)(Select_1.default, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, onChange: changeAlgorithmHandler, defaultValue: "polynomial" }), (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: formRef, onSubmit: handleApplyFilter, initialValues: formData.initialValue, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "maxIterations:", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "maxIterations" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "tolerance" }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "degree [ 1 - 6 ]:", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } } }) }))] }, JSON.stringify(formData.initialValue)), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: () => formRef.current.submitForm(), onCancel: handleCancelFilter })] }));
119
+ return ((0, jsx_runtime_1.jsxs)("div", { style: styles.container, children: [(0, jsx_runtime_1.jsx)("span", { style: styles.label, children: "Algorithm: " }), (0, jsx_runtime_1.jsx)(Select_1.default, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, defaultValue: "polynomial", onChange: changeAlgorithmHandler }), (0, jsx_runtime_1.jsxs)(FormikForm_1.default, { ref: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: formData.initialValue, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "maxIterations:", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "maxIterations", debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "tolerance", debounceTime: 250 }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "degree [ 1 - 6 ]:", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } }, debounceTime: 250 }) })), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => handleApplyFilter(values, true) })] }, JSON.stringify(formData.initialValue)), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: () => formRef.current.submitForm(), onCancel: handleCancelFilter })] }));
117
120
  }
118
121
  exports.default = BaseLineCorrectionPanel;
@@ -27,7 +27,7 @@ function HeaderInner(props) {
27
27
  const modal = (0, Modal_1.useModal)();
28
28
  const { current: { display: { general }, }, workspace, dispatch, } = (0, PreferencesContext_1.usePreferences)();
29
29
  const workspacesList = (0, PreferencesContext_1.useWorkspacesList)();
30
- const hideGeneralSettings = general?.hideGeneralSettings && workspace.base ? true : false;
30
+ const hideGeneralSettings = !!(general?.hideGeneralSettings && workspace.base);
31
31
  const selectedPanel = (0, react_1.useMemo)(() => {
32
32
  switch (selectedOptionPanel) {
33
33
  case ToolTypes_1.options.zeroFilling.id:
@@ -38,7 +38,7 @@ function HeaderInner(props) {
38
38
  return (0, jsx_runtime_1.jsx)(AutoPeakPickingOptionPanel_1.default, {});
39
39
  case ToolTypes_1.options.rangesPicking.id:
40
40
  return (0, jsx_runtime_1.jsx)(RangesPickingOptionPanel_1.default, {});
41
- case ToolTypes_1.options.baseLineCorrection.id:
41
+ case ToolTypes_1.options.baselineCorrection.id:
42
42
  return (0, jsx_runtime_1.jsx)(BaseLineCorrectionPanel_1.default, {});
43
43
  case ToolTypes_1.options.zone2D.id:
44
44
  return (0, jsx_runtime_1.jsx)(Zones2DOptionPanel_1.default, {});
@@ -41,7 +41,7 @@ function ZeroFillingOptionsPanel() {
41
41
  type: Types_1.APPLY_ZERO_FILLING_FILTER,
42
42
  value: {
43
43
  zeroFillingSize: Number(sizeTextInputRef.current.value),
44
- lineBroadeningValue: lineBroadeningValue,
44
+ lineBroadeningValue,
45
45
  },
46
46
  });
47
47
  }, [dispatch, lineBroadeningValue]);
@@ -11,7 +11,7 @@ function useActiveSpectrumStyleOptions(id) {
11
11
  const { activeSpectrum } = (0, ChartContext_1.useChartData)();
12
12
  const preferences = (0, PreferencesContext_1.usePreferences)();
13
13
  return (0, react_1.useMemo)(() => {
14
- const isActive = activeSpectrum === null ? true : id === activeSpectrum.id ? true : false;
14
+ const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
15
15
  const opacity = isActive
16
16
  ? 1
17
17
  : (0, get_1.default)(preferences.current, 'controllers.dimmedSpectraTransparency', 0.1);
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useCheckToolsVisibility = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
+ const react_1 = require("react");
8
9
  const PreferencesContext_1 = require("../context/PreferencesContext");
9
10
  function useCheckToolsVisibility() {
10
11
  const preferences = (0, PreferencesContext_1.usePreferences)();
11
- return (toolKey) => (0, get_1.default)(preferences.current, `display.toolBarButtons.${toolKey}`, true);
12
+ return (0, react_1.useCallback)((toolKey) => (0, get_1.default)(preferences.current, `display.toolBarButtons.${toolKey}`, true), [preferences]);
12
13
  }
13
14
  exports.useCheckToolsVisibility = useCheckToolsVisibility;
@@ -35,7 +35,7 @@ function useExport() {
35
35
  async function handle() {
36
36
  //exported file name by default will be the first spectrum name
37
37
  const fileName = state.data[0]?.display?.name;
38
- const exportedData = (0, SpectraManager_1.toJSON)(state);
38
+ const exportedData = (0, SpectraManager_1.toJSON)(state, 'nmrium');
39
39
  await (0, Export_1.exportAsJSON)(exportedData, fileName, spaceIndent, isCompressed);
40
40
  hideLoading();
41
41
  }
@@ -83,7 +83,7 @@ function useExport() {
83
83
  const hideLoading = await alert.showLoading(`Exporting as ${name}.nmrium process in progress`);
84
84
  setTimeout(() => {
85
85
  void (async () => {
86
- const exportedData = (0, SpectraManager_1.toJSON)(state, dataExportOption);
86
+ const exportedData = (0, SpectraManager_1.toJSON)(state, 'nmrium', dataExportOption);
87
87
  const spaceIndent = pretty ? 2 : 0;
88
88
  await (0, Export_1.exportAsJSON)(exportedData, name, spaceIndent, compressed);
89
89
  hideLoading();
@@ -17,9 +17,8 @@ function useFormatNumberByNucleus(nucleus) {
17
17
  return (0, react_1.useMemo)(() => {
18
18
  function formatFun(n) {
19
19
  return (value, formatKey = 'ppm', prefix = '', suffix = '') => {
20
- return (prefix +
21
- (0, numeral_1.default)(Number(value)).format((0, get_1.default)(nucleusByKey, `${n.toLowerCase()}.${formatKey}`, '0.0')) +
22
- suffix);
20
+ const formattedNumber = (0, numeral_1.default)(Number(value)).format((0, get_1.default)(nucleusByKey, `${n.toLowerCase()}.${formatKey}`, '0.0'));
21
+ return `${prefix}${formattedNumber}${suffix}`;
23
22
  };
24
23
  }
25
24
  if (!nucleus) {
@@ -14,6 +14,7 @@ const ChartContext_1 = require("../context/ChartContext");
14
14
  const DispatchContext_1 = require("../context/DispatchContext");
15
15
  const LoaderContext_1 = require("../context/LoaderContext");
16
16
  const Alert_1 = require("../elements/popup/Alert");
17
+ const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
17
18
  const Types_1 = require("../reducer/types/Types");
18
19
  const FileUtility_1 = require("../utility/FileUtility");
19
20
  const style = (0, react_1.css) `
@@ -51,6 +52,7 @@ function DropZone(props) {
51
52
  const { width, height } = (0, ChartContext_1.useChartData)();
52
53
  const dispatch = (0, DispatchContext_1.useDispatch)();
53
54
  const alert = (0, Alert_1.useAlert)();
55
+ const isToolEnabled = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
54
56
  const loadSubFilesFromZip = (0, react_2.useCallback)(async (extractedfiles, uniqueFileExtensions) => {
55
57
  for (let extension of uniqueFileExtensions) {
56
58
  const selectedFilesByExtensions = extractedfiles.filter((file) => (0, FileUtility_1.getFileExtension)(file.name) === extension);
@@ -197,14 +199,18 @@ function DropZone(props) {
197
199
  dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
198
200
  void loadFilesHandler(droppedFiles);
199
201
  }, [dispatch, loadFilesHandler]);
202
+ const isImportEnabled = isToolEnabled('import');
200
203
  const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = (0, react_dropzone_1.useDropzone)({
201
204
  onDrop,
202
205
  noClick: true,
203
206
  noKeyboard: true,
207
+ noDrag: !isImportEnabled,
204
208
  });
205
209
  const open = (0, react_2.useCallback)(() => {
206
- openImportDialog();
207
- }, [openImportDialog]);
210
+ if (isImportEnabled) {
211
+ openImportDialog();
212
+ }
213
+ }, [isImportEnabled, openImportDialog]);
208
214
  return ((0, jsx_runtime_1.jsx)(LoaderContext_1.LoaderProvider, { value: open, children: (0, jsx_runtime_1.jsxs)("div", { ...getRootProps(), role: "none", css: containerStyle, children: [(0, jsx_runtime_1.jsx)("input", { "data-test-id": "dropzone-input", ...getInputProps() }), isDragActive && ((0, jsx_runtime_1.jsxs)("div", { css: style, style: {
209
215
  width: `${width}px`,
210
216
  height: `${height}px`,