nmrium 0.29.0 → 0.31.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 (543) 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 +49 -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/FooterBanner.js +3 -1
  8. package/lib/component/1d/IntegralResizable.js +5 -4
  9. package/lib/component/1d/IntegralsSeries.js +3 -1
  10. package/lib/component/1d/LinesSeries.js +7 -5
  11. package/lib/component/1d/SpectraTracker.js +1 -1
  12. package/lib/component/1d/Viewer1D.js +10 -13
  13. package/lib/component/1d/database/DatabaseElements.js +2 -2
  14. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  15. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +3 -3
  16. package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
  17. package/lib/component/1d/multiAnalysis/AnalysisRange.js +16 -14
  18. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  19. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +6 -5
  20. package/lib/component/1d/{PeakAnnotation.d.ts → peaks/PeakAnnotation.d.ts} +1 -2
  21. package/lib/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
  22. package/lib/component/1d/{PeakAnnotations.d.ts → peaks/PeakAnnotations.d.ts} +0 -0
  23. package/lib/component/1d/peaks/PeakAnnotations.js +28 -0
  24. package/lib/component/1d/peaks/PeaksShapes.d.ts +3 -0
  25. package/lib/component/1d/peaks/PeaksShapes.js +37 -0
  26. package/lib/component/1d/peaks/usePeakShapesPath.d.ts +13 -0
  27. package/lib/component/1d/peaks/usePeakShapesPath.js +49 -0
  28. package/lib/component/1d/ranges/Range.js +4 -4
  29. package/lib/component/1d/ranges/Ranges.js +8 -2
  30. package/lib/component/1d/tool/PeakPointer.js +3 -1
  31. package/lib/component/1d/tool/XLabelPointer.js +3 -1
  32. package/lib/component/2d/Contours.js +3 -1
  33. package/lib/component/2d/FooterBanner.js +5 -3
  34. package/lib/component/2d/Viewer2D.js +6 -6
  35. package/lib/component/2d/XAxis.js +2 -2
  36. package/lib/component/2d/YAxis.js +2 -2
  37. package/lib/component/2d/tools/XYLabelPointer.js +3 -1
  38. package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
  39. package/lib/component/2d/zones/IndicationLines.js +1 -1
  40. package/lib/component/2d/zones/Signal.d.ts +3 -2
  41. package/lib/component/2d/zones/Signal.js +3 -3
  42. package/lib/component/2d/zones/Zone.d.ts +1 -1
  43. package/lib/component/2d/zones/Zone.js +4 -4
  44. package/lib/component/2d/zones/Zones.js +14 -19
  45. package/lib/component/EventsTrackers/KeysListenerTracker.js +91 -52
  46. package/lib/component/NMRium.d.ts +2 -0
  47. package/lib/component/NMRium.js +14 -3
  48. package/lib/component/assignment/AssignmentsContext.d.ts +1 -1
  49. package/lib/component/context/GlobalContext.d.ts +1 -1
  50. package/lib/component/context/GlobalContext.js +3 -3
  51. package/lib/component/elements/ActiveButton.d.ts +17 -0
  52. package/lib/component/elements/ActiveButton.js +28 -0
  53. package/lib/component/elements/Button.d.ts +6 -6
  54. package/lib/component/elements/Button.js +5 -5
  55. package/lib/component/elements/ButtonToolTip.js +1 -1
  56. package/lib/component/elements/CheckBox.d.ts +2 -6
  57. package/lib/component/elements/CheckBox.js +4 -6
  58. package/lib/component/elements/Input.d.ts +5 -4
  59. package/lib/component/elements/Input.js +1 -1
  60. package/lib/component/elements/Label.d.ts +8 -6
  61. package/lib/component/elements/Label.js +3 -3
  62. package/lib/component/elements/MoleculeSelection.d.ts +2 -2
  63. package/lib/component/elements/MoleculeSelection.js +1 -1
  64. package/lib/component/elements/NextPrev.js +1 -1
  65. package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
  66. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
  67. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  68. package/lib/component/elements/Select.d.ts +7 -11
  69. package/lib/component/elements/Select.js +6 -8
  70. package/lib/component/elements/Tab/Tab.js +1 -1
  71. package/lib/component/elements/Table/Table.d.ts +1 -2
  72. package/lib/component/elements/Table/Table.js +2 -2
  73. package/lib/component/elements/ToggleButton.d.ts +1 -2
  74. package/lib/component/elements/ToggleButton.js +3 -2
  75. package/lib/component/elements/accordion/AccordionItem.js +2 -2
  76. package/lib/component/elements/formik/FormikNumberInput.d.ts +1 -1
  77. package/lib/component/elements/formik/FormikOnChange.d.ts +3 -2
  78. package/lib/component/elements/formik/FormikOnChange.js +11 -5
  79. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  80. package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
  81. package/lib/component/elements/popup/Modal/Provider.js +8 -11
  82. package/lib/component/elements/resizer/DivResizer.js +3 -3
  83. package/lib/component/elements/resizer/Resizer.d.ts +1 -0
  84. package/lib/component/elements/resizer/SVGResizer.js +3 -3
  85. package/lib/component/header/ApodizationOptionsPanel.d.ts +2 -0
  86. package/lib/component/header/ApodizationOptionsPanel.js +81 -0
  87. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +2 -1
  88. package/lib/component/header/AutoPeakPickingOptionPanel.js +40 -36
  89. package/lib/component/header/BaseLineCorrectionPanel.d.ts +1 -2
  90. package/lib/component/header/BaseLineCorrectionPanel.js +84 -52
  91. package/lib/component/header/Header.js +5 -2
  92. package/lib/component/header/HeaderContainer.d.ts +7 -0
  93. package/lib/component/header/HeaderContainer.js +10 -0
  94. package/lib/component/header/ManualPhaseCorrectionPanel.js +27 -29
  95. package/lib/component/header/RangesPickingOptionPanel.js +19 -21
  96. package/lib/component/header/ZeroFillingOptionsPanel.js +52 -47
  97. package/lib/component/header/Zones2DOptionPanel.js +11 -13
  98. package/lib/component/highlight/index.d.ts +27 -10
  99. package/lib/component/highlight/index.js +19 -17
  100. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
  101. package/lib/component/hooks/useCheckToolsVisibility.d.ts +10 -1
  102. package/lib/component/hooks/useCheckToolsVisibility.js +31 -1
  103. package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  104. package/lib/component/hooks/useExport.d.ts +0 -1
  105. package/lib/component/hooks/useExport.js +1 -17
  106. package/lib/component/hooks/useFilter.d.ts +1 -0
  107. package/lib/component/hooks/useFilter.js +7 -0
  108. package/lib/component/hooks/useIntegralPath.js +5 -2
  109. package/lib/component/hooks/useNucleus.js +4 -4
  110. package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
  111. package/lib/component/hooks/useSpectrum.js +3 -1
  112. package/lib/component/hooks/useToolsFunctions.js +1 -1
  113. package/lib/component/loader/DropZone.js +8 -148
  114. package/lib/component/modal/AlignSpectraModal.js +1 -2
  115. package/lib/component/modal/EditPeakShapeModal.d.ts +9 -0
  116. package/lib/component/modal/EditPeakShapeModal.js +85 -0
  117. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -3
  118. package/lib/component/modal/MoleculeStructureEditorModal.js +2 -3
  119. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
  120. package/lib/component/modal/PredictSpectraModal.js +1 -1
  121. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +1 -1
  122. package/lib/component/modal/changeSum/ChangeSumModal.js +9 -11
  123. package/lib/component/modal/changeSum/SelectMolecule.js +2 -2
  124. package/lib/component/modal/editRange/EditRangeModal.js +3 -3
  125. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +4 -9
  126. package/lib/component/modal/setting/DatabasesTabContent.js +2 -2
  127. package/lib/component/modal/setting/DisplayTabContent.js +1 -1
  128. package/lib/component/modal/setting/FormattingTabContent.js +2 -2
  129. package/lib/component/modal/setting/GeneralSettings.js +1 -1
  130. package/lib/component/modal/setting/ToolsTabContent.js +17 -13
  131. package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -2
  132. package/lib/component/modal/setting/WorkspaceItem.js +2 -2
  133. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  134. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  135. package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +3 -3
  136. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
  137. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +5 -4
  138. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +13 -10
  139. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +4 -2
  140. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  141. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -2
  142. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +5 -3
  143. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +12 -4
  144. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  145. package/lib/component/panels/Panels.js +3 -3
  146. package/lib/component/panels/PeaksPanel/PeaksPanel.js +47 -22
  147. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
  148. package/lib/component/panels/PeaksPanel/PeaksTable.js +44 -13
  149. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  150. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
  151. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
  152. package/lib/component/panels/RangesPanel/RangesTableRow.js +4 -4
  153. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  154. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +3 -2
  155. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +3 -3
  156. package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +3 -3
  157. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  158. package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
  159. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  160. package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  161. package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.d.ts +1 -1
  162. package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
  163. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
  164. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
  165. package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  166. package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  167. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  168. package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
  169. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -13
  170. package/lib/component/panels/databasePanel/DatabaseTable.js +3 -3
  171. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
  172. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  173. package/lib/component/panels/header/DefaultPanelHeader.js +3 -12
  174. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  175. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +2 -1
  176. package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -2
  177. package/lib/component/panels/predictionPanel/PredictionPanel.js +15 -3
  178. package/lib/component/reducer/IgnoreActions.js +5 -0
  179. package/lib/component/reducer/Reducer.d.ts +141 -51
  180. package/lib/component/reducer/Reducer.js +69 -45
  181. package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
  182. package/lib/component/reducer/actions/DomainActions.js +11 -9
  183. package/lib/component/reducer/actions/FiltersActions.d.ts +13 -7
  184. package/lib/component/reducer/actions/FiltersActions.js +326 -204
  185. package/lib/component/reducer/actions/IntegralsActions.js +15 -10
  186. package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
  187. package/lib/component/reducer/actions/LoadActions.js +19 -34
  188. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
  189. package/lib/component/reducer/actions/MoleculeActions.js +48 -19
  190. package/lib/component/reducer/actions/PeaksActions.d.ts +4 -1
  191. package/lib/component/reducer/actions/PeaksActions.js +52 -13
  192. package/lib/component/reducer/actions/PreferencesActions.js +8 -10
  193. package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
  194. package/lib/component/reducer/actions/RangesActions.js +87 -29
  195. package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  196. package/lib/component/reducer/actions/SpectrumsActions.js +14 -11
  197. package/lib/component/reducer/actions/ToolsActions.js +47 -95
  198. package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
  199. package/lib/component/reducer/actions/ZonesActions.js +68 -17
  200. package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
  201. package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
  202. package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
  203. package/lib/component/reducer/helper/getSpectrum.js +3 -2
  204. package/lib/component/reducer/helper/getStrongestPeak.d.ts +7 -0
  205. package/lib/component/reducer/helper/getStrongestPeak.js +15 -0
  206. package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
  207. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
  208. package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -15
  209. package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
  210. package/lib/component/reducer/types/Types.d.ts +12 -0
  211. package/lib/component/reducer/types/Types.js +12 -0
  212. package/lib/component/tool/BrushX.js +1 -1
  213. package/lib/component/tool/BrushXY.js +4 -3
  214. package/lib/component/tool/CrossLinePointer.js +5 -4
  215. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +8 -2
  216. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +22 -7
  217. package/lib/component/tool/FloatMoleculeStructures/index.d.ts +3 -2
  218. package/lib/component/tool/FloatMoleculeStructures/index.js +19 -6
  219. package/lib/component/toolbar/BasicToolBar.js +7 -14
  220. package/lib/component/toolbar/FunctionToolBar.js +13 -23
  221. package/lib/component/toolbar/ToolTypes.d.ts +7 -1
  222. package/lib/component/toolbar/ToolTypes.js +119 -9
  223. package/lib/component/utility/assert.d.ts +1 -0
  224. package/lib/component/utility/assert.js +5 -0
  225. package/lib/component/workspaces/Workspace.d.ts +4 -1
  226. package/lib/component/workspaces/basic.js +12 -11
  227. package/lib/component/workspaces/embedded.js +14 -13
  228. package/lib/component/workspaces/exercise.js +10 -6
  229. package/lib/component/workspaces/prediction.js +14 -13
  230. package/lib/component/workspaces/process1D.js +20 -19
  231. package/lib/component/workspaces/workspaceDefaultProperties.js +14 -15
  232. package/lib/constants.js +1 -1
  233. package/lib/data/Filters.d.ts +2 -2
  234. package/lib/data/Filters.js +2 -2
  235. package/lib/data/FiltersManager.js +3 -3
  236. package/lib/data/PredictionManager.d.ts +0 -1
  237. package/lib/data/PredictionManager.js +15 -15
  238. package/lib/data/SpectraManager.d.ts +2 -5
  239. package/lib/data/SpectraManager.js +4 -95
  240. package/lib/data/constants/SignalsKinds.d.ts +0 -1
  241. package/lib/data/constants/SignalsKinds.js +0 -8
  242. package/lib/data/data1d/Data1DManager.js +5 -5
  243. package/lib/data/data1d/Spectrum1D/SumManager.d.ts +5 -5
  244. package/lib/data/data1d/Spectrum1D/SumManager.js +18 -12
  245. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +2 -2
  246. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -1
  247. package/lib/data/data1d/Spectrum1D/index.js +2 -1
  248. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
  249. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
  250. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
  251. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +1 -1
  252. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -16
  253. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +8 -0
  254. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +24 -0
  255. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
  256. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
  257. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
  258. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
  259. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -3
  260. package/lib/data/data1d/database.js +4 -6
  261. package/lib/data/data1d/filter1d/apodization.d.ts +25 -0
  262. package/lib/data/data1d/filter1d/apodization.js +63 -0
  263. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +24 -7
  264. package/lib/data/data1d/filter1d/baselineCorrection.js +10 -17
  265. package/lib/data/data1d/filter1d/fft.js +11 -0
  266. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
  267. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
  268. package/lib/data/data1d/filter1d/zeroFillingAndApodization.d.ts +9 -0
  269. package/lib/data/data1d/filter1d/zeroFillingAndApodization.js +24 -0
  270. package/lib/data/data2d/Processing2D.d.ts +3 -3
  271. package/lib/data/data2d/Processing2D.js +3 -2
  272. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -3
  273. package/lib/data/data2d/Spectrum2D/zones/detectZones.js +3 -3
  274. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -3
  275. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
  276. package/lib/data/molecules/Molecule.d.ts +20 -6
  277. package/lib/data/molecules/Molecule.js +5 -8
  278. package/lib/data/molecules/MoleculeManager.d.ts +4 -4
  279. package/lib/data/molecules/MoleculeManager.js +5 -5
  280. package/lib/data/types/data1d/SumOptions.d.ts +1 -1
  281. package/lib/data/utilities/generateNumbersPowerOfX.d.ts +0 -1
  282. package/lib/data/utilities/generateNumbersPowerOfX.js +0 -1
  283. package/lib/data/utilities/isInRange.d.ts +7 -0
  284. package/lib/data/utilities/isInRange.js +4 -0
  285. package/lib/types/NMRiumDataReturn.d.ts +2 -2
  286. package/lib/types/NMRiumGeneralPreferences.d.ts +0 -2
  287. package/lib/types/NMRiumToolBarPreferences.d.ts +14 -13
  288. package/lib/versionInfo.js +1 -1
  289. package/lib-cjs/component/1d/ApodizationLine.js +77 -0
  290. package/lib-cjs/component/1d/Chart1D.js +4 -2
  291. package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +15 -8
  292. package/lib-cjs/component/1d/FooterBanner.js +3 -1
  293. package/lib-cjs/component/1d/IntegralResizable.js +4 -3
  294. package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
  295. package/lib-cjs/component/1d/LinesSeries.js +6 -4
  296. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  297. package/lib-cjs/component/1d/Viewer1D.js +10 -13
  298. package/lib-cjs/component/1d/database/DatabaseElements.js +1 -1
  299. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -2
  300. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  301. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
  302. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +15 -13
  303. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  304. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -3
  305. package/lib-cjs/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
  306. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +33 -0
  307. package/lib-cjs/component/1d/peaks/PeaksShapes.js +42 -0
  308. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +53 -0
  309. package/lib-cjs/component/1d/ranges/Range.js +3 -3
  310. package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
  311. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
  312. package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
  313. package/lib-cjs/component/2d/Contours.js +3 -1
  314. package/lib-cjs/component/2d/FooterBanner.js +5 -3
  315. package/lib-cjs/component/2d/Viewer2D.js +6 -6
  316. package/lib-cjs/component/2d/XAxis.js +2 -2
  317. package/lib-cjs/component/2d/YAxis.js +2 -2
  318. package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
  319. package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
  320. package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
  321. package/lib-cjs/component/2d/zones/Signal.js +3 -3
  322. package/lib-cjs/component/2d/zones/Zone.js +3 -3
  323. package/lib-cjs/component/2d/zones/Zones.js +13 -18
  324. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +89 -50
  325. package/lib-cjs/component/NMRium.js +14 -3
  326. package/lib-cjs/component/context/GlobalContext.js +4 -4
  327. package/lib-cjs/component/elements/ActiveButton.js +33 -0
  328. package/lib-cjs/component/elements/Button.js +5 -5
  329. package/lib-cjs/component/elements/ButtonToolTip.js +1 -1
  330. package/lib-cjs/component/elements/CheckBox.js +3 -5
  331. package/lib-cjs/component/elements/Input.js +1 -1
  332. package/lib-cjs/component/elements/Label.js +3 -3
  333. package/lib-cjs/component/elements/MoleculeSelection.js +1 -1
  334. package/lib-cjs/component/elements/NextPrev.js +1 -1
  335. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  336. package/lib-cjs/component/elements/Select.js +6 -8
  337. package/lib-cjs/component/elements/Tab/Tab.js +1 -1
  338. package/lib-cjs/component/elements/Table/Table.js +2 -2
  339. package/lib-cjs/component/elements/ToggleButton.js +3 -2
  340. package/lib-cjs/component/elements/accordion/AccordionItem.js +2 -2
  341. package/lib-cjs/component/elements/formik/FormikOnChange.js +10 -4
  342. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  343. package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
  344. package/lib-cjs/component/elements/resizer/DivResizer.js +3 -3
  345. package/lib-cjs/component/elements/resizer/SVGResizer.js +2 -2
  346. package/lib-cjs/component/header/ApodizationOptionsPanel.js +110 -0
  347. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +39 -35
  348. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +82 -49
  349. package/lib-cjs/component/header/Header.js +5 -2
  350. package/lib-cjs/component/header/HeaderContainer.js +14 -0
  351. package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +26 -28
  352. package/lib-cjs/component/header/RangesPickingOptionPanel.js +19 -21
  353. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +73 -45
  354. package/lib-cjs/component/header/Zones2DOptionPanel.js +11 -13
  355. package/lib-cjs/component/highlight/index.js +20 -18
  356. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
  357. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +31 -1
  358. package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  359. package/lib-cjs/component/hooks/useExport.js +0 -16
  360. package/lib-cjs/component/hooks/useFilter.js +14 -0
  361. package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
  362. package/lib-cjs/component/hooks/useNucleus.js +4 -4
  363. package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
  364. package/lib-cjs/component/hooks/useSpectrum.js +3 -1
  365. package/lib-cjs/component/hooks/useToolsFunctions.js +1 -1
  366. package/lib-cjs/component/loader/DropZone.js +7 -150
  367. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
  368. package/lib-cjs/component/modal/EditPeakShapeModal.js +113 -0
  369. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -3
  370. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
  371. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  372. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +9 -11
  373. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +2 -2
  374. package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -3
  375. package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +3 -8
  376. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +2 -2
  377. package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
  378. package/lib-cjs/component/modal/setting/FormattingTabContent.js +2 -2
  379. package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -1
  380. package/lib-cjs/component/modal/setting/ToolsTabContent.js +17 -13
  381. package/lib-cjs/component/modal/setting/WorkspaceItem.js +2 -2
  382. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  383. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  384. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
  385. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -9
  386. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  387. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +11 -3
  388. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  389. package/lib-cjs/component/panels/Panels.js +3 -3
  390. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +45 -20
  391. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
  392. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +42 -11
  393. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
  394. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
  395. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
  396. package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  397. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -1
  398. package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +3 -6
  399. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  400. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
  401. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  402. package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  403. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
  404. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
  405. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
  406. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  407. package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  408. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  409. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
  410. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -13
  411. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +2 -2
  412. package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -1
  413. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  414. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -12
  415. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  416. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -2
  417. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +15 -3
  418. package/lib-cjs/component/reducer/IgnoreActions.js +5 -0
  419. package/lib-cjs/component/reducer/Reducer.js +72 -50
  420. package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
  421. package/lib-cjs/component/reducer/actions/FiltersActions.js +332 -205
  422. package/lib-cjs/component/reducer/actions/IntegralsActions.js +15 -10
  423. package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
  424. package/lib-cjs/component/reducer/actions/MoleculeActions.js +49 -19
  425. package/lib-cjs/component/reducer/actions/PeaksActions.js +54 -12
  426. package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
  427. package/lib-cjs/component/reducer/actions/RangesActions.js +87 -29
  428. package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  429. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -11
  430. package/lib-cjs/component/reducer/actions/ToolsActions.js +46 -94
  431. package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
  432. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
  433. package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
  434. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
  435. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +19 -0
  436. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -5
  437. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
  438. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
  439. package/lib-cjs/component/reducer/types/Types.js +15 -3
  440. package/lib-cjs/component/tool/BrushX.js +1 -1
  441. package/lib-cjs/component/tool/BrushXY.js +4 -3
  442. package/lib-cjs/component/tool/CrossLinePointer.js +5 -4
  443. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +21 -6
  444. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +19 -6
  445. package/lib-cjs/component/toolbar/BasicToolBar.js +7 -14
  446. package/lib-cjs/component/toolbar/FunctionToolBar.js +12 -22
  447. package/lib-cjs/component/toolbar/ToolTypes.js +119 -9
  448. package/lib-cjs/component/utility/assert.js +9 -0
  449. package/lib-cjs/component/workspaces/basic.js +12 -11
  450. package/lib-cjs/component/workspaces/embedded.js +14 -13
  451. package/lib-cjs/component/workspaces/exercise.js +10 -6
  452. package/lib-cjs/component/workspaces/prediction.js +14 -13
  453. package/lib-cjs/component/workspaces/process1D.js +20 -19
  454. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +14 -15
  455. package/lib-cjs/constants.js +1 -1
  456. package/lib-cjs/data/Filters.js +3 -3
  457. package/lib-cjs/data/FiltersManager.js +3 -6
  458. package/lib-cjs/data/PredictionManager.js +15 -15
  459. package/lib-cjs/data/SpectraManager.js +5 -100
  460. package/lib-cjs/data/constants/SignalsKinds.js +0 -8
  461. package/lib-cjs/data/data1d/Data1DManager.js +5 -5
  462. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +18 -12
  463. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +2 -5
  464. package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
  465. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
  466. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
  467. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
  468. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -19
  469. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +28 -0
  470. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
  471. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
  472. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
  473. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -5
  474. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -6
  475. package/lib-cjs/data/data1d/database.js +4 -6
  476. package/lib-cjs/data/data1d/filter1d/apodization.js +70 -0
  477. package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +11 -18
  478. package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
  479. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
  480. package/lib-cjs/data/data1d/filter1d/zeroFillingAndApodization.js +30 -0
  481. package/lib-cjs/data/data2d/Processing2D.js +3 -2
  482. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -6
  483. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +3 -6
  484. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -6
  485. package/lib-cjs/data/molecules/Molecule.js +5 -8
  486. package/lib-cjs/data/molecules/MoleculeManager.js +5 -5
  487. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +0 -1
  488. package/lib-cjs/data/utilities/isInRange.js +7 -0
  489. package/lib-cjs/versionInfo.js +1 -1
  490. package/package.json +36 -35
  491. package/lib/component/1d/PeakAnnotations.js +0 -41
  492. package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
  493. package/lib/component/utility/nmredataToNmrium.js +0 -66
  494. package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
  495. package/lib/component/utility/nmriumToNmredata.js +0 -80
  496. package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
  497. package/lib/component/utility/util/nmredata/addRanges.js +0 -52
  498. package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
  499. package/lib/component/utility/util/nmredata/addSource.js +0 -54
  500. package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
  501. package/lib/component/utility/util/nmredata/addZones.js +0 -41
  502. package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
  503. package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
  504. package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
  505. package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
  506. package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
  507. package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
  508. package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
  509. package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
  510. package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
  511. package/lib/component/utility/util/nmredata/getLabels.js +0 -66
  512. package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
  513. package/lib/component/utility/util/nmredata/getToFix.js +0 -19
  514. package/lib/data/data1d/filter1d/lineBroadening.d.ts +0 -14
  515. package/lib/data/data1d/filter1d/lineBroadening.js +0 -57
  516. package/lib/data/migration/MigrationManager.d.ts +0 -2
  517. package/lib/data/migration/MigrationManager.js +0 -17
  518. package/lib/data/migration/changeKeys.d.ts +0 -1
  519. package/lib/data/migration/changeKeys.js +0 -9
  520. package/lib/data/migration/migrateToVersion1.d.ts +0 -11
  521. package/lib/data/migration/migrateToVersion1.js +0 -32
  522. package/lib/data/migration/migrateToVersion2.d.ts +0 -1
  523. package/lib/data/migration/migrateToVersion2.js +0 -111
  524. package/lib/data/utilities/generateID.d.ts +0 -1
  525. package/lib/data/utilities/generateID.js +0 -9
  526. package/lib-cjs/component/1d/PeakAnnotations.js +0 -46
  527. package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
  528. package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
  529. package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
  530. package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
  531. package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -48
  532. package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
  533. package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
  534. package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
  535. package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
  536. package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
  537. package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
  538. package/lib-cjs/data/data1d/filter1d/lineBroadening.js +0 -63
  539. package/lib-cjs/data/migration/MigrationManager.js +0 -24
  540. package/lib-cjs/data/migration/changeKeys.js +0 -13
  541. package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
  542. package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
  543. package/lib-cjs/data/utilities/generateID.js +0 -12
