nmrium 0.37.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 (371) 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 -1
  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.js +15 -7
  26. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  27. package/lib/component/context/DispatchContext.d.ts +23 -3
  28. package/lib/component/context/DispatchContext.js +1 -1
  29. package/lib/component/context/LoggerContext.js +1 -1
  30. package/lib/component/elements/Button.js +7 -9
  31. package/lib/component/elements/IsotopesViewer.js +1 -1
  32. package/lib/component/elements/ReactTable/ReactTable.js +1 -2
  33. package/lib/component/elements/formik/FormikCheckBox.js +1 -1
  34. package/lib/component/elements/formik/FormikColorInput.js +1 -1
  35. package/lib/component/elements/formik/FormikColorPicker.js +1 -1
  36. package/lib/component/elements/formik/FormikColumnFormatField.js +1 -1
  37. package/lib/component/elements/formik/FormikInput.js +1 -1
  38. package/lib/component/elements/formik/FormikSelect.js +2 -2
  39. package/lib/component/elements/formik/FormikSlider.js +1 -1
  40. package/lib/component/elements/formik/FormikTextarea.js +2 -2
  41. package/lib/component/header/ApodizationOptionsPanel.js +4 -5
  42. package/lib/component/header/AutoPeakPickingOptionPanel.js +1 -2
  43. package/lib/component/header/BaseLineCorrectionPanel.js +4 -5
  44. package/lib/component/header/Header.js +4 -6
  45. package/lib/component/header/PhaseCorrectionPanel.js +7 -8
  46. package/lib/component/header/RangesPickingOptionPanel.js +1 -2
  47. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -11
  48. package/lib/component/header/Zones2DOptionPanel.js +5 -6
  49. package/lib/component/hooks/useExport.js +1 -0
  50. package/lib/component/hooks/useToolsFunctions.js +8 -10
  51. package/lib/component/loader/DropZone.js +4 -5
  52. package/lib/component/loader/NoData.js +1 -1
  53. package/lib/component/modal/AlignSpectraModal.js +1 -2
  54. package/lib/component/modal/EditPeakShapeModal.js +1 -2
  55. package/lib/component/modal/ImportPublicationStringModal.js +1 -2
  56. package/lib/component/modal/LoadJCAMPModal.js +2 -3
  57. package/lib/component/modal/MoleculeStructureEditorModal.js +24 -19
  58. package/lib/component/modal/PredictSpectraModal.js +24 -21
  59. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  60. package/lib/component/modal/editRange/EditRangeModal.js +3 -4
  61. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
  62. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
  63. package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -3
  64. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
  65. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
  66. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
  67. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  68. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
  69. package/lib/component/panels/InformationPanel.js +6 -6
  70. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
  71. package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -10
  72. package/lib/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
  73. package/lib/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
  74. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
  75. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
  76. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
  77. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -5
  78. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +4 -1
  79. package/lib/component/panels/MoleculesPanel/Utilities.js +2 -2
  80. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  81. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
  82. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
  83. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  84. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
  85. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
  86. package/lib/component/panels/Panels.js +1 -1
  87. package/lib/component/panels/PeaksPanel/PeaksPanel.js +4 -5
  88. package/lib/component/panels/PeaksPanel/PeaksTable.js +4 -5
  89. package/lib/component/panels/RangesPanel/RangesHeader.js +12 -15
  90. package/lib/component/panels/RangesPanel/RangesPanel.js +24 -29
  91. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
  92. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
  93. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
  94. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
  95. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
  96. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
  97. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
  98. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
  99. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
  100. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
  101. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  102. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
  103. package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -34
  104. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  105. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +2 -13
  106. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
  107. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -2
  108. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  109. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +2 -2
  110. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
  111. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
  112. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +2 -2
  113. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
  114. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +2 -2
  115. package/lib/component/panels/ZonesPanel/ZonesPanel.js +15 -18
  116. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -51
  117. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +3 -3
  118. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +16 -0
  119. package/lib/component/panels/ZonesPanel/hooks/useMapZones.js +52 -0
  120. package/lib/component/panels/databasePanel/DatabasePanel.js +9 -7
  121. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -2
  122. package/lib/component/panels/filtersPanel/FiltersTable.js +8 -9
  123. package/lib/component/panels/header/DefaultPanelHeader.js +1 -1
  124. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
  125. package/lib/component/panels/predictionPanel/PredictionPanel.js +4 -5
  126. package/lib/component/reducer/IgnoreActions.d.ts +2 -1
  127. package/lib/component/reducer/IgnoreActions.js +35 -32
  128. package/lib/component/reducer/Reducer.d.ts +8 -5
  129. package/lib/component/reducer/Reducer.js +199 -221
  130. package/lib/component/reducer/actions/AssignmentsActions.d.ts +7 -6
  131. package/lib/component/reducer/actions/AssignmentsActions.js +2 -2
  132. package/lib/component/reducer/actions/CorrelationsActions.d.ts +21 -13
  133. package/lib/component/reducer/actions/CorrelationsActions.js +25 -20
  134. package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -2
  135. package/lib/component/reducer/actions/DatabaseActions.js +5 -2
  136. package/lib/component/reducer/actions/DimensionsActions.d.ts +8 -3
  137. package/lib/component/reducer/actions/DimensionsActions.js +3 -5
  138. package/lib/component/reducer/actions/DomainActions.d.ts +11 -5
  139. package/lib/component/reducer/actions/DomainActions.js +13 -19
  140. package/lib/component/reducer/actions/FiltersActions.d.ts +70 -23
  141. package/lib/component/reducer/actions/FiltersActions.js +250 -255
  142. package/lib/component/reducer/actions/GlobalActions.d.ts +7 -2
  143. package/lib/component/reducer/actions/GlobalActions.js +3 -3
  144. package/lib/component/reducer/actions/IntegralsActions.d.ts +28 -7
  145. package/lib/component/reducer/actions/IntegralsActions.js +16 -15
  146. package/lib/component/reducer/actions/LoadActions.d.ts +23 -5
  147. package/lib/component/reducer/actions/LoadActions.js +52 -52
  148. package/lib/component/reducer/actions/MoleculeActions.d.ts +38 -9
  149. package/lib/component/reducer/actions/MoleculeActions.js +27 -18
  150. package/lib/component/reducer/actions/PeaksActions.d.ts +39 -8
  151. package/lib/component/reducer/actions/PeaksActions.js +19 -11
  152. package/lib/component/reducer/actions/PreferencesActions.d.ts +8 -3
  153. package/lib/component/reducer/actions/PreferencesActions.js +5 -3
  154. package/lib/component/reducer/actions/RangesActions.d.ts +85 -18
  155. package/lib/component/reducer/actions/RangesActions.js +80 -65
  156. package/lib/component/reducer/actions/SpectraAnalysisAction.d.ts +7 -1
  157. package/lib/component/reducer/actions/SpectrumsActions.d.ts +57 -24
  158. package/lib/component/reducer/actions/SpectrumsActions.js +69 -60
  159. package/lib/component/reducer/actions/ToolsActions.d.ts +59 -21
  160. package/lib/component/reducer/actions/ToolsActions.js +54 -32
  161. package/lib/component/reducer/actions/ZonesActions.d.ts +79 -15
  162. package/lib/component/reducer/actions/ZonesActions.js +68 -49
  163. package/lib/component/reducer/helper/Zoom1DManager.d.ts +6 -5
  164. package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
  165. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -2
  166. package/lib/component/reducer/helper/get2DRange.d.ts +7 -1
  167. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  168. package/lib/component/reducer/types/ActionType.d.ts +6 -0
  169. package/lib/component/reducer/types/ActionType.js +1 -0
  170. package/lib/component/toolbar/BasicToolBar.js +6 -9
  171. package/lib/component/toolbar/FunctionToolBar.js +4 -9
  172. package/lib/component/toolbar/ToolBar.js +1 -1
  173. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  174. package/lib/component/utility/Events.d.ts +4 -4
  175. package/lib/component/utility/Events.js +2 -2
  176. package/lib/component/utility/GroupByInfoKey.js +1 -1
  177. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  178. package/lib/data/PredictionManager.d.ts +5 -8
  179. package/lib/data/PredictionManager.js +3 -3
  180. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
  181. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  182. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.d.ts +2 -3
  183. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
  184. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +5 -3
  185. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -35
  186. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +2 -35
  187. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +7 -10
  188. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  189. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  190. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.d.ts +5 -1
  191. package/lib/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
  192. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +2 -0
  193. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +2 -0
  194. package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +2 -0
  195. package/lib/data/matrixGeneration.js +4 -2
  196. package/lib/data/molecules/Molecule.d.ts +3 -3
  197. package/lib/data/molecules/MoleculeManager.d.ts +5 -5
  198. package/lib/data/molecules/MoleculeManager.js +1 -1
  199. package/lib/data/utilities/generateColor.js +1 -1
  200. package/lib/data/utilities/isNumber.d.ts +1 -0
  201. package/lib/data/utilities/isNumber.js +3 -0
  202. package/lib/versionInfo.js +1 -1
  203. package/lib-cjs/component/1d/FooterBanner.js +1 -1
  204. package/lib-cjs/component/1d/Viewer1D.js +25 -20
  205. package/lib-cjs/component/1d/integral/IntegralResizable.js +2 -3
  206. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  207. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +7 -9
  208. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -2
  209. package/lib-cjs/component/1d/ranges/Range.js +9 -8
  210. package/lib-cjs/component/1d/ranges/Ranges.js +5 -7
  211. package/lib-cjs/component/1d/tool/BaseLineZones.js +1 -2
  212. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +4 -5
  213. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/index.js +13 -17
  214. package/lib-cjs/component/2d/1d-tracer/Left1DChart.js +1 -1
  215. package/lib-cjs/component/2d/1d-tracer/VerticalSliceChart.js +1 -1
  216. package/lib-cjs/component/2d/Chart2D.js +1 -1
  217. package/lib-cjs/component/2d/Viewer2D.js +10 -9
  218. package/lib-cjs/component/2d/fid/FidCanvas.js +4 -6
  219. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  220. package/lib-cjs/component/2d/utilities/scale.js +1 -1
  221. package/lib-cjs/component/2d/zones/Zones.js +1 -1
  222. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +28 -21
  223. package/lib-cjs/component/NMRium.js +15 -7
  224. package/lib-cjs/component/context/DispatchContext.js +1 -1
  225. package/lib-cjs/component/context/LoggerContext.js +1 -1
  226. package/lib-cjs/component/elements/Button.js +7 -9
  227. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  228. package/lib-cjs/component/elements/ReactTable/ReactTable.js +1 -2
  229. package/lib-cjs/component/elements/Tab/Tabs.js +1 -1
  230. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  231. package/lib-cjs/component/elements/formik/FormikColorInput.js +1 -1
  232. package/lib-cjs/component/elements/formik/FormikColorPicker.js +1 -1
  233. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +1 -1
  234. package/lib-cjs/component/elements/formik/FormikInput.js +1 -1
  235. package/lib-cjs/component/elements/formik/FormikSelect.js +2 -2
  236. package/lib-cjs/component/elements/formik/FormikSlider.js +1 -1
  237. package/lib-cjs/component/elements/formik/FormikTextarea.js +2 -2
  238. package/lib-cjs/component/header/ApodizationOptionsPanel.js +3 -4
  239. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +1 -2
  240. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +4 -5
  241. package/lib-cjs/component/header/Header.js +4 -6
  242. package/lib-cjs/component/header/PhaseCorrectionPanel.js +7 -8
  243. package/lib-cjs/component/header/RangesPickingOptionPanel.js +1 -2
  244. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -11
  245. package/lib-cjs/component/header/Zones2DOptionPanel.js +5 -6
  246. package/lib-cjs/component/highlight/index.js +1 -1
  247. package/lib-cjs/component/hooks/useExport.js +1 -0
  248. package/lib-cjs/component/hooks/useTableSortBy.js +1 -1
  249. package/lib-cjs/component/hooks/useToolsFunctions.js +8 -10
  250. package/lib-cjs/component/hooks/useXYReduce.js +1 -1
  251. package/lib-cjs/component/loader/DropZone.js +4 -5
  252. package/lib-cjs/component/loader/NoData.js +1 -1
  253. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
  254. package/lib-cjs/component/modal/EditPeakShapeModal.js +1 -2
  255. package/lib-cjs/component/modal/ImportPublicationStringModal.js +1 -2
  256. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -3
  257. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -19
  258. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -21
  259. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  260. package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -4
  261. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +2 -2
  262. package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +1 -1
  263. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +2 -3
  264. package/lib-cjs/component/modal/setting/settings-tabs/DatabasesTabContent.js +4 -4
  265. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +2 -2
  266. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +2 -2
  267. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +1 -2
  268. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -6
  269. package/lib-cjs/component/panels/InformationPanel.js +6 -6
  270. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +11 -20
  271. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -10
  272. package/lib-cjs/component/panels/MatrixGenerationPanel/ExclusionsZonesTable.js +1 -1
  273. package/lib-cjs/component/panels/MatrixGenerationPanel/FiltersOptions.js +4 -4
  274. package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -2
  275. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -2
  276. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +10 -13
  277. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -5
  278. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +2 -2
  279. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  280. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +3 -4
  281. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -2
  282. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  283. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/LegendsPreferences.js +2 -2
  284. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/MultipleAnalysisCodeEditor.js +1 -1
  285. package/lib-cjs/component/panels/Panels.js +1 -1
  286. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -5
  287. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +4 -5
  288. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +12 -15
  289. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +24 -29
  290. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +1 -1
  291. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +3 -3
  292. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -2
  293. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +16 -14
  294. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +16 -16
  295. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +7 -5
  296. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +4 -5
  297. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +3 -7
  298. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +4 -2
  299. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  300. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +4 -8
  301. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +39 -34
  302. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  303. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +22 -20
  304. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  305. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +6 -7
  306. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +1 -1
  307. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +15 -18
  308. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +2 -51
  309. package/lib-cjs/component/panels/ZonesPanel/hooks/useMapZones.js +56 -0
  310. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +8 -6
  311. package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -2
  312. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +8 -9
  313. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -1
  314. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +2 -3
  315. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +4 -5
  316. package/lib-cjs/component/reducer/IgnoreActions.js +35 -55
  317. package/lib-cjs/component/reducer/Reducer.js +199 -221
  318. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +3 -3
  319. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +23 -18
  320. package/lib-cjs/component/reducer/actions/DatabaseActions.js +4 -1
  321. package/lib-cjs/component/reducer/actions/DimensionsActions.js +3 -6
  322. package/lib-cjs/component/reducer/actions/DomainActions.js +15 -23
  323. package/lib-cjs/component/reducer/actions/FiltersActions.js +267 -272
  324. package/lib-cjs/component/reducer/actions/GlobalActions.js +4 -4
  325. package/lib-cjs/component/reducer/actions/IntegralsActions.js +19 -18
  326. package/lib-cjs/component/reducer/actions/LoadActions.js +55 -55
  327. package/lib-cjs/component/reducer/actions/MoleculeActions.js +31 -22
  328. package/lib-cjs/component/reducer/actions/PeaksActions.js +23 -15
  329. package/lib-cjs/component/reducer/actions/PreferencesActions.js +7 -5
  330. package/lib-cjs/component/reducer/actions/RangesActions.js +81 -64
  331. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +77 -67
  332. package/lib-cjs/component/reducer/actions/ToolsActions.js +54 -31
  333. package/lib-cjs/component/reducer/actions/ZonesActions.js +73 -52
  334. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  335. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -2
  336. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -2
  337. package/lib-cjs/component/reducer/types/ActionType.js +2 -0
  338. package/lib-cjs/component/toolbar/BasicToolBar.js +6 -9
  339. package/lib-cjs/component/toolbar/FunctionToolBar.js +4 -9
  340. package/lib-cjs/component/toolbar/ToolBar.js +1 -1
  341. package/lib-cjs/component/utility/GroupByInfoKey.js +1 -1
  342. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  343. package/lib-cjs/data/PredictionManager.js +3 -3
  344. package/lib-cjs/data/SpectraManager.js +1 -1
  345. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +1 -1
  346. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  347. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +5 -4
  348. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +2 -2
  349. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  350. package/lib-cjs/data/data2d/Spectrum2D/zones/changeZoneSignal.js +6 -8
  351. package/lib-cjs/data/matrixGeneration.js +4 -2
  352. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  353. package/lib-cjs/data/utilities/generateColor.js +1 -1
  354. package/lib-cjs/data/utilities/isNumber.js +7 -0
  355. package/lib-cjs/versionInfo.js +1 -1
  356. package/package.json +24 -23
  357. package/lib/component/reducer/actions/HistoryActions.d.ts +0 -4
  358. package/lib/component/reducer/actions/HistoryActions.js +0 -40
  359. package/lib/component/reducer/types/HistoryTypes.d.ts +0 -4
  360. package/lib/component/reducer/types/HistoryTypes.js +0 -4
  361. package/lib/component/reducer/types/Types.d.ts +0 -132
  362. package/lib/component/reducer/types/Types.js +0 -126
  363. package/lib/component/toolbar/HistoryToolBar.d.ts +0 -8
  364. package/lib/component/toolbar/HistoryToolBar.js +0 -30
  365. package/lib/data/utilities/isMolFileEmpty.d.ts +0 -1
  366. package/lib/data/utilities/isMolFileEmpty.js +0 -6
  367. package/lib-cjs/component/reducer/actions/HistoryActions.js +0 -45
  368. package/lib-cjs/component/reducer/types/HistoryTypes.js +0 -7
  369. package/lib-cjs/component/reducer/types/Types.js +0 -131
  370. package/lib-cjs/component/toolbar/HistoryToolBar.js +0 -35
  371. package/lib-cjs/data/utilities/isMolFileEmpty.js +0 -10
