nmrium 0.42.0 → 0.43.1-pre.1692874523

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 (306) hide show
  1. package/lib/component/1d/ApodizationLine.js +1 -1
  2. package/lib/component/1d/Chart1D.js +3 -2
  3. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  4. package/lib/component/1d/Line.js +1 -1
  5. package/lib/component/1d/Viewer1D.js +15 -3
  6. package/lib/component/1d/integral/IntegralResizable.js +4 -3
  7. package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  8. package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
  9. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
  10. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
  11. package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
  12. package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
  13. package/lib/component/1d/peaks/Peaks.d.ts +1 -0
  14. package/lib/component/1d/peaks/Peaks.js +22 -0
  15. package/lib/component/1d/ranges/Range.js +3 -1
  16. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  17. package/lib/component/1d/tool/BaseLineZones.js +11 -31
  18. package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
  19. package/lib/component/1d/utilities/intersectionResolver.js +71 -0
  20. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  21. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
  22. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
  23. package/lib/component/2d/SlicingView.js +1 -1
  24. package/lib/component/2d/Viewer2D.js +1 -3
  25. package/lib/component/2d/ft/Contours.js +1 -1
  26. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
  27. package/lib/component/EventsTrackers/KeysListenerTracker.js +48 -8
  28. package/lib/component/assignment/index.d.ts +6 -1
  29. package/lib/component/assignment/index.js +5 -1
  30. package/lib/component/context/DispatchContext.d.ts +3 -2
  31. package/lib/component/context/KeyModifierContext.d.ts +13 -0
  32. package/lib/component/context/KeyModifierContext.js +39 -0
  33. package/lib/component/context/PreferencesContext.d.ts +39 -39
  34. package/lib/component/elements/Button.js +2 -0
  35. package/lib/component/elements/CounterLabel.d.ts +7 -0
  36. package/lib/component/elements/CounterLabel.js +12 -0
  37. package/lib/component/elements/EditableColumn.js +12 -6
  38. package/lib/component/elements/Input.d.ts +3 -12
  39. package/lib/component/elements/Input.js +24 -76
  40. package/lib/component/elements/Message.js +0 -1
  41. package/lib/component/elements/NumberInput.d.ts +1 -0
  42. package/lib/component/elements/NumberInput.js +10 -3
  43. package/lib/component/elements/PreferencesButton.d.ts +4 -0
  44. package/lib/component/elements/PreferencesButton.js +6 -0
  45. package/lib/component/elements/formik/FormikInput.d.ts +2 -2
  46. package/lib/component/elements/formik/FormikInput.js +3 -6
  47. package/lib/component/elements/formik/FormikOnChange.js +1 -1
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  49. package/lib/component/header/ApodizationOptionsPanel.js +23 -14
  50. package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
  51. package/lib/component/header/Header.d.ts +10 -3
  52. package/lib/component/header/Header.js +6 -6
  53. package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
  54. package/lib/component/highlight/index.d.ts +1 -0
  55. package/lib/component/highlight/index.js +1 -0
  56. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  57. package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
  58. package/lib/component/hooks/useResizerStatus.d.ts +2 -0
  59. package/lib/component/hooks/useResizerStatus.js +7 -0
  60. package/lib/component/hooks/useSpectrum.js +1 -1
  61. package/lib/component/main/ErrorOverlay.js +20 -0
  62. package/lib/component/main/InnerNMRium.d.ts +7 -0
  63. package/lib/component/main/InnerNMRium.js +52 -0
  64. package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
  65. package/lib/component/main/InnerNMRiumContents.js +88 -0
  66. package/lib/component/main/NMRium.d.ts +23 -0
  67. package/lib/component/main/NMRium.js +13 -0
  68. package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
  69. package/lib/component/main/NMRiumStateProvider.js +74 -0
  70. package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  71. package/lib/component/main/StateError.d.ts +4 -0
  72. package/lib/component/main/StateError.js +16 -0
  73. package/lib/component/main/index.d.ts +3 -0
  74. package/lib/component/main/index.js +3 -0
  75. package/lib/component/main/types.d.ts +18 -0
  76. package/lib/component/main/types.js +2 -0
  77. package/lib/component/modal/AlignSpectraModal.js +78 -29
  78. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
  79. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
  80. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  81. package/lib/component/modal/PredictSpectraModal.js +1 -1
  82. package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  83. package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
  84. package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
  85. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
  86. package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
  87. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
  88. package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
  89. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  90. package/lib/component/modal/setting/GeneralSettings.js +2 -2
  91. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  92. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  93. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  94. package/lib/component/modal/setting/settingsValidation.js +5 -1
  95. package/lib/component/panels/InformationPanel.js +9 -100
  96. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
  97. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  98. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  99. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  100. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
  101. package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
  102. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +13 -9
  103. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  104. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  105. package/lib/component/panels/Panels.js +6 -7
  106. package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
  107. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  108. package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
  109. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  110. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  111. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  112. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  113. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  114. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -6
  115. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
  116. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
  117. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
  118. package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
  119. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  120. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
  121. package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
  122. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
  123. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
  124. package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
  125. package/lib/component/panels/header/DefaultPanelHeader.js +11 -13
  126. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -3
  127. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  128. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  129. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  130. package/lib/component/reducer/IgnoreActions.js +1 -1
  131. package/lib/component/reducer/Reducer.d.ts +3 -8
  132. package/lib/component/reducer/Reducer.js +34 -8
  133. package/lib/component/reducer/actions/DomainActions.js +2 -3
  134. package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
  135. package/lib/component/reducer/actions/FiltersActions.js +96 -28
  136. package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
  137. package/lib/component/reducer/actions/IntegralsActions.js +44 -20
  138. package/lib/component/reducer/actions/MoleculeActions.js +4 -4
  139. package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
  140. package/lib/component/reducer/actions/PeaksActions.js +19 -1
  141. package/lib/component/reducer/actions/PreferencesActions.js +1 -2
  142. package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
  143. package/lib/component/reducer/actions/RangesActions.js +31 -3
  144. package/lib/component/reducer/actions/ToolsActions.js +10 -10
  145. package/lib/component/reducer/core/Constants.d.ts +0 -4
  146. package/lib/component/reducer/core/Constants.js +0 -5
  147. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
  148. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  149. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
  150. package/lib/component/toolbar/FunctionToolBar.js +13 -3
  151. package/lib/component/toolbar/ToolTypes.d.ts +3 -2
  152. package/lib/component/toolbar/ToolTypes.js +57 -22
  153. package/lib/component/utility/export.js +7 -4
  154. package/lib/component/utility/filterType.d.ts +3 -0
  155. package/lib/component/utility/filterType.js +1 -0
  156. package/lib/component/workspaces/basic.js +2 -0
  157. package/lib/component/workspaces/embedded.js +2 -0
  158. package/lib/component/workspaces/exercise.js +2 -0
  159. package/lib/component/workspaces/prediction.js +9 -0
  160. package/lib/component/workspaces/process1D.js +2 -0
  161. package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
  162. package/lib/data/PredictionManager.d.ts +3 -3
  163. package/lib/data/PredictionManager.js +10 -10
  164. package/lib/data/constants/References.d.ts +5 -3
  165. package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
  166. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
  167. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
  168. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  169. package/lib/data/molecules/Molecule.js +2 -2
  170. package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
  171. package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
  172. package/lib/versionInfo.js +1 -1
  173. package/lib-cjs/component/1d/ApodizationLine.js +1 -1
  174. package/lib-cjs/component/1d/Chart1D.js +3 -2
  175. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  176. package/lib-cjs/component/1d/Line.js +1 -1
  177. package/lib-cjs/component/1d/Viewer1D.js +15 -3
  178. package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
  179. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  180. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
  181. package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
  182. package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
  183. package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
  184. package/lib-cjs/component/1d/ranges/Range.js +3 -1
  185. package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
  186. package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
  187. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +17 -16
  188. package/lib-cjs/component/2d/SlicingView.js +1 -1
  189. package/lib-cjs/component/2d/Viewer2D.js +1 -3
  190. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  191. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +47 -7
  192. package/lib-cjs/component/assignment/index.js +5 -1
  193. package/lib-cjs/component/context/KeyModifierContext.js +44 -0
  194. package/lib-cjs/component/elements/Button.js +2 -0
  195. package/lib-cjs/component/elements/CounterLabel.js +16 -0
  196. package/lib-cjs/component/elements/EditableColumn.js +12 -6
  197. package/lib-cjs/component/elements/Input.js +23 -75
  198. package/lib-cjs/component/elements/Message.js +0 -1
  199. package/lib-cjs/component/elements/NumberInput.js +12 -2
  200. package/lib-cjs/component/elements/PreferencesButton.js +13 -0
  201. package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
  202. package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
  203. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  204. package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
  205. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
  206. package/lib-cjs/component/header/Header.js +6 -6
  207. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
  208. package/lib-cjs/component/highlight/index.js +1 -0
  209. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  210. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
  211. package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
  212. package/lib-cjs/component/hooks/useSpectrum.js +1 -1
  213. package/lib-cjs/component/main/ErrorOverlay.js +26 -0
  214. package/lib-cjs/component/main/InnerNMRium.js +82 -0
  215. package/lib-cjs/component/main/InnerNMRiumContents.js +95 -0
  216. package/lib-cjs/component/main/NMRium.js +19 -0
  217. package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
  218. package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  219. package/lib-cjs/component/main/StateError.js +20 -0
  220. package/lib-cjs/component/main/index.js +21 -0
  221. package/lib-cjs/component/main/types.js +3 -0
  222. package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
  223. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
  224. package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
  225. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  226. package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  227. package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
  228. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
  229. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
  232. package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  233. package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
  235. package/lib-cjs/component/panels/InformationPanel.js +7 -98
  236. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
  237. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  238. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  239. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  240. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
  241. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +8 -9
  242. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  243. package/lib-cjs/component/panels/Panels.js +6 -7
  244. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
  245. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  246. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
  247. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  248. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  249. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  250. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  251. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  252. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +29 -6
  253. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
  254. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
  255. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
  256. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  257. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
  258. package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
  259. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +12 -12
  260. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -3
  261. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  262. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  263. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  264. package/lib-cjs/component/reducer/IgnoreActions.js +1 -1
  265. package/lib-cjs/component/reducer/Reducer.js +33 -7
  266. package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
  267. package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
  268. package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
  269. package/lib-cjs/component/reducer/actions/MoleculeActions.js +3 -3
  270. package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
  271. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
  272. package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
  273. package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
  274. package/lib-cjs/component/reducer/core/Constants.js +1 -6
  275. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
  276. package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
  277. package/lib-cjs/component/toolbar/ToolTypes.js +57 -22
  278. package/lib-cjs/component/utility/export.js +7 -4
  279. package/lib-cjs/component/utility/filterType.js +2 -0
  280. package/lib-cjs/component/workspaces/basic.js +2 -0
  281. package/lib-cjs/component/workspaces/embedded.js +2 -0
  282. package/lib-cjs/component/workspaces/exercise.js +2 -0
  283. package/lib-cjs/component/workspaces/prediction.js +9 -0
  284. package/lib-cjs/component/workspaces/process1D.js +2 -0
  285. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
  286. package/lib-cjs/data/PredictionManager.js +9 -9
  287. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
  288. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  289. package/lib-cjs/data/molecules/Molecule.js +2 -2
  290. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
  291. package/lib-cjs/versionInfo.js +1 -1
  292. package/package.json +26 -25
  293. package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
  294. package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
  295. package/lib/component/ErrorOverlay.js +0 -27
  296. package/lib/component/NMRium.d.ts +0 -42
  297. package/lib/component/NMRium.js +0 -237
  298. package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
  299. package/lib/component/reducer/actions/GlobalActions.js +0 -4
  300. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
  301. package/lib-cjs/component/ErrorOverlay.js +0 -30
  302. package/lib-cjs/component/NMRium.js +0 -267
  303. package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
  304. /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
  305. /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
  306. /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
