nmrium 0.36.0 → 0.38.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 (411) hide show
  1. package/lib/component/1d/FooterBanner.js +1 -1
  2. package/lib/component/1d/Viewer1D.js +26 -21
  3. package/lib/component/1d/integral/Integral.d.ts +2 -6
  4. package/lib/component/1d/integral/IntegralResizable.d.ts +2 -6
  5. package/lib/component/1d/integral/IntegralResizable.js +2 -3
  6. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  7. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
  8. package/lib/component/1d/peaks/PeakAnnotation.js +1 -2
  9. package/lib/component/1d/ranges/Range.js +9 -8
  10. package/lib/component/1d/ranges/Ranges.js +5 -7
  11. package/lib/component/1d/tool/BaseLineZones.js +1 -2
  12. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
  14. package/lib/component/2d/1d-tracer/Left1DChart.js +1 -1
  15. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
  16. package/lib/component/2d/Chart2D.js +1 -1
  17. package/lib/component/2d/Viewer2D.js +10 -9
  18. package/lib/component/2d/fid/FidCanvas.js +4 -6
  19. package/lib/component/2d/ft/Contours.js +1 -7
  20. package/lib/component/2d/utilities/DimensionLayout.d.ts +9 -24
  21. package/lib/component/2d/utilities/scale.d.ts +2 -1
  22. package/lib/component/2d/utilities/scale.js +1 -1
  23. package/lib/component/2d/zones/Zones.js +1 -1
  24. package/lib/component/EventsTrackers/KeysListenerTracker.js +28 -21
  25. package/lib/component/NMRium.d.ts +2 -0
  26. package/lib/component/NMRium.js +22 -15
  27. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  28. package/lib/component/context/DispatchContext.d.ts +23 -3
  29. package/lib/component/context/DispatchContext.js +1 -1
  30. package/lib/component/context/LoggerContext.js +1 -1
  31. package/lib/component/elements/Button.js +7 -9
  32. package/lib/component/elements/IsotopesViewer.js +1 -1
  33. package/lib/component/elements/ReactTable/ReactTable.js +1 -2
  34. package/lib/component/elements/RemoveAssignmentsButton.d.ts +4 -0
  35. package/lib/component/{panels/RangesPanel/TableColumns → elements}/RemoveAssignmentsButton.js +14 -1
  36. package/lib/component/elements/formik/FormikCheckBox.js +1 -1
  37. package/lib/component/elements/formik/FormikColorInput.js +1 -1
  38. package/lib/component/elements/formik/FormikColorPicker.js +1 -1
  39. package/lib/component/elements/formik/FormikColumnFormatField.js +1 -1
  40. package/lib/component/elements/formik/FormikInput.js +1 -1
  41. package/lib/component/elements/formik/FormikSelect.js +2 -2
  42. package/lib/component/elements/formik/FormikSlider.js +1 -1
  43. package/lib/component/elements/formik/FormikTextarea.js +2 -2
  44. package/lib/component/header/ApodizationOptionsPanel.js +4 -5
  45. package/lib/component/header/AutoPeakPickingOptionPanel.js +1 -2
  46. package/lib/component/header/BaseLineCorrectionPanel.js +4 -5
  47. package/lib/component/header/Header.js +5 -7
  48. package/lib/component/header/PhaseCorrectionPanel.js +7 -8
  49. package/lib/component/header/RangesPickingOptionPanel.js +1 -2
  50. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -11
  51. package/lib/component/header/Zones2DOptionPanel.js +5 -6
  52. package/lib/component/hooks/useExport.js +1 -0
  53. package/lib/component/hooks/useToolsFunctions.js +8 -10
  54. package/lib/component/loader/DropZone.js +4 -5
  55. package/lib/component/loader/NoData.js +1 -1
  56. package/lib/component/modal/AboutPredictionModal.d.ts +2 -0
  57. package/lib/component/modal/AboutPredictionModal.js +49 -0
  58. package/lib/component/modal/AlignSpectraModal.js +1 -2
  59. package/lib/component/modal/EditPeakShapeModal.js +1 -2
  60. package/lib/component/modal/ImportPublicationStringModal.js +1 -2
  61. package/lib/component/modal/LoadJCAMPModal.js +2 -3
  62. package/lib/component/modal/MoleculeStructureEditorModal.js +24 -19
  63. package/lib/component/modal/PredictSpectraModal.js +24 -21
  64. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  65. package/lib/component/modal/editRange/EditRangeModal.js +3 -4
  66. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
  67. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
  68. package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -3
  69. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
  70. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
  71. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
  72. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  73. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
  74. package/lib/component/panels/InformationPanel.js +6 -6
  75. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
  76. package/lib/component/panels/IntegralsPanel/IntegralTable.js +27 -23
  77. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +8 -5
  78. package/lib/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
  79. package/lib/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
  80. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
  81. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
  82. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
  83. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -0
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -7
  85. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +4 -1
  86. package/lib/component/panels/MoleculesPanel/Utilities.js +2 -2
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  88. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
  89. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
  90. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  91. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
  92. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
  93. package/lib/component/panels/Panels.js +1 -1
  94. package/lib/component/panels/PeaksPanel/PeaksPanel.js +4 -5
  95. package/lib/component/panels/PeaksPanel/PeaksTable.js +4 -5
  96. package/lib/component/panels/RangesPanel/RangesHeader.js +12 -15
  97. package/lib/component/panels/RangesPanel/RangesPanel.js +24 -29
  98. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +0 -1
  99. package/lib/component/panels/RangesPanel/RangesTableRow.js +0 -11
  100. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -3
  101. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
  102. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +2 -3
  103. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
  104. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
  105. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
  106. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
  107. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +2 -2
  108. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
  109. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
  110. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
  111. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +1 -1
  112. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
  113. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  114. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
  115. package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -34
  116. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  117. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +2 -21
  118. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
  119. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +4 -5
  120. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +12 -16
  121. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +3 -7
  122. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +2 -2
  123. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
  124. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
  125. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +4 -5
  126. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +27 -19
  127. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +3 -7
  128. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.js +2 -2
  129. package/lib/component/panels/ZonesPanel/ZonesPanel.js +15 -18
  130. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -51
  131. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +3 -3
  132. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -22
  133. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +16 -0
  134. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +52 -0
  135. package/lib/component/panels/databasePanel/DatabasePanel.js +9 -7
  136. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -2
  137. package/lib/component/panels/filtersPanel/FiltersTable.js +8 -9
  138. package/lib/component/panels/header/DefaultPanelHeader.js +1 -1
  139. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
  140. package/lib/component/panels/predictionPanel/PredictionPanel.js +10 -6
  141. package/lib/component/reducer/IgnoreActions.d.ts +2 -1
  142. package/lib/component/reducer/IgnoreActions.js +35 -32
  143. package/lib/component/reducer/Reducer.d.ts +8 -5
  144. package/lib/component/reducer/Reducer.js +199 -221
  145. package/lib/component/reducer/actions/AssignmentsActions.d.ts +7 -6
  146. package/lib/component/reducer/actions/AssignmentsActions.js +2 -2
  147. package/lib/component/reducer/actions/CorrelationsActions.d.ts +21 -13
  148. package/lib/component/reducer/actions/CorrelationsActions.js +25 -20
  149. package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -2
  150. package/lib/component/reducer/actions/DatabaseActions.js +5 -2
  151. package/lib/component/reducer/actions/DimensionsActions.d.ts +8 -3
  152. package/lib/component/reducer/actions/DimensionsActions.js +3 -5
  153. package/lib/component/reducer/actions/DomainActions.d.ts +11 -5
  154. package/lib/component/reducer/actions/DomainActions.js +13 -19
  155. package/lib/component/reducer/actions/FiltersActions.d.ts +70 -23
  156. package/lib/component/reducer/actions/FiltersActions.js +250 -255
  157. package/lib/component/reducer/actions/GlobalActions.d.ts +7 -2
  158. package/lib/component/reducer/actions/GlobalActions.js +3 -3
  159. package/lib/component/reducer/actions/IntegralsActions.d.ts +28 -7
  160. package/lib/component/reducer/actions/IntegralsActions.js +16 -15
  161. package/lib/component/reducer/actions/LoadActions.d.ts +23 -5
  162. package/lib/component/reducer/actions/LoadActions.js +65 -57
  163. package/lib/component/reducer/actions/MoleculeActions.d.ts +38 -9
  164. package/lib/component/reducer/actions/MoleculeActions.js +53 -20
  165. package/lib/component/reducer/actions/PeaksActions.d.ts +39 -8
  166. package/lib/component/reducer/actions/PeaksActions.js +19 -11
  167. package/lib/component/reducer/actions/PreferencesActions.d.ts +8 -3
  168. package/lib/component/reducer/actions/PreferencesActions.js +22 -7
  169. package/lib/component/reducer/actions/RangesActions.d.ts +85 -18
  170. package/lib/component/reducer/actions/RangesActions.js +80 -65
  171. package/lib/component/reducer/actions/SpectraAnalysisAction.d.ts +7 -1
  172. package/lib/component/reducer/actions/SpectrumsActions.d.ts +57 -24
  173. package/lib/component/reducer/actions/SpectrumsActions.js +69 -60
  174. package/lib/component/reducer/actions/ToolsActions.d.ts +59 -21
  175. package/lib/component/reducer/actions/ToolsActions.js +54 -32
  176. package/lib/component/reducer/actions/ZonesActions.d.ts +79 -15
  177. package/lib/component/reducer/actions/ZonesActions.js +68 -49
  178. package/lib/component/reducer/helper/Zoom1DManager.d.ts +6 -5
  179. package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
  180. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -2
  181. package/lib/component/reducer/helper/get2DRange.d.ts +7 -1
  182. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -0
  183. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  184. package/lib/component/reducer/types/ActionType.d.ts +6 -0
  185. package/lib/component/reducer/types/ActionType.js +1 -0
  186. package/lib/component/toolbar/BasicToolBar.js +6 -9
  187. package/lib/component/toolbar/FunctionToolBar.js +4 -9
  188. package/lib/component/toolbar/ToolBar.js +1 -1
  189. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  190. package/lib/component/utility/Events.d.ts +4 -4
  191. package/lib/component/utility/Events.js +2 -2
  192. package/lib/component/utility/GroupByInfoKey.js +1 -1
  193. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  194. package/lib/component/workspaces/Workspace.d.ts +2 -1
  195. package/lib/component/workspaces/exercise.js +31 -0
  196. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  197. package/lib/data/PredictionManager.d.ts +5 -8
  198. package/lib/data/PredictionManager.js +3 -3
  199. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
  200. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  201. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.d.ts +2 -3
  202. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
  203. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +5 -3
  204. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -35
  205. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +2 -35
  206. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +7 -10
  207. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  208. package/lib/data/data2d/Processing2D.d.ts +3 -3
  209. package/lib/data/data2d/Spectrum2D/contours.d.ts +1 -4
  210. package/lib/data/data2d/Spectrum2D/contours.js +0 -1
  211. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  212. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts +5 -1
  213. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
  214. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -0
  215. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -0
  216. package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +2 -0
  217. package/lib/data/matrixGeneration.js +4 -2
  218. package/lib/data/molecules/Molecule.d.ts +3 -3
  219. package/lib/data/molecules/MoleculeManager.d.ts +5 -5
  220. package/lib/data/molecules/MoleculeManager.js +1 -1
  221. package/lib/data/utilities/ZoneUtilities.js +0 -1
  222. package/lib/data/utilities/generateColor.js +1 -1
  223. package/lib/data/utilities/isNumber.d.ts +1 -0
  224. package/lib/data/utilities/isNumber.js +3 -0
  225. package/lib/types/NMRiumGeneralPreferences.d.ts +1 -0
  226. package/lib/versionInfo.js +1 -1
  227. package/lib-cjs/component/1d/FooterBanner.js +1 -1
  228. package/lib-cjs/component/1d/Viewer1D.js +25 -20
  229. package/lib-cjs/component/1d/integral/IntegralResizable.js +2 -3
  230. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  231. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
  232. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -2
  233. package/lib-cjs/component/1d/ranges/Range.js +9 -8
  234. package/lib-cjs/component/1d/ranges/Ranges.js +5 -7
  235. package/lib-cjs/component/1d/tool/BaseLineZones.js +1 -2
  236. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
  237. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
  238. package/lib-cjs/component/2d/1d-tracer/Left1DChart.js +1 -1
  239. package/lib-cjs/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
  240. package/lib-cjs/component/2d/Chart2D.js +1 -1
  241. package/lib-cjs/component/2d/Viewer2D.js +10 -9
  242. package/lib-cjs/component/2d/fid/FidCanvas.js +4 -6
  243. package/lib-cjs/component/2d/ft/Contours.js +1 -7
  244. package/lib-cjs/component/2d/utilities/scale.js +1 -1
  245. package/lib-cjs/component/2d/zones/Zones.js +1 -1
  246. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +28 -21
  247. package/lib-cjs/component/NMRium.js +19 -12
  248. package/lib-cjs/component/context/DispatchContext.js +1 -1
  249. package/lib-cjs/component/context/LoggerContext.js +1 -1
  250. package/lib-cjs/component/elements/Button.js +7 -9
  251. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  252. package/lib-cjs/component/elements/ReactTable/ReactTable.js +1 -2
  253. package/lib-cjs/component/{panels/RangesPanel/TableColumns → elements}/RemoveAssignmentsButton.js +15 -2
  254. package/lib-cjs/component/elements/Tab/Tabs.js +1 -1
  255. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  256. package/lib-cjs/component/elements/formik/FormikColorInput.js +1 -1
  257. package/lib-cjs/component/elements/formik/FormikColorPicker.js +1 -1
  258. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +1 -1
  259. package/lib-cjs/component/elements/formik/FormikInput.js +1 -1
  260. package/lib-cjs/component/elements/formik/FormikSelect.js +2 -2
  261. package/lib-cjs/component/elements/formik/FormikSlider.js +1 -1
  262. package/lib-cjs/component/elements/formik/FormikTextarea.js +2 -2
  263. package/lib-cjs/component/header/ApodizationOptionsPanel.js +3 -4
  264. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +1 -2
  265. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +4 -5
  266. package/lib-cjs/component/header/Header.js +5 -7
  267. package/lib-cjs/component/header/PhaseCorrectionPanel.js +7 -8
  268. package/lib-cjs/component/header/RangesPickingOptionPanel.js +1 -2
  269. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -11
  270. package/lib-cjs/component/header/Zones2DOptionPanel.js +5 -6
  271. package/lib-cjs/component/highlight/index.js +1 -1
  272. package/lib-cjs/component/hooks/useExport.js +1 -0
  273. package/lib-cjs/component/hooks/useTableSortBy.js +1 -1
  274. package/lib-cjs/component/hooks/useToolsFunctions.js +8 -10
  275. package/lib-cjs/component/hooks/useXYReduce.js +1 -1
  276. package/lib-cjs/component/loader/DropZone.js +4 -5
  277. package/lib-cjs/component/loader/NoData.js +1 -1
  278. package/lib-cjs/component/modal/AboutPredictionModal.js +54 -0
  279. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
  280. package/lib-cjs/component/modal/EditPeakShapeModal.js +1 -2
  281. package/lib-cjs/component/modal/ImportPublicationStringModal.js +1 -2
  282. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -3
  283. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -19
  284. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -21
  285. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  286. package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -4
  287. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
  288. package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
  289. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +2 -3
  290. package/lib-cjs/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
  291. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
  292. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
  293. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  294. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
  295. package/lib-cjs/component/panels/InformationPanel.js +6 -6
  296. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
  297. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +27 -23
  298. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +7 -4
  299. package/lib-cjs/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
  300. package/lib-cjs/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
  301. package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
  302. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
  303. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
  304. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -7
  305. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +2 -2
  306. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  307. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
  308. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
  309. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  310. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
  311. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
  312. package/lib-cjs/component/panels/Panels.js +1 -1
  313. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -5
  314. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +4 -5
  315. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +12 -15
  316. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +24 -29
  317. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +0 -12
  318. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -3
  319. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
  320. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +2 -3
  321. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
  322. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
  323. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
  324. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +2 -2
  325. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
  326. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
  327. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
  328. package/lib-cjs/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +1 -1
  329. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
  330. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  331. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
  332. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +39 -34
  333. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  334. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
  335. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +12 -19
  336. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +2 -2
  337. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
  338. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +27 -22
  339. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.js +2 -2
  340. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +15 -18
  341. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +2 -51
  342. package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +1 -21
  343. package/lib-cjs/component/panels/ZonesPanel/hooks/useMapZones.js +56 -0
  344. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +8 -6
  345. package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -2
  346. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +8 -9
  347. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -1
  348. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
  349. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +10 -6
  350. package/lib-cjs/component/reducer/IgnoreActions.js +35 -55
  351. package/lib-cjs/component/reducer/Reducer.js +199 -221
  352. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +3 -3
  353. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +23 -18
  354. package/lib-cjs/component/reducer/actions/DatabaseActions.js +4 -1
  355. package/lib-cjs/component/reducer/actions/DimensionsActions.js +3 -6
  356. package/lib-cjs/component/reducer/actions/DomainActions.js +15 -23
  357. package/lib-cjs/component/reducer/actions/FiltersActions.js +267 -272
  358. package/lib-cjs/component/reducer/actions/GlobalActions.js +4 -4
  359. package/lib-cjs/component/reducer/actions/IntegralsActions.js +19 -18
  360. package/lib-cjs/component/reducer/actions/LoadActions.js +68 -60
  361. package/lib-cjs/component/reducer/actions/MoleculeActions.js +56 -23
  362. package/lib-cjs/component/reducer/actions/PeaksActions.js +23 -15
  363. package/lib-cjs/component/reducer/actions/PreferencesActions.js +24 -9
  364. package/lib-cjs/component/reducer/actions/RangesActions.js +81 -64
  365. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +77 -67
  366. package/lib-cjs/component/reducer/actions/ToolsActions.js +54 -31
  367. package/lib-cjs/component/reducer/actions/ZonesActions.js +73 -52
  368. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  369. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -2
  370. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -2
  371. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -0
  372. package/lib-cjs/component/reducer/types/ActionType.js +2 -0
  373. package/lib-cjs/component/toolbar/BasicToolBar.js +6 -9
  374. package/lib-cjs/component/toolbar/FunctionToolBar.js +4 -9
  375. package/lib-cjs/component/toolbar/ToolBar.js +1 -1
  376. package/lib-cjs/component/utility/GroupByInfoKey.js +1 -1
  377. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  378. package/lib-cjs/component/workspaces/exercise.js +31 -0
  379. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
  380. package/lib-cjs/data/PredictionManager.js +3 -3
  381. package/lib-cjs/data/SpectraManager.js +1 -1
  382. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
  383. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  384. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
  385. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +2 -2
  386. package/lib-cjs/data/data2d/Spectrum2D/contours.js +0 -1
  387. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  388. package/lib-cjs/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
  389. package/lib-cjs/data/matrixGeneration.js +4 -2
  390. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  391. package/lib-cjs/data/utilities/ZoneUtilities.js +0 -1
  392. package/lib-cjs/data/utilities/generateColor.js +1 -1
  393. package/lib-cjs/data/utilities/isNumber.js +7 -0
  394. package/lib-cjs/versionInfo.js +1 -1
  395. package/package.json +35 -34
  396. package/lib/component/panels/RangesPanel/TableColumns/RemoveAssignmentsButton.d.ts +0 -3
  397. package/lib/component/reducer/actions/HistoryActions.d.ts +0 -4
  398. package/lib/component/reducer/actions/HistoryActions.js +0 -40
  399. package/lib/component/reducer/types/HistoryTypes.d.ts +0 -4
  400. package/lib/component/reducer/types/HistoryTypes.js +0 -4
  401. package/lib/component/reducer/types/Types.d.ts +0 -132
  402. package/lib/component/reducer/types/Types.js +0 -126
  403. package/lib/component/toolbar/HistoryToolBar.d.ts +0 -8
  404. package/lib/component/toolbar/HistoryToolBar.js +0 -30
  405. package/lib/data/utilities/isMolFileEmpty.d.ts +0 -1
  406. package/lib/data/utilities/isMolFileEmpty.js +0 -6
  407. package/lib-cjs/component/reducer/actions/HistoryActions.js +0 -45
  408. package/lib-cjs/component/reducer/types/HistoryTypes.js +0 -7
  409. package/lib-cjs/component/reducer/types/Types.js +0 -131
  410. package/lib-cjs/component/toolbar/HistoryToolBar.js +0 -35
  411. package/lib-cjs/data/utilities/isMolFileEmpty.js +0 -10
