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
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.handleSignalProcessingFilter = exports.rollbackSpectrum = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.rollbackSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateZeroFillingFilter = exports.calculateApodizationFilter = exports.calculateBaseLineCorrection = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyApodizationFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
29
+ exports.rollbackSpectrumByFilter = exports.rollbackSpectrum = exports.handleSignalProcessingFilter = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.handleSetFilterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.handleDeleteSpectraFilter = exports.handleDeleteFilter = exports.handleEnableFilter = exports.handleCalculateZeroFillingFilter = exports.handleCalculateApodizationFilter = exports.handleCalculateBaseLineCorrection = exports.calculateBaseLineCorrection = exports.handleCalculateManualPhaseCorrection = exports.handleApplyAbsoluteFilter = exports.handleApplyAutoPhaseCorrectionFilter = exports.handleApplyManualPhaseCorrectionFilter = exports.handleApplyFFTFilter = exports.handleApplyApodizationFilter = exports.handleApplyZeroFillingFilter = exports.handleShiftSpectrumAlongXAxis = void 0;
30
30
  const uuid_1 = require("@lukeed/uuid");
31
31
  const immer_1 = require("immer");
32
32
  const Filters = __importStar(require("../../../data/Filters"));
@@ -46,8 +46,158 @@ const getStrongestPeak_1 = require("../helper/getStrongestPeak");
46
46
  const DomainActions_1 = require("./DomainActions");
47
47
  const PreferencesActions_1 = require("./PreferencesActions");
48
48
  const ToolsActions_1 = require("./ToolsActions");
49
- function shiftSpectrumAlongXAxis(draft, shift) {
49
+ function getFilterUpdateDomainRules(filterName) {
50
+ return (
51
+ // eslint-disable-next-line import/namespace
52
+ Filters[filterName]?.DOMAIN_UPDATE_RULES || {
53
+ updateXDomain: false,
54
+ updateYDomain: false,
55
+ });
56
+ }
57
+ function rollbackSpectrumByFilter(draft, options) {
58
+ const { applyFilter = true, searchBy = 'id', reset = false, key, activeSpectrum, triggerSource = 'none', } = options || {};
59
+ const currentActiveSpectrum = activeSpectrum || (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
60
+ let updateDomainOptions = {
61
+ updateXDomain: false,
62
+ updateYDomain: false,
63
+ };
64
+ let previousIsFid = false;
65
+ let currentIsFid = false;
66
+ if (currentActiveSpectrum) {
67
+ const index = currentActiveSpectrum.index;
68
+ const datum = draft.data[index];
69
+ previousIsFid = datum.info.isFid;
70
+ const filterIndex = datum.filters.findIndex((f) => f[searchBy] === key);
71
+ const activeFilterId = draft.toolOptions.data.activeFilterID;
72
+ if (filterIndex !== -1 && !reset) {
73
+ const filters = datum.filters.slice(0, filterIndex || 1);
74
+ //set active filter
75
+ draft.toolOptions.data.activeFilterID = datum.filters[filterIndex]?.id;
76
+ if (filters.length > 0) {
77
+ for (let i = 0; i <= filterIndex; i++) {
78
+ const { updateXDomain, updateYDomain } = getFilterUpdateDomainRules(datum.filters[i].name);
79
+ updateDomainOptions.updateXDomain =
80
+ updateXDomain || updateDomainOptions.updateXDomain;
81
+ updateDomainOptions.updateYDomain =
82
+ updateYDomain || updateDomainOptions.updateYDomain;
83
+ }
84
+ FiltersManager.reapplyFilters(datum, filters);
85
+ }
86
+ draft.tempData = (0, immer_1.current)(draft).data;
87
+ // apply the current Filters
88
+ if (applyFilter) {
89
+ FiltersManager.reapplyFilters(datum, datum.filters.slice(0, filterIndex + 1));
90
+ }
91
+ currentIsFid = datum.info.isFid;
92
+ //if we still point to the same filter then close the filter options panel and reset the selected tool to default one (zoom tool)
93
+ if (activeFilterId === datum.filters[filterIndex].id &&
94
+ triggerSource === 'Apply') {
95
+ draft.toolOptions.selectedOptionPanel = null;
96
+ draft.toolOptions.selectedTool = 'zoom';
97
+ }
98
+ }
99
+ else {
100
+ //if the filter is not exists, create a clone of the current data
101
+ draft.tempData = (0, immer_1.current)(draft).data;
102
+ }
103
+ // re-implement all filters and rest all view property that related to filters
104
+ if (reset) {
105
+ draft.tempData = null;
106
+ FiltersManager.reapplyFilters(datum);
107
+ updateDomainOptions = { updateXDomain: true, updateYDomain: true };
108
+ const { toolOptions: { data }, } = (0, Reducer_1.getInitialState)();
109
+ draft.toolOptions.data = data;
110
+ draft.toolOptions.selectedOptionPanel = null;
111
+ draft.toolOptions.selectedTool = 'zoom';
112
+ currentIsFid = datum.info.isFid;
113
+ }
114
+ }
115
+ (0, DomainActions_1.setDomain)(draft, updateDomainOptions);
116
+ if (previousIsFid !== currentIsFid) {
117
+ (0, DomainActions_1.setMode)(draft);
118
+ (0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { verticalAlign: 'auto-check' });
119
+ }
120
+ }
121
+ exports.rollbackSpectrumByFilter = rollbackSpectrumByFilter;
122
+ function rollbackSpectrum(draft, options) {
123
+ const { filterKey, reset = false, updateFilterViewOptions = true } = options;
124
+ //return back the spectra data to point of time before applying a specific filter
125
+ const applyFilter = [
126
+ Filters.phaseCorrection.id,
127
+ Filters.fft.id,
128
+ Filters.shiftX.id,
129
+ Filters.shift2DX.id,
130
+ Filters.shift2DY.id,
131
+ Filters.signalProcessing.id,
132
+ ].includes(filterKey);
133
+ rollbackSpectrumByFilter(draft, {
134
+ searchBy: 'name',
135
+ key: filterKey,
136
+ applyFilter,
137
+ reset,
138
+ });
139
+ if (updateFilterViewOptions) {
140
+ updateFilterOptionsInView(draft, filterKey);
141
+ }
142
+ }
143
+ exports.rollbackSpectrum = rollbackSpectrum;
144
+ function updateFilterOptionsInView(draft, filterKey) {
145
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
146
+ switch (filterKey) {
147
+ case Filters.phaseCorrection.id: {
148
+ // look for the strongest peak to set it as a pivot
149
+ const { xValue, index } = (0, getStrongestPeak_1.getStrongestPeak)(draft) || {
150
+ xValue: 0,
151
+ index: 0,
152
+ };
153
+ draft.toolOptions.data.pivot = { value: xValue, index };
154
+ break;
155
+ }
156
+ case Filters.baselineCorrection.id: {
157
+ if (activeSpectrum) {
158
+ const baselineCorrectionFilter = (0, immer_1.current)(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === ToolTypes_1.options.baselineCorrection.id);
159
+ if (baselineCorrectionFilter) {
160
+ draft.toolOptions.data.baselineCorrection.zones =
161
+ baselineCorrectionFilter
162
+ ? baselineCorrectionFilter.value.zones
163
+ : [];
164
+ }
165
+ }
166
+ break;
167
+ }
168
+ case Filters.apodization.id: {
169
+ draft.toolOptions.data.apodizationOptions = apodization_1.defaultApodizationOptions;
170
+ break;
171
+ }
172
+ default:
173
+ break;
174
+ }
175
+ }
176
+ /**
177
+ * getActiveFilterIndex return active filter index. Otherwise, its returns -1
178
+ */
179
+ function getActiveFilterIndex(draft) {
180
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
181
+ const id = draft.toolOptions.data.activeFilterID;
182
+ if (id && activeSpectrum) {
183
+ const spectrum = draft.data[activeSpectrum.index];
184
+ const index = spectrum.filters.findIndex((filter) => filter.id === id);
185
+ return index;
186
+ }
187
+ return -1;
188
+ }
189
+ function updateView(draft, filterUpdateDomainRules) {
190
+ draft.tempData = null;
191
+ const { updateXDomain, updateYDomain } = filterUpdateDomainRules;
192
+ (0, ToolsActions_1.resetSelectedTool)(draft);
193
+ (0, DomainActions_1.setDomain)(draft, { updateXDomain, updateYDomain });
194
+ (0, DomainActions_1.setMode)(draft);
195
+ (0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { verticalAlign: 'auto-check' });
196
+ }
197
+ //action
198
+ function handleShiftSpectrumAlongXAxis(draft, action) {
50
199
  //apply filter into the spectrum
200
+ const { shift } = action.payload;
51
201
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
52
202
  if (activeSpectrum) {
53
203
  const activeFilterIndex = getActiveFilterIndex(draft);
@@ -67,8 +217,9 @@ function shiftSpectrumAlongXAxis(draft, shift) {
67
217
  }
68
218
  }
69
219
  }
70
- exports.shiftSpectrumAlongXAxis = shiftSpectrumAlongXAxis;
71
- function applyZeroFillingFilter(draft, action) {
220
+ exports.handleShiftSpectrumAlongXAxis = handleShiftSpectrumAlongXAxis;
221
+ //action
222
+ function handleApplyZeroFillingFilter(draft, action) {
72
223
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
73
224
  if (activeSpectrum) {
74
225
  const activeFilterIndex = getActiveFilterIndex(draft);
@@ -94,8 +245,26 @@ function applyZeroFillingFilter(draft, action) {
94
245
  }
95
246
  }
96
247
  }
97
- exports.applyZeroFillingFilter = applyZeroFillingFilter;
98
- function calculateApodizationFilter(draft, action) {
248
+ exports.handleApplyZeroFillingFilter = handleApplyZeroFillingFilter;
249
+ //action
250
+ function handleCalculateZeroFillingFilter(draft, action) {
251
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
252
+ if (activeSpectrum) {
253
+ const index = activeSpectrum.index;
254
+ const { data: { x, re, im }, filters, info, } = draft.tempData[index];
255
+ let _data = { data: { x, re, im }, filters, info };
256
+ (0, zeroFilling_1.apply)(_data, action.payload);
257
+ const { im: newIm, re: newRe, x: newX } = _data.data;
258
+ const datum = draft.data[index];
259
+ datum.data.x = newX;
260
+ datum.data.im = newIm;
261
+ datum.data.re = newRe;
262
+ draft.xDomain = [newX[0], newX.at(-1)];
263
+ }
264
+ }
265
+ exports.handleCalculateZeroFillingFilter = handleCalculateZeroFillingFilter;
266
+ //action
267
+ function handleCalculateApodizationFilter(draft, action) {
99
268
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
100
269
  if (activeSpectrum) {
101
270
  const index = activeSpectrum.index;
@@ -110,8 +279,9 @@ function calculateApodizationFilter(draft, action) {
110
279
  datum.data.re = newRe;
111
280
  }
112
281
  }
113
- exports.calculateApodizationFilter = calculateApodizationFilter;
114
- function applyApodizationFilter(draft, action) {
282
+ exports.handleCalculateApodizationFilter = handleCalculateApodizationFilter;
283
+ //action
284
+ function handleApplyApodizationFilter(draft, action) {
115
285
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
116
286
  if (activeSpectrum) {
117
287
  const index = activeSpectrum.index;
@@ -134,24 +304,9 @@ function applyApodizationFilter(draft, action) {
134
304
  }
135
305
  }
136
306
  }
137
- exports.applyApodizationFilter = applyApodizationFilter;
138
- function calculateZeroFillingFilter(draft, action) {
139
- const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
140
- if (activeSpectrum) {
141
- const index = activeSpectrum.index;
142
- const { data: { x, re, im }, filters, info, } = draft.tempData[index];
143
- let _data = { data: { x, re, im }, filters, info };
144
- (0, zeroFilling_1.apply)(_data, action.payload);
145
- const { im: newIm, re: newRe, x: newX } = _data.data;
146
- const datum = draft.data[index];
147
- datum.data.x = newX;
148
- datum.data.im = newIm;
149
- datum.data.re = newRe;
150
- draft.xDomain = [newX[0], newX[newX.length - 1]];
151
- }
152
- }
153
- exports.calculateZeroFillingFilter = calculateZeroFillingFilter;
154
- function applyFFTFilter(draft) {
307
+ exports.handleApplyApodizationFilter = handleApplyApodizationFilter;
308
+ //action
309
+ function handleApplyFFTFilter(draft) {
155
310
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
156
311
  if (activeSpectrum) {
157
312
  const { index } = activeSpectrum;
@@ -169,12 +324,13 @@ function applyFFTFilter(draft) {
169
324
  }
170
325
  }
171
326
  }
172
- exports.applyFFTFilter = applyFFTFilter;
173
- function applyManualPhaseCorrectionFilter(draft, filterOptions) {
327
+ exports.handleApplyFFTFilter = handleApplyFFTFilter;
328
+ //action
329
+ function handleApplyManualPhaseCorrectionFilter(draft, action) {
174
330
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
175
331
  if (activeSpectrum) {
176
332
  const { index } = activeSpectrum;
177
- const { ph0, ph1 } = filterOptions;
333
+ const { ph0, ph1 } = action.payload;
178
334
  draft.data = draft.tempData;
179
335
  const activeFilterIndex = getActiveFilterIndex(draft);
180
336
  FiltersManager.applyFilter(draft.data[index], [
@@ -195,8 +351,25 @@ function applyManualPhaseCorrectionFilter(draft, filterOptions) {
195
351
  }
196
352
  }
197
353
  }
198
- exports.applyManualPhaseCorrectionFilter = applyManualPhaseCorrectionFilter;
199
- function applyAbsoluteFilter(draft) {
354
+ exports.handleApplyManualPhaseCorrectionFilter = handleApplyManualPhaseCorrectionFilter;
355
+ //action
356
+ function handleCalculateManualPhaseCorrection(draft, action) {
357
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
358
+ if (activeSpectrum) {
359
+ const { index } = activeSpectrum;
360
+ const { data: { x, re, im }, info, } = draft.tempData[index];
361
+ const { ph0, ph1 } = action.payload;
362
+ let _data = { data: { x, re, im }, info };
363
+ (0, phaseCorrection_1.apply)(_data, { ph0, ph1 });
364
+ const { im: newIm, re: newRe } = _data.data;
365
+ const datum = draft.data[index];
366
+ datum.data.im = newIm;
367
+ datum.data.re = newRe;
368
+ }
369
+ }
370
+ exports.handleCalculateManualPhaseCorrection = handleCalculateManualPhaseCorrection;
371
+ //action
372
+ function handleApplyAbsoluteFilter(draft) {
200
373
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
201
374
  if (activeSpectrum) {
202
375
  const { index } = activeSpectrum;
@@ -219,8 +392,9 @@ function applyAbsoluteFilter(draft) {
219
392
  }
220
393
  }
221
394
  }
222
- exports.applyAbsoluteFilter = applyAbsoluteFilter;
223
- function applyAutoPhaseCorrectionFilter(draft) {
395
+ exports.handleApplyAbsoluteFilter = handleApplyAbsoluteFilter;
396
+ //action
397
+ function handleApplyAutoPhaseCorrectionFilter(draft) {
224
398
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
225
399
  if (activeSpectrum) {
226
400
  const { index } = activeSpectrum;
@@ -243,8 +417,37 @@ function applyAutoPhaseCorrectionFilter(draft) {
243
417
  }
244
418
  }
245
419
  }
246
- exports.applyAutoPhaseCorrectionFilter = applyAutoPhaseCorrectionFilter;
247
- function calculateBaseLineCorrection(draft, action) {
420
+ exports.handleApplyAutoPhaseCorrectionFilter = handleApplyAutoPhaseCorrectionFilter;
421
+ //action
422
+ function handleBaseLineCorrectionFilter(draft, action) {
423
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
424
+ if (activeSpectrum) {
425
+ const { zones } = draft.toolOptions.data.baselineCorrection;
426
+ const { livePreview, ...options } = action.payload;
427
+ const activeFilterIndex = getActiveFilterIndex(draft);
428
+ FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
429
+ {
430
+ name: Filters.baselineCorrection.id,
431
+ value: {
432
+ ...options,
433
+ zones,
434
+ },
435
+ },
436
+ ], { filterIndex: activeFilterIndex });
437
+ if (activeFilterIndex !== -1) {
438
+ rollbackSpectrumByFilter(draft, {
439
+ searchBy: 'name',
440
+ key: Filters.baselineCorrection.id,
441
+ triggerSource: 'Apply',
442
+ });
443
+ }
444
+ else {
445
+ updateView(draft, Filters.baselineCorrection.DOMAIN_UPDATE_RULES);
446
+ }
447
+ }
448
+ }
449
+ exports.handleBaseLineCorrectionFilter = handleBaseLineCorrectionFilter;
450
+ function calculateBaseLineCorrection(draft, baseLineOptions) {
248
451
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
249
452
  if (activeSpectrum) {
250
453
  const { index } = activeSpectrum;
@@ -252,7 +455,7 @@ function calculateBaseLineCorrection(draft, action) {
252
455
  // save the baseline options temporary
253
456
  draft.toolOptions.data.baselineCorrection = {
254
457
  ...draft.toolOptions.data.baselineCorrection,
255
- ...(action?.options ? { options: action.options } : {}),
458
+ ...(baseLineOptions ? { options: baseLineOptions } : {}),
256
459
  };
257
460
  const { zones, options } = draft.toolOptions.data.baselineCorrection;
258
461
  const { livePreview, ...filterOptions } = options;
@@ -270,26 +473,18 @@ function calculateBaseLineCorrection(draft, action) {
270
473
  }
271
474
  }
272
475
  exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
273
- function calculateManualPhaseCorrection(draft, filterOptions) {
274
- const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
275
- if (activeSpectrum) {
276
- const { index } = activeSpectrum;
277
- const { data: { x, re, im }, info, } = draft.tempData[index];
278
- const { ph0, ph1 } = filterOptions;
279
- let _data = { data: { x, re, im }, info };
280
- (0, phaseCorrection_1.apply)(_data, { ph0, ph1 });
281
- const { im: newIm, re: newRe } = _data.data;
282
- const datum = draft.data[index];
283
- datum.data.im = newIm;
284
- datum.data.re = newRe;
285
- }
476
+ //action
477
+ function handleCalculateBaseLineCorrection(draft, action) {
478
+ calculateBaseLineCorrection(draft, action.payload);
286
479
  }
287
- exports.calculateManualPhaseCorrection = calculateManualPhaseCorrection;
288
- function enableFilter(draft, filterID, checked) {
480
+ exports.handleCalculateBaseLineCorrection = handleCalculateBaseLineCorrection;
481
+ //action
482
+ function handleEnableFilter(draft, action) {
483
+ const { id: filterID, enabled } = action.payload;
289
484
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
290
485
  if (activeSpectrum) {
291
486
  //apply filter into the spectrum
292
- FiltersManager.enableFilter(draft.data[activeSpectrum.index], filterID, checked);
487
+ FiltersManager.enableFilter(draft.data[activeSpectrum.index], filterID, enabled);
293
488
  (0, ToolsActions_1.resetSelectedTool)(draft);
294
489
  (0, DomainActions_1.setDomain)(draft);
295
490
  (0, DomainActions_1.setMode)(draft);
@@ -301,9 +496,10 @@ function enableFilter(draft, filterID, checked) {
301
496
  }
302
497
  }
303
498
  }
304
- exports.enableFilter = enableFilter;
305
- function deleteFilter(draft, actions) {
306
- const filterID = actions.payload?.id;
499
+ exports.handleEnableFilter = handleEnableFilter;
500
+ //action
501
+ function handleDeleteFilter(draft, action) {
502
+ const filterID = action?.payload?.id;
307
503
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
308
504
  if (activeSpectrum) {
309
505
  //apply filter into the spectrum
@@ -314,13 +510,14 @@ function deleteFilter(draft, actions) {
314
510
  (0, DomainActions_1.setMode)(draft);
315
511
  }
316
512
  }
317
- exports.deleteFilter = deleteFilter;
318
- function deleteSpectraFilter(draft, actions) {
319
- const filterType = actions.payload.filterType;
513
+ exports.handleDeleteFilter = handleDeleteFilter;
514
+ //action
515
+ function handleDeleteSpectraFilter(draft, action) {
516
+ const filterName = action.payload.filterName;
320
517
  if (draft.view.spectra.activeTab) {
321
518
  for (const datum of draft.data) {
322
519
  if ((0, nucleusToString_1.default)(datum?.info?.nucleus) === draft.view.spectra.activeTab) {
323
- const filtersResult = datum.filters?.filter((filter) => filter.name === filterType) || [];
520
+ const filtersResult = datum.filters?.filter((filter) => filter.name === filterName) || [];
324
521
  for (const filter of filtersResult) {
325
522
  FiltersManager.deleteFilter(datum, filter.id);
326
523
  }
@@ -331,118 +528,9 @@ function deleteSpectraFilter(draft, actions) {
331
528
  (0, DomainActions_1.setMode)(draft);
332
529
  }
333
530
  }
334
- exports.deleteSpectraFilter = deleteSpectraFilter;
335
- function handleBaseLineCorrectionFilter(draft, action) {
336
- const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
337
- if (activeSpectrum) {
338
- const { zones } = draft.toolOptions.data.baselineCorrection;
339
- const { livePreview, ...options } = action.options;
340
- const activeFilterIndex = getActiveFilterIndex(draft);
341
- FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
342
- {
343
- name: Filters.baselineCorrection.id,
344
- value: {
345
- zones,
346
- ...options,
347
- },
348
- },
349
- ], { filterIndex: activeFilterIndex });
350
- if (activeFilterIndex !== -1) {
351
- rollbackSpectrumByFilter(draft, {
352
- searchBy: 'name',
353
- key: Filters.baselineCorrection.id,
354
- triggerSource: 'Apply',
355
- });
356
- }
357
- else {
358
- updateView(draft, Filters.baselineCorrection.DOMAIN_UPDATE_RULES);
359
- }
360
- }
361
- }
362
- exports.handleBaseLineCorrectionFilter = handleBaseLineCorrectionFilter;
363
- /**
364
- * reset spectrum data for specific point of time (Filter)
365
- * @param {object} draft
366
- * @param {object} options
367
- * @param {string} options.id Filter id
368
- * @param {boolean=} options.resetTool
369
- * @param {boolean=} options.updateDomain
370
- * @param {boolean=} options.rollback
371
- */
372
- function getFilterUpdateDomainRules(filterName) {
373
- return (
374
- // eslint-disable-next-line import/namespace
375
- Filters[filterName]?.DOMAIN_UPDATE_RULES || {
376
- updateXDomain: false,
377
- updateYDomain: false,
378
- });
379
- }
380
- function rollbackSpectrumByFilter(draft, options) {
381
- const { applyFilter = true, searchBy = 'id', reset = false, key, activeSpectrum, triggerSource = 'none', } = options || {};
382
- const currentActiveSpectrum = activeSpectrum || (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
383
- let updateDomainOptions = {
384
- updateXDomain: false,
385
- updateYDomain: false,
386
- };
387
- let previousIsFid = false;
388
- let currentIsFid = false;
389
- if (currentActiveSpectrum) {
390
- const index = currentActiveSpectrum.index;
391
- const datum = draft.data[index];
392
- previousIsFid = datum.info.isFid;
393
- const filterIndex = datum.filters.findIndex((f) => f[searchBy] === key);
394
- const activeFilterId = draft.toolOptions.data.activeFilterID;
395
- if (filterIndex !== -1 && !reset) {
396
- const filters = datum.filters.slice(0, filterIndex || 1);
397
- //set active filter
398
- draft.toolOptions.data.activeFilterID = datum.filters[filterIndex]?.id;
399
- if (filters.length > 0) {
400
- for (let i = 0; i <= filterIndex; i++) {
401
- const { updateXDomain, updateYDomain } = getFilterUpdateDomainRules(datum.filters[i].name);
402
- updateDomainOptions.updateXDomain =
403
- updateXDomain || updateDomainOptions.updateXDomain;
404
- updateDomainOptions.updateYDomain =
405
- updateYDomain || updateDomainOptions.updateYDomain;
406
- }
407
- FiltersManager.reapplyFilters(datum, filters);
408
- }
409
- draft.tempData = (0, immer_1.current)(draft).data;
410
- // apply the current Filters
411
- if (applyFilter) {
412
- FiltersManager.reapplyFilters(datum, datum.filters.slice(0, filterIndex + 1));
413
- }
414
- currentIsFid = datum.info.isFid;
415
- //if we still point to the same filter then close the filter options panel and reset the selected tool to default one (zoom tool)
416
- if (activeFilterId === datum.filters[filterIndex].id &&
417
- triggerSource === 'Apply') {
418
- draft.toolOptions.selectedOptionPanel = null;
419
- draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
420
- }
421
- }
422
- else {
423
- //if the filter is not exists, create a clone of the current data
424
- draft.tempData = (0, immer_1.current)(draft).data;
425
- }
426
- // re-implement all filters and rest all view property that related to filters
427
- if (reset) {
428
- draft.tempData = null;
429
- FiltersManager.reapplyFilters(datum);
430
- updateDomainOptions = { updateXDomain: true, updateYDomain: true };
431
- const { toolOptions: { data }, } = (0, Reducer_1.getInitialState)();
432
- draft.toolOptions.data = data;
433
- draft.toolOptions.selectedOptionPanel = null;
434
- draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
435
- currentIsFid = datum.info.isFid;
436
- }
437
- }
438
- (0, DomainActions_1.setDomain)(draft, updateDomainOptions);
439
- if (previousIsFid !== currentIsFid) {
440
- (0, DomainActions_1.setMode)(draft);
441
- (0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { verticalAlign: 'auto-check' });
442
- }
443
- }
444
- exports.rollbackSpectrumByFilter = rollbackSpectrumByFilter;
445
- function filterSnapshotHandler(draft, action) {
531
+ exports.handleDeleteSpectraFilter = handleDeleteSpectraFilter;
532
+ //action
533
+ function handleSetFilterSnapshotHandler(draft, action) {
446
534
  const { name: filterKey, id } = action.payload;
447
535
  const reset = draft.toolOptions.data.activeFilterID === id;
448
536
  if (ToolTypes_1.options?.[filterKey]?.isFilter) {
@@ -453,28 +541,8 @@ function filterSnapshotHandler(draft, action) {
453
541
  rollbackSpectrum(draft, { filterKey, reset });
454
542
  }
455
543
  }
456
- exports.filterSnapshotHandler = filterSnapshotHandler;
457
- function handleMultipleSpectraFilter(draft, action) {
458
- const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
459
- if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
460
- const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
461
- ?.value || [];
462
- for (const spectrum of spectra) {
463
- const filters = action.payload.map((filter) => {
464
- if (filter.name === Filters.equallySpaced.id) {
465
- return {
466
- ...filter,
467
- options: { ...filter.options, exclusions },
468
- };
469
- }
470
- return filter;
471
- });
472
- FiltersManager.applyFilter(spectrum, filters);
473
- }
474
- }
475
- (0, DomainActions_1.setDomain)(draft);
476
- }
477
- exports.handleMultipleSpectraFilter = handleMultipleSpectraFilter;
544
+ exports.handleSetFilterSnapshotHandler = handleSetFilterSnapshotHandler;
545
+ //action
478
546
  function handleSignalProcessingFilter(draft, action) {
479
547
  const { data, view } = draft;
480
548
  const nucleus = view.spectra.activeTab;
@@ -493,8 +561,9 @@ function handleSignalProcessingFilter(draft, action) {
493
561
  (0, DomainActions_1.setDomain)(draft, { updateXDomain, updateYDomain });
494
562
  }
495
563
  exports.handleSignalProcessingFilter = handleSignalProcessingFilter;
564
+ //action
496
565
  function handleAddExclusionZone(draft, action) {
497
- const { from: startX, to: endX } = action.payload;
566
+ const { startX, endX } = action.payload;
498
567
  const range = (0, getRange_1.default)(draft, { startX, endX });
499
568
  let spectra;
500
569
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
@@ -523,11 +592,12 @@ function handleAddExclusionZone(draft, action) {
523
592
  (0, DomainActions_1.setDomain)(draft, { updateXDomain, updateYDomain });
524
593
  }
525
594
  exports.handleAddExclusionZone = handleAddExclusionZone;
595
+ //action
526
596
  function handleDeleteExclusionZone(draft, action) {
527
- const { zone, spectrumID } = action.payload;
597
+ const { zone, spectrumId } = action.payload;
528
598
  // if spectrum id exists, remove the selected exclusion zone in the spectrum
529
- if (spectrumID) {
530
- const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
599
+ if (spectrumId) {
600
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumId);
531
601
  const filter = draft.data[spectrumIndex].filters.find((_filter) => _filter.name === Filters.exclusionZones.id);
532
602
  if (filter) {
533
603
  if (filter.value.length === 1) {
@@ -553,78 +623,3 @@ function handleDeleteExclusionZone(draft, action) {
553
623
  }
554
624
  }
555
625
  exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
556
- function rollbackSpectrum(draft, options) {
557
- const { filterKey, reset = false, updateFilterViewOptions = true } = options;
558
- //return back the spectra data to point of time before applying a specific filter
559
- const applyFilter = [
560
- Filters.phaseCorrection.id,
561
- Filters.fft.id,
562
- Filters.shiftX.id,
563
- Filters.shift2DX.id,
564
- Filters.shift2DY.id,
565
- Filters.signalProcessing.id,
566
- ].includes(filterKey);
567
- rollbackSpectrumByFilter(draft, {
568
- searchBy: 'name',
569
- key: filterKey,
570
- applyFilter,
571
- reset,
572
- });
573
- if (updateFilterViewOptions) {
574
- updateFilterOptionsInView(draft, filterKey);
575
- }
576
- }
577
- exports.rollbackSpectrum = rollbackSpectrum;
578
- function updateFilterOptionsInView(draft, filterKey) {
579
- const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
580
- switch (filterKey) {
581
- case Filters.phaseCorrection.id: {
582
- // look for the strongest peak to set it as a pivot
583
- const { xValue, index } = (0, getStrongestPeak_1.getStrongestPeak)(draft) || {
584
- xValue: 0,
585
- index: 0,
586
- };
587
- draft.toolOptions.data.pivot = { value: xValue, index };
588
- break;
589
- }
590
- case Filters.baselineCorrection.id: {
591
- if (activeSpectrum) {
592
- const baselineCorrectionFilter = (0, immer_1.current)(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === ToolTypes_1.options.baselineCorrection.id);
593
- if (baselineCorrectionFilter) {
594
- draft.toolOptions.data.baselineCorrection.zones =
595
- baselineCorrectionFilter
596
- ? baselineCorrectionFilter.value.zones
597
- : [];
598
- }
599
- }
600
- break;
601
- }
602
- case Filters.apodization.id: {
603
- draft.toolOptions.data.apodizationOptions = apodization_1.defaultApodizationOptions;
604
- break;
605
- }
606
- default:
607
- break;
608
- }
609
- }
610
- /**
611
- * getActiveFilterIndex return active filter index. Otherwise, its returns -1
612
- */
613
- function getActiveFilterIndex(draft) {
614
- const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
615
- const id = draft.toolOptions.data.activeFilterID;
616
- if (id && activeSpectrum) {
617
- const spectrum = draft.data[activeSpectrum.index];
618
- const index = spectrum.filters.findIndex((filter) => filter.id === id);
619
- return index;
620
- }
621
- return -1;
622
- }
623
- function updateView(draft, filterUpdateDomainRules) {
624
- draft.tempData = null;
625
- const { updateXDomain, updateYDomain } = filterUpdateDomainRules;
626
- (0, ToolsActions_1.resetSelectedTool)(draft);
627
- (0, DomainActions_1.setDomain)(draft, { updateXDomain, updateYDomain });
628
- (0, DomainActions_1.setMode)(draft);
629
- (0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { verticalAlign: 'auto-check' });
630
- }