@@ -1,9 +1,26 @@
1
1
  import { Database } from 'nmr-load-save';
2
+ import { DatabaseNMREntry } from 'nmr-processing';
2
3
  import { LocalDatabase } from '../../../data/data1d/database';
4
+ export type Databases = Array<LocalDatabase | Database>;
3
5
  export interface DatabaseInnerProps {
4
6
  nucleus: string;
5
7
  selectedTool: string;
6
- databases: Array<LocalDatabase | Database>;
8
+ databases: Databases;
7
9
  defaultDatabase: string;
8
10
  }
11
+ export interface DatabaseSearchKeywords {
12
+ solvent: string;
13
+ searchKeywords: string;
14
+ }
15
+ export interface DataBaseSearchResultEntry {
16
+ data: DatabaseNMREntry[];
17
+ databases: Array<{
18
+ key: string;
19
+ value: string;
20
+ }>;
21
+ solvents: Array<{
22
+ label: string;
23
+ value: string;
24
+ }>;
25
+ }
9
26
  export default function PeaksPanel(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -5,9 +5,6 @@ import { readFromWebSource, serializeNmriumState, } from 'nmr-load-save';
5
5
  import { mapRanges } from 'nmr-processing';
6
6
  import OCL from 'openchemlib/full';
7
7
  import { useCallback, useState, useRef, memo, useEffect, useMemo } from 'react';
8
- import { BsHexagon, BsHexagonFill } from 'react-icons/bs';
9
- import { FaICursor } from 'react-icons/fa';
10
- import { IoSearchOutline } from 'react-icons/io5';
11
8
  import { useAccordionContext } from 'react-science/ui';
12
9
  import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
13
10
  import { getSum } from '../../../data/data1d/Spectrum1D/SumManager';
@@ -15,15 +12,9 @@ import { initiateDatabase, prepareData, DATA_BASES, } from '../../../data/data1d
15
12
  import { useChartData } from '../../context/ChartContext';
16
13
  import { useDispatch } from '../../context/DispatchContext';
17
14
  import { usePreferences } from '../../context/PreferencesContext';
18
- import Button from '../../elements/Button';
19
- import Input from '../../elements/Input';
20
- import Select from '../../elements/Select';
21
- import ToggleButton from '../../elements/ToggleButton';
22
15
  import { useAlert } from '../../elements/popup/Alert';
23
16
  import { positions, transitions, useModal } from '../../elements/popup/Modal';
24
17
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
25
- import useToolsFunctions from '../../hooks/useToolsFunctions';
26
- import { DISPLAYER_MODE } from '../../reducer/core/Constants';
27
18
  import { options } from '../../toolbar/ToolTypes';
28
19
  import Events from '../../utility/Events';
29
20
  import { exportAsJSON } from '../../utility/export';
@@ -31,11 +22,11 @@ import nucleusToString from '../../utility/nucleusToString';
31
22
  import { PanelNoData } from '../PanelNoData';
32
23
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
33
24
  import NoTableData from '../extra/placeholder/NoTableData';
34
- import DefaultPanelHeader from '../header/DefaultPanelHeader';
35
25
  import PreferencesHeader from '../header/PreferencesHeader';
36
26
  import DatabasePreferences from './DatabasePreferences';
37
27
  import { DatabaseStructureSearchModal } from './DatabaseStructureSearchModal';
38
28
  import DatabaseTable from './DatabaseTable';
29
+ import { DatabaseSearchOptions } from './DatabaseSearchOptions';
39
30
  const emptyKeywords = {
40
31
  solvent: '-1',
41
32
  searchKeywords: '',
@@ -52,7 +43,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
52
43
  const alert = useAlert();
53
44
  const modal = useModal();
54
45
  const { item } = useAccordionContext('Databases');
55
- const { handleChangeOption } = useToolsFunctions();
56
46
  const format = useFormatNumberByNucleus(nucleus);
57
47
  const [isFlipped, setFlipStatus] = useState(false);
58
48
  const settingRef = useRef();
@@ -72,18 +62,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
72
62
  settingRef.current.saveSetting();
73
63
  setFlipStatus(false);
74
64
  }, []);
