nmrium 0.29.0 → 0.30.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 (409) hide show
  1. package/README.md +12 -2
  2. package/lib/component/1d/ApodizationLine.d.ts +3 -0
  3. package/lib/component/1d/ApodizationLine.js +47 -0
  4. package/lib/component/1d/Chart1D.js +4 -2
  5. package/lib/component/1d/ExclusionZoneAnnotation.d.ts +1 -1
  6. package/lib/component/1d/ExclusionZoneAnnotation.js +14 -7
  7. package/lib/component/1d/IntegralResizable.js +5 -4
  8. package/lib/component/1d/LinesSeries.js +6 -6
  9. package/lib/component/1d/Viewer1D.js +7 -12
  10. package/lib/component/1d/database/DatabaseElements.js +2 -2
  11. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  12. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +3 -3
  13. package/lib/component/1d/multiAnalysis/AnalysisRange.js +16 -14
  14. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -4
  15. package/lib/component/1d/{PeakAnnotation.d.ts → peaks/PeakAnnotation.d.ts} +1 -2
  16. package/lib/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
  17. package/lib/component/1d/{PeakAnnotations.d.ts → peaks/PeakAnnotations.d.ts} +0 -0
  18. package/lib/component/1d/peaks/PeakAnnotations.js +26 -0
  19. package/lib/component/1d/peaks/PeaksShapes.d.ts +3 -0
  20. package/lib/component/1d/peaks/PeaksShapes.js +35 -0
  21. package/lib/component/1d/peaks/usePeakShapesPath.d.ts +13 -0
  22. package/lib/component/1d/peaks/usePeakShapesPath.js +45 -0
  23. package/lib/component/1d/ranges/Range.js +4 -4
  24. package/lib/component/2d/FooterBanner.js +2 -2
  25. package/lib/component/2d/Viewer2D.js +2 -2
  26. package/lib/component/2d/zones/Signal.d.ts +3 -2
  27. package/lib/component/2d/zones/Signal.js +3 -3
  28. package/lib/component/2d/zones/Zone.d.ts +1 -1
  29. package/lib/component/2d/zones/Zone.js +4 -4
  30. package/lib/component/EventsTrackers/KeysListenerTracker.js +91 -52
  31. package/lib/component/assignment/AssignmentsContext.d.ts +1 -1
  32. package/lib/component/context/GlobalContext.d.ts +1 -1
  33. package/lib/component/context/GlobalContext.js +3 -3
  34. package/lib/component/elements/ActiveButton.d.ts +17 -0
  35. package/lib/component/elements/ActiveButton.js +28 -0
  36. package/lib/component/elements/Button.d.ts +6 -6
  37. package/lib/component/elements/Button.js +5 -5
  38. package/lib/component/elements/ButtonToolTip.js +1 -1
  39. package/lib/component/elements/CheckBox.d.ts +2 -6
  40. package/lib/component/elements/CheckBox.js +4 -6
  41. package/lib/component/elements/Input.d.ts +5 -4
  42. package/lib/component/elements/Input.js +1 -1
  43. package/lib/component/elements/Label.d.ts +8 -6
  44. package/lib/component/elements/Label.js +3 -3
  45. package/lib/component/elements/MoleculeSelection.d.ts +2 -2
  46. package/lib/component/elements/MoleculeSelection.js +1 -1
  47. package/lib/component/elements/NextPrev.js +1 -1
  48. package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
  49. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
  50. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  51. package/lib/component/elements/Select.d.ts +7 -11
  52. package/lib/component/elements/Select.js +6 -8
  53. package/lib/component/elements/Tab/Tab.js +1 -1
  54. package/lib/component/elements/Table/Table.d.ts +1 -2
  55. package/lib/component/elements/Table/Table.js +2 -2
  56. package/lib/component/elements/ToggleButton.d.ts +1 -2
  57. package/lib/component/elements/ToggleButton.js +3 -2
  58. package/lib/component/elements/accordion/AccordionItem.js +2 -2
  59. package/lib/component/elements/formik/FormikNumberInput.d.ts +1 -1
  60. package/lib/component/elements/formik/FormikOnChange.d.ts +3 -2
  61. package/lib/component/elements/formik/FormikOnChange.js +11 -5
  62. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  63. package/lib/component/elements/resizer/DivResizer.js +3 -3
  64. package/lib/component/elements/resizer/Resizer.d.ts +1 -0
  65. package/lib/component/elements/resizer/SVGResizer.js +3 -3
  66. package/lib/component/header/ApodizationOptionsPanel.d.ts +2 -0
  67. package/lib/component/header/ApodizationOptionsPanel.js +81 -0
  68. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +2 -1
  69. package/lib/component/header/AutoPeakPickingOptionPanel.js +40 -36
  70. package/lib/component/header/BaseLineCorrectionPanel.d.ts +1 -2
  71. package/lib/component/header/BaseLineCorrectionPanel.js +84 -52
  72. package/lib/component/header/Header.js +5 -2
  73. package/lib/component/header/HeaderContainer.d.ts +7 -0
  74. package/lib/component/header/HeaderContainer.js +10 -0
  75. package/lib/component/header/ManualPhaseCorrectionPanel.js +27 -29
  76. package/lib/component/header/RangesPickingOptionPanel.js +19 -21
  77. package/lib/component/header/ZeroFillingOptionsPanel.js +49 -46
  78. package/lib/component/header/Zones2DOptionPanel.js +11 -13
  79. package/lib/component/highlight/index.d.ts +27 -10
  80. package/lib/component/highlight/index.js +19 -17
  81. package/lib/component/hooks/useCheckToolsVisibility.d.ts +10 -1
  82. package/lib/component/hooks/useCheckToolsVisibility.js +31 -1
  83. package/lib/component/hooks/useFilter.d.ts +1 -0
  84. package/lib/component/hooks/useFilter.js +7 -0
  85. package/lib/component/hooks/useToolsFunctions.js +1 -1
  86. package/lib/component/loader/DropZone.js +1 -1
  87. package/lib/component/modal/AlignSpectraModal.js +1 -2
  88. package/lib/component/modal/EditPeakShapeModal.d.ts +9 -0
  89. package/lib/component/modal/EditPeakShapeModal.js +85 -0
  90. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -3
  91. package/lib/component/modal/MoleculeStructureEditorModal.js +2 -3
  92. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
  93. package/lib/component/modal/PredictSpectraModal.js +1 -1
  94. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +1 -1
  95. package/lib/component/modal/changeSum/ChangeSumModal.js +9 -11
  96. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  97. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  98. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +4 -9
  99. package/lib/component/modal/setting/DatabasesTabContent.js +2 -2
  100. package/lib/component/modal/setting/DisplayTabContent.js +1 -1
  101. package/lib/component/modal/setting/FormattingTabContent.js +2 -2
  102. package/lib/component/modal/setting/GeneralSettings.js +1 -1
  103. package/lib/component/modal/setting/ToolsTabContent.js +13 -13
  104. package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -2
  105. package/lib/component/modal/setting/WorkspaceItem.js +2 -2
  106. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  107. package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +3 -3
  108. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
  109. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +5 -4
  110. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +13 -10
  111. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +4 -2
  112. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  113. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -2
  114. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +5 -3
  115. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +12 -4
  116. package/lib/component/panels/Panels.js +3 -3
  117. package/lib/component/panels/PeaksPanel/PeaksPanel.js +47 -22
  118. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
  119. package/lib/component/panels/PeaksPanel/PeaksTable.js +44 -13
  120. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  121. package/lib/component/panels/RangesPanel/RangesTableRow.js +4 -4
  122. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  123. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +3 -2
  124. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +3 -3
  125. package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +3 -3
  126. package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
  127. package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  128. package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.d.ts +1 -1
  129. package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
  130. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
  131. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
  132. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -2
  133. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  134. package/lib/component/panels/databasePanel/DatabasePanel.js +4 -12
  135. package/lib/component/panels/databasePanel/DatabaseTable.js +3 -3
  136. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
  137. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  138. package/lib/component/panels/header/DefaultPanelHeader.js +3 -12
  139. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  140. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +2 -1
  141. package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -2
  142. package/lib/component/panels/predictionPanel/PredictionPanel.js +15 -3
  143. package/lib/component/reducer/IgnoreActions.js +4 -0
  144. package/lib/component/reducer/Reducer.d.ts +37 -6
  145. package/lib/component/reducer/Reducer.js +25 -5
  146. package/lib/component/reducer/actions/FiltersActions.d.ts +13 -7
  147. package/lib/component/reducer/actions/FiltersActions.js +165 -29
  148. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  149. package/lib/component/reducer/actions/MoleculeActions.js +27 -14
  150. package/lib/component/reducer/actions/PeaksActions.d.ts +4 -1
  151. package/lib/component/reducer/actions/PeaksActions.js +38 -5
  152. package/lib/component/reducer/actions/RangesActions.js +2 -2
  153. package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
  154. package/lib/component/reducer/actions/ToolsActions.js +9 -72
  155. package/lib/component/reducer/helper/getStrongestPeak.d.ts +7 -0
  156. package/lib/component/reducer/helper/getStrongestPeak.js +14 -0
  157. package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
  158. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
  159. package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -15
  160. package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
  161. package/lib/component/reducer/types/Types.d.ts +7 -0
  162. package/lib/component/reducer/types/Types.js +7 -0
  163. package/lib/component/tool/BrushX.js +1 -1
  164. package/lib/component/tool/BrushXY.js +4 -3
  165. package/lib/component/tool/CrossLinePointer.js +5 -4
  166. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  167. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +14 -6
  168. package/lib/component/tool/FloatMoleculeStructures/index.d.ts +3 -2
  169. package/lib/component/tool/FloatMoleculeStructures/index.js +13 -6
  170. package/lib/component/toolbar/BasicToolBar.js +3 -8
  171. package/lib/component/toolbar/FunctionToolBar.js +11 -23
  172. package/lib/component/toolbar/ToolTypes.d.ts +7 -1
  173. package/lib/component/toolbar/ToolTypes.js +119 -9
  174. package/lib/component/utility/util/nmredata/addZones.js +3 -3
  175. package/lib/component/workspaces/Workspace.d.ts +4 -1
  176. package/lib/component/workspaces/basic.js +12 -11
  177. package/lib/component/workspaces/embedded.js +14 -13
  178. package/lib/component/workspaces/exercise.js +4 -6
  179. package/lib/component/workspaces/prediction.js +14 -13
  180. package/lib/component/workspaces/process1D.js +20 -19
  181. package/lib/component/workspaces/workspaceDefaultProperties.js +14 -15
  182. package/lib/constants.js +1 -1
  183. package/lib/data/Filters.d.ts +2 -2
  184. package/lib/data/Filters.js +2 -2
  185. package/lib/data/FiltersManager.js +3 -3
  186. package/lib/data/PredictionManager.d.ts +0 -1
  187. package/lib/data/PredictionManager.js +15 -15
  188. package/lib/data/SpectraManager.d.ts +2 -1
  189. package/lib/data/SpectraManager.js +2 -8
  190. package/lib/data/constants/SignalsKinds.d.ts +0 -1
  191. package/lib/data/constants/SignalsKinds.js +0 -8
  192. package/lib/data/data1d/Data1DManager.js +5 -5
  193. package/lib/data/data1d/Spectrum1D/SumManager.d.ts +5 -5
  194. package/lib/data/data1d/Spectrum1D/SumManager.js +18 -12
  195. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +2 -2
  196. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -1
  197. package/lib/data/data1d/Spectrum1D/index.js +2 -1
  198. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
  199. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
  200. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +4 -2
  201. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +1 -1
  202. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -16
  203. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +8 -0
  204. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +24 -0
  205. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
  206. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  207. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
  208. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
  209. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -3
  210. package/lib/data/data1d/database.js +4 -6
  211. package/lib/data/data1d/filter1d/apodization.d.ts +25 -0
  212. package/lib/data/data1d/filter1d/apodization.js +63 -0
  213. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +24 -7
  214. package/lib/data/data1d/filter1d/baselineCorrection.js +10 -17
  215. package/lib/data/data1d/filter1d/zeroFillingAndApodization.d.ts +9 -0
  216. package/lib/data/data1d/filter1d/zeroFillingAndApodization.js +24 -0
  217. package/lib/data/data2d/Processing2D.d.ts +3 -3
  218. package/lib/data/data2d/Processing2D.js +3 -2
  219. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -3
  220. package/lib/data/data2d/Spectrum2D/zones/detectZones.js +3 -3
  221. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -3
  222. package/lib/data/migration/MigrationManager.d.ts +1 -1
  223. package/lib/data/migration/MigrationManager.js +3 -1
  224. package/lib/data/migration/migrateToVersion3.d.ts +1 -0
  225. package/lib/data/migration/migrateToVersion3.js +55 -0
  226. package/lib/data/molecules/Molecule.d.ts +15 -6
  227. package/lib/data/molecules/Molecule.js +5 -8
  228. package/lib/data/molecules/MoleculeManager.d.ts +4 -4
  229. package/lib/data/molecules/MoleculeManager.js +5 -5
  230. package/lib/data/types/data1d/SumOptions.d.ts +1 -1
  231. package/lib/data/utilities/generateNumbersPowerOfX.d.ts +0 -1
  232. package/lib/data/utilities/generateNumbersPowerOfX.js +0 -1
  233. package/lib/data/utilities/isInRange.d.ts +7 -0
  234. package/lib/data/utilities/isInRange.js +4 -0
  235. package/lib/types/NMRiumDataReturn.d.ts +2 -2
  236. package/lib/types/NMRiumGeneralPreferences.d.ts +0 -2
  237. package/lib/types/NMRiumToolBarPreferences.d.ts +14 -13
  238. package/lib/versionInfo.js +1 -1
  239. package/lib-cjs/component/1d/ApodizationLine.js +75 -0
  240. package/lib-cjs/component/1d/Chart1D.js +4 -2
  241. package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +15 -8
  242. package/lib-cjs/component/1d/IntegralResizable.js +4 -3
  243. package/lib-cjs/component/1d/LinesSeries.js +5 -5
  244. package/lib-cjs/component/1d/Viewer1D.js +7 -12
  245. package/lib-cjs/component/1d/database/DatabaseElements.js +1 -1
  246. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -2
  247. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  248. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +15 -13
  249. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +1 -2
  250. package/lib-cjs/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
  251. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +31 -0
  252. package/lib-cjs/component/1d/peaks/PeaksShapes.js +40 -0
  253. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +49 -0
  254. package/lib-cjs/component/1d/ranges/Range.js +3 -3
  255. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  256. package/lib-cjs/component/2d/Viewer2D.js +2 -2
  257. package/lib-cjs/component/2d/zones/Signal.js +3 -3
  258. package/lib-cjs/component/2d/zones/Zone.js +3 -3
  259. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +89 -50
  260. package/lib-cjs/component/context/GlobalContext.js +4 -4
  261. package/lib-cjs/component/elements/ActiveButton.js +33 -0
  262. package/lib-cjs/component/elements/Button.js +5 -5
  263. package/lib-cjs/component/elements/ButtonToolTip.js +1 -1
  264. package/lib-cjs/component/elements/CheckBox.js +3 -5
  265. package/lib-cjs/component/elements/Input.js +1 -1
  266. package/lib-cjs/component/elements/Label.js +3 -3
  267. package/lib-cjs/component/elements/MoleculeSelection.js +1 -1
  268. package/lib-cjs/component/elements/NextPrev.js +1 -1
  269. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  270. package/lib-cjs/component/elements/Select.js +6 -8
  271. package/lib-cjs/component/elements/Tab/Tab.js +1 -1
  272. package/lib-cjs/component/elements/Table/Table.js +2 -2
  273. package/lib-cjs/component/elements/ToggleButton.js +3 -2
  274. package/lib-cjs/component/elements/accordion/AccordionItem.js +2 -2
  275. package/lib-cjs/component/elements/formik/FormikOnChange.js +10 -4
  276. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  277. package/lib-cjs/component/elements/resizer/DivResizer.js +3 -3
  278. package/lib-cjs/component/elements/resizer/SVGResizer.js +2 -2
  279. package/lib-cjs/component/header/ApodizationOptionsPanel.js +110 -0
  280. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +39 -35
  281. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +82 -49
  282. package/lib-cjs/component/header/Header.js +5 -2
  283. package/lib-cjs/component/header/HeaderContainer.js +14 -0
  284. package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +26 -28
  285. package/lib-cjs/component/header/RangesPickingOptionPanel.js +19 -21
  286. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +70 -44
  287. package/lib-cjs/component/header/Zones2DOptionPanel.js +11 -13
  288. package/lib-cjs/component/highlight/index.js +20 -18
  289. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +31 -1
  290. package/lib-cjs/component/hooks/useFilter.js +14 -0
  291. package/lib-cjs/component/hooks/useToolsFunctions.js +1 -1
  292. package/lib-cjs/component/loader/DropZone.js +1 -1
  293. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
  294. package/lib-cjs/component/modal/EditPeakShapeModal.js +113 -0
  295. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -3
  296. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
  297. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  298. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +9 -11
  299. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  300. package/lib-cjs/component/modal/editRange/EditRangeModal.js +2 -2
  301. package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +3 -8
  302. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +2 -2
  303. package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
  304. package/lib-cjs/component/modal/setting/FormattingTabContent.js +2 -2
  305. package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -1
  306. package/lib-cjs/component/modal/setting/ToolsTabContent.js +13 -13
  307. package/lib-cjs/component/modal/setting/WorkspaceItem.js +2 -2
  308. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  309. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
  310. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -9
  311. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  312. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +11 -3
  313. package/lib-cjs/component/panels/Panels.js +3 -3
  314. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +45 -20
  315. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
  316. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +42 -11
  317. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +1 -1
  318. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
  319. package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  320. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -1
  321. package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +3 -6
  322. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
  323. package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  324. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
  325. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
  326. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
  327. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -2
  328. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  329. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +4 -12
  330. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +2 -2
  331. package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -1
  332. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  333. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -12
  334. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  335. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -2
  336. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +15 -3
  337. package/lib-cjs/component/reducer/IgnoreActions.js +4 -0
  338. package/lib-cjs/component/reducer/Reducer.js +25 -8
  339. package/lib-cjs/component/reducer/actions/FiltersActions.js +170 -29
  340. package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -2
  341. package/lib-cjs/component/reducer/actions/MoleculeActions.js +27 -14
  342. package/lib-cjs/component/reducer/actions/PeaksActions.js +40 -4
  343. package/lib-cjs/component/reducer/actions/RangesActions.js +2 -2
  344. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +1 -1
  345. package/lib-cjs/component/reducer/actions/ToolsActions.js +8 -71
  346. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +18 -0
  347. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -5
  348. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
  349. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
  350. package/lib-cjs/component/reducer/types/Types.js +10 -3
  351. package/lib-cjs/component/tool/BrushX.js +1 -1
  352. package/lib-cjs/component/tool/BrushXY.js +4 -3
  353. package/lib-cjs/component/tool/CrossLinePointer.js +5 -4
  354. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +12 -4
  355. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +13 -6
  356. package/lib-cjs/component/toolbar/BasicToolBar.js +3 -8
  357. package/lib-cjs/component/toolbar/FunctionToolBar.js +10 -22
  358. package/lib-cjs/component/toolbar/ToolTypes.js +119 -9
  359. package/lib-cjs/component/utility/util/nmredata/addZones.js +3 -6
  360. package/lib-cjs/component/workspaces/basic.js +12 -11
  361. package/lib-cjs/component/workspaces/embedded.js +14 -13
  362. package/lib-cjs/component/workspaces/exercise.js +4 -6
  363. package/lib-cjs/component/workspaces/prediction.js +14 -13
  364. package/lib-cjs/component/workspaces/process1D.js +20 -19
  365. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +14 -15
  366. package/lib-cjs/constants.js +1 -1
  367. package/lib-cjs/data/Filters.js +3 -3
  368. package/lib-cjs/data/FiltersManager.js +3 -6
  369. package/lib-cjs/data/PredictionManager.js +15 -15
  370. package/lib-cjs/data/SpectraManager.js +2 -8
  371. package/lib-cjs/data/constants/SignalsKinds.js +0 -8
  372. package/lib-cjs/data/data1d/Data1DManager.js +5 -5
  373. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +18 -12
  374. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +2 -5
  375. package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
  376. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
  377. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
  378. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +4 -2
  379. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -19
  380. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +28 -0
  381. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
  382. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  383. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
  384. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -5
  385. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -6
  386. package/lib-cjs/data/data1d/database.js +4 -6
  387. package/lib-cjs/data/data1d/filter1d/apodization.js +70 -0
  388. package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +11 -18
  389. package/lib-cjs/data/data1d/filter1d/zeroFillingAndApodization.js +30 -0
  390. package/lib-cjs/data/data2d/Processing2D.js +3 -2
  391. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -6
  392. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +3 -6
  393. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -6
  394. package/lib-cjs/data/migration/MigrationManager.js +3 -1
  395. package/lib-cjs/data/migration/migrateToVersion3.js +58 -0
  396. package/lib-cjs/data/molecules/Molecule.js +5 -8
  397. package/lib-cjs/data/molecules/MoleculeManager.js +5 -5
  398. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +0 -1
  399. package/lib-cjs/data/utilities/isInRange.js +7 -0
  400. package/lib-cjs/versionInfo.js +1 -1
  401. package/package.json +32 -31
  402. package/lib/component/1d/PeakAnnotations.js +0 -41
  403. package/lib/data/data1d/filter1d/lineBroadening.d.ts +0 -14
  404. package/lib/data/data1d/filter1d/lineBroadening.js +0 -57
  405. package/lib/data/utilities/generateID.d.ts +0 -1
  406. package/lib/data/utilities/generateID.js +0 -9
  407. package/lib-cjs/component/1d/PeakAnnotations.js +0 -46
  408. package/lib-cjs/data/data1d/filter1d/lineBroadening.js +0 -63
  409. package/lib-cjs/data/utilities/generateID.js +0 -12