@@ -1,16 +1,18 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext, useReducer, useMemo, useContext, useCallback, useEffect, } from 'react';
3
- export var HighlightedSource;
4
- (function (HighlightedSource) {
5
- HighlightedSource["PEAK"] = "PEAK";
6
- HighlightedSource["INTEGRAL"] = "INTEGRAL";
7
- HighlightedSource["SIGNAL"] = "SIGNAL";
8
- HighlightedSource["RANGE"] = "RANGE";
9
- HighlightedSource["ZONE"] = "ZONE";
10
- HighlightedSource["EXCLUSION_ZONE"] = "EXCLUSION_ZONE";
11
- HighlightedSource["DATABASE"] = "DATABASE";
12
- HighlightedSource["UNKNOWN"] = "UNKNOWN";
13
- })(HighlightedSource || (HighlightedSource = {}));
3
+ export var HighlightEventSource;
4
+ (function (HighlightEventSource) {
5
+ HighlightEventSource["PEAK"] = "PEAK";
6
+ HighlightEventSource["INTEGRAL"] = "INTEGRAL";
7
+ HighlightEventSource["SIGNAL"] = "SIGNAL";
8
+ HighlightEventSource["RANGE"] = "RANGE";
9
+ HighlightEventSource["ZONE"] = "ZONE";
10
+ HighlightEventSource["EXCLUSION_ZONE"] = "EXCLUSION_ZONE";
11
+ HighlightEventSource["MULTIPLE_ANALYSIS_ZONE"] = "MULTIPLE_ANALYSIS_ZONE";
12
+ HighlightEventSource["DATABASE"] = "DATABASE";
13
+ HighlightEventSource["ATOM"] = "ATOM";
14
+ HighlightEventSource["UNKNOWN"] = "UNKNOWN";
15
+ })(HighlightEventSource || (HighlightEventSource = {}));
14
16
  const emptyState = {
15
17
  highlight: {
16
18
  highlights: {},
@@ -25,8 +27,8 @@ const highlightContext = createContext(emptyState);
25
27
  function highlightReducer(state, action) {
26
28
  switch (action.type) {
27
29
  case 'SHOW': {
28
- const { convertedHighlights, sourceData } = action.payload;
29
- const { type = HighlightedSource.UNKNOWN, extra = null } = sourceData || {};
30
+ const { convertedHighlights = [], sourceData } = action.payload || {};
31
+ const { type = HighlightEventSource.UNKNOWN, extra = null } = sourceData || {};
30
32
  const newState = {
31
33
  ...state,
32
34
  highlights: { ...state.highlights },
@@ -41,7 +43,7 @@ function highlightReducer(state, action) {
41
43
  return newState;
42
44
  }
43
45
  case 'HIDE': {
44
- const { convertedHighlights } = action.payload;
46
+ const { convertedHighlights = [] } = action.payload || {};
45
47
  const newState = {
46
48
  ...state,
47
49
  highlights: { ...state.highlights },
@@ -60,7 +62,7 @@ function highlightReducer(state, action) {
60
62
  const newState = {
61
63
  ...state,
62
64
  // allow just one permanent highlights group at same time
63
- highlightedPermanently: action.payload,
65
+ highlightedPermanently: action.payload?.convertedHighlights || [],
64
66
  };
65
67
  return newState;
66
68
  }
@@ -72,7 +74,7 @@ function highlightReducer(state, action) {
72
74
  return newState;
73
75
  }
74
76
  default: {
75
- throw new Error(`unknown action type: ${action.type}`);
77
+ throw new Error(`unknown action type: ${String(action.type)}`);
76
78
  }
77
79
  }
78
80
  }
@@ -168,7 +170,7 @@ export function useHighlight(highlights, sourceData = null) {
168
170
  if (!isActivePermanently) {
169
171
  dispatch({
170
172
  type: 'SET_PERMANENT',
171
- payload: convertedHighlights,
173
+ payload: { convertedHighlights },
172
174
  });
173
175
  }
174
176
  else {
@@ -1,9 +1,9 @@
1
1
  import get from 'lodash/get';
2
2
  import { useMemo } from 'react';
3
- import { useChartData } from '../context/ChartContext';
4
3
  import { usePreferences } from '../context/PreferencesContext';
4
+ import { useActiveSpectrum } from '../reducer/Reducer';
5
5
  export default function useActiveSpectrumStyleOptions(id) {
6
- const { activeSpectrum } = useChartData();
6
+ const activeSpectrum = useActiveSpectrum();
7
7
  const preferences = usePreferences();
8
8
  return useMemo(() => {
9
9
  const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
@@ -1,2 +1,11 @@
1
+ import { Info1D } from '../../data/types/data1d/Info1D';
2
+ import { Info2D } from '../../data/types/data2d';
1
3
  import { NMRiumToolBarPreferences } from '../../types/NMRiumToolBarPreferences';
2
- export declare function useCheckToolsVisibility(): (toolKey: keyof NMRiumToolBarPreferences) => boolean;
4
+ declare type SpectrumInfo = Info1D | Info2D;
5
+ interface CheckOptions {
6
+ checkSpectrumType?: boolean;
7
+ checkMode?: boolean;
8
+ extraInfoCheckParameters?: SpectrumInfo;
9
+ }
10
+ export declare function useCheckToolsVisibility(): (toolKey: keyof NMRiumToolBarPreferences, checkOptions?: CheckOptions) => boolean;
11
+ export {};
@@ -1,7 +1,37 @@
1
1
  import lodashGet from 'lodash/get';
2
2
  import { useCallback } from 'react';
3
+ import { useChartData } from '../context/ChartContext';
3
4
  import { usePreferences } from '../context/PreferencesContext';
5
+ import { options } from '../toolbar/ToolTypes';
6
+ import useSpectrum from './useSpectrum';
7
+ const emptyData = { info: {} };
4
8
  export function useCheckToolsVisibility() {
9
+ const { displayerMode } = useChartData();
5
10
  const preferences = usePreferences();
6
- return useCallback((toolKey) => lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false), [preferences]);
11
+ const spectrum = useSpectrum(emptyData);
12
+ return useCallback((toolKey, checkOptions = {}) => {
13
+ const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
14
+ let flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
15
+ const { spectrumType, mode } = options[toolKey];
16
+ const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
17
+ const spectrumCheckFlag = !checkSpectrumType ||
18
+ (checkSpectrumType &&
19
+ (!spectrumType ||
20
+ !spectrum ||
21
+ (spectrumType === 'FID' && spectrum.info.isFid) ||
22
+ (spectrumType === 'FT' && !spectrum.info.isFid)));
23
+ return (flag &&
24
+ modeFlag &&
25
+ spectrumCheckFlag &&
26
+ (!extraInfoCheckParameters ||
27
+ checkInfo(extraInfoCheckParameters, spectrum.info)));
28
+ }, [displayerMode, preferences, spectrum]);
29
+ }
30
+ function checkInfo(checkParameters, data) {
31
+ for (const key in checkParameters) {
32
+ if (checkParameters[key] !== data[key]) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
7
37
  }
@@ -1,9 +1,11 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
+ import { useActiveSpectrum } from '../reducer/Reducer';
3
4
  import nucleusToString from '../utility/nucleusToString';
4
5
  const emptyData = { info: {}, datum: {}, ftCounter: 0, fidCounter: 0 };
5
6
  export default function useDatumWithSpectraStatistics() {
6
- const { data, activeSpectrum, activeTab } = useChartData();
7
+ const { data, view: { spectra: { activeTab }, }, } = useChartData();
8
+ const activeSpectrum = useActiveSpectrum();
7
9
  return useMemo(() => {
8
10
  if (data) {
9
11
  let info = {};
@@ -1,7 +1,6 @@
1
1
  export default function useExport(): {
2
2
  saveToClipboardHandler: () => Promise<void>;
3
3
  saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => Promise<void>;
4
- saveAsNMREHandler: () => Promise<void>;
5
4
  saveAsSVGHandler: () => Promise<void>;
6
5
  saveAsPNGHandler: () => Promise<void>;
7
6
  saveAsHandler: () => Promise<void>;
@@ -6,8 +6,7 @@ import { useGlobal } from '../context/GlobalContext';
6
6
  import { useAlert } from '../elements/popup/Alert';
7
7
  import { positions, useModal } from '../elements/popup/Modal';
8
8
  import SaveAsModal from '../modal/SaveAsModal';
9
- import { copyPNGToClipboard, exportAsJSON, exportAsNMRE, exportAsPng, exportAsSVG, } from '../utility/Export';
10
- import { nmriumToNmredata } from '../utility/nmriumToNmredata';
9
+ import { copyPNGToClipboard, exportAsJSON, exportAsPng, exportAsSVG, } from '../utility/Export';
11
10
  export default function useExport() {
12
11
  const { rootRef } = useGlobal();
13
12
  const modal = useModal();
@@ -38,20 +37,6 @@ export default function useExport() {
38
37
  }, 0);
39
38
  }
40
39
  }, [alert, state]);
41
- const saveAsNMREHandler = useCallback(async () => {
42
- if (state.data.length > 0) {
43
- const hideLoading = await alert.showLoading('Exporting as NMRE process in progress');
44
- setTimeout(() => {
45
- async function handle() {
46
- const fileName = state.data[0]?.display?.name;
47
- const exportedData = await nmriumToNmredata(state);
48
- exportAsNMRE(exportedData, fileName);
49
- hideLoading();
50
- }
51
- void handle();
52
- }, 0);
53
- }
54
- }, [alert, state]);
55
40
  const saveAsSVGHandler = useCallback(async () => {
56
41
  if (state.data.length > 0 && rootRef) {
57
42
  const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
@@ -100,7 +85,6 @@ export default function useExport() {
100
85
  return {
101
86
  saveToClipboardHandler,
102
87
  saveAsJSONHandler,
103
- saveAsNMREHandler,
104
88
  saveAsSVGHandler,
105
89
  saveAsPNGHandler,
106
90
  saveAsHandler,
@@ -0,0 +1 @@
1
+ export declare function useFilter(filterID: string): import("../../data/FiltersManager").Filter | null;
@@ -0,0 +1,7 @@
1
+ import { useMemo } from 'react';
2
+ import useSpectrum from './useSpectrum';
3
+ const emptyData = { filters: {} };
4
+ export function useFilter(filterID) {
5
+ const { filters } = useSpectrum(emptyData);
6
+ return useMemo(() => filters.find((filter) => filter.name === filterID) || null, [filterID, filters]);
7
+ }
@@ -2,10 +2,12 @@ import { xyIntegral, xyReduce } from 'ml-spectra-processing';
2
2
  import { useMemo } from 'react';
3
3
  import { getIntegralYScale } from '../1d/utilities/scale';
4
4
  import { useChartData } from '../context/ChartContext';
5
+ import { useActiveSpectrum } from '../reducer/Reducer';
5
6
  import { PathBuilder } from '../utility/PathBuilder';
6
7
  import { useXScale } from './useXScale';
7
8
  function useIntegralYDomain() {
8
- const { height, margin, verticalAlign, activeSpectrum, integralsYDomains } = useChartData();
9
+ const { height, margin, verticalAlign, integralsYDomains } = useChartData();
10
+ const activeSpectrum = useActiveSpectrum();
9
11
  return useMemo(() => getIntegralYScale({
10
12
  height,
11
13
  margin,
@@ -15,7 +17,8 @@ function useIntegralYDomain() {
15
17
  }), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
16
18
  }
17
19
  export default function useIntegralPath(integralOptions) {
18
- const { data, activeSpectrum } = useChartData();
20
+ const { data } = useChartData();
21
+ const activeSpectrum = useActiveSpectrum();
19
22
  const scaleX = useXScale();
20
23
  const scaleY = useIntegralYDomain();
21
24
  const integral = useMemo(() => {
@@ -1,11 +1,11 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
3
  export default function useNucleus() {
4
- const { tabActiveSpectrum } = useChartData();
4
+ const { view: { spectra: { activeSpectra }, }, } = useChartData();
5
5
  return useMemo(() => {
6
- if (tabActiveSpectrum && Object.keys(tabActiveSpectrum).length > 0) {
7
- return Object.keys(tabActiveSpectrum);
6
+ if (activeSpectra && Object.keys(activeSpectra).length > 0) {
7
+ return Object.keys(activeSpectra);
8
8
  }
9
9
  return [];
10
- }, [tabActiveSpectrum]);
10
+ }, [activeSpectra]);
11
11
  }
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
3
  import nucleusToString from '../utility/nucleusToString';
4
4
  export default function useSpectraByActiveNucleus() {
5
- const { data, activeTab } = useChartData();
5
+ const { data, view: { spectra: { activeTab }, }, } = useChartData();
6
6
  return useMemo(() => {
7
7
  if (data) {
8
8
  return (data.filter((spectrum) => activeTab === nucleusToString(spectrum.info.nucleus)) || []);
@@ -1,7 +1,9 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
+ import { useActiveSpectrum } from '../reducer/Reducer';
3
4
  export default function useSpectrum(defaultValue) {
4
- const { data, activeSpectrum } = useChartData();
5
+ const { data } = useChartData();
6
+ const activeSpectrum = useActiveSpectrum();
5
7
  return useMemo(() => {
6
8
  if (data && activeSpectrum && activeSpectrum.id) {
7
9
  const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
@@ -18,7 +18,7 @@ export default function useToolsFunctions() {
18
18
  if ([
19
19
  options.peakPicking.id,
20
20
  options.integral.id,
21
- options.zone2D.id,
21
+ options.zonePicking.id,
22
22
  options.exclusionZones.id,
23
23
  ].includes(selectedTool)) {
24
24
  alert.show('Press Shift + Left Mouse button to select zone');
@@ -1,17 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import Zip from 'jszip';
5
4
  import { useCallback } from 'react';
6
5
  import { useDropzone } from 'react-dropzone';
7
6
  import { FaUpload } from 'react-icons/fa';
8
7
  import { useChartData } from '../context/ChartContext';
9
8
  import { useDispatch } from '../context/DispatchContext';
10
9
  import { LoaderProvider } from '../context/LoaderContext';
11
- import { useAlert } from '../elements/popup/Alert';
12
10
  import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
13
- import { LOAD_MOL_FILE, LOAD_JSON_FILE, LOAD_JCAMP_FILE, SET_LOADING_FLAG, LOAD_ZIP_FILE, LOAD_JDF_FILE, LOAD_NMREDATA_FILE, } from '../reducer/types/Types';
14
- import { FILES_TYPES, FILES_SIGNATURES, getFileExtension, getFileSignature, loadFiles, loadFilesFromZip, } from '../utility/FileUtility';
11
+ import { SET_LOADING_FLAG, LOAD_DROP_FILES } from '../reducer/types/Types';
15
12
  const style = css `
16
13
  height: 100%;
17
14
  background-color: #b5b5b599;
@@ -46,153 +43,16 @@ const containerStyle = css `
46
43
  function DropZone(props) {
47
44
  const { width, height } = useChartData();
48
45
  const dispatch = useDispatch();
49
- const alert = useAlert();
50
46
  const isToolEnabled = useCheckToolsVisibility();
51
- const loadSubFilesFromZip = useCallback(async (extractedfiles, uniqueFileExtensions) => {
52
- for (let extension of uniqueFileExtensions) {
53
- const selectedFilesByExtensions = extractedfiles.filter((file) => getFileExtension(file.name) === extension);
54
- switch (extension) {
55
- case FILES_TYPES.MOL: {
56
- const files = await loadFilesFromZip(selectedFilesByExtensions);
57
- dispatch({ type: LOAD_MOL_FILE, files });
58
- break;
59
- }
60
- case FILES_TYPES.NMRIUM:
61
- case FILES_TYPES.JSON: {
62
- const files = await loadFilesFromZip(selectedFilesByExtensions, {
63
- asBuffer: true,
64
- });
65
- if (selectedFilesByExtensions.length === 1) {
66
- const decoder = new TextDecoder('utf8');
67
- files[0].binary = decoder.decode(files[0].binary);
68
- dispatch({ type: LOAD_JSON_FILE, files });
69
- }
70
- else {
71
- throw new Error('You can add only one json file');
72
- }
73
- break;
74
- }
75
- case FILES_TYPES.JDX:
76
- case FILES_TYPES.DX: {
77
- const files = await loadFilesFromZip(selectedFilesByExtensions, {
78
- asBuffer: true,
79
- });
80
- dispatch({ type: LOAD_JCAMP_FILE, files });
81
- break;
82
- }
83
- case FILES_TYPES.JDF: {
84
- const files = await loadFilesFromZip(selectedFilesByExtensions, {
85
- asBuffer: true,
86
- });
87
- dispatch({ type: LOAD_JDF_FILE, files });
88
- break;
89
- }
90
- default:
91
- break;
92
- }
93
- }
47
+ const loadFilesHandler = useCallback((files) => {
48
+ files.forEach((file) => {
49
+ Object.defineProperty(file, 'webkitRelativePath', { value: file.path });
50
+ });
51
+ dispatch({ type: LOAD_DROP_FILES, files });
94
52
  }, [dispatch]);
95
- const loadFilesHandler = useCallback(async (files) => {
96
- const uniqueFileExtensions = [
97
- ...new Set(files.map((file) => getFileExtension(file.name))),
98
- ];
99
- for (let extension of uniqueFileExtensions) {
100
- const selectedFilesByExtensions = files.filter((file) => getFileExtension(file.name) === extension);
101
- try {
102
- switch (extension) {
103
- case FILES_TYPES.MOL: {
104
- const files = await loadFiles(selectedFilesByExtensions);
105
- dispatch({ type: LOAD_MOL_FILE, files });
106
- break;
107
- }
108
- case FILES_TYPES.NMRIUM:
109
- case FILES_TYPES.JSON:
110
- if (selectedFilesByExtensions.length === 1) {
111
- const files = await loadFiles(selectedFilesByExtensions, {
112
- asBuffer: true,
113
- });
114
- // InputFileFormat
115
- const fileSignature = getFileSignature(files[0].binary);
116
- if (fileSignature === FILES_SIGNATURES.ZIP) {
117
- const unzipResult = await Zip.loadAsync(files[0].binary);
118
- await loadSubFilesFromZip(Object.values(unzipResult.files), [
119
- FILES_TYPES.NMRIUM,
120
- ]);
121
- }
122
- else {
123
- const decoder = new TextDecoder('utf8');
124
- files[0].binary = decoder.decode(files[0].binary);
125
- dispatch({ type: LOAD_JSON_FILE, files });
126
- }
127
- }
128
- else {
129
- throw new Error('You can add only one json file');
130
- }
131
- break;
132
- case FILES_TYPES.JDX:
133
- case FILES_TYPES.DX: {
134
- const files = await loadFiles(selectedFilesByExtensions, {
135
- asBuffer: true,
136
- });
137
- dispatch({ type: LOAD_JCAMP_FILE, files });
138
- break;
139
- }
140
- case FILES_TYPES.JDF: {
141
- const files = await loadFiles(selectedFilesByExtensions, {
142
- asBuffer: true,
143
- });
144
- dispatch({ type: LOAD_JDF_FILE, files });
145
- break;
146
- }
147
- case FILES_TYPES.ZIP: {
148
- const files = await loadFiles(selectedFilesByExtensions, {
149
- asBuffer: true,
150
- });
151
- for (const zipFile of files) {
152
- const unzipResult = await Zip.loadAsync(zipFile.binary);
153
- const uniqueFileExtensions = [
154
- ...new Set(Object.values(unzipResult.files).map((file) => getFileExtension(file.name))),
155
- ];
156
- const isNotZip = uniqueFileExtensions.some((ex) => FILES_TYPES[ex.toUpperCase()] && ex !== FILES_TYPES.ZIP);
157
- if (isNotZip) {
158
- const hasBruker = Object.keys(unzipResult.files).some((path) => {
159
- return ['2rr', 'fid', '1r'].some((brukerFile) => path.endsWith(brukerFile));
160
- });
161
- if (hasBruker)
162
- dispatch({ type: LOAD_ZIP_FILE, files });
163
- await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
164
- }
165
- else {
166
- dispatch({ type: LOAD_ZIP_FILE, files });
167
- }
168
- }
169
- break;
170
- }
171
- case FILES_TYPES.NMREDATA:
172
- void loadFiles(selectedFilesByExtensions, {
173
- asBuffer: true,
174
- }).then(async (files) => {
175
- for (const zipFile of files) {
176
- dispatch({
177
- type: LOAD_NMREDATA_FILE,
178
- file: zipFile,
179
- });
180
- }
181
- });
182
- break;
183
- default:
184
- throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
185
- }
186
- }
187
- catch (e) {
188
- dispatch({ type: SET_LOADING_FLAG, isLoading: false });
189
- alert.error(e.message);
190
- }
191
- }
192
- }, [alert, dispatch, loadSubFilesFromZip]);
193
53
  const onDrop = useCallback((droppedFiles) => {
194
54
  dispatch({ type: SET_LOADING_FLAG, isLoading: true });
195
- void loadFilesHandler(droppedFiles);
55
+ loadFilesHandler(droppedFiles);
196
56
  }, [dispatch, loadFilesHandler]);
197
57
  const isImportEnabled = isToolEnabled('import');
198
58
  const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
@@ -206,7 +66,7 @@ function DropZone(props) {
206
66
  openImportDialog();
207
67
  }
208
68
  }, [isImportEnabled, openImportDialog]);
209
- return (_jsx(LoaderProvider, { value: open, children: _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { "data-test-id": "dropzone-input", ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
69
+ return (_jsx(LoaderProvider, { value: open, children: _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
210
70
  width: `${width}px`,
211
71
  height: `${height}px`,
212
72
  marginTop: '30px',
@@ -19,7 +19,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
19
19
  const List = useMemo(() => {
20
20
  const list = REFERENCES[nucleus]
21
21
  ? Object.entries(REFERENCES[nucleus]).map((item) => ({
22
- key: item[0],
23
22
  value: item[0],
24
23
  label: item[0],
25
24
  }), [])
@@ -52,6 +51,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
52
51
  ...resValues,
53
52
  });
54
53
  }, [nucleus]);
55
- return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsxs(FormikForm, { ref: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, { data: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Number of Peaks : ", children: _jsx(FormikInput, { name: "nbPeaks", type: "number" }) }) }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Target PPM :", children: _jsx(FormikInput, { name: "targetX", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
54
+ return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsxs(FormikForm, { ref: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, { items: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Number of Peaks : ", children: _jsx(FormikInput, { name: "nbPeaks", type: "number" }) }) }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Target PPM :", children: _jsx(FormikInput, { name: "targetX", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
56
55
  }
57
56
  export default AlignSpectraModal;
@@ -0,0 +1,9 @@
1
+ import { Peak } from '../../data/types/data1d';
2
+ import { PeaksNucleusPreferences } from '../workspaces/Workspace';
3
+ interface EditPeakShapeModalProps {
4
+ onClose?: (element?: string) => void;
5
+ peak: Peak;
6
+ peaksPreferences: PeaksNucleusPreferences;
7
+ }
8
+ declare function EditPeakShapeModal({ onClose, peak, peaksPreferences, }: EditPeakShapeModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export default EditPeakShapeModal;
@@ -0,0 +1,85 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { css } from '@emotion/react';
4
+ import { useCallback, useRef, useState } from 'react';
5
+ import * as Yup from 'yup';
6
+ import { useDispatch } from '../context/DispatchContext';
7
+ import ActionButtons from '../elements/ActionButtons';
8
+ import CloseButton from '../elements/CloseButton';
9
+ import Label from '../elements/Label';
10
+ import Select from '../elements/Select';
11
+ import FormikForm from '../elements/formik/FormikForm';
12
+ import FormikInput from '../elements/formik/FormikInput';
13
+ import { CHANGE_PEAK_SHAPE } from '../reducer/types/Types';
14
+ import { formatNumber } from '../utility/formatNumber';
15
+ import { ModalStyles } from './ModalStyle';
16
+ const styles = css `
17
+ width: 400px;
18
+ min-height: 250px;
19
+
20
+ .inner-content {
21
+ flex: 1;
22
+ }
23
+ `;
24
+ const getKindDefaultValues = (kind) => {
25
+ return {
26
+ kind,
27
+ fwhm: 500,
28
+ ...(kind === 'pseudoVoigt' && { mu: 0.5 }),
29
+ };
30
+ };
31
+ const getValues = (peak, kind) => {
32
+ const { shape } = peak;
33
+ const shapeData = (shape?.kind || '').toLocaleLowerCase() !== kind
34
+ ? {
35
+ ...getKindDefaultValues(kind),
36
+ ...(shape?.fwhm && { fwhm: shape?.fwhm }),
37
+ }
38
+ : shape;
39
+ return shapeData;
40
+ };
41
+ const validation = (kind) => Yup.object().shape({
42
+ fwhm: Yup.number().required(),
43
+ ...(kind === 'pseudoVoigt' && { mu: Yup.number().required() }),
44
+ });
45
+ const KINDS = [
46
+ {
47
+ value: 'gaussian',
48
+ label: 'Gaussian',
49
+ },
50
+ {
51
+ value: 'lorentzian',
52
+ label: 'Lorentzian',
53
+ },
54
+ {
55
+ value: 'pseudoVoigt',
56
+ label: 'PseudoVoigt',
57
+ },
58
+ ];
59
+ const labelStyle = {
60
+ container: { paddingTop: '5px' },
61
+ label: { flex: 3, fontSize: '14px', fontWeight: 'normal' },
62
+ wrapper: { flex: 7, display: 'flex' },
63
+ };
64
+ const inputStyle = { input: { width: '200px', textAlign: 'left' } };
65
+ function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
66
+ const dispatch = useDispatch();
67
+ const refForm = useRef();
68
+ const [kind, setKind] = useState(peak.shape?.kind);
69
+ const changePeakShapeHandler = useCallback((values) => {
70
+ dispatch({
71
+ type: CHANGE_PEAK_SHAPE,
72
+ payload: {
73
+ id: peak.id,
74
+ shape: {
75
+ ...values,
76
+ },
77
+ },
78
+ });
79
+ onClose();
80
+ }, [dispatch, onClose, peak.id]);
81
+ const values = getValues(peak, kind);
82
+ const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
83
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsxs(FormikForm, { ref: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }, JSON.stringify(values)) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
84
+ }
85
+ export default EditPeakShapeModal;
@@ -1,8 +1,8 @@
1
- import { Molecule } from '../../data/molecules/Molecule';
1
+ import { StateMoleculeExtended } from '../../data/molecules/Molecule';
2
2
  interface MoleculeStructureEditorModalProps {
3
3
  onClose?: (element?: string) => void;
4
- selectedMolecule?: Molecule;
4
+ selectedMolecule?: StateMoleculeExtended;
5
5
  }
6
6
  declare function MoleculeStructureEditorModal(props: MoleculeStructureEditorModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
- export declare function useMoleculeEditor(): (molecule?: Molecule) => void;
7
+ export declare function useMoleculeEditor(): (molecule?: StateMoleculeExtended) => void;
8
8
  export default MoleculeStructureEditorModal;
@@ -29,13 +29,12 @@ function MoleculeStructureEditorModal(props) {
29
29
  }, [onClose]);
30
30
  const handleSave = useCallback(() => {
31
31
  if (selectedMolecule) {
32
- const { key, isFloat, label } = selectedMolecule;
32
+ const { id, label } = selectedMolecule;
33
33
  dispatch({
34
34
  type: SET_MOLECULE,
35
35
  payload: {
36
36
  molfile,
37
- key,
38
- isFloat,
37
+ id,
39
38
  label,
40
39
  },
41
40
  });
@@ -67,7 +67,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
67
67
  const List = useMemo(() => {
68
68
  const list = REFERENCES[nucleus]
69
69
  ? Object.entries(REFERENCES[nucleus]).map((item) => ({
70
- key: item[0],
71
70
  value: item[0],
72
71
  label: item[0],
73
72
  }), [])
@@ -115,6 +114,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
115
114
  break;
116
115
  }
117
116
  }, [filter, submitHandler]);
118
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Apply filters" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content container", children: [_jsx("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Filter :" }), _jsx(Select, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler })] }), filterOptions] }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: onClose, cancelLabel: "Close" }) })] }));
117
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Apply filters" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content container", children: [_jsx("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Filter :" }), _jsx(Select, { items: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler })] }), filterOptions] }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: onClose, cancelLabel: "Close" }) })] }));
119
118
  }
120
119
  export default MultipleSpectraFiltersModal;