@@ -3,7 +3,7 @@ import { current } from 'immer';
3
3
  import * as Filters from '../../../data/Filters';
4
4
  import * as FiltersManager from '../../../data/FiltersManager';
5
5
  import { apply as apodization, defaultApodizationOptions, } from '../../../data/data1d/filter1d/apodization';
6
- import { apply as baselineCorrection } from '../../../data/data1d/filter1d/baselineCorrection';
6
+ import { apply as baselineCorrection, } from '../../../data/data1d/filter1d/baselineCorrection';
7
7
  import { apply as phaseCorrection } from '../../../data/data1d/filter1d/phaseCorrection';
8
8
  import { apply as zeroFilling } from '../../../data/data1d/filter1d/zeroFilling';
9
9
  import { options as Tools } from '../../toolbar/ToolTypes';
@@ -17,8 +17,156 @@ import { getStrongestPeak } from '../helper/getStrongestPeak';
17
17
  import { setDomain, setMode } from './DomainActions';
18
18
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
19
19
  import { activateTool, resetSelectedTool } from './ToolsActions';
20
- function shiftSpectrumAlongXAxis(draft, shift) {
20
+ function getFilterUpdateDomainRules(filterName) {
21
+ return (
22
+ // eslint-disable-next-line import/namespace
23
+ Filters[filterName]?.DOMAIN_UPDATE_RULES || {
24
+ updateXDomain: false,
25
+ updateYDomain: false,
26
+ });
27
+ }
28
+ function rollbackSpectrumByFilter(draft, options) {
29
+ const { applyFilter = true, searchBy = 'id', reset = false, key, activeSpectrum, triggerSource = 'none', } = options || {};
30
+ const currentActiveSpectrum = activeSpectrum || getActiveSpectrum(draft);
31
+ let updateDomainOptions = {
32
+ updateXDomain: false,
33
+ updateYDomain: false,
34
+ };
35
+ let previousIsFid = false;
36
+ let currentIsFid = false;
37
+ if (currentActiveSpectrum) {
38
+ const index = currentActiveSpectrum.index;
39
+ const datum = draft.data[index];
40
+ previousIsFid = datum.info.isFid;
41
+ const filterIndex = datum.filters.findIndex((f) => f[searchBy] === key);
42
+ const activeFilterId = draft.toolOptions.data.activeFilterID;
43
+ if (filterIndex !== -1 && !reset) {
44
+ const filters = datum.filters.slice(0, filterIndex || 1);
45
+ //set active filter
46
+ draft.toolOptions.data.activeFilterID = datum.filters[filterIndex]?.id;
47
+ if (filters.length > 0) {
48
+ for (let i = 0; i <= filterIndex; i++) {
49
+ const { updateXDomain, updateYDomain } = getFilterUpdateDomainRules(datum.filters[i].name);
50
+ updateDomainOptions.updateXDomain =
51
+ updateXDomain || updateDomainOptions.updateXDomain;
52
+ updateDomainOptions.updateYDomain =
53
+ updateYDomain || updateDomainOptions.updateYDomain;
54
+ }
55
+ FiltersManager.reapplyFilters(datum, filters);
56
+ }
57
+ draft.tempData = current(draft).data;
58
+ // apply the current Filters
59
+ if (applyFilter) {
60
+ FiltersManager.reapplyFilters(datum, datum.filters.slice(0, filterIndex + 1));
61
+ }
62
+ currentIsFid = datum.info.isFid;
63
+ //if we still point to the same filter then close the filter options panel and reset the selected tool to default one (zoom tool)
64
+ if (activeFilterId === datum.filters[filterIndex].id &&
65
+ triggerSource === 'Apply') {
66
+ draft.toolOptions.selectedOptionPanel = null;
67
+ draft.toolOptions.selectedTool = 'zoom';
68
+ }
69
+ }
70
+ else {
71
+ //if the filter is not exists, create a clone of the current data
72
+ draft.tempData = current(draft).data;
73
+ }
74
+ // re-implement all filters and rest all view property that related to filters
75
+ if (reset) {
76
+ draft.tempData = null;
77
+ FiltersManager.reapplyFilters(datum);
78
+ updateDomainOptions = { updateXDomain: true, updateYDomain: true };
79
+ const { toolOptions: { data }, } = getInitialState();
80
+ draft.toolOptions.data = data;
81
+ draft.toolOptions.selectedOptionPanel = null;
82
+ draft.toolOptions.selectedTool = 'zoom';
83
+ currentIsFid = datum.info.isFid;
84
+ }
85
+ }
86
+ setDomain(draft, updateDomainOptions);
87
+ if (previousIsFid !== currentIsFid) {
88
+ setMode(draft);
89
+ changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
90
+ }
91
+ }
92
+ function rollbackSpectrum(draft, options) {
93
+ const { filterKey, reset = false, updateFilterViewOptions = true } = options;
94
+ //return back the spectra data to point of time before applying a specific filter
95
+ const applyFilter = [
96
+ Filters.phaseCorrection.id,
97
+ Filters.fft.id,
98
+ Filters.shiftX.id,
99
+ Filters.shift2DX.id,
100
+ Filters.shift2DY.id,
101
+ Filters.signalProcessing.id,
102
+ ].includes(filterKey);
103
+ rollbackSpectrumByFilter(draft, {
104
+ searchBy: 'name',
105
+ key: filterKey,
106
+ applyFilter,
107
+ reset,
108
+ });
109
+ if (updateFilterViewOptions) {
110
+ updateFilterOptionsInView(draft, filterKey);
111
+ }
112
+ }
113
+ function updateFilterOptionsInView(draft, filterKey) {
114
+ const activeSpectrum = getActiveSpectrum(draft);
115
+ switch (filterKey) {
116
+ case Filters.phaseCorrection.id: {
117
+ // look for the strongest peak to set it as a pivot
118
+ const { xValue, index } = getStrongestPeak(draft) || {
119
+ xValue: 0,
120
+ index: 0,
121
+ };
122
+ draft.toolOptions.data.pivot = { value: xValue, index };
123
+ break;
124
+ }
125
+ case Filters.baselineCorrection.id: {
126
+ if (activeSpectrum) {
127
+ const baselineCorrectionFilter = current(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === Tools.baselineCorrection.id);
128
+ if (baselineCorrectionFilter) {
129
+ draft.toolOptions.data.baselineCorrection.zones =
130
+ baselineCorrectionFilter
131
+ ? baselineCorrectionFilter.value.zones
132
+ : [];
133
+ }
134
+ }
135
+ break;
136
+ }
137
+ case Filters.apodization.id: {
138
+ draft.toolOptions.data.apodizationOptions = defaultApodizationOptions;
139
+ break;
140
+ }
141
+ default:
142
+ break;
143
+ }
144
+ }
145
+ /**
146
+ * getActiveFilterIndex return active filter index. Otherwise, its returns -1
147
+ */
148
+ function getActiveFilterIndex(draft) {
149
+ const activeSpectrum = getActiveSpectrum(draft);
150
+ const id = draft.toolOptions.data.activeFilterID;
151
+ if (id && activeSpectrum) {
152
+ const spectrum = draft.data[activeSpectrum.index];
153
+ const index = spectrum.filters.findIndex((filter) => filter.id === id);
154
+ return index;
155
+ }
156
+ return -1;
157
+ }
158
+ function updateView(draft, filterUpdateDomainRules) {
159
+ draft.tempData = null;
160
+ const { updateXDomain, updateYDomain } = filterUpdateDomainRules;
161
+ resetSelectedTool(draft);
162
+ setDomain(draft, { updateXDomain, updateYDomain });
163
+ setMode(draft);
164
+ changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
165
+ }
166
+ //action
167
+ function handleShiftSpectrumAlongXAxis(draft, action) {
21
168
  //apply filter into the spectrum
169
+ const { shift } = action.payload;
22
170
  const activeSpectrum = getActiveSpectrum(draft);
23
171
  if (activeSpectrum) {
24
172
  const activeFilterIndex = getActiveFilterIndex(draft);
@@ -38,7 +186,8 @@ function shiftSpectrumAlongXAxis(draft, shift) {
38
186
  }
39
187
  }
40
188
  }
41
- function applyZeroFillingFilter(draft, action) {
189
+ //action
190
+ function handleApplyZeroFillingFilter(draft, action) {
42
191
  const activeSpectrum = getActiveSpectrum(draft);
43
192
  if (activeSpectrum) {
44
193
  const activeFilterIndex = getActiveFilterIndex(draft);
@@ -64,7 +213,24 @@ function applyZeroFillingFilter(draft, action) {
64
213
  }
65
214
  }
66
215
  }
67
- function calculateApodizationFilter(draft, action) {
216
+ //action
217
+ function handleCalculateZeroFillingFilter(draft, action) {
218
+ const activeSpectrum = getActiveSpectrum(draft);
219
+ if (activeSpectrum) {
220
+ const index = activeSpectrum.index;
221
+ const { data: { x, re, im }, filters, info, } = draft.tempData[index];
222
+ let _data = { data: { x, re, im }, filters, info };
223
+ zeroFilling(_data, action.payload);
224
+ const { im: newIm, re: newRe, x: newX } = _data.data;
225
+ const datum = draft.data[index];
226
+ datum.data.x = newX;
227
+ datum.data.im = newIm;
228
+ datum.data.re = newRe;
229
+ draft.xDomain = [newX[0], newX.at(-1)];
230
+ }
231
+ }
232
+ //action
233
+ function handleCalculateApodizationFilter(draft, action) {
68
234
  const activeSpectrum = getActiveSpectrum(draft);
69
235
  if (activeSpectrum) {
70
236
  const index = activeSpectrum.index;
@@ -79,7 +245,8 @@ function calculateApodizationFilter(draft, action) {
79
245
  datum.data.re = newRe;
80
246
  }
81
247
  }
82
- function applyApodizationFilter(draft, action) {
248
+ //action
249
+ function handleApplyApodizationFilter(draft, action) {
83
250
  const activeSpectrum = getActiveSpectrum(draft);
84
251
  if (activeSpectrum) {
85
252
  const index = activeSpectrum.index;
@@ -102,22 +269,8 @@ function applyApodizationFilter(draft, action) {
102
269
  }
103
270
  }
104
271
  }
105
- function calculateZeroFillingFilter(draft, action) {
106
- const activeSpectrum = getActiveSpectrum(draft);
107
- if (activeSpectrum) {
108
- const index = activeSpectrum.index;
109
- const { data: { x, re, im }, filters, info, } = draft.tempData[index];
110
- let _data = { data: { x, re, im }, filters, info };
111
- zeroFilling(_data, action.payload);
112
- const { im: newIm, re: newRe, x: newX } = _data.data;
113
- const datum = draft.data[index];
114
- datum.data.x = newX;
115
- datum.data.im = newIm;
116
- datum.data.re = newRe;
117
- draft.xDomain = [newX[0], newX[newX.length - 1]];
118
- }
119
- }
120
- function applyFFTFilter(draft) {
272
+ //action
273
+ function handleApplyFFTFilter(draft) {
121
274
  const activeSpectrum = getActiveSpectrum(draft);
122
275
  if (activeSpectrum) {
123
276
  const { index } = activeSpectrum;
@@ -135,11 +288,12 @@ function applyFFTFilter(draft) {
135
288
  }
136
289
  }
137
290
  }
138
- function applyManualPhaseCorrectionFilter(draft, filterOptions) {
291
+ //action
292
+ function handleApplyManualPhaseCorrectionFilter(draft, action) {
139
293
  const activeSpectrum = getActiveSpectrum(draft);
140
294
  if (activeSpectrum) {
141
295
  const { index } = activeSpectrum;
142
- const { ph0, ph1 } = filterOptions;
296
+ const { ph0, ph1 } = action.payload;
143
297
  draft.data = draft.tempData;
144
298
  const activeFilterIndex = getActiveFilterIndex(draft);
145
299
  FiltersManager.applyFilter(draft.data[index], [
@@ -160,7 +314,23 @@ function applyManualPhaseCorrectionFilter(draft, filterOptions) {
160
314
  }
161
315
  }
162
316
  }
163
- function applyAbsoluteFilter(draft) {
317
+ //action
318
+ function handleCalculateManualPhaseCorrection(draft, action) {
319
+ const activeSpectrum = getActiveSpectrum(draft);
320
+ if (activeSpectrum) {
321
+ const { index } = activeSpectrum;
322
+ const { data: { x, re, im }, info, } = draft.tempData[index];
323
+ const { ph0, ph1 } = action.payload;
324
+ let _data = { data: { x, re, im }, info };
325
+ phaseCorrection(_data, { ph0, ph1 });
326
+ const { im: newIm, re: newRe } = _data.data;
327
+ const datum = draft.data[index];
328
+ datum.data.im = newIm;
329
+ datum.data.re = newRe;
330
+ }
331
+ }
332
+ //action
333
+ function handleApplyAbsoluteFilter(draft) {
164
334
  const activeSpectrum = getActiveSpectrum(draft);
165
335
  if (activeSpectrum) {
166
336
  const { index } = activeSpectrum;
@@ -183,7 +353,8 @@ function applyAbsoluteFilter(draft) {
183
353
  }
184
354
  }
185
355
  }
186
- function applyAutoPhaseCorrectionFilter(draft) {
356
+ //action
357
+ function handleApplyAutoPhaseCorrectionFilter(draft) {
187
358
  const activeSpectrum = getActiveSpectrum(draft);
188
359
  if (activeSpectrum) {
189
360
  const { index } = activeSpectrum;
@@ -206,7 +377,35 @@ function applyAutoPhaseCorrectionFilter(draft) {
206
377
  }
207
378
  }
208
379
  }
209
- function calculateBaseLineCorrection(draft, action) {
380
+ //action
381
+ function handleBaseLineCorrectionFilter(draft, action) {
382
+ const activeSpectrum = getActiveSpectrum(draft);
383
+ if (activeSpectrum) {
384
+ const { zones } = draft.toolOptions.data.baselineCorrection;
385
+ const { livePreview, ...options } = action.payload;
386
+ const activeFilterIndex = getActiveFilterIndex(draft);
387
+ FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
388
+ {
389
+ name: Filters.baselineCorrection.id,
390
+ value: {
391
+ ...options,
392
+ zones,
393
+ },
394
+ },
395
+ ], { filterIndex: activeFilterIndex });
396
+ if (activeFilterIndex !== -1) {
397
+ rollbackSpectrumByFilter(draft, {
398
+ searchBy: 'name',
399
+ key: Filters.baselineCorrection.id,
400
+ triggerSource: 'Apply',
401
+ });
402
+ }
403
+ else {
404
+ updateView(draft, Filters.baselineCorrection.DOMAIN_UPDATE_RULES);
405
+ }
406
+ }
407
+ }
408
+ function calculateBaseLineCorrection(draft, baseLineOptions) {
210
409
  const activeSpectrum = getActiveSpectrum(draft);
211
410
  if (activeSpectrum) {
212
411
  const { index } = activeSpectrum;
@@ -214,7 +413,7 @@ function calculateBaseLineCorrection(draft, action) {
214
413
  // save the baseline options temporary
215
414
  draft.toolOptions.data.baselineCorrection = {
216
415
  ...draft.toolOptions.data.baselineCorrection,
217
- ...(action?.options ? { options: action.options } : {}),
416
+ ...(baseLineOptions ? { options: baseLineOptions } : {}),
218
417
  };
219
418
  const { zones, options } = draft.toolOptions.data.baselineCorrection;
220
419
  const { livePreview, ...filterOptions } = options;
@@ -231,25 +430,17 @@ function calculateBaseLineCorrection(draft, action) {
231
430
  }
232
431
  }
233
432
  }
234
- function calculateManualPhaseCorrection(draft, filterOptions) {
235
- const activeSpectrum = getActiveSpectrum(draft);
236
- if (activeSpectrum) {
237
- const { index } = activeSpectrum;
238
- const { data: { x, re, im }, info, } = draft.tempData[index];
239
- const { ph0, ph1 } = filterOptions;
240
- let _data = { data: { x, re, im }, info };
241
- phaseCorrection(_data, { ph0, ph1 });
242
- const { im: newIm, re: newRe } = _data.data;
243
- const datum = draft.data[index];
244
- datum.data.im = newIm;
245
- datum.data.re = newRe;
246
- }
433
+ //action
434
+ function handleCalculateBaseLineCorrection(draft, action) {
435
+ calculateBaseLineCorrection(draft, action.payload);
247
436
  }
248
- function enableFilter(draft, filterID, checked) {
437
+ //action
438
+ function handleEnableFilter(draft, action) {
439
+ const { id: filterID, enabled } = action.payload;
249
440
  const activeSpectrum = getActiveSpectrum(draft);
250
441
  if (activeSpectrum) {
251
442
  //apply filter into the spectrum
252
- FiltersManager.enableFilter(draft.data[activeSpectrum.index], filterID, checked);
443
+ FiltersManager.enableFilter(draft.data[activeSpectrum.index], filterID, enabled);
253
444
  resetSelectedTool(draft);
254
445
  setDomain(draft);
255
446
  setMode(draft);
@@ -261,8 +452,9 @@ function enableFilter(draft, filterID, checked) {
261
452
  }
262
453
  }
263
454
  }
264
- function deleteFilter(draft, actions) {
265
- const filterID = actions.payload?.id;
455
+ //action
456
+ function handleDeleteFilter(draft, action) {
457
+ const filterID = action?.payload?.id;
266
458
  const activeSpectrum = getActiveSpectrum(draft);
267
459
  if (activeSpectrum) {
268
460
  //apply filter into the spectrum
@@ -273,12 +465,13 @@ function deleteFilter(draft, actions) {
273
465
  setMode(draft);
274
466
  }
275
467
  }
276
- function deleteSpectraFilter(draft, actions) {
277
- const filterType = actions.payload.filterType;
468
+ //action
469
+ function handleDeleteSpectraFilter(draft, action) {
470
+ const filterName = action.payload.filterName;
278
471
  if (draft.view.spectra.activeTab) {
279
472
  for (const datum of draft.data) {
280
473
  if (nucleusToString(datum?.info?.nucleus) === draft.view.spectra.activeTab) {
281
- const filtersResult = datum.filters?.filter((filter) => filter.name === filterType) || [];
474
+ const filtersResult = datum.filters?.filter((filter) => filter.name === filterName) || [];
282
475
  for (const filter of filtersResult) {
283
476
  FiltersManager.deleteFilter(datum, filter.id);
284
477
  }
@@ -289,115 +482,8 @@ function deleteSpectraFilter(draft, actions) {
289
482
  setMode(draft);
290
483
  }
291
484
  }
292
- function handleBaseLineCorrectionFilter(draft, action) {
293
- const activeSpectrum = getActiveSpectrum(draft);
294
- if (activeSpectrum) {
295
- const { zones } = draft.toolOptions.data.baselineCorrection;
296
- const { livePreview, ...options } = action.options;
297
- const activeFilterIndex = getActiveFilterIndex(draft);
298
- FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
299
- {
300
- name: Filters.baselineCorrection.id,
301
- value: {
302
- zones,
303
- ...options,
304
- },
305
- },
306
- ], { filterIndex: activeFilterIndex });
307
- if (activeFilterIndex !== -1) {
308
- rollbackSpectrumByFilter(draft, {
309
- searchBy: 'name',
310
- key: Filters.baselineCorrection.id,
311
- triggerSource: 'Apply',
312
- });
313
- }
314
- else {
315
- updateView(draft, Filters.baselineCorrection.DOMAIN_UPDATE_RULES);
316
- }
317
- }
318
- }
319
- /**
320
- * reset spectrum data for specific point of time (Filter)
321
- * @param {object} draft
322
- * @param {object} options
323
- * @param {string} options.id Filter id
324
- * @param {boolean=} options.resetTool
325
- * @param {boolean=} options.updateDomain
326
- * @param {boolean=} options.rollback
327
- */
328
- function getFilterUpdateDomainRules(filterName) {
329
- return (
330
- // eslint-disable-next-line import/namespace
331
- Filters[filterName]?.DOMAIN_UPDATE_RULES || {
332
- updateXDomain: false,
333
- updateYDomain: false,
334
- });
335
- }
336
- function rollbackSpectrumByFilter(draft, options) {
337
- const { applyFilter = true, searchBy = 'id', reset = false, key, activeSpectrum, triggerSource = 'none', } = options || {};
338
- const currentActiveSpectrum = activeSpectrum || getActiveSpectrum(draft);
339
- let updateDomainOptions = {
340
- updateXDomain: false,
341
- updateYDomain: false,
342
- };
343
- let previousIsFid = false;
344
- let currentIsFid = false;
345
- if (currentActiveSpectrum) {
346
- const index = currentActiveSpectrum.index;
347
- const datum = draft.data[index];
348
- previousIsFid = datum.info.isFid;
349
- const filterIndex = datum.filters.findIndex((f) => f[searchBy] === key);
350
- const activeFilterId = draft.toolOptions.data.activeFilterID;
351
- if (filterIndex !== -1 && !reset) {
352
- const filters = datum.filters.slice(0, filterIndex || 1);
353
- //set active filter
354
- draft.toolOptions.data.activeFilterID = datum.filters[filterIndex]?.id;
355
- if (filters.length > 0) {
356
- for (let i = 0; i <= filterIndex; i++) {
357
- const { updateXDomain, updateYDomain } = getFilterUpdateDomainRules(datum.filters[i].name);
358
- updateDomainOptions.updateXDomain =
359
- updateXDomain || updateDomainOptions.updateXDomain;
360
- updateDomainOptions.updateYDomain =
361
- updateYDomain || updateDomainOptions.updateYDomain;
362
- }
363
- FiltersManager.reapplyFilters(datum, filters);
364
- }
365
- draft.tempData = current(draft).data;
366
- // apply the current Filters
367
- if (applyFilter) {
368
- FiltersManager.reapplyFilters(datum, datum.filters.slice(0, filterIndex + 1));
369
- }
370
- currentIsFid = datum.info.isFid;
371
- //if we still point to the same filter then close the filter options panel and reset the selected tool to default one (zoom tool)
372
- if (activeFilterId === datum.filters[filterIndex].id &&
373
- triggerSource === 'Apply') {
374
- draft.toolOptions.selectedOptionPanel = null;
375
- draft.toolOptions.selectedTool = Tools.zoom.id;
376
- }
377
- }
378
- else {
379
- //if the filter is not exists, create a clone of the current data
380
- draft.tempData = current(draft).data;
381
- }
382
- // re-implement all filters and rest all view property that related to filters
383
- if (reset) {
384
- draft.tempData = null;
385
- FiltersManager.reapplyFilters(datum);
386
- updateDomainOptions = { updateXDomain: true, updateYDomain: true };
387
- const { toolOptions: { data }, } = getInitialState();
388
- draft.toolOptions.data = data;
389
- draft.toolOptions.selectedOptionPanel = null;
390
- draft.toolOptions.selectedTool = Tools.zoom.id;
391
- currentIsFid = datum.info.isFid;
392
- }
393
- }
394
- setDomain(draft, updateDomainOptions);
395
- if (previousIsFid !== currentIsFid) {
396
- setMode(draft);
397
- changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
398
- }
399
- }
400
- function filterSnapshotHandler(draft, action) {
485
+ //action
486
+ function handleSetFilterSnapshotHandler(draft, action) {
401
487
  const { name: filterKey, id } = action.payload;
402
488
  const reset = draft.toolOptions.data.activeFilterID === id;
403
489
  if (Tools?.[filterKey]?.isFilter) {
@@ -408,26 +494,7 @@ function filterSnapshotHandler(draft, action) {
408
494
  rollbackSpectrum(draft, { filterKey, reset });
409
495
  }
410
496
  }
411
- function handleMultipleSpectraFilter(draft, action) {
412
- const spectra = getSpectraByNucleus(draft.view.spectra.activeTab, draft.data);
413
- if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
414
- const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
415
- ?.value || [];
416
- for (const spectrum of spectra) {
417
- const filters = action.payload.map((filter) => {
418
- if (filter.name === Filters.equallySpaced.id) {
419
- return {
420
- ...filter,
421
- options: { ...filter.options, exclusions },
422
- };
423
- }
424
- return filter;
425
- });
426
- FiltersManager.applyFilter(spectrum, filters);
427
- }
428
- }
429
- setDomain(draft);
430
- }
497
+ //action
431
498
  function handleSignalProcessingFilter(draft, action) {
432
499
  const { data, view } = draft;
433
500
  const nucleus = view.spectra.activeTab;
@@ -445,8 +512,9 @@ function handleSignalProcessingFilter(draft, action) {
445
512
  const { updateXDomain, updateYDomain } = Filters.signalProcessing.DOMAIN_UPDATE_RULES;
446
513
  setDomain(draft, { updateXDomain, updateYDomain });
447
514
  }
515
+ //action
448
516
  function handleAddExclusionZone(draft, action) {
449
- const { from: startX, to: endX } = action.payload;
517
+ const { startX, endX } = action.payload;
450
518
  const range = getRange(draft, { startX, endX });
451
519
  let spectra;
452
520
  const activeSpectrum = getActiveSpectrum(draft);
@@ -474,11 +542,12 @@ function handleAddExclusionZone(draft, action) {
474
542
  const { updateXDomain, updateYDomain } = Filters.exclusionZones.DOMAIN_UPDATE_RULES;
475
543
  setDomain(draft, { updateXDomain, updateYDomain });
476
544
  }
545
+ //action
477
546
  function handleDeleteExclusionZone(draft, action) {
478
- const { zone, spectrumID } = action.payload;
547
+ const { zone, spectrumId } = action.payload;
479
548
  // if spectrum id exists, remove the selected exclusion zone in the spectrum
480
- if (spectrumID) {
481
- const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
549
+ if (spectrumId) {
550
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumId);
482
551
  const filter = draft.data[spectrumIndex].filters.find((_filter) => _filter.name === Filters.exclusionZones.id);
483
552
  if (filter) {
484
553
  if (filter.value.length === 1) {
@@ -503,78 +572,4 @@ function handleDeleteExclusionZone(draft, action) {
503
572
  }
504
573
  }
505
574
  }
506
- function rollbackSpectrum(draft, options) {
507
- const { filterKey, reset = false, updateFilterViewOptions = true } = options;
508
- //return back the spectra data to point of time before applying a specific filter
509
- const applyFilter = [
510
- Filters.phaseCorrection.id,
511
- Filters.fft.id,
512
- Filters.shiftX.id,
513
- Filters.shift2DX.id,
514
- Filters.shift2DY.id,
515
- Filters.signalProcessing.id,
516
- ].includes(filterKey);
517
- rollbackSpectrumByFilter(draft, {
518
- searchBy: 'name',
519
- key: filterKey,
520
- applyFilter,
521
- reset,
522
- });
523
- if (updateFilterViewOptions) {
524
- updateFilterOptionsInView(draft, filterKey);
525
- }
526
- }
527
- function updateFilterOptionsInView(draft, filterKey) {
528
- const activeSpectrum = getActiveSpectrum(draft);
529
- switch (filterKey) {
530
- case Filters.phaseCorrection.id: {
531
- // look for the strongest peak to set it as a pivot
532
- const { xValue, index } = getStrongestPeak(draft) || {
533
- xValue: 0,
534
- index: 0,
535
- };
536
- draft.toolOptions.data.pivot = { value: xValue, index };
537
- break;
538
- }
539
- case Filters.baselineCorrection.id: {
540
- if (activeSpectrum) {
541
- const baselineCorrectionFilter = current(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === Tools.baselineCorrection.id);
542
- if (baselineCorrectionFilter) {
543
- draft.toolOptions.data.baselineCorrection.zones =
544
- baselineCorrectionFilter
545
- ? baselineCorrectionFilter.value.zones
546
- : [];
547
- }
548
- }
549
- break;
550
- }
551
- case Filters.apodization.id: {
552
- draft.toolOptions.data.apodizationOptions = defaultApodizationOptions;
553
- break;
554
- }
555
- default:
556
- break;
557
- }
558
- }
559
- /**
560
- * getActiveFilterIndex return active filter index. Otherwise, its returns -1
561
- */
562
- function getActiveFilterIndex(draft) {
563
- const activeSpectrum = getActiveSpectrum(draft);
564
- const id = draft.toolOptions.data.activeFilterID;
565
- if (id && activeSpectrum) {
566
- const spectrum = draft.data[activeSpectrum.index];
567
- const index = spectrum.filters.findIndex((filter) => filter.id === id);
568
- return index;
569
- }
570
- return -1;
571
- }
572
- function updateView(draft, filterUpdateDomainRules) {
573
- draft.tempData = null;
574
- const { updateXDomain, updateYDomain } = filterUpdateDomainRules;
575
- resetSelectedTool(draft);
576
- setDomain(draft, { updateXDomain, updateYDomain });
577
- setMode(draft);
578
- changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
579
- }
580
- export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyApodizationFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, calculateApodizationFilter, calculateZeroFillingFilter, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, rollbackSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, rollbackSpectrum, handleSignalProcessingFilter, };
575
+ export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
@@ -1,4 +1,9 @@
1
1
  import { Draft } from 'immer';
2
2
  import { State } from '../Reducer';
3
- declare function setIsOverDisplayer(draft: Draft<State>, actions: any): void;
4
- export { setIsOverDisplayer };
3
+ import { ActionType } from '../types/ActionType';
4
+ type SetIsOverDisplayerAction = ActionType<'SET_MOUSE_OVER_DISPLAYER', {
5
+ isMouseOverDisplayer: boolean;
6
+ }>;
7
+ export type GlobalActions = SetIsOverDisplayerAction;
8
+ declare function handleSetIsOverDisplayer(draft: Draft<State>, action: SetIsOverDisplayerAction): void;
9
+ export { handleSetIsOverDisplayer };
@@ -1,4 +1,4 @@
1
- function setIsOverDisplayer(draft, actions) {
2
- draft.overDisplayer = actions.payload;
1
+ function handleSetIsOverDisplayer(draft, action) {
2
+ draft.overDisplayer = action.payload.isMouseOverDisplayer;
3
3
  }
4
- export { setIsOverDisplayer };
4
+ export { handleSetIsOverDisplayer };