75
- const handleSearch = useCallback((input) => {
76
- if (typeof input === 'string' || input === -1) {
77
- const solvent = String(input);
78
- setKeywords((prevState) => ({ ...prevState, solvent }));
79
- }
80
- else {
81
- setKeywords((prevState) => ({
82
- ...prevState,
83
- searchKeywords: input.target.value,
84
- }));
85
- }
86
- }, []);
87
65
  const search = useCallback((solvents) => {
88
66
  const { solvent, searchKeywords } = keywords;
89
67
  if (databaseInstance.current) {
@@ -236,13 +214,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
236
214
  alert.error(`No jcamp file to save`);
237
215
  }
238
216
  }, [alert, result]);
239
- const clearHandler = useCallback(() => {
240
- setKeywords((prevState) => ({ ...prevState, searchKeywords: '' }));
241
- }, []);
242
- const enableFilterHandler = useCallback((flag) => {
243
- const tool = !flag ? options.zoom.id : options.databaseRangesSelection.id;
244
- handleChangeOption(tool);
245
- }, [handleChangeOption]);
246
217
  const searchByStructureHandler = (idCodeValue) => {
247
218
  setIdCode(idCodeValue);
248
219
  };
@@ -264,15 +235,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
264
235
  }
265
236
  }
266
237
  `,
267
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { showSettingButton: true, onSettingClick: settingsPanelHandler, canDelete: false, children: [_jsx(ToggleButton, { defaultValue: selectedTool === options.databaseRangesSelection.id, popupTitle: "Filter by select ranges", popupPlacement: "right", onClick: enableFilterHandler, children: _jsx(FaICursor, { style: {
268
- pointerEvents: 'none',
269
- fontSize: '12px',
270
- transform: 'rotate(90deg)',
271
- } }) }, `${selectedTool}`), _jsx(Select, { style: { flex: 2, marginLeft: '5px' }, items: databases, itemTextField: "label", itemValueField: "key", onChange: handleChangeDatabase, placeholder: "Select database", defaultValue: defaultDatabase }), _jsx(Select, { style: { flex: 1, margin: '0px 5px' }, items: result.solvents, placeholder: "Solvent", onChange: handleSearch, value: keywords.solvent }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(Button.Done, { fill: "clear", onClick: openSearchByStructure, style: { marginLeft: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
272
- fontSize: '14px',
273
- } })) : (_jsx(BsHexagonFill, { style: {
274
- fontSize: '14px',
275
- } })) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
238
+ ], children: [!isFlipped && (_jsx(DatabaseSearchOptions, { databases: databases, defaultDatabase: defaultDatabase, idCode: idCode, keywords: keywords, result: result, selectedTool: selectedTool, total: databaseInstance.current?.data.length || 0, onKeywordsChange: (options) => setKeywords((prevKeywords) => ({ ...prevKeywords, ...options })), onSettingClick: settingsPanelHandler, onStructureClick: openSearchByStructure, onDatabaseChange: handleChangeDatabase })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
276
239
  ? 'Please select a database'
277
240
  : 'Please add databases URL in the general preferences' }))) : (_jsx(DatabasePreferences, { ref: settingRef })) })] }));
278
241
  }
@@ -282,7 +245,7 @@ export default function PeaksPanel() {
282
245
  const { current } = usePreferences();
283
246
  const { data, defaultDatabase } = current.databases;
284
247
  const databases = DATA_BASES.concat(data.filter((datum) => datum.enabled));
285
- if (!activeTab || displayerMode !== DISPLAYER_MODE.DM_1D) {
248
+ if (!activeTab || displayerMode !== '1D') {
286
249
  return (_jsx(PanelNoData, { children: "Databases are only available when 1D experimental spectrum is displayed. It will automatically select the corresponding nucleus" }));
287
250
  }
288
251
  return (_jsx(MemoizedDatabasePanel, { nucleus: activeTab, selectedTool: selectedTool, databases: databases, defaultDatabase: defaultDatabase }));
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { DataBaseSearchResultEntry, DatabaseSearchKeywords, Databases } from './DatabasePanel';
3
+ type OnClick = React.ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
4
+ interface DatabaseSearchOptionsProps {
5
+ databases: Databases;
6
+ defaultDatabase: string;
7
+ keywords: DatabaseSearchKeywords;
8
+ result: DataBaseSearchResultEntry;
9
+ selectedTool: string;
10
+ idCode?: string;
11
+ total: number;
12
+ onKeywordsChange: (k: Partial<DatabaseSearchKeywords>) => void;
13
+ onSettingClick: OnClick;
14
+ onStructureClick: OnClick;
15
+ onDatabaseChange: (databaseKey: string) => void;
16
+ }
17
+ export declare function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, selectedTool, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }: DatabaseSearchOptionsProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BsHexagon, BsHexagonFill } from 'react-icons/bs';
3
+ import Button from '../../elements/Button';
4
+ import { CounterLabel } from '../../elements/CounterLabel';
5
+ import Input from '../../elements/Input';
6
+ import { PreferencesButton } from '../../elements/PreferencesButton';
7
+ import Select from '../../elements/Select';
8
+ import PanelHeader from '../header/PanelHeader';
9
+ import useToolsFunctions from '../../hooks/useToolsFunctions';
10
+ import { options } from '../../toolbar/ToolTypes';
11
+ import { createFilterLabel } from '../header/DefaultPanelHeader';
12
+ import { FaICursor } from 'react-icons/fa';
13
+ import { IoSearchOutline } from 'react-icons/io5';
14
+ import ToggleButton from '../../elements/ToggleButton';
15
+ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, selectedTool, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }) {
16
+ const { handleChangeOption } = useToolsFunctions();
17
+ function enableFilterHandler(flag) {
18
+ const tool = !flag ? options.zoom.id : options.databaseRangesSelection.id;
19
+ handleChangeOption(tool);
20
+ }
21
+ function handleSearch(input) {
22
+ if (typeof input === 'string' || input === -1) {
23
+ const solvent = String(input);
24
+ onKeywordsChange({ solvent });
25
+ }
26
+ else {
27
+ onKeywordsChange({
28
+ searchKeywords: input.target.value,
29
+ });
30
+ }
31
+ }
32
+ function clearHandler() {
33
+ onKeywordsChange({ searchKeywords: '' });
34
+ }
35
+ return (_jsxs(PanelHeader, { style: { flexDirection: 'column', alignItems: 'normal' }, children: [_jsxs("div", { style: {
36
+ display: 'flex',
37
+ justifyContent: 'space-between',
38
+ paddingBottom: '2px',
39
+ }, children: [_jsx(Select, { style: { flex: 6 }, items: databases, itemTextField: "label", itemValueField: "key", onChange: onDatabaseChange, placeholder: "Select database", defaultValue: defaultDatabase }), _jsx(Select, { style: { flex: 4, margin: '0px 5px' }, items: result.solvents, placeholder: "Solvent", onChange: handleSearch, value: keywords.solvent }), _jsxs("div", { style: {
40
+ display: 'flex',
41
+ alignItems: 'center',
42
+ flex: 2,
43
+ justifyContent: 'flex-end',
44
+ }, children: [_jsx(CounterLabel, { children: createFilterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToggleButton, { defaultValue: selectedTool === options.databaseRangesSelection.id, popupTitle: "Filter by select ranges", popupPlacement: "right", onClick: enableFilterHandler, children: _jsx(FaICursor, { style: {
45
+ pointerEvents: 'none',
46
+ fontSize: '12px',
47
+ transform: 'rotate(90deg)',
48
+ } }) }, `${selectedTool}`), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { margin: '0 5px', flex: 1 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(Button.Done, { fill: "clear", onClick: onStructureClick, style: { padding: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
49
+ fontSize: '12px',
50
+ } })) : (_jsx(BsHexagonFill, { style: {
51
+ fontSize: '12px',
52
+ } })) })] })] }));
53
+ }
@@ -1,21 +1,20 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  interface DefaultPanelHeaderProps {
3
3
  counter?: number;
4
- counterFiltered?: number;
4
+ counterLabel?: string;
5
5
  deleteToolTip?: string;
6
6
  filterToolTip?: string;
7
7
  onDelete?: () => void;
8
8
  onFilter?: () => void;
9
9
  onSettingClick?: () => void;
10
- filterIsActive?: boolean;
11
10
  canDelete?: boolean;
12
11
  disableDelete?: boolean;
13
12
  showSettingButton?: boolean;
14
- showCounter?: boolean;
15
13
  children?: ReactNode;
16
14
  style?: CSSProperties;
17
15
  className?: string;
18
16
  renderRightButtons?: () => ReactNode;
19
17
  }
20
- declare function DefaultPanelHeader({ counter, onDelete, deleteToolTip, onFilter, filterToolTip, filterIsActive, counterFiltered, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function createFilterLabel(total: number, counter: number | false): string;
19
+ declare function DefaultPanelHeader({ counter, counterLabel, onDelete, deleteToolTip, onFilter, filterToolTip, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
21
20
  export default DefaultPanelHeader;
@@ -1,26 +1,24 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FaRegTrashAlt, FaCog, FaFilter } from 'react-icons/fa';
2
+ import { FaRegTrashAlt, FaFilter } from 'react-icons/fa';
3
3
  import Button from '../../elements/Button';
4
4
  import ToggleButton from '../../elements/ToggleButton';
5
- import ToolTip from '../../elements/ToolTip/ToolTip';
6
5
  import PanelHeader from './PanelHeader';
6
+ import { PreferencesButton } from '../../elements/PreferencesButton';
7
+ import { CounterLabel } from '../../elements/CounterLabel';
7
8
  const styles = {
8
9
  leftContainer: {
9
10
  display: 'flex',
10
11
  flexDirection: 'row',
11
12
  flex: 1,
12
13
  },
13
- counterLabel: {
14
- margin: 0,
15
- textAlign: 'right',
16
- lineHeight: '22px',
17
- padding: '0 10px',
18
- whiteSpace: 'nowrap',
19
- },
20
14
  };
21
- function DefaultPanelHeader({ counter, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', filterIsActive = false, counterFiltered = 0, children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
22
- return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, defaultValue: filterIsActive, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counter !== undefined && (_jsxs("p", { style: styles.counterLabel, children: ["[", ' ', filterIsActive && counterFiltered !== undefined
23
- ? `${counterFiltered}/${counter}`
24
- : counter, ' ', "]"] })), showSettingButton && (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
15
+ export function createFilterLabel(total, counter) {
16
+ if (typeof counter === 'boolean') {
17
+ return `[ ${total || 0} ]`;
18
+ }
19
+ return `[ ${counter}/${total} ]`;
20
+ }
21
+ function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
22
+ return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && _jsx(CounterLabel, { children: counterLabel }), showSettingButton && _jsx(PreferencesButton, { onClick: onSettingClick })] }));
25
23
  }
26
24
  export default DefaultPanelHeader;
@@ -39,7 +39,7 @@ export default function PredictionPanel() {
39
39
  const settingRef = useRef();
40
40
  const { item: spectraPanelState, utils: { toggle: openSpectraPanel }, } = useAccordionContext('Spectra');
41
41
  const predictionPreferences = usePanelPreferences('prediction');
42
- const openMoleculeEditor = useMoleculeEditor(true);
42
+ const { modal, openMoleculeEditor } = useMoleculeEditor(true);
43
43
  const refreshSlider = useRef(false);
44
44
  useEffect(() => {
45
45
  if (Array.isArray(molecules) &&
@@ -72,7 +72,7 @@ export default function PredictionPanel() {
72
72
  }
73
73
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
74
74
  try {
75
- const data = await predictSpectra(molfile);
75
+ const data = await predictSpectra(molfile, predictionPreferences.spectra);
76
76
  dispatch({
77
77
  type: 'PREDICT_SPECTRA',
78
78
  payload: {
@@ -120,5 +120,5 @@ export default function PredictionPanel() {
120
120
  ...styles.slider,
121
121
  height: height - 31,
122
122
  }, children: molIndex === currentIndex && (_jsx(StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : (_jsx(StructureEditor, { initialMolfile: molfile || '', width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
123
- } }) }), _jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Button.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && (_jsx(Button.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] }))] }));
123
+ } }) }), _jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Button.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && (_jsx(Button.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] })), modal] }));
124
124
  }
@@ -37,7 +37,6 @@ function PredictionSimpleOptions() {
37
37
  display: 'flex',
38
38
  justifyContent: 'flex-end',
39
39
  flex: '1',
40
- padding: '0 10px',
41
40
  height: '100%',
42
41
  }, children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "1d.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] }), _jsx(FormikOnChange, { enableValidation: true, onChange: optionsChangeHandler })] }) }));
43
42
  }
@@ -64,7 +64,7 @@ export default function SpectrumSimulation() {
64
64
  }
65
65
  function saveSettingsHandler(values) {
66
66
  simulateHandler(values);
67
- formRef.current?.setValues(values);
67
+ void formRef.current?.setValues(values);
68
68
  }
69
69
  return (_jsx(Formik, { initialValues: { ...defaultSimulationOptions, data }, enableReinitialize: true,
70
70
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -20,6 +20,5 @@ export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, sp
20
20
  display: 'flex',
21
21
  justifyContent: 'flex-end',
22
22
  flex: '1',
23
- padding: '0 10px',
24
- }, children: [_jsx(Label, { title: "Spin system", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
23
+ }, children: [_jsx(Label, { title: "", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
25
24
  }
@@ -1,5 +1,6 @@
1
1
  const ignoreActions = new Set([
2
2
  'INITIALIZE_NMRIUM',
3
+ 'SECRET_THROW_ERROR',
3
4
  'APPLY_KEY_PREFERENCES',
4
5
  'BRUSH_END',
5
6
  'RESET_SELECTED_TOOL',
@@ -19,7 +20,6 @@ const ignoreActions = new Set([
19
20
  'CHANGE_SPECTRUM_VISIBILITY',
20
21
  'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS',
21
22
  'CHANGE_ACTIVE_SPECTRUM',
22
- 'SET_MOUSE_OVER_DISPLAYER',
23
23
  'CHANGE_FLOAT_MOLECULE_POSITION',
24
24
  'ALIGN_SPECTRA',
25
25
  'TOGGLE_REAL_IMAGINARY_VISIBILITY',
@@ -7,7 +7,6 @@ import { StateMoleculeExtended } from '../../data/molecules/Molecule';
7
7
  import { UsedColors } from '../../types/UsedColors';
8
8
  import { Action } from '../context/DispatchContext';
9
9
  import { Tool } from '../toolbar/ToolTypes';
10
- import { DISPLAYER_MODE } from './core/Constants';
11
10
  import { ZoomHistory } from './helper/ZoomHistoryManager';
12
11
  export interface ActiveSpectrum {
13
12
  id: string;
@@ -23,6 +22,7 @@ export declare const zoneStateInit: {
23
22
  showSignals: boolean;
24
23
  showPeaks: boolean;
25
24
  };
25
+ export type DisplayerMode = '1D' | '2D';
26
26
  export interface Margin {
27
27
  top: number;
28
28
  right: number;
@@ -146,7 +146,7 @@ export interface State {
146
146
  * displayer mode '1D' or '2D'
147
147
  * @default '1D'
148
148
  */
149
- displayerMode: DISPLAYER_MODE;
149
+ displayerMode: DisplayerMode;
150
150
  /**
151
151
  * unique key identifier per Displayer instance
152
152
  */
@@ -162,12 +162,6 @@ export interface State {
162
162
  zoom: {
163
163
  history: ZoomHistory;
164
164
  };
165
- /**
166
- * boolean indicator to check if the mouse over the displayer or not
167
- * value change to true once the mouse come over the displayer and vice versa true once the mouse out of the displayer
168
- * @default false
169
- */
170
- overDisplayer: boolean;
171
165
  /**
172
166
  * Basic options for the tools
173
167
  */
@@ -193,6 +187,7 @@ export interface State {
193
187
  baselineCorrection: {
194
188
  zones: BaselineCorrectionZone[];
195
189
  options: any;
190
+ livePreview: boolean;
196
191
  };
197
192
  apodizationOptions: ApodizationOptions;
198
193
  /**
@@ -1,5 +1,5 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
- import { produce } from 'immer';
2
+ import { produce, original } from 'immer';
3
3
  import { buildCorrelationData } from 'nmr-correlation';
4
4
  import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants';
5
5
  import * as AssignmentsActions from './actions/AssignmentsActions';
@@ -8,7 +8,6 @@ import * as DatabaseActions from './actions/DatabaseActions';
8
8
  import * as DimensionsActions from './actions/DimensionsActions';
9
9
  import * as DomainActions from './actions/DomainActions';
10
10
  import * as FiltersActions from './actions/FiltersActions';
11
- import * as GlobalActions from './actions/GlobalActions';
12
11
  import * as IntegralsActions from './actions/IntegralsActions';
13
12
  import * as LoadActions from './actions/LoadActions';
14
13
  import * as MoleculeActions from './actions/MoleculeActions';
@@ -19,7 +18,6 @@ import * as SpectraAnalysisActions from './actions/SpectraAnalysisAction';
19
18
  import * as SpectrumsActions from './actions/SpectrumsActions';
20
19
  import * as ToolsActions from './actions/ToolsActions';
21
20
  import * as ZonesActions from './actions/ZonesActions';
22
- import { DISPLAYER_MODE } from './core/Constants';
23
21
  export const rangeStateInit = {
24
22
  showMultiplicityTrees: false,
25
23
  showRangesIntegrals: true,
@@ -86,13 +84,12 @@ export const getInitialState = () => ({
86
84
  },
87
85
  isLoading: false,
88
86
  keysPreferences: {},
89
- displayerMode: DISPLAYER_MODE.DM_1D,
87
+ displayerMode: '1D',
90
88
  correlations: {},
91
89
  displayerKey: '',
92
90
  zoom: {
93
91
  history: {},
94
92
  },
95
- overDisplayer: false,
96
93
  toolOptions: {
97
94
  selectedTool: 'zoom',
98
95
  selectedOptionPanel: null,
@@ -100,6 +97,7 @@ export const getInitialState = () => ({
100
97
  baselineCorrection: {
101
98
  options: {},
102
99
  zones: [],
100
+ livePreview: true,
103
101
  },
104
102
  apodizationOptions: {},
105
103
  pivot: { value: 0, index: 0 },
@@ -149,6 +147,8 @@ function innerSpectrumReducer(draft, action) {
149
147
  return PeaksActions.handleChangePeakShape(draft, action);
150
148
  case 'TOGGLE_PEAKS_VIEW_PROPERTY':
151
149
  return PeaksActions.handleTogglePeaksViewProperty(draft, action);
150
+ case 'TOGGLE_PEAKS_DISPLAYING_MODE':
151
+ return PeaksActions.handleChangePeaksDisplayingMode(draft);
152
152
  case 'ADD_INTEGRAL':
153
153
  return IntegralsActions.handleAddIntegral(draft, action);
154
154
  case 'DELETE_INTEGRAL':
@@ -162,6 +162,8 @@ function innerSpectrumReducer(draft, action) {
162
162
  return IntegralsActions.handleChangeIntegralsSumFlag(draft);
163
163
  case 'CHANGE_INTEGRAL_RELATIVE':
164
164
  return IntegralsActions.handleChangeIntegralsRelativeValue(draft, action);
165
+ case 'CUT_INTEGRAL':
166
+ return IntegralsActions.handleCutIntegral(draft, action);
165
167
  case 'SET_X_DOMAIN':
166
168
  return DomainActions.handleSetXDomain(draft, action);
167
169
  case 'SET_Y_DOMAIN':
@@ -182,6 +184,10 @@ function innerSpectrumReducer(draft, action) {
182
184
  return FiltersActions.handleCalculateZeroFillingFilter(draft, action);
183
185
  case 'APPLY_FFT_FILTER':
184
186
  return FiltersActions.handleApplyFFTFilter(draft);
187
+ case 'APPLY_FFT_DIMENSION_1_FILTER':
188
+ return FiltersActions.handleApplyFFtDimension1Filter(draft);
189
+ case 'APPLY_FFT_DIMENSION_2_FILTER':
190
+ return FiltersActions.handleApplyFFtDimension2Filter(draft);
185
191
  case 'APPLY_MANUAL_PHASE_CORRECTION_FILTER':
186
192
  return FiltersActions.handleApplyManualPhaseCorrectionFilter(draft, action);
187
193
  case 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER':
@@ -328,6 +334,8 @@ function innerSpectrumReducer(draft, action) {
328
334
  return RangesActions.handleAutoSpectraRangesDetection(draft);
329
335
  case 'SHOW_J_GRAPH':
330
336
  return RangesActions.handleShowJGraph(draft, action);
337
+ case 'CUT_RANGE':
338
+ return RangesActions.handleCutRange(draft, action);
331
339
  case 'SET_KEY_PREFERENCES':
332
340
  return PreferencesActions.handleSetKeyPreferences(draft, action);
333
341
  case 'APPLY_KEY_PREFERENCES':
@@ -370,15 +378,33 @@ function innerSpectrumReducer(draft, action) {
370
378
  return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
371
379
  case 'SET_AUTOMATIC_ASSIGNMENTS':
372
380
  return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
373
- case 'SET_MOUSE_OVER_DISPLAYER':
374
- return GlobalActions.handleSetIsOverDisplayer(draft, action);
381
+ case 'SECRET_THROW_ERROR': {
382
+ throw new Error('Error thrown in main reducer');
383
+ }
375
384
  default:
376
385
  }
377
386
  }
378
387
  catch (error) {
379
388
  draft.errorAction = error;
380
- error.data = { action };
389
+ error.data = { action, state: getDebugState(draft) };
381
390
  reportError(error);
382
391
  }
383
392
  }
384
393
  export const spectrumReducer = produce(innerSpectrumReducer);
394
+ function getDebugState(draft) {
395
+ const state = original(draft);
396
+ const string = JSON.stringify(state, (key, value) => {
397
+ if (ArrayBuffer.isView(value)) {
398
+ return Array.from(value).slice(0, 20);
399
+ }
400
+ if (Array.isArray(value) && typeof value[0] === 'number') {
401
+ return value.slice(0, 20);
402
+ }
403
+ return value;
404
+ });
405
+ if (string.length > 800000) {
406
+ // fallback, better to have something as a string t han nothing
407
+ return string.slice(0, 800000);
408
+ }
409
+ return JSON.parse(string);
410
+ }
@@ -2,7 +2,6 @@ import { extent } from 'd3';
2
2
  import { get1DDataXY } from '../../../data/data1d/Spectrum1D/get1DDataXY';
3
3
  import { isSpectrum2D } from '../../../data/data2d/Spectrum2D';
4
4
  import nucleusToString from '../../utility/nucleusToString';
5
- import { DISPLAYER_MODE } from '../core/Constants';
6
5
  import { addToBrushHistory } from '../helper/ZoomHistoryManager';
7
6
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
8
7
  function getActiveData(draft) {
@@ -123,7 +122,7 @@ function setDomain(draft, options) {
123
122
  const { updateYDomain = true, isYDomainShared = true, updateXDomain = true, } = options || {};
124
123
  let domain;
125
124
  if (draft.view.spectra.activeTab) {
126
- if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
125
+ if (draft.displayerMode === '1D') {
127
126
  domain = getDomain(draft);
128
127
  }
129
128
  else {
@@ -136,7 +135,7 @@ function setDomain(draft, options) {
136
135
  // draft.originDomain = domain;
137
136
  if (updateYDomain) {
138
137
  draft.yDomain = domain.yDomain;
139
- if (draft.displayerMode === DISPLAYER_MODE.DM_1D && isYDomainShared) {
138
+ if (draft.displayerMode === '1D' && isYDomainShared) {
140
139
  draft.yDomains = Object.fromEntries(Object.keys(domain.yDomains).map((key) => {
141
140
  return [key, domain.yDomain];
142
141
  }));
@@ -7,18 +7,37 @@ import { ActionType } from '../types/ActionType';
7
7
  type ShiftSpectrumAlongXAxisAction = ActionType<'SHIFT_SPECTRUM', {
8
8
  shift: number;
9
9
  }>;
10
- type ApodizationFilterAction = ActionType<'APPLY_APODIZATION_FILTER' | 'CALCULATE_APODIZATION_FILTER', ApodizationOptions>;
11
- type ZeroFillingFilterAction = ActionType<'APPLY_ZERO_FILLING_FILTER' | 'CALCULATE_ZERO_FILLING_FILTER', {
12
- nbPoints: number;
10
+ type ApodizationFilterAction = ActionType<'APPLY_APODIZATION_FILTER', {
11
+ options: ApodizationOptions;
12
+ }>;
13
+ type ApodizationFilterLiveAction = ActionType<'CALCULATE_APODIZATION_FILTER', {
14
+ options: ApodizationOptions;
15
+ livePreview: boolean;
16
+ }>;
17
+ type ZeroFillingFilterAction = ActionType<'APPLY_ZERO_FILLING_FILTER', {
18
+ options: {
19
+ nbPoints: number;
20
+ };
21
+ }>;
22
+ type ZeroFillingFilterLiveAction = ActionType<'CALCULATE_ZERO_FILLING_FILTER', {
23
+ options: {
24
+ nbPoints: number;
25
+ };
26
+ livePreview: boolean;
13
27
  }>;
14
28
  type ManualPhaseCorrectionFilterAction = ActionType<'APPLY_MANUAL_PHASE_CORRECTION_FILTER' | 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER', {
15
29
  ph0: number;
16
30
  ph1: number;
17
31
  }>;
18
- type BaselineCorrectionFilterProps = Omit<BaselineCorrectionOptions, 'zones'> & {
32
+ type BaselineCorrectionFilterOptions = Omit<BaselineCorrectionOptions, 'zones'>;
33
+ interface BaselineCorrectionFilterProps {
34
+ options: BaselineCorrectionFilterOptions;
19
35
  livePreview: boolean;
20
- };
21
- type BaselineCorrectionFilterAction = ActionType<'APPLY_BASE_LINE_CORRECTION_FILTER' | 'CALCULATE_BASE_LINE_CORRECTION_FILTER', BaselineCorrectionFilterProps>;
36
+ }
37
+ type BaselineCorrectionFilterAction = ActionType<'APPLY_BASE_LINE_CORRECTION_FILTER', {
38
+ options: BaselineCorrectionFilterOptions;
39
+ }>;
40
+ type BaselineCorrectionFilterLiveAction = ActionType<'CALCULATE_BASE_LINE_CORRECTION_FILTER', BaselineCorrectionFilterProps>;
22
41
  type EnableFilterAction = ActionType<'ENABLE_FILTER', {
23
42
  id: string;
24
43
  enabled: boolean;
@@ -44,7 +63,7 @@ type DeleteExclusionZoneAction = ActionType<'DELETE_EXCLUSION_ZONE', {
44
63
  type ApplySignalProcessingAction = ActionType<'APPLY_SIGNAL_PROCESSING_FILTER', {
45
64
  options: MatrixOptions;
46
65
  }>;
47
- export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ZeroFillingFilterAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
66
+ export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ApodizationFilterLiveAction | ZeroFillingFilterAction | ZeroFillingFilterLiveAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | BaselineCorrectionFilterLiveAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_FFT_DIMENSION_1_FILTER' | 'APPLY_FFT_DIMENSION_2_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
48
67
  interface RollbackSpectrumByFilterOptions {
49
68
  applyFilter?: boolean;
50
69
  reset?: boolean;
@@ -62,17 +81,19 @@ interface RollbackSpectrumOptions {
62
81
  declare function rollbackSpectrum(draft: Draft<State>, options: RollbackSpectrumOptions): void;
63
82
  declare function handleShiftSpectrumAlongXAxis(draft: Draft<State>, action: ShiftSpectrumAlongXAxisAction): void;
64
83
  declare function handleApplyZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterAction): void;
65
- declare function handleCalculateZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterAction): void;
66
- declare function handleCalculateApodizationFilter(draft: Draft<State>, action: ApodizationFilterAction): void;
84
+ declare function handleCalculateZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterLiveAction): void;
85
+ declare function handleCalculateApodizationFilter(draft: Draft<State>, action: ApodizationFilterLiveAction): void;
67
86
  declare function handleApplyApodizationFilter(draft: Draft<State>, action: ApodizationFilterAction): void;
68
87
  declare function handleApplyFFTFilter(draft: Draft<State>): void;
88
+ declare function handleApplyFFtDimension1Filter(draft: Draft<State>): void;
89
+ declare function handleApplyFFtDimension2Filter(draft: Draft<State>): void;
69
90
  declare function handleApplyManualPhaseCorrectionFilter(draft: Draft<State>, action: ManualPhaseCorrectionFilterAction): void;
70
91
  declare function handleCalculateManualPhaseCorrection(draft: Draft<State>, action: ManualPhaseCorrectionFilterAction): void;
71
92
  declare function handleApplyAbsoluteFilter(draft: Draft<State>): void;
72
93
  declare function handleApplyAutoPhaseCorrectionFilter(draft: Draft<State>): void;
73
94
  declare function handleBaseLineCorrectionFilter(draft: Draft<State>, action: BaselineCorrectionFilterAction): void;
74
95
  declare function calculateBaseLineCorrection(draft: Draft<State>, baseLineOptions?: BaselineCorrectionFilterProps): void;
75
- declare function handleCalculateBaseLineCorrection(draft: Draft<State>, action: BaselineCorrectionFilterAction): void;
96
+ declare function handleCalculateBaseLineCorrection(draft: Draft<State>, action: BaselineCorrectionFilterLiveAction): void;
76
97
  declare function handleEnableFilter(draft: Draft<State>, action: EnableFilterAction): void;
77
98
  declare function handleDeleteFilter(draft: Draft<State>, action: DeleteFilterAction): void;
78
99
  declare function handleDeleteSpectraFilter(draft: Draft<State>, action: DeleteSpectraFilterAction): void;
@@ -80,4 +101,4 @@ declare function handleSetFilterSnapshotHandler(draft: Draft<State>, action: Set
80
101
  declare function handleSignalProcessingFilter(draft: Draft<State>, action: ApplySignalProcessingAction): void;
81
102
  declare function handleAddExclusionZone(draft: Draft<State>, action: AddExclusionZoneAction): void;
82
103
  declare function handleDeleteExclusionZone(draft: Draft<State>, action: DeleteExclusionZoneAction): void;
83
- export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
104
+ export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };