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
@@ -1,7 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import { CorrelationData } from 'nmr-correlation';
3
3
  import { SpectraAnalysis } from '../../data/data1d/MultipleAnalysis';
4
- import { Molecule } from '../../data/molecules/Molecule';
4
+ import { ApodizationOptions } from '../../data/data1d/filter1d/apodization';
5
+ import { FloatingMolecules, StateMoleculeExtended } from '../../data/molecules/Molecule';
5
6
  import { Contours } from '../../data/types/data2d/Contours';
6
7
  import { UsedColors } from '../../types/UsedColors';
7
8
  import { Spectra } from '../NMRium';
@@ -118,7 +119,14 @@ export interface State {
118
119
  * molecules
119
120
  * @default []
120
121
  */
121
- molecules: Array<Molecule>;
122
+ molecules: Array<StateMoleculeExtended>;
123
+ /**
124
+ * View related information
125
+ * @default { floatingMolecules: [] };
126
+ */
127
+ view: {
128
+ floatingMolecules: Array<FloatingMolecules>;
129
+ };
122
130
  /**
123
131
  * options to control spectra vertical alignment
124
132
  * @default {align: 'bottom',value: DEFAULT_YAXIS_SHIFT_VALUE}
@@ -204,6 +212,7 @@ export interface State {
204
212
  zones: any[];
205
213
  options: any;
206
214
  };
215
+ apodizationOptions: ApodizationOptions;
207
216
  /**
208
217
  * pivot point for manual phase correction
209
218
  * @default {value:0,index:0}
@@ -242,6 +251,14 @@ export interface State {
242
251
  * @default 0
243
252
  */
244
253
  predictionIndex: number;
254
+ /**
255
+ * boolean indicator to hide/show peaks shapes
256
+ * @default false
257
+ */
258
+ peaksOptions: {
259
+ showPeaksShapes: boolean;
260
+ showPeaksSum: boolean;
261
+ };
245
262
  };
246
263
  };
247
264
  usedColors: UsedColors;
@@ -670,7 +687,7 @@ export declare const spectrumReducer: (base: {
670
687
  readonly sum: number | undefined;
671
688
  readonly sumAuto: boolean;
672
689
  readonly mf?: string | undefined;
673
- readonly moleculeKey?: string | undefined;
690
+ readonly moleculeId?: string | undefined;
674
691
  };
675
692
  };