@@ -1,9 +1,30 @@
1
1
  import { Draft } from 'immer';
2
+ import { Integral } from 'nmr-load-save';
3
+ import { SetSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
2
4
  import { State } from '../Reducer';
3
- declare function handleChangeIntegralSum(draft: Draft<State>, options: any): void;
4
- declare function addIntegral(draft: Draft<State>, action: any): void;
5
- declare function deleteIntegral(draft: Draft<State>, action: any): void;
6
- declare function changeIntegral(draft: Draft<State>, action: any): void;
7
- declare function handleChangeIntegralsRelativeValue(draft: Draft<State>, action: any): void;
8
- declare function handleChangeIntegralsSumFlag(draft: any, action: any): void;
9
- export { handleChangeIntegralSum, addIntegral, deleteIntegral, changeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
5
+ import { ActionType } from '../types/ActionType';
6
+ type ChangeIntegralSumAction = ActionType<'CHANGE_INTEGRAL_SUM', {
7
+ options: SetSumOptions;
8
+ }>;
9
+ type AddIntegralAction = ActionType<'ADD_INTEGRAL', {
10
+ startX: number;
11
+ endX: number;
12
+ }>;
13
+ type DeleteIntegralAction = ActionType<'DELETE_INTEGRAL', {
14
+ id?: string;
15
+ }>;
16
+ type ChangeIntegralAction = ActionType<'CHANGE_INTEGRAL' | 'RESIZE_INTEGRAL', {
17
+ integral: Integral;
18
+ }>;
19
+ type ChangeIntegralRelativeValueAction = ActionType<'CHANGE_INTEGRAL_RELATIVE', {
20
+ id: string;
21
+ value: number;
22
+ }>;
23
+ export type IntegralsActions = ChangeIntegralSumAction | AddIntegralAction | DeleteIntegralAction | ChangeIntegralAction | ChangeIntegralRelativeValueAction | ActionType<'CHANGE_INTEGRALS_SUM_FLAG'>;
24
+ declare function handleChangeIntegralSum(draft: Draft<State>, action: ChangeIntegralSumAction): void;
25
+ declare function handleAddIntegral(draft: Draft<State>, action: AddIntegralAction): void;
26
+ declare function handleDeleteIntegral(draft: Draft<State>, action: DeleteIntegralAction): void;
27
+ declare function handleChangeIntegral(draft: Draft<State>, action: ChangeIntegralAction): void;
28
+ declare function handleChangeIntegralsRelativeValue(draft: Draft<State>, action: ChangeIntegralRelativeValueAction): void;
29
+ declare function handleChangeIntegralsSumFlag(draft: any): void;
30
+ export { handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
@@ -6,7 +6,8 @@ import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/
6
6
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
7
7
  import getRange from '../helper/getRange';
8
8
  import { setIntegralsYDomain } from './DomainActions';
9
- function handleChangeIntegralSum(draft, options) {
9
+ function handleChangeIntegralSum(draft, action) {
10
+ const { options } = action.payload;
10
11
  const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
11
12
  const activeSpectrum = getActiveSpectrum(draft);
12
13
  if (activeSpectrum?.id) {
@@ -16,8 +17,8 @@ function handleChangeIntegralSum(draft, options) {
16
17
  updateIntegralsRelativeValues(datum, true);
17
18
  }
18
19
  }
19
- function addIntegral(draft, action) {
20
- const { startX, endX } = action;
20
+ function handleAddIntegral(draft, action) {
21
+ const { startX, endX } = action.payload;
21
22
  const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
22
23
  const activeSpectrum = getActiveSpectrum(draft);
23
24
  const [from, to] = getRange(draft, { startX, endX });
@@ -43,14 +44,14 @@ function addIntegral(draft, action) {
43
44
  setIntegralsYDomain(draft, datum);
44
45
  }
45
46
  }
46
- function deleteIntegral(draft, action) {
47
+ function handleDeleteIntegral(draft, action) {
47
48
  const activeSpectrum = getActiveSpectrum(draft);
48
49
  if (activeSpectrum) {
49
50
  const state = original(draft);
50
51
  const { index } = activeSpectrum;
51
- const { integralID } = action;
52
+ const { id: integralID } = action?.payload || {};
52
53
  const datum = draft.data[index];
53
- if (integralID == null) {
54
+ if (!integralID) {
54
55
  datum.integrals.values = [];
55
56
  }
56
57
  else {
@@ -60,10 +61,10 @@ function deleteIntegral(draft, action) {
60
61
  }
61
62
  }
62
63
  }
63
- function changeIntegral(draft, action) {
64
+ function handleChangeIntegral(draft, action) {
64
65
  const activeSpectrum = getActiveSpectrum(draft);
65
66
  const state = original(draft);
66
- const integral = action.payload.data;
67
+ const { integral } = action.payload;
67
68
  if (activeSpectrum?.id) {
68
69
  const { index } = activeSpectrum;
69
70
  const originalDatum = state.data[index];
@@ -72,9 +73,9 @@ function changeIntegral(draft, action) {
72
73
  const integralIndex = originalDatum.integrals.values.findIndex((i) => i.id === integral.id);
73
74
  if (integralIndex !== -1) {
74
75
  datum.integrals.values[integralIndex] = {
76
+ ...integral,
75
77
  originFrom: integral.from,
76
78
  originTo: integral.to,
77
- ...integral,
78
79
  absolute: xyIntegration({ x, y: re }, { from: integral.from, to: integral.to, reverse: true }),
79
80
  };
80
81
  updateIntegralsRelativeValues(datum);
@@ -83,18 +84,18 @@ function changeIntegral(draft, action) {
83
84
  }
84
85
  function handleChangeIntegralsRelativeValue(draft, action) {
85
86
  const activeSpectrum = getActiveSpectrum(draft);
86
- const data = action.payload.data;
87
+ const { id, value } = action.payload;
87
88
  if (activeSpectrum?.id) {
88
89
  const { index } = activeSpectrum;
89
- changeIntegralsRelative(draft.data[index], data);
90
+ changeIntegralsRelative(draft.data[index], { id, value });
90
91
  }
91
92
  }
92
- function handleChangeIntegralsSumFlag(draft, action) {
93
- const flag = action.payload;
93
+ function handleChangeIntegralsSumFlag(draft) {
94
94
  const activeSpectrum = getActiveSpectrum(draft);
95
95
  if (activeSpectrum) {
96
96
  const { index } = activeSpectrum;
97
- draft.data[index].integrals.options.isSumConstant = !flag;
97
+ const integralOptions = draft.data[index].integrals.options;
98
+ integralOptions.isSumConstant = !integralOptions.isSumConstant;
98
99
  }
99
100
  }
100
- export { handleChangeIntegralSum, addIntegral, deleteIntegral, changeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
101
+ export { handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
@@ -1,13 +1,31 @@
1
1
  import { Draft } from 'immer';
2
- import { Spectrum } from 'nmr-load-save';
2
+ import { NmriumState, Spectrum } from 'nmr-load-save';
3
+ import { ParseResult } from 'papaparse';
3
4
  import { UsedColors } from '../../../types/UsedColors';
4
5
  import { OnLoadProcessing } from '../../workspaces/Workspace';
5
6
  import { State } from '../Reducer';
6
- declare function setIsLoading(draft: Draft<State>, isLoading: boolean): void;
7
+ import { ActionType } from '../types/ActionType';
8
+ interface InitiateProps {
9
+ nmriumState: Partial<NmriumState>;
10
+ }
11
+ interface InputProps extends InitiateProps {
12
+ containsNmrium?: boolean;
13
+ usedColors?: UsedColors;
14
+ onLoadProcessing?: OnLoadProcessing;
15
+ parseMetaFileResult?: ParseResult<any> | null;
16
+ resetSourceObject?: boolean;
17
+ }
18
+ type SetIsLoadingAction = ActionType<'SET_LOADING_FLAG', {
19
+ isLoading: boolean;
20
+ }>;
21
+ type LoadDropFilesAction = ActionType<'LOAD_DROP_FILES', InputProps>;
22
+ type InitiateAction = ActionType<'INITIATE', InitiateProps>;
23
+ export type LoadActions = SetIsLoadingAction | LoadDropFilesAction | InitiateAction;
7
24
  declare function initSpectra(inputSpectra: Spectrum[], options: {
8
25
  usedColors: UsedColors;
9
26
  onLoadProcessing: OnLoadProcessing;
10
27
  }): any;
11
- declare function initiate(draft: Draft<State>, action: any): State | undefined;
12
- declare function loadDropFiles(draft: Draft<State>, action: any): State | undefined;
13
- export { setIsLoading, initSpectra, initiate, loadDropFiles };
28
+ declare function handleSetIsLoading(draft: Draft<State>, action: SetIsLoadingAction): void;
29
+ declare function handleInitiate(draft: Draft<State>, action: InitiateAction): State | undefined;
30
+ declare function handleLoadDropFiles(draft: Draft<State>, action: LoadDropFilesAction): State | undefined;
31
+ export { handleSetIsLoading, initSpectra, handleInitiate, handleLoadDropFiles };
@@ -9,14 +9,24 @@ import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Con
9
9
  import nucleusToString from '../../utility/nucleusToString';
10
10
  import { getDefaultViewState, getInitialState, } from '../Reducer';
11
11
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
12
- import { importSpectraMetaInfo } from './SpectrumsActions';
12
+ import { setSpectraMetaInfo } from './SpectrumsActions';
13
13
  import { setActiveTab } from './ToolsActions';
14
- function setIsLoading(draft, isLoading) {
15
- draft.isLoading = isLoading;
16
- }
17
- function setColors(draft, colors) {
18
- draft.usedColors['1d'] = draft.usedColors['1d'].concat(colors['1d']);
19
- draft.usedColors['2d'] = draft.usedColors['2d'].concat(colors['2d']);
14
+ function convertHybridizationStringValuesInCorrelations(correlations) {
15
+ return {
16
+ ...correlations,
17
+ values: correlations.values.map((correlation) => {
18
+ if (typeof correlation.hybridization === 'string') {
19
+ let values = [];
20
+ if (correlation.hybridization.length > 0) {
21
+ const hybridizationString = correlation.hybridization.replaceAll('SP', '');
22
+ const value = Number(hybridizationString);
23
+ values.push(value);
24
+ }
25
+ correlation.hybridization = values;
26
+ }
27
+ return correlation;
28
+ }),
29
+ };
20
30
  }
21
31
  function setCorrelation(draft, correlations) {
22
32
  if (!correlations || Object.keys(correlations).length === 0) {
@@ -32,32 +42,17 @@ function setCorrelation(draft, correlations) {
32
42
  // draft.correlations = correlations // original command without overwriting
33
43
  }
34
44
  }
35
- function initSpectra(inputSpectra, options) {
36
- const spectra = [];
37
- const { usedColors, onLoadProcessing } = options;
38
- for (const spectrum of inputSpectra) {
39
- const { info } = spectrum;
40
- if (info.dimension === 1) {
41
- const filters = onLoadProcessing?.[nucleusToString(info.nucleus)] || [];
42
- spectra.push(initiateDatum1D(spectrum, { usedColors, filters }));
43
- }
44
- else if (info.dimension === 2) {
45
- spectra.push(initiateDatum2D({ ...spectrum }, { usedColors }));
46
- }
47
- }
48
- return spectra;
49
- }
50
- function setData(draft, input) {
51
- const { data, usedColors, view, onLoadProcessing = {}, parseMetaFileResult = null, } = input || {
52
- data: { spectra: [], molecules: [], correlations: {} },
45
+ function setData(draft, input, options = {}) {
46
+ const { nmriumState: { data, view }, onLoadProcessing = {}, parseMetaFileResult = null, } = input || {
47
+ nmriumState: { data: { spectra: [], molecules: [], correlations: {} } },
53
48
  multipleAnalysis: {},
54
49
  };
50
+ const { autoOnLoadProcessing = true } = options;
55
51
  const { source, spectra = [], molecules = [], correlations = {}, } = data || {};
56
52
  if (view) {
57
53
  const defaultViewState = getDefaultViewState();
58
54
  draft.view = lodashMerge(defaultViewState, view);
59
55
  }
60
- setColors(draft, usedColors);
61
56
  if (source) {
62
57
  draft.source = lodashMergeWith(draft.source, source, (objValue, srcValue) => {
63
58
  if (Array.isArray(objValue)) {
@@ -66,7 +61,10 @@ function setData(draft, input) {
66
61
  });
67
62
  }
68
63
  draft.molecules = draft.molecules.concat(MoleculeManager.fromJSON(molecules, draft.molecules));
69
- draft.data = draft.data.concat(initSpectra(spectra, { usedColors, onLoadProcessing }));
64
+ draft.data = draft.data.concat(initSpectra(spectra, {
65
+ usedColors: draft.usedColors,
66
+ onLoadProcessing: autoOnLoadProcessing ? onLoadProcessing : {},
67
+ }));
70
68
  setCorrelation(draft, correlations);
71
69
  if (parseMetaFileResult) {
72
70
  const { matches } = linkMetaWithSpectra({
@@ -74,49 +72,50 @@ function setData(draft, input) {
74
72
  spectra: draft.data,
75
73
  parseMetaFileResult,
76
74
  });
77
- importSpectraMetaInfo(draft, { payload: { spectraMeta: matches } });
75
+ setSpectraMetaInfo(draft, matches);
78
76
  }
79
77
  }
80
- function convertHybridizationStringValuesInCorrelations(correlations) {
81
- return {
82
- ...correlations,
83
- values: correlations.values.map((correlation) => {
84
- if (typeof correlation.hybridization === 'string') {
85
- let values = [];
86
- if (correlation.hybridization.length > 0) {
87
- const hybridizationString = correlation.hybridization.replaceAll('SP', '');
88
- const value = Number(hybridizationString);
89
- values.push(value);
90
- }
91
- correlation.hybridization = values;
92
- }
93
- return correlation;
94
- }),
95
- };
78
+ function initSpectra(inputSpectra, options) {
79
+ const spectra = [];
80
+ const { usedColors, onLoadProcessing } = options;
81
+ for (const spectrum of inputSpectra) {
82
+ const { info } = spectrum;
83
+ if (info.dimension === 1) {
84
+ const filters = onLoadProcessing?.[nucleusToString(info.nucleus)] || [];
85
+ spectra.push(initiateDatum1D(spectrum, { usedColors, filters }));
86
+ }
87
+ else if (info.dimension === 2) {
88
+ spectra.push(initiateDatum2D({ ...spectrum }, { usedColors }));
89
+ }
90
+ }
91
+ return spectra;
96
92
  }
97
93
  function setPreferences(draft, data) {
98
94
  const emptyPreferences = {
99
95
  verticalAlign: null,
100
96
  };
101
97
  const { verticalAlign = null } = data || emptyPreferences;
102
- if (verticalAlign) {
98
+ const vAlign = verticalAlign?.[draft.view.spectra.activeTab];
99
+ if (vAlign) {
103
100
  changeSpectrumVerticalAlignment(draft, {
104
- verticalAlign,
101
+ verticalAlign: vAlign,
105
102
  });
106
103
  }
107
104
  else {
108
105
  changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
109
106
  }
110
107
  }
111
- function initData(draft, action, forceInitialize = false) {
112
- const { data, view } = action.payload;
108
+ function initData(draft, action, options = {}) {
109
+ const { forceInitialize = false, autoOnLoadProcessing = true } = options;
110
+ const { nmriumState: { data, view }, } = action.payload;
111
+ const viewState = view;
113
112
  if (data?.spectra?.length || forceInitialize) {
114
113
  const state = getInitialState();
115
- setData(state, action.payload);
116
- setActiveTab(state, { tab: data?.view?.activeTab || '' });
114
+ setData(state, action.payload, { autoOnLoadProcessing });
115
+ setActiveTab(state, { tab: viewState?.spectra?.activeTab || '' });
117
116
  state.width = draft.width;
118
117
  state.height = draft.height;
119
- setPreferences(state, data?.view);
118
+ setPreferences(state, viewState);
120
119
  state.isLoading = false;
121
120
  state.actionType = action.type;
122
121
  return state;
@@ -130,14 +129,23 @@ function initData(draft, action, forceInitialize = false) {
130
129
  draft.isLoading = false;
131
130
  }
132
131
  }
133
- function initiate(draft, action) {
134
- return initData(draft, action, true);
132
+ //action
133
+ function handleSetIsLoading(draft, action) {
134
+ draft.isLoading = action.payload.isLoading;
135
+ }
136
+ //action
137
+ function handleInitiate(draft, action) {
138
+ return initData(draft, action, {
139
+ forceInitialize: true,
140
+ autoOnLoadProcessing: false,
141
+ });
135
142
  }
136
- function loadDropFiles(draft, action) {
143
+ //action
144
+ function handleLoadDropFiles(draft, action) {
137
145
  const { payload, type } = action;
138
- const { data: { spectra = [] }, containsNmrium = false, resetSourceObject = true, } = payload;
146
+ const { nmriumState: { data: { spectra = [] } = {} }, containsNmrium = false, resetSourceObject = true, } = payload;
139
147
  if (containsNmrium) {
140
- return initData(draft, action);
148
+ return initData(draft, action, { autoOnLoadProcessing: false });
141
149
  }
142
150
  else {
143
151
  setData(draft, payload);
@@ -151,4 +159,4 @@ function loadDropFiles(draft, action) {
151
159
  draft.isLoading = false;
152
160
  }
153
161
  }
154
- export { setIsLoading, initSpectra, initiate, loadDropFiles };
162
+ export { handleSetIsLoading, initSpectra, handleInitiate, handleLoadDropFiles };
@@ -1,11 +1,40 @@
1
1
  import { Draft } from 'immer';
2
+ import { PredictedSpectraResult, PredictionOptions } from '../../../data/PredictionManager';
3
+ import { MoleculeBoundingRect, StateMolecule } from '../../../data/molecules/Molecule';
4
+ import { AssignmentContext } from '../../assignment/AssignmentsContext';
2
5
  import { State } from '../Reducer';
3
- declare function addMoleculeHandler(draft: Draft<State>, molfile: any): void;
4
- declare function setMoleculeHandler(draft: Draft<State>, action: any): void;
5
- declare function deleteMoleculeHandler(draft: Draft<State>, action: any): void;
6
- declare function predictSpectraFromMoleculeHandler(draft: Draft<State>, action: any): void;
7
- declare function floatMoleculeOverSpectrum(draft: Draft<State>, action: any): void;
8
- declare function toggleMoleculeAtomsNumbers(draft: Draft<State>, action: any): void;
9
- declare function changeFloatMoleculePosition(draft: Draft<State>, action: any): void;
10
- declare function changeMoleculeLabel(draft: Draft<State>, action: any): void;
11
- export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeFloatMoleculePosition, changeMoleculeLabel, toggleMoleculeAtomsNumbers, };
6
+ import { ActionType } from '../types/ActionType';
7
+ type AddMoleculeAction = ActionType<'ADD_MOLECULE', {
8
+ molfile: string;
9
+ }>;
10
+ type SetMoleculeAction = ActionType<'SET_MOLECULE', Required<StateMolecule>>;
11
+ type DeleteMoleculeAction = ActionType<'DELETE_MOLECULE', {
12
+ id: string;
13
+ assignmentData: AssignmentContext;
14
+ }>;
15
+ type PredictSpectraFromMoleculeAction = ActionType<'PREDICT_SPECTRA', {
16
+ molfile: string;
17
+ options: PredictionOptions;
18
+ predictedSpectra?: PredictedSpectraResult;
19
+ }>;
20
+ type ToggleMoleculeViewObjectAction = ActionType<'FLOAT_MOLECULE_OVER_SPECTRUM' | 'TOGGLE_MOLECULE_ATOM_NUMBER', {
21
+ id: string;
22
+ }>;
23
+ type ChangeFloatMoleculePositionAction = ActionType<'CHANGE_FLOAT_MOLECULE_POSITION', {
24
+ id: string;
25
+ bounding: MoleculeBoundingRect;
26
+ }>;
27
+ type ChangeMoleculeLabelAction = ActionType<'CHANGE_MOLECULE_LABEL', {
28
+ id: string;
29
+ label: string;
30
+ }>;
31
+ export type MoleculeActions = AddMoleculeAction | SetMoleculeAction | DeleteMoleculeAction | PredictSpectraFromMoleculeAction | ToggleMoleculeViewObjectAction | ChangeFloatMoleculePositionAction | ChangeMoleculeLabelAction;
32
+ declare function handleAddMolecule(draft: Draft<State>, action: AddMoleculeAction): void;
33
+ declare function handleSetMolecule(draft: Draft<State>, action: SetMoleculeAction): void;
34
+ declare function handleDeleteMolecule(draft: Draft<State>, action: DeleteMoleculeAction): void;
35
+ declare function handlePredictSpectraFromMolecule(draft: Draft<State>, action: PredictSpectraFromMoleculeAction): void;
36
+ declare function handleFloatMoleculeOverSpectrum(draft: Draft<State>, action: ToggleMoleculeViewObjectAction): void;
37
+ declare function handleToggleMoleculeAtomsNumbers(draft: Draft<State>, action: ToggleMoleculeViewObjectAction): void;
38
+ declare function handleChangeFloatMoleculePosition(draft: Draft<State>, action: ChangeFloatMoleculePositionAction): void;
39
+ declare function handleChangeMoleculeLabel(draft: Draft<State>, action: ChangeMoleculeLabelAction): void;
40
+ export { handleAddMolecule, handleSetMolecule, handleDeleteMolecule, handlePredictSpectraFromMolecule, handleFloatMoleculeOverSpectrum, handleToggleMoleculeAtomsNumbers, handleChangeFloatMoleculePosition, handleChangeMoleculeLabel, };
@@ -1,14 +1,16 @@
1
- import { generateSpectra } from '../../../data/PredictionManager';
1
+ import { generateSpectra, } from '../../../data/PredictionManager';
2
2
  import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager';
3
- import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT } from '../../../data/molecules/Molecule';
3
+ import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT, } from '../../../data/molecules/Molecule';
4
4
  import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
5
5
  import { generateColor } from '../../../data/utilities/generateColor';
6
6
  import nucleusToString from '../../utility/nucleusToString';
7
- import { DISPLAYER_MODE } from '../core/Constants';
8
- import { handleUnlinkRange } from './RangesActions';
7
+ import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
8
+ import { unlinkRange } from './RangesActions';
9
9
  import { setActiveTab } from './ToolsActions';
10
- import { handleUnlinkZone } from './ZonesActions';
11
- function addMoleculeHandler(draft, molfile) {
10
+ import { unlinkZone } from './ZonesActions';
11
+ //action
12
+ function handleAddMolecule(draft, action) {
13
+ const { molfile } = action.payload;
12
14
  const isEmpty = draft.molecules.length === 0;
13
15
  MoleculeManager.addMolfile(draft.molecules, molfile);
14
16
  /**
@@ -20,7 +22,8 @@ function addMoleculeHandler(draft, molfile) {
20
22
  changeSpectraRelativeSum(draft, molecule.id, molecule);
21
23
  }
22
24
  }
23
- function setMoleculeHandler(draft, action) {
25
+ //action
26
+ function handleSetMolecule(draft, action) {
24
27
  const { id, label, molfile } = action.payload;
25
28
  MoleculeManager.setMolfile(draft.molecules, {
26
29
  id,
@@ -35,13 +38,14 @@ function setMoleculeHandler(draft, action) {
35
38
  }
36
39
  function removeAssignments(draft, assignmentData) {
37
40
  if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
38
- handleUnlinkRange(draft, { payload: { assignmentData, rangeData: null } });
41
+ unlinkRange(draft, { assignmentData });
39
42
  }
40
43
  if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
41
- handleUnlinkZone(draft, { payload: { assignmentData, zoneData: null } });
44
+ unlinkZone(draft, { assignmentData });
42
45
  }
43
46
  }
44
- function deleteMoleculeHandler(draft, action) {
47
+ //action
48
+ function handleDeleteMolecule(draft, action) {
45
49
  const { id, assignmentData } = action.payload;
46
50
  // remove Assignments links of the active spectrum
47
51
  removeAssignments(draft, assignmentData);
@@ -56,14 +60,15 @@ function deleteMoleculeHandler(draft, action) {
56
60
  */
57
61
  changeSpectraRelativeSum(draft, id, draft.molecules[0] || null);
58
62
  }
59
- function predictSpectraFromMoleculeHandler(draft, action) {
60
- const { data, options } = action.payload;
61
- if (!data) {
63
+ //action
64
+ function handlePredictSpectraFromMolecule(draft, action) {
65
+ const { predictedSpectra, options } = action.payload;
66
+ if (!predictedSpectra) {
62
67
  draft.isLoading = false;
63
68
  }
64
69
  else {
65
70
  const color = generateColor(false, draft.usedColors['1d']);
66
- for (const spectrum of generateSpectra(data, options, color)) {
71
+ for (const spectrum of generateSpectra(predictedSpectra, options, color)) {
67
72
  draft.data.push(spectrum);
68
73
  draft.view.spectra.activeSpectra[nucleusToString(spectrum.info.nucleus)] =
69
74
  [
@@ -82,10 +87,14 @@ function predictSpectraFromMoleculeHandler(draft, action) {
82
87
  function initMoleculeViewProperties(id, draft) {
83
88
  // check if the molecule is exists in the view object otherwise add it with the default value
84
89
  if (!draft.view.molecules[id]) {
90
+ const position = getFloatingMoleculeInitialPosition(id, draft);
85
91
  draft.view.molecules[id] = {
86
92
  floating: {
87
93
  visible: false,
88
- bounding: DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT,
94
+ bounding: {
95
+ ...DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT,
96
+ ...position,
97
+ },
89
98
  },
90
99
  showAtomNumber: false,
91
100
  };
@@ -94,7 +103,28 @@ function initMoleculeViewProperties(id, draft) {
94
103
  function getMoleculeViewObject(id, draft) {
95
104
  return draft.view.molecules[id] || null;
96
105
  }
97
- function floatMoleculeOverSpectrum(draft, action) {
106
+ function getFloatingMoleculeInitialPosition(id, draft) {
107
+ const { view: { molecules }, width: displayerWidth, height: displayerHeight, } = draft;
108
+ const { top, left } = MARGIN['2D'];
109
+ const { width: baseWidth, height: baseHeight } = DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT;
110
+ const width = displayerWidth - left;
111
+ const height = displayerHeight - top;
112
+ const columns = Math.floor(width / baseWidth);
113
+ const rows = Math.floor(height / baseHeight);
114
+ const moleculeKeys = Object.keys(molecules);
115
+ let index = 0;
116
+ if (!molecules[id]) {
117
+ index = moleculeKeys.length - 1;
118
+ }
119
+ else {
120
+ index = moleculeKeys.indexOf(id);
121
+ }
122
+ const x = ((index + 1) % columns) * (width / columns) + left;
123
+ const y = Math.floor(moleculeKeys.length / columns) * (height / rows) + top;
124
+ return { x, y };
125
+ }
126
+ //action
127
+ function handleFloatMoleculeOverSpectrum(draft, action) {
98
128
  const { id } = action.payload;
99
129
  initMoleculeViewProperties(id, draft);
100
130
  const molecule = getMoleculeViewObject(id, draft);
@@ -102,7 +132,8 @@ function floatMoleculeOverSpectrum(draft, action) {
102
132
  molecule.floating.visible = !molecule.floating.visible;
103
133
  }
104
134
  }
105
- function toggleMoleculeAtomsNumbers(draft, action) {
135
+ //action
136
+ function handleToggleMoleculeAtomsNumbers(draft, action) {
106
137
  const { id } = action.payload;
107
138
  initMoleculeViewProperties(id, draft);
108
139
  const molecule = getMoleculeViewObject(id, draft);
@@ -110,7 +141,8 @@ function toggleMoleculeAtomsNumbers(draft, action) {
110
141
  molecule.showAtomNumber = !molecule.showAtomNumber;
111
142
  }
112
143
  }
113
- function changeFloatMoleculePosition(draft, action) {
144
+ //action
145
+ function handleChangeFloatMoleculePosition(draft, action) {
114
146
  const { id, bounding } = action.payload;
115
147
  const molecule = getMoleculeViewObject(id, draft);
116
148
  if (molecule) {
@@ -120,9 +152,10 @@ function changeFloatMoleculePosition(draft, action) {
120
152
  throw new Error(`Molecule ${id} does not exist`);
121
153
  }
122
154
  }
123
- function changeMoleculeLabel(draft, action) {
155
+ //action
156
+ function handleChangeMoleculeLabel(draft, action) {
124
157
  const { id, label } = action.payload;
125
158
  const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
126
159
  draft.molecules[moleculeIndex].label = label;
127
160
  }
128
- export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeFloatMoleculePosition, changeMoleculeLabel, toggleMoleculeAtomsNumbers, };
161
+ export { handleAddMolecule, handleSetMolecule, handleDeleteMolecule, handlePredictSpectraFromMolecule, handleFloatMoleculeOverSpectrum, handleToggleMoleculeAtomsNumbers, handleChangeFloatMoleculePosition, handleChangeMoleculeLabel, };
@@ -1,10 +1,41 @@
1
1
  import { Draft } from 'immer';
2
+ import { Peak1D } from 'nmr-load-save';
3
+ import { OptionsXYAutoPeaksPicking } from 'nmr-processing';
4
+ import { defaultPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
2
5
  import { State } from '../Reducer';
3
- declare function addPeak(draft: Draft<State>, mouseCoordinates: any): void;
4
- declare function addPeaks(draft: Draft<State>, action: any): void;
5
- declare function deletePeak(draft: Draft<State>, peakData: any): void;
6
- declare function handleOptimizePeaks(draft: Draft<State>, action: any): void;
7
- declare function handleAutoPeakPicking(draft: Draft<State>, action: any): void;
8
- declare function changePeakShapeHandler(draft: Draft<State>, action: any): void;
9
- declare function handleTogglePeaksViewProperty(draft: Draft<State>, action: any): void;
10
- export { addPeak, addPeaks, deletePeak, handleAutoPeakPicking, handleOptimizePeaks, changePeakShapeHandler, handleTogglePeaksViewProperty, };
6
+ import { ActionType } from '../types/ActionType';
7
+ type AddPeakAction = ActionType<'ADD_PEAK', {
8
+ x: number;
9
+ }>;
10
+ type AddPeaksAction = ActionType<'ADD_PEAKS', {
11
+ startX: number;
12
+ endX: number;
13
+ }>;
14
+ type DeletePeakAction = ActionType<'DELETE_PEAK', {
15
+ id?: string;
16
+ }>;
17
+ type OptimizePeaksAction = ActionType<'OPTIMIZE_PEAKS', {
18
+ peaks: Peak1D[];
19
+ }>;
20
+ type AutoPeaksPickingAction = ActionType<'AUTO_PEAK_PICKING', {
21
+ maxNumberOfPeaks: number;
22
+ minMaxRatio: number;
23
+ noiseFactor: number;
24
+ direction: OptionsXYAutoPeaksPicking['direction'];
25
+ }>;
26
+ type ChangePeaksShapeAction = ActionType<'CHANGE_PEAK_SHAPE', {
27
+ id: string;
28
+ shape: Peak1D['shape'];
29
+ }>;
30
+ type TogglePeaksViewAction = ActionType<'TOGGLE_PEAKS_VIEW_PROPERTY', {
31
+ key: keyof typeof defaultPeaksViewState;
32
+ }>;
33
+ export type PeaksActions = AddPeakAction | AddPeaksAction | DeletePeakAction | OptimizePeaksAction | AutoPeaksPickingAction | ChangePeaksShapeAction | TogglePeaksViewAction;
34
+ declare function handleAddPeak(draft: Draft<State>, action: AddPeakAction): void;
35
+ declare function handleAddPeaks(draft: Draft<State>, action: AddPeaksAction): void;
36
+ declare function handleDeletePeak(draft: Draft<State>, action: DeletePeakAction): void;
37
+ declare function handleOptimizePeaks(draft: Draft<State>, action: OptimizePeaksAction): void;
38
+ declare function handleAutoPeakPicking(draft: Draft<State>, action: AutoPeaksPickingAction): void;
39
+ declare function handleChangePeakShape(draft: Draft<State>, action: ChangePeaksShapeAction): void;
40
+ declare function handleTogglePeaksViewProperty(draft: Draft<State>, action: TogglePeaksViewAction): void;
41
+ export { handleAddPeak, handleAddPeaks, handleDeletePeak, handleAutoPeakPicking, handleOptimizePeaks, handleChangePeakShape, handleTogglePeaksViewProperty, };