nmrium 0.37.0 → 0.38.1

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 (374) 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/database/DatabaseSpectrum.js +2 -1
  4. package/lib/component/1d/integral/Integral.d.ts +2 -6
  5. package/lib/component/1d/integral/IntegralResizable.d.ts +2 -6
  6. package/lib/component/1d/integral/IntegralResizable.js +2 -3
  7. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  8. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
  9. package/lib/component/1d/peaks/PeakAnnotation.js +1 -2
  10. package/lib/component/1d/ranges/Range.js +9 -8
  11. package/lib/component/1d/ranges/Ranges.js +5 -7
  12. package/lib/component/1d/tool/BaseLineZones.js +1 -2
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
  14. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
  15. package/lib/component/2d/1d-tracer/Left1DChart.js +1 -1
  16. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
  17. package/lib/component/2d/Chart2D.js +1 -1
  18. package/lib/component/2d/Viewer2D.js +10 -9
  19. package/lib/component/2d/fid/FidCanvas.js +4 -6
  20. package/lib/component/2d/ft/Contours.js +1 -1
  21. package/lib/component/2d/utilities/DimensionLayout.d.ts +9 -24
  22. package/lib/component/2d/utilities/scale.d.ts +2 -1
  23. package/lib/component/2d/utilities/scale.js +1 -1
  24. package/lib/component/2d/zones/Zones.js +1 -1
  25. package/lib/component/EventsTrackers/KeysListenerTracker.js +28 -21
  26. package/lib/component/NMRium.js +15 -7
  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/formik/FormikCheckBox.js +1 -1
  35. package/lib/component/elements/formik/FormikColorInput.js +1 -1
  36. package/lib/component/elements/formik/FormikColorPicker.js +1 -1
  37. package/lib/component/elements/formik/FormikColumnFormatField.js +1 -1
  38. package/lib/component/elements/formik/FormikInput.js +1 -1
  39. package/lib/component/elements/formik/FormikSelect.js +2 -2
  40. package/lib/component/elements/formik/FormikSlider.js +1 -1
  41. package/lib/component/elements/formik/FormikTextarea.js +2 -2
  42. package/lib/component/header/ApodizationOptionsPanel.js +4 -5
  43. package/lib/component/header/AutoPeakPickingOptionPanel.js +1 -2
  44. package/lib/component/header/BaseLineCorrectionPanel.js +4 -5
  45. package/lib/component/header/Header.js +4 -6
  46. package/lib/component/header/PhaseCorrectionPanel.js +7 -8
  47. package/lib/component/header/RangesPickingOptionPanel.js +1 -2
  48. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -11
  49. package/lib/component/header/Zones2DOptionPanel.js +5 -6
  50. package/lib/component/hooks/useExport.js +1 -0
  51. package/lib/component/hooks/useToolsFunctions.js +8 -10
  52. package/lib/component/loader/DropZone.js +4 -5
  53. package/lib/component/loader/NoData.js +1 -1
  54. package/lib/component/modal/AlignSpectraModal.js +1 -2
  55. package/lib/component/modal/EditPeakShapeModal.js +1 -2
  56. package/lib/component/modal/ImportPublicationStringModal.js +1 -2
  57. package/lib/component/modal/LoadJCAMPModal.js +2 -3
  58. package/lib/component/modal/MoleculeStructureEditorModal.js +24 -19
  59. package/lib/component/modal/PredictSpectraModal.d.ts +1 -1
  60. package/lib/component/modal/PredictSpectraModal.js +24 -21
  61. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  62. package/lib/component/modal/editRange/EditRangeModal.js +3 -4
  63. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
  64. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
  65. package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -3
  66. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
  67. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
  68. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
  69. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  70. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
  71. package/lib/component/panels/InformationPanel.js +6 -6
  72. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
  73. package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -10
  74. package/lib/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
  75. package/lib/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
  76. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
  77. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
  78. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
  79. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +5 -6
  80. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +4 -1
  81. package/lib/component/panels/MoleculesPanel/Utilities.js +2 -2
  82. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  83. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
  84. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
  85. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  86. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
  87. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
  88. package/lib/component/panels/Panels.js +1 -1
  89. package/lib/component/panels/PeaksPanel/PeaksPanel.js +4 -5
  90. package/lib/component/panels/PeaksPanel/PeaksTable.js +4 -5
  91. package/lib/component/panels/RangesPanel/RangesHeader.js +12 -15
  92. package/lib/component/panels/RangesPanel/RangesPanel.js +24 -29
  93. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
  94. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
  95. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
  96. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
  97. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
  98. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
  99. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
  100. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
  101. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
  102. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
  103. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  104. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
  105. package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -34
  106. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  107. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +2 -13
  108. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
  109. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -2
  110. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  111. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +2 -2
  112. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
  113. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
  114. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +2 -2
  115. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
  116. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +2 -2
  117. package/lib/component/panels/ZonesPanel/ZonesPanel.js +15 -18
  118. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -51
  119. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +3 -3
  120. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +16 -0
  121. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +52 -0
  122. package/lib/component/panels/databasePanel/DatabasePanel.js +15 -11
  123. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -2
  124. package/lib/component/panels/filtersPanel/FiltersTable.js +8 -9
  125. package/lib/component/panels/header/DefaultPanelHeader.js +1 -1
  126. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
  127. package/lib/component/panels/predictionPanel/PredictionPanel.js +4 -5
  128. package/lib/component/reducer/IgnoreActions.d.ts +2 -1
  129. package/lib/component/reducer/IgnoreActions.js +35 -32
  130. package/lib/component/reducer/Reducer.d.ts +8 -5
  131. package/lib/component/reducer/Reducer.js +202 -220
  132. package/lib/component/reducer/actions/AssignmentsActions.d.ts +7 -6
  133. package/lib/component/reducer/actions/AssignmentsActions.js +2 -2
  134. package/lib/component/reducer/actions/CorrelationsActions.d.ts +21 -13
  135. package/lib/component/reducer/actions/CorrelationsActions.js +25 -20
  136. package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -2
  137. package/lib/component/reducer/actions/DatabaseActions.js +5 -2
  138. package/lib/component/reducer/actions/DimensionsActions.d.ts +8 -3
  139. package/lib/component/reducer/actions/DimensionsActions.js +3 -5
  140. package/lib/component/reducer/actions/DomainActions.d.ts +11 -5
  141. package/lib/component/reducer/actions/DomainActions.js +13 -19
  142. package/lib/component/reducer/actions/FiltersActions.d.ts +70 -23
  143. package/lib/component/reducer/actions/FiltersActions.js +250 -255
  144. package/lib/component/reducer/actions/GlobalActions.d.ts +7 -2
  145. package/lib/component/reducer/actions/GlobalActions.js +3 -3
  146. package/lib/component/reducer/actions/IntegralsActions.d.ts +28 -7
  147. package/lib/component/reducer/actions/IntegralsActions.js +16 -15
  148. package/lib/component/reducer/actions/LoadActions.d.ts +23 -5
  149. package/lib/component/reducer/actions/LoadActions.js +52 -52
  150. package/lib/component/reducer/actions/MoleculeActions.d.ts +38 -9
  151. package/lib/component/reducer/actions/MoleculeActions.js +27 -18
  152. package/lib/component/reducer/actions/PeaksActions.d.ts +39 -8
  153. package/lib/component/reducer/actions/PeaksActions.js +19 -11
  154. package/lib/component/reducer/actions/PreferencesActions.d.ts +8 -3
  155. package/lib/component/reducer/actions/PreferencesActions.js +5 -3
  156. package/lib/component/reducer/actions/RangesActions.d.ts +85 -18
  157. package/lib/component/reducer/actions/RangesActions.js +80 -65
  158. package/lib/component/reducer/actions/SpectraAnalysisAction.d.ts +7 -1
  159. package/lib/component/reducer/actions/SpectrumsActions.d.ts +57 -24
  160. package/lib/component/reducer/actions/SpectrumsActions.js +69 -60
  161. package/lib/component/reducer/actions/ToolsActions.d.ts +59 -21
  162. package/lib/component/reducer/actions/ToolsActions.js +54 -32
  163. package/lib/component/reducer/actions/ZonesActions.d.ts +79 -15
  164. package/lib/component/reducer/actions/ZonesActions.js +68 -49
  165. package/lib/component/reducer/helper/Zoom1DManager.d.ts +6 -5
  166. package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
  167. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -2
  168. package/lib/component/reducer/helper/get2DRange.d.ts +7 -1
  169. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  170. package/lib/component/reducer/types/ActionType.d.ts +6 -0
  171. package/lib/component/reducer/types/ActionType.js +1 -0
  172. package/lib/component/toolbar/BasicToolBar.js +6 -9
  173. package/lib/component/toolbar/FunctionToolBar.js +4 -9
  174. package/lib/component/toolbar/ToolBar.js +1 -1
  175. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  176. package/lib/component/utility/Events.d.ts +4 -4
  177. package/lib/component/utility/Events.js +2 -2
  178. package/lib/component/utility/GroupByInfoKey.js +1 -1
  179. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  180. package/lib/data/PredictionManager.d.ts +7 -9
  181. package/lib/data/PredictionManager.js +3 -3
  182. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
  183. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  184. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.d.ts +2 -3
  185. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
  186. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +5 -3
  187. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -35
  188. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +2 -35
  189. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +7 -10
  190. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  191. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  192. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts +5 -1
  193. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
  194. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -0
  195. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -0
  196. package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +2 -0
  197. package/lib/data/matrixGeneration.js +4 -2
  198. package/lib/data/molecules/Molecule.d.ts +3 -3
  199. package/lib/data/molecules/MoleculeManager.d.ts +5 -5
  200. package/lib/data/molecules/MoleculeManager.js +1 -1
  201. package/lib/data/utilities/generateColor.js +1 -1
  202. package/lib/data/utilities/isNumber.d.ts +1 -0
  203. package/lib/data/utilities/isNumber.js +3 -0
  204. package/lib/versionInfo.js +1 -1
  205. package/lib-cjs/component/1d/FooterBanner.js +1 -1
  206. package/lib-cjs/component/1d/Viewer1D.js +25 -20
  207. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
  208. package/lib-cjs/component/1d/integral/IntegralResizable.js +2 -3
  209. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  210. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
  211. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -2
  212. package/lib-cjs/component/1d/ranges/Range.js +9 -8
  213. package/lib-cjs/component/1d/ranges/Ranges.js +5 -7
  214. package/lib-cjs/component/1d/tool/BaseLineZones.js +1 -2
  215. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
  216. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
  217. package/lib-cjs/component/2d/1d-tracer/Left1DChart.js +1 -1
  218. package/lib-cjs/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
  219. package/lib-cjs/component/2d/Chart2D.js +1 -1
  220. package/lib-cjs/component/2d/Viewer2D.js +10 -9
  221. package/lib-cjs/component/2d/fid/FidCanvas.js +4 -6
  222. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  223. package/lib-cjs/component/2d/utilities/scale.js +1 -1
  224. package/lib-cjs/component/2d/zones/Zones.js +1 -1
  225. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +28 -21
  226. package/lib-cjs/component/NMRium.js +15 -7
  227. package/lib-cjs/component/context/DispatchContext.js +1 -1
  228. package/lib-cjs/component/context/LoggerContext.js +1 -1
  229. package/lib-cjs/component/elements/Button.js +7 -9
  230. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  231. package/lib-cjs/component/elements/ReactTable/ReactTable.js +1 -2
  232. package/lib-cjs/component/elements/Tab/Tabs.js +1 -1
  233. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  234. package/lib-cjs/component/elements/formik/FormikColorInput.js +1 -1
  235. package/lib-cjs/component/elements/formik/FormikColorPicker.js +1 -1
  236. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +1 -1
  237. package/lib-cjs/component/elements/formik/FormikInput.js +1 -1
  238. package/lib-cjs/component/elements/formik/FormikSelect.js +2 -2
  239. package/lib-cjs/component/elements/formik/FormikSlider.js +1 -1
  240. package/lib-cjs/component/elements/formik/FormikTextarea.js +2 -2
  241. package/lib-cjs/component/header/ApodizationOptionsPanel.js +3 -4
  242. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +1 -2
  243. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +4 -5
  244. package/lib-cjs/component/header/Header.js +4 -6
  245. package/lib-cjs/component/header/PhaseCorrectionPanel.js +7 -8
  246. package/lib-cjs/component/header/RangesPickingOptionPanel.js +1 -2
  247. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -11
  248. package/lib-cjs/component/header/Zones2DOptionPanel.js +5 -6
  249. package/lib-cjs/component/highlight/index.js +1 -1
  250. package/lib-cjs/component/hooks/useExport.js +1 -0
  251. package/lib-cjs/component/hooks/useTableSortBy.js +1 -1
  252. package/lib-cjs/component/hooks/useToolsFunctions.js +8 -10
  253. package/lib-cjs/component/hooks/useXYReduce.js +1 -1
  254. package/lib-cjs/component/loader/DropZone.js +4 -5
  255. package/lib-cjs/component/loader/NoData.js +1 -1
  256. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
  257. package/lib-cjs/component/modal/EditPeakShapeModal.js +1 -2
  258. package/lib-cjs/component/modal/ImportPublicationStringModal.js +1 -2
  259. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -3
  260. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -19
  261. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -21
  262. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  263. package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -4
  264. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
  265. package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
  266. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +2 -3
  267. package/lib-cjs/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
  268. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
  269. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
  270. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  271. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
  272. package/lib-cjs/component/panels/InformationPanel.js +6 -6
  273. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
  274. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -10
  275. package/lib-cjs/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
  276. package/lib-cjs/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
  277. package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
  278. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
  279. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
  280. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +5 -6
  281. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +2 -2
  282. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  283. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
  284. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
  285. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  286. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
  287. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
  288. package/lib-cjs/component/panels/Panels.js +1 -1
  289. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -5
  290. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +4 -5
  291. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +12 -15
  292. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +24 -29
  293. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
  294. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
  295. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
  296. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
  297. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
  298. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
  299. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
  300. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
  301. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
  302. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  303. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
  304. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +39 -34
  305. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  306. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
  307. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  308. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
  309. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
  310. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +15 -18
  311. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +2 -51
  312. package/lib-cjs/component/panels/ZonesPanel/hooks/useMapZones.js +56 -0
  313. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +14 -10
  314. package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -2
  315. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +8 -9
  316. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -1
  317. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
  318. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +4 -5
  319. package/lib-cjs/component/reducer/IgnoreActions.js +35 -55
  320. package/lib-cjs/component/reducer/Reducer.js +202 -220
  321. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +3 -3
  322. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +23 -18
  323. package/lib-cjs/component/reducer/actions/DatabaseActions.js +4 -1
  324. package/lib-cjs/component/reducer/actions/DimensionsActions.js +3 -6
  325. package/lib-cjs/component/reducer/actions/DomainActions.js +15 -23
  326. package/lib-cjs/component/reducer/actions/FiltersActions.js +267 -272
  327. package/lib-cjs/component/reducer/actions/GlobalActions.js +4 -4
  328. package/lib-cjs/component/reducer/actions/IntegralsActions.js +19 -18
  329. package/lib-cjs/component/reducer/actions/LoadActions.js +55 -55
  330. package/lib-cjs/component/reducer/actions/MoleculeActions.js +31 -22
  331. package/lib-cjs/component/reducer/actions/PeaksActions.js +23 -15
  332. package/lib-cjs/component/reducer/actions/PreferencesActions.js +7 -5
  333. package/lib-cjs/component/reducer/actions/RangesActions.js +81 -64
  334. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +77 -67
  335. package/lib-cjs/component/reducer/actions/ToolsActions.js +54 -31
  336. package/lib-cjs/component/reducer/actions/ZonesActions.js +73 -52
  337. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  338. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -2
  339. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -2
  340. package/lib-cjs/component/reducer/types/ActionType.js +2 -0
  341. package/lib-cjs/component/toolbar/BasicToolBar.js +6 -9
  342. package/lib-cjs/component/toolbar/FunctionToolBar.js +4 -9
  343. package/lib-cjs/component/toolbar/ToolBar.js +1 -1
  344. package/lib-cjs/component/utility/GroupByInfoKey.js +1 -1
  345. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  346. package/lib-cjs/data/PredictionManager.js +3 -3
  347. package/lib-cjs/data/SpectraManager.js +1 -1
  348. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
  349. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  350. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
  351. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +2 -2
  352. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  353. package/lib-cjs/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
  354. package/lib-cjs/data/matrixGeneration.js +4 -2
  355. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  356. package/lib-cjs/data/utilities/generateColor.js +1 -1
  357. package/lib-cjs/data/utilities/isNumber.js +7 -0
  358. package/lib-cjs/versionInfo.js +1 -1
  359. package/package.json +24 -23
  360. package/lib/component/reducer/actions/HistoryActions.d.ts +0 -4
  361. package/lib/component/reducer/actions/HistoryActions.js +0 -40
  362. package/lib/component/reducer/types/HistoryTypes.d.ts +0 -4
  363. package/lib/component/reducer/types/HistoryTypes.js +0 -4
  364. package/lib/component/reducer/types/Types.d.ts +0 -132
  365. package/lib/component/reducer/types/Types.js +0 -126
  366. package/lib/component/toolbar/HistoryToolBar.d.ts +0 -8
  367. package/lib/component/toolbar/HistoryToolBar.js +0 -30
  368. package/lib/data/utilities/isMolFileEmpty.d.ts +0 -1
  369. package/lib/data/utilities/isMolFileEmpty.js +0 -6
  370. package/lib-cjs/component/reducer/actions/HistoryActions.js +0 -45
  371. package/lib-cjs/component/reducer/types/HistoryTypes.js +0 -7
  372. package/lib-cjs/component/reducer/types/Types.js +0 -131
  373. package/lib-cjs/component/toolbar/HistoryToolBar.js +0 -35
  374. package/lib-cjs/data/utilities/isMolFileEmpty.js +0 -10
@@ -7,8 +7,6 @@ import { useDispatch } from '../../../context/DispatchContext';
7
7
  import Select from '../../../elements/Select';
8
8
  import { useModal, positions, transitions, } from '../../../elements/popup/Modal';
9
9
  import EditZoneModal from '../../../modal/editZone/EditZoneModal';
10
- import { CHANGE_ZONE_SIGNAL_KIND, DELETE_2D_ZONE, SAVE_EDITED_ZONE, SET_SELECTED_TOOL, SET_X_DOMAIN, SET_Y_DOMAIN, } from '../../../reducer/types/Types';
11
- import { options } from '../../../toolbar/ToolTypes';
12
10
  const selectBoxStyle = {
13
11
  marginLeft: 2,
14
12
  marginRight: 2,
@@ -19,18 +17,18 @@ function ActionsColumn({ rowData, rowSpanTags }) {
19
17
  const dispatch = useDispatch();
20
18
  const assignmentData = useAssignmentData();
21
19
  const modal = useModal();
22
- const changeSignalKindHandler = useCallback((value) => {
20
+ const changeSignalKindHandler = useCallback((kind) => {
23
21
  dispatch({
24
- type: CHANGE_ZONE_SIGNAL_KIND,
22
+ type: 'CHANGE_ZONE_SIGNAL_KIND',
25
23
  payload: {
26
- rowData,
27
- value,
24
+ zoneData: rowData,
25
+ kind,
28
26
  },
29
27
  });
30
28
  }, [dispatch, rowData]);
31
29
  const deleteZoneHandler = useCallback(() => {
32
30
  dispatch({
33
- type: DELETE_2D_ZONE,
31
+ type: 'DELETE_2D_ZONE',
34
32
  payload: {
35
33
  id: rowData.id,
36
34
  assignmentData,
@@ -40,31 +38,35 @@ function ActionsColumn({ rowData, rowSpanTags }) {
40
38
  const zoomZoneHandler = useCallback(() => {
41
39
  const xMargin = Math.abs(rowData.x.from - rowData.x.to) * 10;
42
40
  dispatch({
43
- type: SET_X_DOMAIN,
44
- xDomain: rowData.x.from <= rowData.x.to
45
- ? [rowData.x.from - xMargin, rowData.x.to + xMargin]
46
- : [rowData.x.to - xMargin, rowData.x.from + xMargin],
41
+ type: 'SET_X_DOMAIN',
42
+ payload: {
43
+ xDomain: rowData.x.from <= rowData.x.to
44
+ ? [rowData.x.from - xMargin, rowData.x.to + xMargin]
45
+ : [rowData.x.to - xMargin, rowData.x.from + xMargin],
46
+ },
47
47
  });
48
48
  const yMargin = Math.abs(rowData.y.from - rowData.y.to) * 10;
49
49
  dispatch({
50
- type: SET_Y_DOMAIN,
51
- yDomain: rowData.y.from <= rowData.y.to
52
- ? [rowData.y.from - yMargin, rowData.y.to + yMargin]
53
- : [rowData.y.to - yMargin, rowData.y.from + yMargin],
50
+ type: 'SET_Y_DOMAIN',
51
+ payload: {
52
+ yDomain: rowData.y.from <= rowData.y.to
53
+ ? [rowData.y.from - yMargin, rowData.y.to + yMargin]
54
+ : [rowData.y.to - yMargin, rowData.y.from + yMargin],
55
+ },
54
56
  });
55
57
  }, [dispatch, rowData.x.from, rowData.x.to, rowData.y.from, rowData.y.to]);
56
- const saveEditZoneHandler = useCallback((editedRowData) => {
58
+ const saveEditZoneHandler = useCallback((zone) => {
57
59
  dispatch({
58
- type: SAVE_EDITED_ZONE,
60
+ type: 'SAVE_EDITED_ZONE',
59
61
  payload: {
60
- editedRowData,
62
+ zone,
61
63
  },
62
64
  });
63
65
  }, [dispatch]);
64
66
  const openEditZoneHandler = useCallback(() => {
65
67
  dispatch({
66
- type: SET_SELECTED_TOOL,
67
- payload: { selectedTool: options.editRange.id },
68
+ type: 'SET_SELECTED_TOOL',
69
+ payload: { selectedTool: 'editRange' },
68
70
  });
69
71
  modal.show(_jsx(EditZoneModal, { onCloseEditZoneModal: () => modal.close(), onSaveEditZoneModal: saveEditZoneHandler, onZoomEditZoneModal: () => zoomZoneHandler(), rowData: rowData }), {
70
72
  position: positions.MIDDLE_RIGHT,
@@ -1,8 +1,8 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import { AssignmentsData, Axis } from '../../../assignment/AssignmentsContext';
3
- import { RowDataProps } from './ActionsColumn';
3
+ import { ZoneData } from '../hooks/useMapZones';
4
4
  export interface SignalAssignmentsColumnProps {
5
- rowData: RowDataProps;
5
+ rowData: ZoneData;
6
6
  assignment: AssignmentsData;
7
7
  highlight: {
8
8
  isActive: any;
@@ -9,6 +9,6 @@ function SignalAssignmentsColumn({ rowData, assignment, highlight, onHover, onCl
9
9
  fontWeight: 'bold',
10
10
  }
11
11
  : {};
12
- return (_jsx("td", { ...onHover, ...{ onClick: (e) => onClick(e, assignment, axis) }, style: { padding: '0', ...tdCss }, css: !isAssignmentActive && removeAssignmentCssStyle, children: (diaIDs?.length > 0 || isAssignmentActive) && (_jsxs(_Fragment, { children: [_jsx("span", { children: diaIDs?.length || 0 }), _jsx(RemoveAssignmentsButton, { onClick: (e) => onUnlink(e, false, axis) })] })) }));
12
+ return (_jsx("td", { ...onHover, onClick: (e) => onClick(e, assignment, axis), style: { padding: '0', ...tdCss }, css: !isAssignmentActive && removeAssignmentCssStyle, children: (diaIDs?.length > 0 || isAssignmentActive) && (_jsxs(_Fragment, { children: [_jsx("span", { children: diaIDs?.length || 0 }), _jsx(RemoveAssignmentsButton, { onClick: (e) => onUnlink(e, false, axis) })] })) }));
13
13
  }
14
14
  export default SignalAssignmentsColumn;
@@ -1,7 +1,7 @@
1
1
  import { AssignmentsData, Axis } from '../../../assignment/AssignmentsContext';
2
- import { RowDataProps } from './ActionsColumn';
2
+ import { ZoneData } from '../hooks/useMapZones';
3
3
  interface SignalAssignmentsColumnsProps {
4
- rowData: RowDataProps;
4
+ rowData: ZoneData;
5
5
  onHoverSignalX: any;
6
6
  onHoverSignalY: any;
7
7
  onClick: (event: any, assignment: AssignmentsData, axis: Axis) => void;
@@ -1,6 +1,6 @@
1
- import { RowDataProps } from './ActionsColumn';
1
+ import { ZoneData } from '../hooks/useMapZones';
2
2
  interface SignalDeltaColumnProps {
3
- rowData: RowDataProps;
3
+ rowData: ZoneData;
4
4
  onHoverSignalX: any;
5
5
  onHoverSignalY: any;
6
6
  format: {
@@ -3,7 +3,6 @@ import lodashGet from 'lodash/get';
3
3
  import { Fragment, useCallback } from 'react';
4
4
  import { useDispatch } from '../../../context/DispatchContext';
5
5
  import EditableColumn from '../../../elements/EditableColumn';
6
- import { CHANGE_ZONE_SIGNAL_VALUE } from '../../../reducer/types/Types';
7
6
  import { formatNumber } from '../../../utility/formatNumber';
8
7
  function SignalDeltaColumn({ rowData, onHoverSignalX, onHoverSignalY, format, }) {
9
8
  const dispatch = useDispatch();
@@ -13,20 +12,20 @@ function SignalDeltaColumn({ rowData, onHoverSignalX, onHoverSignalY, format, })
13
12
  const saveXHandler = useCallback((event) => {
14
13
  const value = event.target.value;
15
14
  dispatch({
16
- type: CHANGE_ZONE_SIGNAL_VALUE,
15
+ type: 'CHANGE_ZONE_SIGNAL_VALUE',
17
16
  payload: {
18
- zoneID: rowData.id,
19
- signal: { id, x: value },
17
+ zoneId: rowData.id,
18
+ signal: { id, deltaX: value },
20
19
  },
21
20
  });
22
21
  }, [dispatch, id, rowData.id]);
23
22
  const saveYHandler = useCallback((event) => {
24
23
  const value = event.target.value;
25
24
  dispatch({
26
- type: CHANGE_ZONE_SIGNAL_VALUE,
25
+ type: 'CHANGE_ZONE_SIGNAL_VALUE',
27
26
  payload: {
28
- zoneID: rowData.id,
29
- signal: { id, y: value },
27
+ zoneId: rowData.id,
28
+ signal: { id, deltaY: value },
30
29
  },
31
30
  });
32
31
  }, [dispatch, id, rowData.id]);
@@ -1,9 +1,9 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import { MouseEvent } from 'react';
3
3
  import { AssignmentsData, Axis } from '../../../assignment/AssignmentsContext';
4
- import { RowDataProps } from './ActionsColumn';
4
+ import { ZoneData } from '../hooks/useMapZones';
5
5
  export interface ZoneAssignmentColumnProps {
6
- rowData: RowDataProps;
6
+ rowData: ZoneData;
7
7
  axis: any;
8
8
  onHover: () => void;
9
9
  onClick: (event: MouseEvent, assignment: AssignmentsData, axis: Axis) => void;
@@ -24,6 +24,6 @@ function ZoneAssignmentColumn({ rowData, assignment, highlight, onHover, onClick
24
24
  for (const signal of rowData?.signals || []) {
25
25
  totalNumberOfAtoms += signal?.[axis]?.nbAtoms || 0;
26
26
  }
27
- return (_jsx("td", { ...rowSpanTags, ...onHover, ...{ onClick: (e) => onClick(e, assignment, axis) }, css: !isAssignmentActive && removeAssignmentCssStyle, children: (totalNumberOfAtoms > 0 || isAssignmentActive) && (_jsxs(_Fragment, { children: [totalNumberOfAtoms, " ", ' ( ', _jsx("span", { style: getStyle(flag, false), children: diaIDs?.length || 0 }), ' ) ', _jsx(RemoveAssignmentsButton, { onClick: (e) => onUnlink(e, true, axis) })] })) }));
27
+ return (_jsx("td", { ...rowSpanTags, ...onHover, onClick: (e) => onClick(e, assignment, axis), css: !isAssignmentActive && removeAssignmentCssStyle, children: (totalNumberOfAtoms > 0 || isAssignmentActive) && (_jsxs(_Fragment, { children: [totalNumberOfAtoms, " ", ' ( ', _jsx("span", { style: getStyle(flag, false), children: diaIDs?.length || 0 }), ' ) ', _jsx(RemoveAssignmentsButton, { onClick: (e) => onUnlink(e, true, axis) })] })) }));
28
28
  }
29
29
  export default ZoneAssignmentColumn;
@@ -1,7 +1,7 @@
1
1
  import { AssignmentsData, Axis } from '../../../assignment/AssignmentsContext';
2
- import { RowDataProps } from './ActionsColumn';
2
+ import { ZoneData } from '../hooks/useMapZones';
3
3
  interface ZoneAssignmentsColumnsProps {
4
- rowData: RowDataProps;
4
+ rowData: ZoneData;
5
5
  onHoverZoneX: any;
6
6
  onHoverZoneY: any;
7
7
  onClick: (event: any, assignment: AssignmentsData, axis: Axis) => void;
@@ -11,7 +11,6 @@ import ToolTip from '../../elements/ToolTip/ToolTip';
11
11
  import { useModal } from '../../elements/popup/Modal';
12
12
  import useSpectrum from '../../hooks/useSpectrum';
13
13
  import { zoneStateInit } from '../../reducer/Reducer';
14
- import { DELETE_2D_ZONE, SHOW_ZONES, SHOW_ZONES_PEAKS, SHOW_ZONES_SIGNALS, UNLINK_ZONE, } from '../../reducer/types/Types';
15
14
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
16
15
  import NoTableData from '../extra/placeholder/NoTableData';
17
16
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
@@ -81,11 +80,11 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
81
80
  const handleOnFilter = useCallback(() => {
82
81
  setFilterIsActive(!filterIsActive);
83
82
  }, [filterIsActive]);
84
- const unlinkZoneHandler = useCallback((zoneData = null, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined) => {
83
+ const unlinkZoneHandler = useCallback((zoneData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined) => {
85
84
  dispatch({
86
- type: UNLINK_ZONE,
85
+ type: 'UNLINK_ZONE',
87
86
  payload: {
88
- zoneData,
87
+ zone: zoneData,
89
88
  assignmentData,
90
89
  isOnZoneLevel,
91
90
  signalIndex,
@@ -109,7 +108,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
109
108
  {
110
109
  text: 'Yes',
111
110
  handler: () => {
112
- dispatch({ type: DELETE_2D_ZONE, payload: { assignmentData } });
111
+ dispatch({ type: 'DELETE_2D_ZONE', payload: { assignmentData } });
113
112
  },
114
113
  },
115
114
  { text: 'No' },
@@ -124,13 +123,13 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
124
123
  setFlipStatus(false);
125
124
  }, []);
126
125
  const handleSetShowZones = () => {
127
- dispatch({ type: SHOW_ZONES, payload: { id } });
126
+ dispatch({ type: 'SHOW_ZONES', payload: { id } });
128
127
  };
129
128
  const handleSetShowSignals = () => {
130
- dispatch({ type: SHOW_ZONES_SIGNALS, payload: { id } });
129
+ dispatch({ type: 'SHOW_ZONES_SIGNALS', payload: { id } });
131
130
  };
132
131
  const handleSetShowPeaks = () => {
133
- dispatch({ type: SHOW_ZONES_PEAKS, payload: { id } });
132
+ dispatch({ type: 'SHOW_ZONES_PEAKS', payload: { id } });
134
133
  };
135
134
  return (_jsxs("div", { css: [
136
135
  tablePanelStyle,
@@ -151,14 +150,12 @@ export default function ZonesPanel() {
151
150
  const { displayerKey, xDomain, yDomain, view: { zones: zoneState, spectra: { activeTab }, }, } = useChartData();
152
151
  const { zones, info, id } = useSpectrum(emptyData);
153
152
  const zoneProps = zoneState.find((r) => r.spectrumID === id) || zoneStateInit;
154
- return (_jsx(MemoizedZonesPanel, { ...{
155
- id,
156
- xDomain,
157
- yDomain,
158
- activeTab,
159
- displayerKey,
160
- zones,
161
- experiment: info.experiment,
162
- ...zoneProps,
163
- } }));
153
+ return (_jsx(MemoizedZonesPanel, { id,
154
+ xDomain,
155
+ yDomain,
156
+ activeTab,
157
+ displayerKey,
158
+ zones,
159
+ experiment: info.experiment,
160
+ ...zoneProps }));
164
161
  }
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import { useMemo } from 'react';
5
4
  import { FaLink } from 'react-icons/fa';
6
5
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
7
6
  import useTableSortBy from '../../hooks/useTableSortBy';
8
7
  import ZonesTableRow from './ZonesTableRow';
8
+ import { useMapZones } from './hooks/useMapZones';
9
9
  const tableStyle = css `
10
10
  border-spacing: 0;
11
11
  border: 1px solid #dedede;
@@ -59,56 +59,7 @@ const tableStyle = css `
59
59
  }
60
60
  `;
61
61
  function ZonesTable({ tableData, onUnlink, nuclei, experiment, }) {
62
- const data = useMemo(() => {
63
- const data = [];
64
- for (const [i, zone] of tableData.entries()) {
65
- if (zone.signals.length === 1) {
66
- data.push({
67
- ...zone,
68
- tableMetaInfo: {
69
- ...zone.tableMetaInfo,
70
- signal: zone.signals[0],
71
- rowIndex: i,
72
- signalIndex: 0,
73
- id: zone.signals[0].id,
74
- experiment,
75
- nuclei,
76
- },
77
- });
78
- }
79
- else if (zone.signals.length > 1) {
80
- for (const [j, signal] of zone.signals.entries()) {
81
- let hide = false;
82
- let rowSpan = null;
83
- if (j < zone.signals.length - 1) {
84
- if (j === 0) {
85
- rowSpan = zone.signals.length;
86
- }
87
- else {
88
- hide = true;
89
- }
90
- }
91
- else {
92
- hide = true;
93
- }
94
- data.push({
95
- ...zone,
96
- tableMetaInfo: {
97
- ...zone.tableMetaInfo,
98
- signal,
99
- rowSpan,
100
- hide,
101
- rowIndex: i,
102
- signalIndex: j,
103
- id: signal.id,
104
- experiment,
105
- },
106
- });
107
- }
108
- }
109
- }
110
- return data;
111
- }, [experiment, nuclei, tableData]);
62
+ const data = useMapZones(tableData, { nuclei, experiment });
112
63
  const { items: sortedData, isSortedDesc, onSort } = useTableSortBy(data);
113
64
  const { deltaPPM: deltaX } = usePanelPreferences('zones', nuclei[0]);
114
65
  const { deltaPPM: deltaY } = usePanelPreferences('zones', nuclei[1]);
@@ -1,10 +1,10 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import { Axis } from '../../assignment/AssignmentsContext';
3
3
  import { ContextMenuProps } from '../../elements/ReactTable/ReactTable';
4
- import { RowDataProps } from './TableColumns/ActionsColumn';
4
+ import { ZoneData } from './hooks/useMapZones';
5
5
  interface ZonesTableRowProps extends ContextMenuProps {
6
- rowData: RowDataProps;
7
- onUnlink: (rowData: RowDataProps, isOnZoneLevel: boolean, signalIndex: any, axis: Axis) => void;
6
+ rowData: ZoneData;
7
+ onUnlink: (rowData: ZoneData, isOnZoneLevel: boolean, signalIndex: any, axis: Axis) => void;
8
8
  rowIndex: number;
9
9
  format: {
10
10
  x: string;
@@ -0,0 +1,16 @@
1
+ import { Zone } from 'nmr-load-save';
2
+ export interface ZoneData extends Zone {
3
+ tableMetaInfo: {
4
+ id: number;
5
+ signalIndex: number;
6
+ rowSpan: any;
7
+ signal: {
8
+ kind: any;
9
+ };
10
+ experiment: string;
11
+ };
12
+ }
13
+ export declare function useMapZones(data: any, info: {
14
+ experiment: string;
15
+ nuclei: string[];
16
+ }): ZoneData[];
@@ -0,0 +1,52 @@
1
+ import { useMemo } from 'react';
2
+ export function useMapZones(data, info) {
3
+ return useMemo(() => {
4
+ const zonesData = [];
5
+ for (const [i, zone] of data.entries()) {
6
+ if (zone.signals.length === 1) {
7
+ zonesData.push({
8
+ ...zone,
9
+ tableMetaInfo: {
10
+ ...zone.tableMetaInfo,
11
+ signal: zone.signals[0],
12
+ rowIndex: i,
13
+ signalIndex: 0,
14
+ id: zone.signals[0].id,
15
+ ...info,
16
+ },
17
+ });
18
+ }
19
+ else if (zone.signals.length > 1) {
20
+ for (const [j, signal] of zone.signals.entries()) {
21
+ let hide = false;
22
+ let rowSpan = null;
23
+ if (j < zone.signals.length - 1) {
24
+ if (j === 0) {
25
+ rowSpan = zone.signals.length;
26
+ }
27
+ else {
28
+ hide = true;
29
+ }
30
+ }
31
+ else {
32
+ hide = true;
33
+ }
34
+ zonesData.push({
35
+ ...zone,
36
+ tableMetaInfo: {
37
+ ...zone.tableMetaInfo,
38
+ signal,
39
+ rowSpan,
40
+ hide,
41
+ rowIndex: i,
42
+ signalIndex: j,
43
+ id: signal.id,
44
+ experiment: info.experiment,
45
+ },
46
+ });
47
+ }
48
+ }
49
+ }
50
+ return zonesData;
51
+ }, [data, info]);
52
+ }
@@ -8,7 +8,7 @@ import { BsHexagon, BsHexagonFill } from 'react-icons/bs';
8
8
  import { FaICursor } from 'react-icons/fa';
9
9
  import { IoSearchOutline } from 'react-icons/io5';
10
10
  import { useAccordionContext } from 'react-science/ui';
11
- import { mapRanges } from '../../../data/data1d/Spectrum1D';
11
+ import { isSpectrum1D, mapRanges } from '../../../data/data1d/Spectrum1D';
12
12
  import { getSum } from '../../../data/data1d/Spectrum1D/SumManager';
13
13
  import { initiateDatabase, prepareData, DATA_BASES, } from '../../../data/data1d/database';
14
14
  import { useChartData } from '../../context/ChartContext';
@@ -23,7 +23,6 @@ import { positions, transitions, useModal } from '../../elements/popup/Modal';
23
23
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
24
24
  import useToolsFunctions from '../../hooks/useToolsFunctions';
25
25
  import { DISPLAYER_MODE } from '../../reducer/core/Constants';
26
- import { RESURRECTING_SPECTRUM_FROM_JCAMP, RESURRECTING_SPECTRUM_FROM_RANGES, } from '../../reducer/types/Types';
27
26
  import { options } from '../../toolbar/ToolTypes';
28
27
  import Events from '../../utility/Events';
29
28
  import { exportAsJSON } from '../../utility/export';
@@ -189,19 +188,23 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
189
188
  return prepareData(result.data);
190
189
  }, [result.data]);
191
190
  const resurrectHandler = useCallback((rowData) => {
192
- const { index, baseURL, jcampURL: jcampRelativeURL } = rowData;
191
+ let { index, baseURL, jcampURL: jcampRelativeURL } = rowData;
193
192
  const { ranges, solvent, names = [] } = result.data[index];
194
193
  if (jcampRelativeURL) {
194
+ const url = new URL(jcampRelativeURL, baseURL);
195
195
  setTimeout(async () => {
196
196
  const hideLoading = await alert.showLoading(`load jcamp in progress...`);
197
197
  try {
198
198
  const { data } = await readFromWebSource({
199
- entries: [{ baseURL, relativePath: jcampRelativeURL }],
200
- });
201
- dispatch({
202
- type: RESURRECTING_SPECTRUM_FROM_JCAMP,
203
- payload: { ranges, spectrum: data?.spectra?.[0] || null },
199
+ entries: [{ baseURL: url.origin, relativePath: url.pathname }],
204
200
  });
201
+ const spectrum = data?.spectra?.[0] || null;
202
+ if (spectrum && isSpectrum1D(spectrum)) {
203
+ dispatch({
204
+ type: 'RESURRECTING_SPECTRUM_FROM_JCAMP',
205
+ payload: { ranges, spectrum },
206
+ });
207
+ }
205
208
  }
206
209
  catch {
207
210
  alert.error(`Failed to load Jcamp`);
@@ -213,7 +216,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
213
216
  }
214
217
  else {
215
218
  dispatch({
216
- type: RESURRECTING_SPECTRUM_FROM_RANGES,
219
+ type: 'RESURRECTING_SPECTRUM_FROM_RANGES',
217
220
  payload: { ranges, info: { solvent, nucleus, name: names[0] } },
218
221
  });
219
222
  }
@@ -307,10 +310,11 @@ function mapSolventsToSelect(solvents) {
307
310
  return result;
308
311
  }
309
312
  async function saveJcampAsJson(rowData, filteredData) {
310
- const { index, baseURL, jcampURL: jcampRelativeURL, names, ocl = {}, smiles, } = rowData;
313
+ const { index, baseURL, jcampURL, names, ocl = {}, smiles } = rowData;
311
314
  const { ranges } = filteredData.data[index];
315
+ const url = new URL(jcampURL, baseURL);
312
316
  const { data: { spectra, source } = { source: {}, spectra: [] }, version } = await readFromWebSource({
313
- entries: [{ baseURL, relativePath: jcampRelativeURL }],
317
+ entries: [{ baseURL: url.origin, relativePath: url.pathname }],
314
318
  });
315
319
  let molfile = '';
316
320
  let molecule = null;
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import { useDispatch } from '../../context/DispatchContext';
3
3
  import { useAlert } from '../../elements/popup/Alert/Context';
4
4
  import { useModal } from '../../elements/popup/Modal/Context';
5
- import { DELETE_FILTER } from '../../reducer/types/Types';
6
5
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
7
6
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
8
7
  import FiltersTable from './FiltersTable';
@@ -16,7 +15,7 @@ export default function FiltersPanel() {
16
15
  text: 'Yes',
17
16
  handler: async () => {
18
17
  const hideLoading = await alert.showLoading('Delete filters process in progress');
19
- dispatch({ type: DELETE_FILTER, payload: {} });
18
+ dispatch({ type: 'DELETE_FILTER', payload: {} });
20
19
  hideLoading();
21
20
  },
22
21
  },
@@ -12,7 +12,6 @@ import { useAlert } from '../../elements/popup/Alert';
12
12
  import { useModal } from '../../elements/popup/Modal';
13
13
  import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus';
14
14
  import useSpectrum from '../../hooks/useSpectrum';
15
- import { ENABLE_FILTER, DELETE_FILTER, SET_FILTER_SNAPSHOT, DELETE_SPECTRA_FILTER, } from '../../reducer/types/Types';
16
15
  const rowColors = {
17
16
  active: {
18
17
  base: {
@@ -34,11 +33,11 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
34
33
  const modal = useModal();
35
34
  const alert = useAlert();
36
35
  const selectedFilterIndex = useRef();
37
- const handelFilterCheck = useCallback((id, checked) => {
36
+ const handelFilterCheck = useCallback((id, enabled) => {
38
37
  void (async () => {
39
- const hideLoading = await alert.showLoading(`${checked ? 'Enable' : 'Disable'} filter in progress`);
38
+ const hideLoading = await alert.showLoading(`${enabled ? 'Enable' : 'Disable'} filter in progress`);
40
39
  setTimeout(() => {
41
- dispatch({ type: ENABLE_FILTER, id, checked });
40
+ dispatch({ type: 'ENABLE_FILTER', payload: { id, enabled } });
42
41
  hideLoading();
43
42
  }, 0);
44
43
  })();
@@ -49,7 +48,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
49
48
  text: 'Yes',
50
49
  handler: async () => {
51
50
  const hideLoading = await alert.showLoading('Delete filter process in progress');
52
- dispatch({ type: DELETE_FILTER, payload: { id } });
51
+ dispatch({ type: 'DELETE_FILTER', payload: { id } });
53
52
  hideLoading();
54
53
  },
55
54
  },
@@ -61,8 +60,8 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
61
60
  handler: async () => {
62
61
  const hideLoading = await alert.showLoading('Delete all spectra filter process in progress');
63
62
  dispatch({
64
- type: DELETE_SPECTRA_FILTER,
65
- payload: { filterType: name },
63
+ type: 'DELETE_SPECTRA_FILTER',
64
+ payload: { filterName: name },
66
65
  });
67
66
  hideLoading();
68
67
  },
@@ -81,7 +80,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
81
80
  void (async () => {
82
81
  const hideLoading = await alert.showLoading('Filter snapshot process in progress');
83
82
  setTimeout(() => {
84
- dispatch({ type: SET_FILTER_SNAPSHOT, payload: filter });
83
+ dispatch({ type: 'SET_FILTER_SNAPSHOT', payload: filter });
85
84
  hideLoading();
86
85
  }, 0);
87
86
  })();
@@ -144,5 +143,5 @@ export default function FilterTable() {
144
143
  const { toolOptions: { data: { activeFilterID }, }, } = useChartData();
145
144
  const { filters } = useSpectrum(emptyData);
146
145
  const spectraCounter = useSpectraByActiveNucleus().length;
147
- return (_jsx(MemoizedFiltersTable, { ...{ filters, spectraCounter, activeFilterID } }));
146
+ return (_jsx(MemoizedFiltersTable, { filters, spectraCounter, activeFilterID }));
148
147
  }
@@ -27,7 +27,7 @@ const styles = css `
27
27
  }
28
28
  `;
29
29
  function DefaultPanelHeader({ counter, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', filterIsActive = false, counterFiltered = 0, children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
30
- return (_jsxs("div", { css: styles, ...{ style, className }, children: [_jsxs("div", { className: "left-container", children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, defaultValue: filterIsActive, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counter !== undefined && (_jsxs("p", { className: "counter-label", children: ["[", ' ', filterIsActive && counterFiltered !== undefined
30
+ return (_jsxs("div", { css: styles, style, className, children: [_jsxs("div", { className: "left-container", children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, defaultValue: filterIsActive, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counter !== undefined && (_jsxs("p", { className: "counter-label", children: ["[", ' ', filterIsActive && counterFiltered !== undefined
31
31
  ? `${counterFiltered}/${counter}`
32
32
  : counter, ' ', "]"] })), showSettingButton && (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
33
33
  }
@@ -6,7 +6,6 @@ import { useDispatch } from '../../context/DispatchContext';
6
6
  import Button from '../../elements/Button';
7
7
  import { useAlert } from '../../elements/popup/Alert';
8
8
  import { useCheckToolsVisibility } from '../../hooks/useCheckToolsVisibility';
9
- import { AUTO_RANGES_SPECTRA_PICKING, AUTO_ZONES_SPECTRA_PICKING, } from '../../reducer/types/Types';
10
9
  export function SpectraAutomaticPickingButton() {
11
10
  const dispatch = useDispatch();
12
11
  const alert = useAlert();
@@ -16,8 +15,8 @@ export function SpectraAutomaticPickingButton() {
16
15
  void (async () => {
17
16
  const hideLoading = await alert.showLoading('Automatic Ranges/Zones detection for all spectra in progress');
18
17
  setTimeout(() => {
19
- dispatch({ type: AUTO_RANGES_SPECTRA_PICKING });
20
- dispatch({ type: AUTO_ZONES_SPECTRA_PICKING });
18
+ dispatch({ type: 'AUTO_RANGES_SPECTRA_PICKING' });
19
+ dispatch({ type: 'AUTO_ZONES_SPECTRA_PICKING' });
21
20
  hideLoading();
22
21
  }, 0);
23
22
  })();
@@ -4,7 +4,6 @@ import { useAccordionContext } from 'react-science/ui';
4
4
  import { useChartData } from '../../context/ChartContext';
5
5
  import { useDispatch } from '../../context/DispatchContext';
6
6
  import { useAlert } from '../../elements/popup/Alert';
7
- import { PREDICT_SPECTRA, SET_LOADING_FLAG } from '../../reducer/types/Types';
8
7
  import MoleculePanel from '../MoleculesPanel/MoleculePanel';
9
8
  import PredictionPreferences from './PredictionOptions';
10
9
  export default function PredictionPane() {
@@ -20,13 +19,13 @@ export default function PredictionPane() {
20
19
  void (async () => {
21
20
  if (molecule) {
22
21
  dispatch({
23
- type: SET_LOADING_FLAG,
24
- isLoading: true,
22
+ type: 'SET_LOADING_FLAG',
23
+ payload: { isLoading: true },
25
24
  });
26
25
  const hideLoading = await alert.showLoading(`Predict 1H, 13C, COSY, HSQC, and HMBC in progress`);
27
26
  dispatch({
28
- type: PREDICT_SPECTRA,
29
- payload: { mol: molecule, options: values },
27
+ type: 'PREDICT_SPECTRA',
28
+ payload: { molfile: molecule.molfile, options: values },
30
29
  });
31
30
  if (!spectraPanelState?.isOpen) {
32
31
  openSpectraPanel();
@@ -1,2 +1,3 @@
1
- declare function checkActionType(type: string): boolean;
1
+ import { Action } from '../context/DispatchContext';
2
+ declare function checkActionType(type: Action['type']): boolean;
2
3
  export default checkActionType;