676
693
  readonly ranges: {
@@ -738,7 +755,7 @@ export declare const spectrumReducer: (base: {
738
755
  readonly sum: number | undefined;
739
756
  readonly sumAuto: boolean;
740
757
  readonly mf?: string | undefined;
741
- readonly moleculeKey?: string | undefined;
758
+ readonly moleculeId?: string | undefined;
742
759
  };
743
760
  };
744
761
  readonly filters: readonly {
@@ -936,11 +953,16 @@ export declare const spectrumReducer: (base: {
936
953
  readonly atoms: {
937
954
  readonly [x: string]: number;
938
955
  };
939
- readonly key: string;
956
+ readonly id: string;
940
957
  readonly molfile: string;
941
- readonly isFloat: boolean;
942
958
  readonly label: string;
943
959
  }[];
960
+ readonly view: {
961
+ readonly floatingMolecules: readonly {
962
+ readonly id: string;
963
+ readonly visible: boolean;
964
+ }[];
965
+ };
944
966
  readonly verticalAlign: {
945
967
  readonly align: VerticalAlignment;
946
968
  readonly verticalShift: number;
@@ -1018,6 +1040,11 @@ export declare const spectrumReducer: (base: {
1018
1040
  readonly zones: readonly any[];
1019
1041
  readonly options: any;
1020
1042
  };
1043
+ readonly apodizationOptions: {
1044
+ readonly lineBroadening: number;
1045
+ readonly gaussBroadening: number;
1046
+ readonly lineBroadeningCenter: number;
1047
+ };
1021
1048
  readonly pivot: {
1022
1049
  readonly value: number;
1023
1050
  readonly index: number;
@@ -1028,6 +1055,10 @@ export declare const spectrumReducer: (base: {
1028
1055
  readonly showRangesIntegrals: boolean;
1029
1056
  readonly showJGraph: boolean;
1030
1057
  readonly predictionIndex: number;
1058
+ readonly peaksOptions: {
1059
+ readonly showPeaksShapes: boolean;
1060
+ readonly showPeaksSum: boolean;
1061
+ };
1031
1062
  };
1032
1063
  };
1033
1064
  readonly usedColors: {
@@ -1,9 +1,9 @@
1
+ import { v4 } from '@lukeed/uuid';
1
2
  import { produce } from 'immer';
2
3
  import { buildCorrelationData } from 'nmr-correlation';
3
4
  import { predictSpectra } from '../../data/PredictionManager';
4
5
  import * as SpectraManager from '../../data/SpectraManager';
5
6
  import { migrate } from '../../data/migration/MigrationManager';
6
- import generateID from '../../data/utilities/generateID';
7
7
  import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants';
8
8
  import { options } from '../toolbar/ToolTypes';
9
9
  import { nmredataToNmrium } from '../utility/nmredataToNmrium';
@@ -57,6 +57,7 @@ export const getInitialState = () => ({
57
57
  activeSpectrum: null,
58
58
  mode: 'RTL',
59
59
  molecules: [],
60
+ view: { floatingMolecules: [] },
60
61
  verticalAlign: {
61
62
  align: 'bottom',
62
63
  verticalShift: DEFAULT_YAXIS_SHIFT_VALUE,
@@ -87,6 +88,7 @@ export const getInitialState = () => ({
87
88
  options: {},
88
89
  zones: [],
89
90
  },
91
+ apodizationOptions: {},
90
92
  pivot: { value: 0, index: 0 },
91
93
  zonesNoiseFactor: 1,
92
94
  activeFilterID: null,
@@ -94,13 +96,17 @@ export const getInitialState = () => ({
94
96
  showRangesIntegrals: true,
95
97
  showJGraph: false,
96
98
  predictionIndex: 0,
99
+ peaksOptions: {
100
+ showPeaksShapes: false,
101
+ showPeaksSum: false,
102
+ },
97
103
  },
98
104
  },
99
105
  usedColors: { '1d': [], '2d': [] },
100
106
  });
101
107
  export const initialState = getInitialState();
102
108
  export function initState(state) {
103
- const displayerKey = generateID();
109
+ const displayerKey = v4();
104
110
  const correlations = buildCorrelationData([], {
105
111
  tolerance: DefaultTolerance,
106
112
  });
@@ -194,6 +200,14 @@ function innerSpectrumReducer(draft, action) {
194
200
  return PeaksActions.addPeaks(draft, action);
195
201
  case types.DELETE_PEAK_NOTATION:
196
202
  return PeaksActions.deletePeak(draft, action.data);
203
+ case types.AUTO_PEAK_PICKING:
204
+ return PeaksActions.handleAutoPeakPicking(draft, action.options);
205
+ case types.OPTIMIZE_PEAKS:
206
+ return PeaksActions.handleOptimizePeaks(draft, action);
207
+ case types.CHANGE_PEAK_SHAPE:
208
+ return PeaksActions.changePeakShapeHandler(draft, action);
209
+ case types.TOGGLE_PEAKS_SHAPES:
210
+ return PeaksActions.handleShowPeaksShapes(draft, action);
197
211
  case types.ADD_INTEGRAL:
198
212
  return IntegralsActions.addIntegral(draft, action);
199
213
  case types.DELETE_INTEGRAL:
@@ -226,10 +240,18 @@ function innerSpectrumReducer(draft, action) {
226
240
  return ToolsActions.setSelectedOptionPanel(draft, action.selectedOptionPanel);
227
241
  case types.FULL_ZOOM_OUT:
228
242
  return ToolsActions.zoomOut(draft, action);
243
+ case types.DISABLE_FILTER_LIVE_PREVIEW:
244
+ return FiltersActions.handleDisableFilterLivePreview(draft, action);
229
245
  case types.SHIFT_SPECTRUM:
230
246
  return FiltersActions.shiftSpectrumAlongXAxis(draft, action.shiftValue);
247
+ case types.APPLY_APODIZATION_FILTER:
248
+ return FiltersActions.applyApodizationFilter(draft, action);
249
+ case types.CALCULATE_APODIZATION_FILTER:
250
+ return FiltersActions.calculateApodizationFilter(draft, action);
231
251
  case types.APPLY_ZERO_FILLING_FILTER:
232
- return FiltersActions.applyZeroFillingFilter(draft, action.value);
252
+ return FiltersActions.applyZeroFillingFilter(draft, action);
253
+ case types.CALCULATE_ZERO_FILLING_FILTER:
254
+ return FiltersActions.calculateZeroFillingFilter(draft, action);
233
255
  case types.APPLY_FFT_FILTER:
234
256
  return FiltersActions.applyFFTFilter(draft);
235
257
  case types.APPLY_MANUAL_PHASE_CORRECTION_FILTER:
@@ -314,8 +336,6 @@ function innerSpectrumReducer(draft, action) {
314
336
  return ToolsActions.setVerticalIndicatorXPosition(draft, action.position);
315
337
  case types.SET_SPECTRUMS_VERTICAL_ALIGN:
316
338
  return ToolsActions.setSpectrumsVerticalAlign(draft);
317
- case types.AUTO_PEAK_PICKING:
318
- return PeaksActions.handleAutoPeakPicking(draft, action.options);
319
339
  case types.AUTO_ZONES_DETECTION:
320
340
  return ZonesActions.handleAutoZonesDetection(draft, action.options);
321
341
  case types.CHANGE_ZONES_NOISE_FACTOR:
@@ -1,7 +1,10 @@
1
1
  import { Draft } from 'immer';
2
- import { ActiveSpectrum, State } from '../Reducer';
2
+ import { State } from '../Reducer';
3
3
  declare function shiftSpectrumAlongXAxis(draft: Draft<State>, shiftValue: any): void;
4
- declare function applyZeroFillingFilter(draft: Draft<State>, filterOptions: any): void;
4
+ declare function applyZeroFillingFilter(draft: Draft<State>, action: any): void;
5
+ declare function calculateApodizationFilter(draft: Draft<State>, action: any): void;
6
+ declare function applyApodizationFilter(draft: Draft<State>, action: any): void;
7
+ declare function calculateZeroFillingFilter(draft: Draft<State>, action: any): void;
5
8
  declare function applyFFTFilter(draft: Draft<State>): void;
6
9
  declare function applyManualPhaseCorrectionFilter(draft: Draft<State>, filterOptions: any): void;
7
10
  declare function applyAbsoluteFilter(draft: Draft<State>): void;
@@ -15,21 +18,24 @@ declare function handleBaseLineCorrectionFilter(draft: Draft<State>, action: any
15
18
  /**
16
19
  * reset spectrum data for specific point of time (Filter)
17
20
  * @param {object} draft
18
- * @param {string} id Filter id
19
21
  * @param {object} options
22
+ * @param {string} options.id Filter id
20
23
  * @param {boolean=} options.resetTool
21
24
  * @param {boolean=} options.updateDomain
22
25
  * @param {boolean=} options.rollback
23
26
  */
24
- declare function resetSpectrumByFilter(draft: any, id?: string | null, options?: {
27
+ declare function resetSpectrumByFilter(draft: any, options?: {
25
28
  rollback?: boolean;
26
29
  resetTool?: boolean;
27
30
  updateDomain?: boolean;
28
- returnCurrentDatum?: boolean;
31
+ applyFilter?: boolean;
29
32
  searchBy?: 'id' | 'name';
30
- }, activeSpectrum?: ActiveSpectrum | null): any;
33
+ filterId?: string | null;
34
+ }): any;
31
35
  declare function filterSnapshotHandler(draft: Draft<State>, action: any): void;
32
36
  declare function handleMultipleSpectraFilter(draft: Draft<State>, action: any): void;
33
37
  declare function handleAddExclusionZone(draft: Draft<State>, action: any): void;
34
38
  declare function handleDeleteExclusionZone(draft: Draft<State>, action: any): void;
35
- export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
39
+ declare function handleDisableFilterLivePreview(draft: Draft<State>, action: any): void;
40
+ declare function setFilterChanges(draft: Draft<State>, selectedFilterID: any): void;
41
+ export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyApodizationFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, calculateApodizationFilter, calculateZeroFillingFilter, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, handleDisableFilterLivePreview, setFilterChanges, };
@@ -1,16 +1,20 @@
1
+ import { v4 } from '@lukeed/uuid';
1
2
  import { current } from 'immer';
2
3
  import * as Filters from '../../../data/Filters';
3
4
  import * as FiltersManager from '../../../data/FiltersManager';
4
5
  import { updateXShift } from '../../../data/data1d/Spectrum1D';
6
+ import { apply as apodization, defaultApodizationOptions, } from '../../../data/data1d/filter1d/apodization';
5
7
  import { apply as autoPhaseCorrection } from '../../../data/data1d/filter1d/autoPhaseCorrection';
6
8
  import { apply as baselineCorrection } from '../../../data/data1d/filter1d/baselineCorrection';
7
9
  import { apply as phaseCorrection } from '../../../data/data1d/filter1d/phaseCorrection';
10
+ import { apply as zeroFilling } from '../../../data/data1d/filter1d/zeroFilling';
8
11
  import { updateShift as update2dShift } from '../../../data/data2d/Spectrum2D';
9
- import generateID from '../../../data/utilities/generateID';
12
+ import { options } from '../../toolbar/ToolTypes';
10
13
  import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
11
14
  import nucleusToString from '../../utility/nucleusToString';
12
15
  import zoomHistoryManager from '../helper/ZoomHistoryManager';
13
16
  import getRange from '../helper/getRange';
17
+ import { getStrongestPeak } from '../helper/getStrongestPeak';
14
18
  import { setDomain, setMode } from './DomainActions';
15
19
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
16
20
  import { resetSelectedTool } from './ToolsActions';
@@ -26,14 +30,14 @@ function shiftSpectrumAlongXAxis(draft, shiftValue) {
26
30
  setDomain(draft);
27
31
  }
28
32
  }
29
- function applyZeroFillingFilter(draft, filterOptions) {
33
+ function applyZeroFillingFilter(draft, action) {
30
34
  if (draft.activeSpectrum?.id) {
31
35
  const index = draft.activeSpectrum.index;
36
+ const { size } = action.payload;
32
37
  const filters = [
33
- { name: Filters.zeroFilling.id, options: filterOptions.zeroFillingSize },
34
38
  {
35
- name: Filters.lineBroadening.id,
36
- options: filterOptions.lineBroadeningValue,
39
+ name: Filters.zeroFilling.id,
40
+ options: size,
37
41
  },
38
42
  ];
39
43
  FiltersManager.applyFilter(draft.data[index], filters);
@@ -42,6 +46,49 @@ function applyZeroFillingFilter(draft, filterOptions) {
42
46
  setMode(draft);
43
47
  }
44
48
  }
49
+ function calculateApodizationFilter(draft, action) {
50
+ if (draft.activeSpectrum) {
51
+ const index = draft.activeSpectrum.index;
52
+ const options = action.payload;
53
+ const { data: { x, re, im }, info, } = draft.data[index];
54
+ let _data = { data: { x, re, im }, info };
55
+ draft.toolOptions.data.apodizationOptions = options;
56
+ apodization(_data, options);
57
+ const { im: newIm, re: newRe } = _data.data;
58
+ draft.tempData[index].data.im = newIm;
59
+ draft.tempData[index].data.re = newRe;
60
+ }
61
+ }
62
+ function applyApodizationFilter(draft, action) {
63
+ if (draft.activeSpectrum?.id) {
64
+ const index = draft.activeSpectrum.index;
65
+ const options = action.payload;
66
+ const filters = [
67
+ {
68
+ name: Filters.apodization.id,
69
+ options,
70
+ },
71
+ ];
72
+ FiltersManager.applyFilter(draft.data[index], filters);
73
+ resetSelectedTool(draft);
74
+ setDomain(draft);
75
+ setMode(draft);
76
+ }
77
+ }
78
+ function calculateZeroFillingFilter(draft, action) {
79
+ if (draft.activeSpectrum) {
80
+ const index = draft.activeSpectrum.index;
81
+ const { size } = action.payload;
82
+ const { data: { x, re, im }, filters, info, } = draft.data[index];
83
+ let _data = { data: { x, re, im }, filters, info };
84
+ zeroFilling(_data, size);
85
+ const { im: newIm, re: newRe, x: newX } = _data.data;
86
+ draft.tempData[index].data.x = newX;
87
+ draft.tempData[index].data.im = newIm;
88
+ draft.tempData[index].data.re = newRe;
89
+ draft.xDomain = [newX[0], newX[newX.length - 1]];
90
+ }
91
+ }
45
92
  function applyFFTFilter(draft) {
46
93
  if (draft.activeSpectrum?.id) {
47
94
  const { index } = draft.activeSpectrum;
@@ -190,12 +237,13 @@ function handleBaseLineCorrectionFilter(draft, action) {
190
237
  if (draft.activeSpectrum?.id) {
191
238
  const { index } = draft.activeSpectrum;
192
239
  const { zones } = draft.toolOptions.data.baselineCorrection;
240
+ const { livePreview, ...options } = action.options;
193
241
  FiltersManager.applyFilter(draft.data[index], [
194
242
  {
195
243
  name: Filters.baselineCorrection.id,
196
244
  options: {
197
245
  zones,
198
- ...action.options,
246
+ ...options,
199
247
  },
200
248
  },
201
249
  ]);
@@ -208,27 +256,26 @@ function handleBaseLineCorrectionFilter(draft, action) {
208
256
  /**
209
257
  * reset spectrum data for specific point of time (Filter)
210
258
  * @param {object} draft
211
- * @param {string} id Filter id
212
259
  * @param {object} options
260
+ * @param {string} options.id Filter id
213
261
  * @param {boolean=} options.resetTool
214
262
  * @param {boolean=} options.updateDomain
215
263
  * @param {boolean=} options.rollback
216
264
  */
217
- function resetSpectrumByFilter(draft, id = null, options = {}, activeSpectrum = null) {
218
- const { updateDomain = true, rollback = false, searchBy = 'id', returnCurrentDatum = false, } = options;
265
+ function resetSpectrumByFilter(draft, options) {
266
+ const { updateDomain = true, rollback = false, searchBy = 'id', applyFilter = false, // the filter that we rollback and return the affect data for the selected spectrum
267
+ filterId, } = options || {};
219
268
  let currentDatum = null;
220
- const currentActiveSpectrum = activeSpectrum
221
- ? activeSpectrum
222
- : draft.activeSpectrum;
269
+ const currentActiveSpectrum = draft.activeSpectrum;
223
270
  if (currentActiveSpectrum?.id) {
224
271
  const index = currentActiveSpectrum.index;
225
272
  const datum = draft.data[index];
226
- if (id && draft.toolOptions.data.activeFilterID !== id) {
227
- const filterIndex = datum.filters.findIndex((f) => f[searchBy] === id);
273
+ if (filterId && draft.toolOptions.data.activeFilterID !== filterId) {
274
+ const filterIndex = datum.filters.findIndex((f) => f[searchBy] === filterId);
228
275
  let filters = [];
229
276
  if (filterIndex !== -1) {
230
277
  filters = datum.filters.slice(0, rollback ? filterIndex : filterIndex + 1);
231
- if (filters.length > 1) {
278
+ if (filters.length >= 1) {
232
279
  draft.toolOptions.data.activeFilterID =
233
280
  datum.filters[rollback ? filterIndex - 1 : filterIndex]?.id;
234
281
  }
@@ -236,7 +283,7 @@ function resetSpectrumByFilter(draft, id = null, options = {}, activeSpectrum =
236
283
  draft.toolOptions.data.activeFilterID = null;
237
284
  }
238
285
  FiltersManager.reapplyFilters(datum, filters);
239
- if (returnCurrentDatum) {
286
+ if (applyFilter) {
240
287
  const { name, value: options } = datum.filters[filterIndex];
241
288
  const newDatum = current(draft).data[index];
242
289
  if (newDatum.info?.dimension === 1) {
@@ -262,12 +309,13 @@ function resetSpectrumByFilter(draft, id = null, options = {}, activeSpectrum =
262
309
  setMode(draft);
263
310
  }
264
311
  }
265
- if (returnCurrentDatum) {
312
+ if (applyFilter) {
266
313
  return currentDatum;
267
314
  }
268
315
  }
269
316
  function filterSnapshotHandler(draft, action) {
270
- resetSpectrumByFilter(draft, action.id);
317
+ const { filterId } = action.payload;
318
+ resetSpectrumByFilter(draft, { filterId });
271
319
  }
272
320
  function handleMultipleSpectraFilter(draft, action) {
273
321
  const spectra = getSpectraByNucleus(draft.activeTab, draft.data);
@@ -306,7 +354,7 @@ function handleAddExclusionZone(draft, action) {
306
354
  name: Filters.exclusionZones.id,
307
355
  options: [
308
356
  {
309
- id: generateID(),
357
+ id: v4(),
310
358
  from: range[0],
311
359
  to: range[1],
312
360
  },
@@ -317,17 +365,105 @@ function handleAddExclusionZone(draft, action) {
317
365
  setDomain(draft);
318
366
  }
319
367
  function handleDeleteExclusionZone(draft, action) {
320
- const { id, spectrumID } = action.payload;
321
- const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
322
- const exclusionZonesFilter = draft.data[spectrumIndex].filters.find((filter) => filter.name === Filters.exclusionZones.id);
323
- if (exclusionZonesFilter) {
324
- if (exclusionZonesFilter.value.length === 1) {
325
- FiltersManager.deleteFilter(draft.data[spectrumIndex], exclusionZonesFilter.id);
368
+ const { zone, spectrumID } = action.payload;
369
+ // if spectrum id exists, remove the selected exclusive zone in the spectrum
370
+ if (spectrumID) {
371
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
372
+ const filter = draft.data[spectrumIndex].filters.find((_filter) => _filter.name === Filters.exclusionZones.id);
373
+ if (filter) {
374
+ if (filter.value.length === 1) {
375
+ FiltersManager.deleteFilter(draft.data[spectrumIndex], filter.id);
376
+ }
377
+ else {
378
+ filter.value = filter.value.filter((_zone) => _zone.id !== zone?.id);
379
+ FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
380
+ }
326
381
  }
327
- else {
328
- exclusionZonesFilter.value = exclusionZonesFilter.value.filter((zone) => zone.id !== id);
329
- FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
382
+ }
383
+ else {
384
+ // remove all exclusive zone that have the same range in all spectra
385
+ const data = getSpectraByNucleus(draft.activeTab, draft.data);
386
+ for (const datum of data) {
387
+ for (const filter of datum.filters) {
388
+ if (filter.name === Filters.exclusionZones.id) {
389
+ filter.value = filter.value.filter((_zone) => zone.from !== _zone.from && zone.to !== _zone.to);
390
+ FiltersManager.reapplyFilters(datum);
391
+ }
392
+ }
330
393
  }
331
394
  }
332
395
  }
333
- export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
396
+ function handleDisableFilterLivePreview(draft, action) {
397
+ const { selectedTool } = action.payload;
398
+ setFilterChanges(draft, selectedTool);
399
+ if (selectedTool === options.zeroFilling.id) {
400
+ setDomain(draft, { yDomain: { isChanged: false } });
401
+ }
402
+ }
403
+ function checkFilterHasTempData(selectedToolId) {
404
+ return [
405
+ options.phaseCorrection.id,
406
+ options.baselineCorrection.id,
407
+ options.apodization.id,
408
+ options.zeroFilling.id,
409
+ ].includes(selectedToolId);
410
+ }
411
+ function setFilterChanges(draft, selectedFilterID) {
412
+ const activeSpectrumId = draft.activeSpectrum?.id;
413
+ // 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
414
+ if (checkFilterHasTempData(selectedFilterID)) {
415
+ //return back the spectra data to point of time before applying a specific filter
416
+ const isPhaseCorrection = selectedFilterID === options.phaseCorrection.id;
417
+ const updateDomain = [
418
+ options.zeroFilling.id,
419
+ options.apodization.id,
420
+ ].includes(selectedFilterID);
421
+ const rollbackSpectrumData = resetSpectrumByFilter(draft, {
422
+ updateDomain,
423
+ rollback: true,
424
+ searchBy: 'name',
425
+ filterId: selectedFilterID,
426
+ applyFilter: isPhaseCorrection,
427
+ });
428
+ // create a temporary clone of the data
429
+ draft.tempData = current(draft).data;
430
+ if (rollbackSpectrumData) {
431
+ draft.tempData[rollbackSpectrumData?.index] = rollbackSpectrumData?.datum;
432
+ }
433
+ switch (selectedFilterID) {
434
+ case options.phaseCorrection.id: {
435
+ // look for the strongest peak to set it as a pivot
436
+ const { xValue, index } = getStrongestPeak(draft) || {
437
+ xValue: 0,
438
+ index: 0,
439
+ };
440
+ draft.toolOptions.data.pivot = { value: xValue, index };
441
+ break;
442
+ }
443
+ case options.baselineCorrection.id: {
444
+ if (draft.activeSpectrum?.id) {
445
+ const baselineCorrectionFilter = current(draft).data[draft.activeSpectrum.index].filters.find((filter) => filter.name === options.baselineCorrection.id);
446
+ if (baselineCorrectionFilter) {
447
+ draft.toolOptions.data.baselineCorrection.zones =
448
+ baselineCorrectionFilter
449
+ ? baselineCorrectionFilter.value.zones
450
+ : [];
451
+ }
452
+ }
453
+ break;
454
+ }
455
+ case options.apodization.id: {
456
+ draft.toolOptions.data.apodizationOptions = defaultApodizationOptions;
457
+ break;
458
+ }
459
+ default:
460
+ break;
461
+ }
462
+ }
463
+ else if (checkFilterHasTempData(draft.toolOptions.selectedTool)) {
464
+ draft.toolOptions.data.activeFilterID = null;
465
+ const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === activeSpectrumId);
466
+ draft.data[spectrumIndex].data = draft.tempData[spectrumIndex].data;
467
+ }
468
+ }
469
+ export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyApodizationFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, calculateBaseLineCorrection, calculateApodizationFilter, calculateZeroFillingFilter, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, handleDisableFilterLivePreview, setFilterChanges, };
@@ -1,8 +1,8 @@
1
+ import { v4 } from '@lukeed/uuid';
1
2
  import { original } from 'immer';
2
3
  import { xyIntegration } from 'ml-spectra-processing';
3
4
  import { updateIntegralsRelativeValues, changeIntegralsRelative, getShiftX, } from '../../../data/data1d/Spectrum1D';
4
5
  import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
5
- import generateID from '../../../data/utilities/generateID';
6
6
  import getRange from '../helper/getRange';
7
7
  import { setIntegralsYDomain } from './DomainActions';
8
8
  function handleChangeIntegralSum(draft, options) {
@@ -23,7 +23,7 @@ function addIntegral(draft, action) {
23
23
  const { x, re } = datum.data;
24
24
  const shiftX = getShiftX(datum);
25
25
  const integral = {
26
- id: generateID(),
26
+ id: v4(),
27
27
  originFrom: from - shiftX,
28
28
  originTo: to - shiftX,
29
29
  from,
@@ -16,17 +16,21 @@ function addMoleculeHandler(draft, molfile) {
16
16
  */
17
17
  const molecule = draft.molecules[0] || null;
18
18
  if (isEmpty && molecule) {
19
- changeSpectraRelativeSum(draft, molecule.key, molecule);
19
+ changeSpectraRelativeSum(draft, molecule.id, molecule);
20
20
  }
21
21
  }
22
22
  function setMoleculeHandler(draft, action) {
23
- const { key, label, molfile, isFloat } = action.payload;
24
- MoleculeManager.setMolfile(draft.molecules, { key, label, molfile, isFloat });
23
+ const { id, label, molfile } = action.payload;
24
+ MoleculeManager.setMolfile(draft.molecules, {
25
+ id,
26
+ label,
27
+ molfile,
28
+ });
25
29
  /**
26
30
  * update all spectra that its sum was based on this molecule with the new molecule
27
31
  */
28
- const index = draft.molecules.findIndex((molecule) => molecule.key === key);
29
- changeSpectraRelativeSum(draft, key, index !== -1 ? draft.molecules[index] : draft.molecules[0] || null);
32
+ const index = draft.molecules.findIndex((molecule) => molecule.id === id);
33
+ changeSpectraRelativeSum(draft, id, index !== -1 ? draft.molecules[index] : draft.molecules[0] || null);
30
34
  }
31
35
  function removeAssignments(draft, assignmentData) {
32
36
  if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
@@ -37,16 +41,20 @@ function removeAssignments(draft, assignmentData) {
37
41
  }
38
42
  }
39
43
  function deleteMoleculeHandler(draft, action) {
40
- const { key, assignmentData } = action.payload;
44
+ const { id, assignmentData } = action.payload;
41
45
  // remove Assignments links of the active spectrum
42
46
  removeAssignments(draft, assignmentData);
43
- const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.key === key);
47
+ const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
44
48
  draft.molecules.splice(moleculeIndex, 1);
49
+ const floatingMoleculesIndex = draft.view.floatingMolecules.findIndex((m) => m.id === id);
50
+ if (floatingMoleculesIndex !== -1) {
51
+ draft.view.floatingMolecules.splice(floatingMoleculesIndex, 1);
52
+ }
45
53
  /**
46
54
  * update all spectra that its sum was based on this molecule with the first molecule
47
55
  * from molecules list and if no remains molecules it sum will be 100
48
56
  */
49
- changeSpectraRelativeSum(draft, key, draft.molecules[0] || null);
57
+ changeSpectraRelativeSum(draft, id, draft.molecules[0] || null);
50
58
  }
51
59
  function predictSpectraFromMoleculeHandler(draft, action) {
52
60
  const { data, options } = action.payload;
@@ -69,14 +77,19 @@ function predictSpectraFromMoleculeHandler(draft, action) {
69
77
  draft.isLoading = false;
70
78
  }
71
79
  function floatMoleculeOverSpectrum(draft, action) {
72
- const { key } = action.payload;
73
- const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.key === key);
74
- draft.molecules[moleculeIndex].isFloat =
75
- !draft.molecules[moleculeIndex].isFloat;
80
+ const { id } = action.payload;
81
+ const moleculeIndex = draft.view.floatingMolecules.findIndex((m) => m.id === id);
82
+ if (moleculeIndex !== -1) {
83
+ draft.view.floatingMolecules[moleculeIndex].visible =
84
+ !draft.view.floatingMolecules[moleculeIndex].visible;
85
+ }
86
+ else {
87
+ draft.view.floatingMolecules.push({ id, visible: true });
88
+ }
76
89
  }
77
90
  function changeMoleculeLabel(draft, action) {
78
- const { key, label } = action.payload;
79
- const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.key === key);
91
+ const { id, label } = action.payload;
92
+ const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
80
93
  draft.molecules[moleculeIndex].label = label;
81
94
  }
82
95
  export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeMoleculeLabel, };
@@ -3,5 +3,8 @@ import { State } from '../Reducer';
3
3
  declare function addPeak(draft: Draft<State>, mouseCoordinates: any): void;
4
4
  declare function addPeaks(draft: Draft<State>, action: any): void;
5
5
  declare function deletePeak(draft: Draft<State>, peakData: any): void;
6
+ declare function handleOptimizePeaks(draft: Draft<State>, action: any): void;
6
7
  declare function handleAutoPeakPicking(draft: Draft<State>, autOptions: any): void;
7
- export { addPeak, addPeaks, deletePeak, handleAutoPeakPicking };
8
+ declare function changePeakShapeHandler(draft: Draft<State>, action: any): void;
9
+ declare function handleShowPeaksShapes(draft: Draft<State>, action: any): void;
10
+ export { addPeak, addPeaks, deletePeak, handleAutoPeakPicking, handleOptimizePeaks, changePeakShapeHandler, handleShowPeaksShapes, };