@@ -22,17 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.spectrumReducer = exports.dispatchMiddleware = exports.initState = exports.initialState = exports.getInitialState = void 0;
27
+ const uuid_1 = require("@lukeed/uuid");
30
28
  const immer_1 = require("immer");
31
29
  const nmr_correlation_1 = require("nmr-correlation");
32
30
  const PredictionManager_1 = require("../../data/PredictionManager");
33
31
  const SpectraManager = __importStar(require("../../data/SpectraManager"));
34
32
  const MigrationManager_1 = require("../../data/migration/MigrationManager");
35
- const generateID_1 = __importDefault(require("../../data/utilities/generateID"));
36
33
  const Constants_1 = require("../panels/SummaryPanel/CorrelationTable/Constants");
37
34
  const ToolTypes_1 = require("../toolbar/ToolTypes");
38
35
  const nmredataToNmrium_1 = require("../utility/nmredataToNmrium");
@@ -86,6 +83,7 @@ const getInitialState = () => ({
86
83
  activeSpectrum: null,
87
84
  mode: 'RTL',
88
85
  molecules: [],
86
+ view: { floatingMolecules: [] },
89
87
  verticalAlign: {
90
88
  align: 'bottom',
91
89
  verticalShift: Constants_2.DEFAULT_YAXIS_SHIFT_VALUE,
@@ -116,6 +114,7 @@ const getInitialState = () => ({
116
114
  options: {},
117
115
  zones: [],
118
116
  },
117
+ apodizationOptions: {},
119
118
  pivot: { value: 0, index: 0 },
120
119
  zonesNoiseFactor: 1,
121
120
  activeFilterID: null,
@@ -123,6 +122,10 @@ const getInitialState = () => ({
123
122
  showRangesIntegrals: true,
124
123
  showJGraph: false,
125
124
  predictionIndex: 0,
125
+ peaksOptions: {
126
+ showPeaksShapes: false,
127
+ showPeaksSum: false,
128
+ },
126
129
  },
127
130
  },
128
131
  usedColors: { '1d': [], '2d': [] },
@@ -130,7 +133,7 @@ const getInitialState = () => ({
130
133
  exports.getInitialState = getInitialState;
131
134
  exports.initialState = (0, exports.getInitialState)();
132
135
  function initState(state) {
133
- const displayerKey = (0, generateID_1.default)();
136
+ const displayerKey = (0, uuid_1.v4)();
134
137
  const correlations = (0, nmr_correlation_1.buildCorrelationData)([], {
135
138
  tolerance: Constants_1.DefaultTolerance,
136
139
  });
@@ -226,6 +229,14 @@ function innerSpectrumReducer(draft, action) {
226
229
  return PeaksActions.addPeaks(draft, action);
227
230
  case types.DELETE_PEAK_NOTATION:
228
231
  return PeaksActions.deletePeak(draft, action.data);
232
+ case types.AUTO_PEAK_PICKING:
233
+ return PeaksActions.handleAutoPeakPicking(draft, action.options);
234
+ case types.OPTIMIZE_PEAKS:
235
+ return PeaksActions.handleOptimizePeaks(draft, action);
236
+ case types.CHANGE_PEAK_SHAPE:
237
+ return PeaksActions.changePeakShapeHandler(draft, action);
238
+ case types.TOGGLE_PEAKS_SHAPES:
239
+ return PeaksActions.handleShowPeaksShapes(draft, action);
229
240
  case types.ADD_INTEGRAL:
230
241
  return IntegralsActions.addIntegral(draft, action);
231
242
  case types.DELETE_INTEGRAL:
@@ -258,10 +269,18 @@ function innerSpectrumReducer(draft, action) {
258
269
  return ToolsActions.setSelectedOptionPanel(draft, action.selectedOptionPanel);
259
270
  case types.FULL_ZOOM_OUT:
260
271
  return ToolsActions.zoomOut(draft, action);
272
+ case types.DISABLE_FILTER_LIVE_PREVIEW:
273
+ return FiltersActions.handleDisableFilterLivePreview(draft, action);
261
274
  case types.SHIFT_SPECTRUM:
262
275
  return FiltersActions.shiftSpectrumAlongXAxis(draft, action.shiftValue);
276
+ case types.APPLY_APODIZATION_FILTER:
277
+ return FiltersActions.applyApodizationFilter(draft, action);
278
+ case types.CALCULATE_APODIZATION_FILTER:
279
+ return FiltersActions.calculateApodizationFilter(draft, action);
263
280
  case types.APPLY_ZERO_FILLING_FILTER:
264
- return FiltersActions.applyZeroFillingFilter(draft, action.value);
281
+ return FiltersActions.applyZeroFillingFilter(draft, action);
282
+ case types.CALCULATE_ZERO_FILLING_FILTER:
283
+ return FiltersActions.calculateZeroFillingFilter(draft, action);
265
284
  case types.APPLY_FFT_FILTER:
266
285
  return FiltersActions.applyFFTFilter(draft);
267
286
  case types.APPLY_MANUAL_PHASE_CORRECTION_FILTER:
@@ -346,8 +365,6 @@ function innerSpectrumReducer(draft, action) {
346
365
  return ToolsActions.setVerticalIndicatorXPosition(draft, action.position);
347
366
  case types.SET_SPECTRUMS_VERTICAL_ALIGN:
348
367
  return ToolsActions.setSpectrumsVerticalAlign(draft);
349
- case types.AUTO_PEAK_PICKING:
350
- return PeaksActions.handleAutoPeakPicking(draft, action.options);
351
368
  case types.AUTO_ZONES_DETECTION:
352
369
  return ZonesActions.handleAutoZonesDetection(draft, action.options);
353
370
  case types.CHANGE_ZONES_NOISE_FACTOR:
@@ -26,20 +26,24 @@ 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.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateBaseLineCorrection = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
29
+ exports.setFilterChanges = exports.handleDisableFilterLivePreview = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.resetSpectrumByFilter = 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;
30
+ const uuid_1 = require("@lukeed/uuid");
30
31
  const immer_1 = require("immer");
31
32
  const Filters = __importStar(require("../../../data/Filters"));
32
33
  const FiltersManager = __importStar(require("../../../data/FiltersManager"));
33
34
  const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
35
+ const apodization_1 = require("../../../data/data1d/filter1d/apodization");
34
36
  const autoPhaseCorrection_1 = require("../../../data/data1d/filter1d/autoPhaseCorrection");
35
37
  const baselineCorrection_1 = require("../../../data/data1d/filter1d/baselineCorrection");
36
38
  const phaseCorrection_1 = require("../../../data/data1d/filter1d/phaseCorrection");
39
+ const zeroFilling_1 = require("../../../data/data1d/filter1d/zeroFilling");
37
40
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
38
- const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
41
+ const ToolTypes_1 = require("../../toolbar/ToolTypes");
39
42
  const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
40
43
  const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
41
44
  const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
42
45
  const getRange_1 = __importDefault(require("../helper/getRange"));
46
+ const getStrongestPeak_1 = require("../helper/getStrongestPeak");
43
47
  const DomainActions_1 = require("./DomainActions");
44
48
  const PreferencesActions_1 = require("./PreferencesActions");
45
49
  const ToolsActions_1 = require("./ToolsActions");
@@ -56,14 +60,14 @@ function shiftSpectrumAlongXAxis(draft, shiftValue) {
56
60
  }
57
61
  }
58
62
  exports.shiftSpectrumAlongXAxis = shiftSpectrumAlongXAxis;
59
- function applyZeroFillingFilter(draft, filterOptions) {
63
+ function applyZeroFillingFilter(draft, action) {
60
64
  if (draft.activeSpectrum?.id) {
61
65
  const index = draft.activeSpectrum.index;
66
+ const { size } = action.payload;
62
67
  const filters = [
63
- { name: Filters.zeroFilling.id, options: filterOptions.zeroFillingSize },
64
68
  {
65
- name: Filters.lineBroadening.id,
66
- options: filterOptions.lineBroadeningValue,
69
+ name: Filters.zeroFilling.id,
70
+ options: size,
67
71
  },
68
72
  ];
69
73
  FiltersManager.applyFilter(draft.data[index], filters);
@@ -73,6 +77,52 @@ function applyZeroFillingFilter(draft, filterOptions) {
73
77
  }
74
78
  }
75
79
  exports.applyZeroFillingFilter = applyZeroFillingFilter;
80
+ function calculateApodizationFilter(draft, action) {
81
+ if (draft.activeSpectrum) {
82
+ const index = draft.activeSpectrum.index;
83
+ const options = action.payload;
84
+ const { data: { x, re, im }, info, } = draft.data[index];
85
+ let _data = { data: { x, re, im }, info };
86
+ draft.toolOptions.data.apodizationOptions = options;
87
+ (0, apodization_1.apply)(_data, options);
88
+ const { im: newIm, re: newRe } = _data.data;
89
+ draft.tempData[index].data.im = newIm;
90
+ draft.tempData[index].data.re = newRe;
91
+ }
92
+ }
93
+ exports.calculateApodizationFilter = calculateApodizationFilter;
94
+ function applyApodizationFilter(draft, action) {
95
+ if (draft.activeSpectrum?.id) {
96
+ const index = draft.activeSpectrum.index;
97
+ const options = action.payload;
98
+ const filters = [
99
+ {
100
+ name: Filters.apodization.id,
101
+ options,
102
+ },
103
+ ];
104
+ FiltersManager.applyFilter(draft.data[index], filters);
105
+ (0, ToolsActions_1.resetSelectedTool)(draft);
106
+ (0, DomainActions_1.setDomain)(draft);
107
+ (0, DomainActions_1.setMode)(draft);
108
+ }
109
+ }
110
+ exports.applyApodizationFilter = applyApodizationFilter;
111
+ function calculateZeroFillingFilter(draft, action) {
112
+ if (draft.activeSpectrum) {
113
+ const index = draft.activeSpectrum.index;
114
+ const { size } = action.payload;
115
+ const { data: { x, re, im }, filters, info, } = draft.data[index];
116
+ let _data = { data: { x, re, im }, filters, info };
117
+ (0, zeroFilling_1.apply)(_data, size);
118
+ const { im: newIm, re: newRe, x: newX } = _data.data;
119
+ draft.tempData[index].data.x = newX;
120
+ draft.tempData[index].data.im = newIm;
121
+ draft.tempData[index].data.re = newRe;
122
+ draft.xDomain = [newX[0], newX[newX.length - 1]];
123
+ }
124
+ }
125
+ exports.calculateZeroFillingFilter = calculateZeroFillingFilter;
76
126
  function applyFFTFilter(draft) {
77
127
  if (draft.activeSpectrum?.id) {
78
128
  const { index } = draft.activeSpectrum;
@@ -230,12 +280,13 @@ function handleBaseLineCorrectionFilter(draft, action) {
230
280
  if (draft.activeSpectrum?.id) {
231
281
  const { index } = draft.activeSpectrum;
232
282
  const { zones } = draft.toolOptions.data.baselineCorrection;
283
+ const { livePreview, ...options } = action.options;
233
284
  FiltersManager.applyFilter(draft.data[index], [
234
285
  {
235
286
  name: Filters.baselineCorrection.id,
236
287
  options: {
237
288
  zones,
238
- ...action.options,
289
+ ...options,
239
290
  },
240
291
  },
241
292
  ]);
@@ -249,27 +300,26 @@ exports.handleBaseLineCorrectionFilter = handleBaseLineCorrectionFilter;
249
300
  /**
250
301
  * reset spectrum data for specific point of time (Filter)
251
302
  * @param {object} draft
252
- * @param {string} id Filter id
253
303
  * @param {object} options
304
+ * @param {string} options.id Filter id
254
305
  * @param {boolean=} options.resetTool
255
306
  * @param {boolean=} options.updateDomain
256
307
  * @param {boolean=} options.rollback
257
308
  */
258
- function resetSpectrumByFilter(draft, id = null, options = {}, activeSpectrum = null) {
259
- const { updateDomain = true, rollback = false, searchBy = 'id', returnCurrentDatum = false, } = options;
309
+ function resetSpectrumByFilter(draft, options) {
310
+ const { updateDomain = true, rollback = false, searchBy = 'id', applyFilter = false, // the filter that we rollback and return the affect data for the selected spectrum
311
+ filterId, } = options || {};
260
312
  let currentDatum = null;
261
- const currentActiveSpectrum = activeSpectrum
262
- ? activeSpectrum
263
- : draft.activeSpectrum;
313
+ const currentActiveSpectrum = draft.activeSpectrum;
264
314
  if (currentActiveSpectrum?.id) {
265
315
  const index = currentActiveSpectrum.index;
266
316
  const datum = draft.data[index];
267
- if (id && draft.toolOptions.data.activeFilterID !== id) {
268
- const filterIndex = datum.filters.findIndex((f) => f[searchBy] === id);
317
+ if (filterId && draft.toolOptions.data.activeFilterID !== filterId) {
318
+ const filterIndex = datum.filters.findIndex((f) => f[searchBy] === filterId);
269
319
  let filters = [];
270
320
  if (filterIndex !== -1) {
271
321
  filters = datum.filters.slice(0, rollback ? filterIndex : filterIndex + 1);
272
- if (filters.length > 1) {
322
+ if (filters.length >= 1) {
273
323
  draft.toolOptions.data.activeFilterID =
274
324
  datum.filters[rollback ? filterIndex - 1 : filterIndex]?.id;
275
325
  }
@@ -277,7 +327,7 @@ function resetSpectrumByFilter(draft, id = null, options = {}, activeSpectrum =
277
327
  draft.toolOptions.data.activeFilterID = null;
278
328
  }
279
329
  FiltersManager.reapplyFilters(datum, filters);
280
- if (returnCurrentDatum) {
330
+ if (applyFilter) {
281
331
  const { name, value: options } = datum.filters[filterIndex];
282
332
  const newDatum = (0, immer_1.current)(draft).data[index];
283
333
  if (newDatum.info?.dimension === 1) {
@@ -303,13 +353,14 @@ function resetSpectrumByFilter(draft, id = null, options = {}, activeSpectrum =
303
353
  (0, DomainActions_1.setMode)(draft);
304
354
  }
305
355
  }
306
- if (returnCurrentDatum) {
356
+ if (applyFilter) {
307
357
  return currentDatum;
308
358
  }
309
359
  }
310
360
  exports.resetSpectrumByFilter = resetSpectrumByFilter;
311
361
  function filterSnapshotHandler(draft, action) {
312
- resetSpectrumByFilter(draft, action.id);
362
+ const { filterId } = action.payload;
363
+ resetSpectrumByFilter(draft, { filterId });
313
364
  }
314
365
  exports.filterSnapshotHandler = filterSnapshotHandler;
315
366
  function handleMultipleSpectraFilter(draft, action) {
@@ -350,7 +401,7 @@ function handleAddExclusionZone(draft, action) {
350
401
  name: Filters.exclusionZones.id,
351
402
  options: [
352
403
  {
353
- id: (0, generateID_1.default)(),
404
+ id: (0, uuid_1.v4)(),
354
405
  from: range[0],
355
406
  to: range[1],
356
407
  },
@@ -362,17 +413,107 @@ function handleAddExclusionZone(draft, action) {
362
413
  }
363
414
  exports.handleAddExclusionZone = handleAddExclusionZone;
364
415
  function handleDeleteExclusionZone(draft, action) {
365
- const { id, spectrumID } = action.payload;
366
- const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
367
- const exclusionZonesFilter = draft.data[spectrumIndex].filters.find((filter) => filter.name === Filters.exclusionZones.id);
368
- if (exclusionZonesFilter) {
369
- if (exclusionZonesFilter.value.length === 1) {
370
- FiltersManager.deleteFilter(draft.data[spectrumIndex], exclusionZonesFilter.id);
416
+ const { zone, spectrumID } = action.payload;
417
+ // if spectrum id exists, remove the selected exclusive zone in the spectrum
418
+ if (spectrumID) {
419
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
420
+ const filter = draft.data[spectrumIndex].filters.find((_filter) => _filter.name === Filters.exclusionZones.id);
421
+ if (filter) {
422
+ if (filter.value.length === 1) {
423
+ FiltersManager.deleteFilter(draft.data[spectrumIndex], filter.id);
424
+ }
425
+ else {
426
+ filter.value = filter.value.filter((_zone) => _zone.id !== zone?.id);
427
+ FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
428
+ }
371
429
  }
372
- else {
373
- exclusionZonesFilter.value = exclusionZonesFilter.value.filter((zone) => zone.id !== id);
374
- FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
430
+ }
431
+ else {
432
+ // remove all exclusive zone that have the same range in all spectra
433
+ const data = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
434
+ for (const datum of data) {
435
+ for (const filter of datum.filters) {
436
+ if (filter.name === Filters.exclusionZones.id) {
437
+ filter.value = filter.value.filter((_zone) => zone.from !== _zone.from && zone.to !== _zone.to);
438
+ FiltersManager.reapplyFilters(datum);
439
+ }
440
+ }
375
441
  }
376
442
  }
377
443
  }
378
444
  exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
445
+ function handleDisableFilterLivePreview(draft, action) {
446
+ const { selectedTool } = action.payload;
447
+ setFilterChanges(draft, selectedTool);
448
+ if (selectedTool === ToolTypes_1.options.zeroFilling.id) {
449
+ (0, DomainActions_1.setDomain)(draft, { yDomain: { isChanged: false } });
450
+ }
451
+ }
452
+ exports.handleDisableFilterLivePreview = handleDisableFilterLivePreview;
453
+ function checkFilterHasTempData(selectedToolId) {
454
+ return [
455
+ ToolTypes_1.options.phaseCorrection.id,
456
+ ToolTypes_1.options.baselineCorrection.id,
457
+ ToolTypes_1.options.apodization.id,
458
+ ToolTypes_1.options.zeroFilling.id,
459
+ ].includes(selectedToolId);
460
+ }
461
+ function setFilterChanges(draft, selectedFilterID) {
462
+ const activeSpectrumId = draft.activeSpectrum?.id;
463
+ // If the user selects the filter from the filters list or selects its tool and has a record in the filter list for preview and edit
464
+ if (checkFilterHasTempData(selectedFilterID)) {
465
+ //return back the spectra data to point of time before applying a specific filter
466
+ const isPhaseCorrection = selectedFilterID === ToolTypes_1.options.phaseCorrection.id;
467
+ const updateDomain = [
468
+ ToolTypes_1.options.zeroFilling.id,
469
+ ToolTypes_1.options.apodization.id,
470
+ ].includes(selectedFilterID);
471
+ const rollbackSpectrumData = resetSpectrumByFilter(draft, {
472
+ updateDomain,
473
+ rollback: true,
474
+ searchBy: 'name',
475
+ filterId: selectedFilterID,
476
+ applyFilter: isPhaseCorrection,
477
+ });
478
+ // create a temporary clone of the data
479
+ draft.tempData = (0, immer_1.current)(draft).data;
480
+ if (rollbackSpectrumData) {
481
+ draft.tempData[rollbackSpectrumData?.index] = rollbackSpectrumData?.datum;
482
+ }
483
+ switch (selectedFilterID) {
484
+ case ToolTypes_1.options.phaseCorrection.id: {
485
+ // look for the strongest peak to set it as a pivot
486
+ const { xValue, index } = (0, getStrongestPeak_1.getStrongestPeak)(draft) || {
487
+ xValue: 0,
488
+ index: 0,
489
+ };
490
+ draft.toolOptions.data.pivot = { value: xValue, index };
491
+ break;
492
+ }
493
+ case ToolTypes_1.options.baselineCorrection.id: {
494
+ if (draft.activeSpectrum?.id) {
495
+ const baselineCorrectionFilter = (0, immer_1.current)(draft).data[draft.activeSpectrum.index].filters.find((filter) => filter.name === ToolTypes_1.options.baselineCorrection.id);
496
+ if (baselineCorrectionFilter) {
497
+ draft.toolOptions.data.baselineCorrection.zones =
498
+ baselineCorrectionFilter
499
+ ? baselineCorrectionFilter.value.zones
500
+ : [];
501
+ }
502
+ }
503
+ break;
504
+ }
505
+ case ToolTypes_1.options.apodization.id: {
506
+ draft.toolOptions.data.apodizationOptions = apodization_1.defaultApodizationOptions;
507
+ break;
508
+ }
509
+ default:
510
+ break;
511
+ }
512
+ }
513
+ else if (checkFilterHasTempData(draft.toolOptions.selectedTool)) {
514
+ draft.toolOptions.data.activeFilterID = null;
515
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === activeSpectrumId);
516
+ draft.data[spectrumIndex].data = draft.tempData[spectrumIndex].data;
517
+ }
518
+ }
519
+ exports.setFilterChanges = setFilterChanges;
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.handleChangeIntegralsSumFlag = exports.handleChangeIntegralsRelativeValue = exports.changeIntegral = exports.deleteIntegral = exports.addIntegral = exports.handleChangeIntegralSum = void 0;
7
+ const uuid_1 = require("@lukeed/uuid");
7
8
  const immer_1 = require("immer");
8
9
  const ml_spectra_processing_1 = require("ml-spectra-processing");
9
10
  const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
10
11
  const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
11
- const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
12
12
  const getRange_1 = __importDefault(require("../helper/getRange"));
13
13
  const DomainActions_1 = require("./DomainActions");
14
14
  function handleChangeIntegralSum(draft, options) {
@@ -30,7 +30,7 @@ function addIntegral(draft, action) {
30
30
  const { x, re } = datum.data;
31
31
  const shiftX = (0, Spectrum1D_1.getShiftX)(datum);
32
32
  const integral = {
33
- id: (0, generateID_1.default)(),
33
+ id: (0, uuid_1.v4)(),
34
34
  originFrom: from - shiftX,
35
35
  originTo: to - shiftX,
36
36
  from,
@@ -45,18 +45,22 @@ function addMoleculeHandler(draft, molfile) {
45
45
  */
46
46
  const molecule = draft.molecules[0] || null;
47
47
  if (isEmpty && molecule) {
48
- (0, SumManager_1.changeSpectraRelativeSum)(draft, molecule.key, molecule);
48
+ (0, SumManager_1.changeSpectraRelativeSum)(draft, molecule.id, molecule);
49
49
  }
50
50
  }
51
51
  exports.addMoleculeHandler = addMoleculeHandler;
52
52
  function setMoleculeHandler(draft, action) {
53
- const { key, label, molfile, isFloat } = action.payload;
54
- MoleculeManager.setMolfile(draft.molecules, { key, label, molfile, isFloat });
53
+ const { id, label, molfile } = action.payload;
54
+ MoleculeManager.setMolfile(draft.molecules, {
55
+ id,
56
+ label,
57
+ molfile,
58
+ });
55
59
  /**
56
60
  * update all spectra that its sum was based on this molecule with the new molecule
57
61
  */
58
- const index = draft.molecules.findIndex((molecule) => molecule.key === key);
59
- (0, SumManager_1.changeSpectraRelativeSum)(draft, key, index !== -1 ? draft.molecules[index] : draft.molecules[0] || null);
62
+ const index = draft.molecules.findIndex((molecule) => molecule.id === id);
63
+ (0, SumManager_1.changeSpectraRelativeSum)(draft, id, index !== -1 ? draft.molecules[index] : draft.molecules[0] || null);
60
64
  }
61
65
  exports.setMoleculeHandler = setMoleculeHandler;
62
66
  function removeAssignments(draft, assignmentData) {
@@ -68,16 +72,20 @@ function removeAssignments(draft, assignmentData) {
68
72
  }
69
73
  }
70
74
  function deleteMoleculeHandler(draft, action) {
71
- const { key, assignmentData } = action.payload;
75
+ const { id, assignmentData } = action.payload;
72
76
  // remove Assignments links of the active spectrum
73
77
  removeAssignments(draft, assignmentData);
74
- const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.key === key);
78
+ const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
75
79
  draft.molecules.splice(moleculeIndex, 1);
80
+ const floatingMoleculesIndex = draft.view.floatingMolecules.findIndex((m) => m.id === id);
81
+ if (floatingMoleculesIndex !== -1) {
82
+ draft.view.floatingMolecules.splice(floatingMoleculesIndex, 1);
83
+ }
76
84
  /**
77
85
  * update all spectra that its sum was based on this molecule with the first molecule
78
86
  * from molecules list and if no remains molecules it sum will be 100
79
87
  */
80
- (0, SumManager_1.changeSpectraRelativeSum)(draft, key, draft.molecules[0] || null);
88
+ (0, SumManager_1.changeSpectraRelativeSum)(draft, id, draft.molecules[0] || null);
81
89
  }
82
90
  exports.deleteMoleculeHandler = deleteMoleculeHandler;
83
91
  function predictSpectraFromMoleculeHandler(draft, action) {
@@ -102,15 +110,20 @@ function predictSpectraFromMoleculeHandler(draft, action) {
102
110
  }
103
111
  exports.predictSpectraFromMoleculeHandler = predictSpectraFromMoleculeHandler;
104
112
  function floatMoleculeOverSpectrum(draft, action) {
105
- const { key } = action.payload;
106
- const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.key === key);
107
- draft.molecules[moleculeIndex].isFloat =
108
- !draft.molecules[moleculeIndex].isFloat;
113
+ const { id } = action.payload;
114
+ const moleculeIndex = draft.view.floatingMolecules.findIndex((m) => m.id === id);
115
+ if (moleculeIndex !== -1) {
116
+ draft.view.floatingMolecules[moleculeIndex].visible =
117
+ !draft.view.floatingMolecules[moleculeIndex].visible;
118
+ }
119
+ else {
120
+ draft.view.floatingMolecules.push({ id, visible: true });
121
+ }
109
122
  }
110
123
  exports.floatMoleculeOverSpectrum = floatMoleculeOverSpectrum;
111
124
  function changeMoleculeLabel(draft, action) {
112
- const { key, label } = action.payload;
113
- const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.key === key);
125
+ const { id, label } = action.payload;
126
+ const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
114
127
  draft.molecules[moleculeIndex].label = label;
115
128
  }
116
129
  exports.changeMoleculeLabel = changeMoleculeLabel;
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.handleAutoPeakPicking = exports.deletePeak = exports.addPeaks = exports.addPeak = void 0;
6
+ exports.handleShowPeaksShapes = exports.changePeakShapeHandler = exports.handleOptimizePeaks = exports.handleAutoPeakPicking = exports.deletePeak = exports.addPeaks = exports.addPeak = void 0;
7
+ const uuid_1 = require("@lukeed/uuid");
7
8
  const immer_1 = require("immer");
8
9
  const ml_spectra_processing_1 = require("ml-spectra-processing");
9
10
  const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
10
- const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
11
11
  const ToolTypes_1 = require("../../toolbar/ToolTypes");
12
12
  const getRange_1 = __importDefault(require("../helper/getRange"));
13
13
  function addPeak(draft, mouseCoordinates) {
@@ -25,7 +25,7 @@ function addPeak(draft, mouseCoordinates) {
25
25
  const shiftX = (0, Spectrum1D_1.getShiftX)(draft.data[index]);
26
26
  if (candidatePeak) {
27
27
  const peak = {
28
- id: (0, generateID_1.default)(),
28
+ id: (0, uuid_1.v4)(),
29
29
  originalX: candidatePeak.x - shiftX,
30
30
  x: candidatePeak.x,
31
31
  y: candidatePeak.y,
@@ -48,7 +48,7 @@ function addPeaks(draft, action) {
48
48
  const shiftX = (0, Spectrum1D_1.getShiftX)(draft.data[index]);
49
49
  if (peak && !datumOriginal.peaks.values.some((p) => p.x === peak.x)) {
50
50
  const newPeak = {
51
- id: (0, generateID_1.default)(),
51
+ id: (0, uuid_1.v4)(),
52
52
  originalX: peak.x - shiftX,
53
53
  x: peak.x,
54
54
  y: peak.y,
@@ -74,6 +74,21 @@ function deletePeak(draft, peakData) {
74
74
  }
75
75
  }
76
76
  exports.deletePeak = deletePeak;
77
+ function handleOptimizePeaks(draft, action) {
78
+ const { peaks } = action.payload;
79
+ if (draft.activeSpectrum?.id) {
80
+ const { index } = draft.activeSpectrum;
81
+ const datum = draft.data[index];
82
+ const [from, to] = draft.xDomain;
83
+ const newPeaks = (0, Spectrum1D_1.optimizePeaks)(draft.data[index], {
84
+ from,
85
+ to,
86
+ peaks,
87
+ });
88
+ datum.peaks.values = newPeaks;
89
+ }
90
+ }
91
+ exports.handleOptimizePeaks = handleOptimizePeaks;
77
92
  function handleAutoPeakPicking(draft, autOptions) {
78
93
  if (draft.activeSpectrum?.id) {
79
94
  draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
@@ -92,3 +107,24 @@ function handleAutoPeakPicking(draft, autOptions) {
92
107
  }
93
108
  }
94
109
  exports.handleAutoPeakPicking = handleAutoPeakPicking;
110
+ function changePeakShapeHandler(draft, action) {
111
+ const { shape, id } = action.payload;
112
+ if (draft.activeSpectrum?.id) {
113
+ const { index } = draft.activeSpectrum;
114
+ const datum = draft.data[index];
115
+ const peakIndex = datum.peaks.values.findIndex((peak) => peak.id === id);
116
+ if (peakIndex !== -1) {
117
+ datum.peaks.values[peakIndex].shape = shape;
118
+ }
119
+ }
120
+ }
121
+ exports.changePeakShapeHandler = changePeakShapeHandler;
122
+ function handleShowPeaksShapes(draft, action) {
123
+ const { key } = action.payload;
124
+ const peaksOptions = draft.toolOptions.data.peaksOptions;
125
+ draft.toolOptions.data.peaksOptions = {
126
+ ...peaksOptions,
127
+ [key]: !peaksOptions[key],
128
+ };
129
+ }
130
+ exports.handleShowPeaksShapes = handleShowPeaksShapes;
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.handleShowJGraph = exports.handleAutoSpectraRangesDetection = exports.handleShowRangesIntegrals = exports.handleShowMultiplicityTrees = exports.handleUpdateRange = exports.handleChangeRangesSumFlag = exports.handleSetDiaIDRange = exports.handleUnlinkRange = exports.handleSaveEditedRange = exports.handleChangeRangeSignalKind = exports.handleChangeRangeSignalValue = exports.handleChangeRangeRelativeValue = exports.handleResizeRange = exports.handleAddRange = exports.handleChangeRangeSum = exports.handleDeleteSignal = exports.handleDeleteRange = exports.handleAutoRangesDetection = void 0;
30
+ const uuid_1 = require("@lukeed/uuid");
30
31
  const immer_1 = require("immer");
31
32
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
32
33
  const ml_spectra_processing_1 = require("ml-spectra-processing");
@@ -36,7 +37,6 @@ const SignalsKinds_1 = require("../../../data/constants/SignalsKinds");
36
37
  const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
37
38
  const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
38
39
  const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
39
- const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
40
40
  const getRange_1 = __importDefault(require("../helper/getRange"));
41
41
  const CorrelationsActions_1 = require("./CorrelationsActions");
42
42
  const DomainActions_1 = require("./DomainActions");
@@ -147,7 +147,7 @@ function handleSaveEditedRange(draft, action) {
147
147
  (0, RangeUtilities_1.unlinkInAssignmentData)(assignmentData, [_editedRowData]);
148
148
  const rangeIndex = getRangeIndex(state, index, _editedRowData.id);
149
149
  if (_editedRowData.id === 'new') {
150
- _editedRowData.id = (0, generateID_1.default)();
150
+ _editedRowData.id = (0, uuid_1.v4)();
151
151
  }
152
152
  draft.data[index].ranges.values.splice(rangeIndex, 1, _editedRowData);
153
153
  (0, Spectrum1D_1.updateRangesRelativeValues)(draft.data[index]);
@@ -138,7 +138,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
138
138
  * if the new active spectrum different than the previous active spectrum fid then refresh the domain andf the mode.
139
139
  */
140
140
  if (draft.toolOptions.data.activeFilterID) {
141
- (0, FiltersActions_1.resetSpectrumByFilter)(draft, null, {}, currentActiveSpectrum);
141
+ (0, FiltersActions_1.resetSpectrumByFilter)(draft);
142
142
  }
143
143
  else if (refreshDomain) {
144
144
  (0, DomainActions_1.setDomain)(draft);