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
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from '@emotion/styled';
3
+ import { Button, useOnOff } from 'react-science/ui';
4
+ import { useDispatch } from '../../context/DispatchContext';
5
+ export default function AboutUsZakodium() {
6
+ const [isSecretOpen, openSecret] = useOnOff();
7
+ function handleClick(event) {
8
+ if (event.shiftKey && event.altKey) {
9
+ openSecret();
10
+ }
11
+ }
12
+ return (_jsxs(_Fragment, { children: [_jsx("span", { onClick: handleClick, children: "Zakodium" }), ` Sàrl (Switzerland).`, isSecretOpen && _jsx(SecretThrower, {})] }));
13
+ }
14
+ const ThrowerDiv = styled.div `
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 1rem;
18
+ `;
19
+ /**
20
+ * This component is here for us so we can test the impact of thrown exceptions
21
+ * in the deployed application.
22
+ */
23
+ function SecretThrower() {
24
+ const [shouldThrow, setShouldThrow] = useOnOff();
25
+ const dispatch = useDispatch();
26
+ if (shouldThrow) {
27
+ throw new Error('Error thrown in React render');
28
+ }
29
+ return (_jsxs(ThrowerDiv, { children: [_jsx(Button, { onClick: setShouldThrow, children: "Throw in React render" }), _jsx(Button, { onClick: () => dispatch({
30
+ type: 'SECRET_THROW_ERROR',
31
+ payload: { randomNumber: Math.random() },
32
+ }), children: "Throw in main reducer" })] }));
33
+ }
@@ -1,17 +1,6 @@
1
- import { SumOptions } from 'nmr-load-save';
2
- type SaveInput = {
3
- sum: number;
4
- sumAuto: false;
5
- } | {
6
- moleculeId: string;
7
- mf: string;
8
- sumAuto: true;
9
- };
10
- interface ChangeSumModalProps {
11
- onSave: (saveInput: SaveInput) => void;
12
- onClose: () => void;
13
- header: string;
14
- sumOptions: SumOptions;
1
+ import { ReactNode } from 'react';
2
+ import { ChangeSumModalContentsProps } from './ChangeSumModalContents';
3
+ export interface ChangeSumModalProps extends Omit<ChangeSumModalContentsProps, 'onClose'> {
4
+ renderButton: (onClick: () => void) => ReactNode;
15
5
  }
16
- export default function ChangeSumModal({ onSave, onClose, header, sumOptions, }: ChangeSumModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
17
- export {};
6
+ export default function ChangeSumModal({ renderButton, ...otherProps }: ChangeSumModalProps): import("react/jsx-runtime").JSX.Element;
@@ -1,116 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { Formik } from 'formik';
5
- import { useEffect, useRef, useState } from 'react';
6
- import * as Yup from 'yup';
7
- import { usePreferences } from '../../context/PreferencesContext';
8
- import Button from '../../elements/Button';
9
- import CloseButton from '../../elements/CloseButton';
10
- import Tab from '../../elements/Tab/Tab';
11
- import Tabs from '../../elements/Tab/Tabs';
12
- import FormikInput from '../../elements/formik/FormikInput';
13
- import { ModalStyles } from '../ModalStyle';
14
- import SelectMolecule from './SelectMolecule';
15
- const styles = css `
16
- width: 450px;
17
- height: 400px;
18
-
19
- .header {
20
- display: flex;
21
- padding: 10px;
22
-
23
- span {
24
- font-size: 14px;
25
- flex: 1;
26
- }
27
- }
28
-
29
- .tab-content {
30
- flex: 1;
31
- }
32
-
33
- .manual-container {
34
- padding: 30px 5px;
35
-
36
- .input {
37
- width: 80% !important;
38
- height: 36px;
39
- margin: 0 auto;
40
- }
41
-
42
- .input input {
43
- padding: 5px;
44
- text-align: center;
45
- }
46
- }
47
- `;
48
- var SumSetOptions;
49
- (function (SumSetOptions) {
50
- SumSetOptions["Auto"] = "auto";
51
- SumSetOptions["Manual"] = "manual";
52
- })(SumSetOptions || (SumSetOptions = {}));
53
- function getValidationSchema(option) {
54
- switch (option) {
55
- case SumSetOptions.Auto: {
56
- return Yup.object({
57
- molecule: Yup.object().required(),
58
- });
59
- }
60
- case SumSetOptions.Manual: {
61
- return Yup.object({
62
- sum: Yup.number().required(),
63
- });
64
- }
65
- default:
66
- return null;
67
- }
68
- }
69
- export default function ChangeSumModal({ onSave, onClose, header, sumOptions, }) {
70
- const { current: { display: { panels }, }, } = usePreferences();
71
- const [setOption, setActiveOption] = useState(SumSetOptions.Auto);
72
- const formRef = useRef(null);
73
- function handleKeyDown(event) {
74
- if (event.key === 'Enter') {
75
- formRef.current.submitForm();
76
- }
77
- }
78
- function onTabChangeHandler(tab) {
79
- setActiveOption(tab.tabid);
80
- }
81
- useEffect(() => {
82
- if (sumOptions?.sumAuto && panels?.structuresPanel?.display) {
83
- setActiveOption(SumSetOptions.Auto);
84
- const { mf, moleculeId: id } = sumOptions;
85
- formRef.current.setValues({
86
- sum: null,
87
- molecule: id && mf ? { mf, id } : null,
88
- });
89
- }
90
- else {
91
- setActiveOption(SumSetOptions.Manual);
92
- formRef.current.setValues({ sum: sumOptions?.sum ?? '', molecule: null });
93
- }
94
- }, [panels?.structuresPanel, sumOptions]);
95
- function saveHandler(values) {
96
- switch (setOption) {
97
- case SumSetOptions.Auto: {
98
- const { molecule: { mf, id: moleculeId }, } = values;
99
- onSave({ sumAuto: true, mf, moleculeId });
100
- break;
101
- }
102
- case SumSetOptions.Manual: {
103
- const { sum } = values;
104
- onSave({ sum, sumAuto: false });
105
- break;
106
- }
107
- default:
108
- return;
109
- }
110
- onClose();
111
- }
112
- const isStructurePanelVisible = panels?.structuresPanel?.display || false;
113
- return (
114
- // <div css={modalContainer}>
115
- _jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: header }), _jsx(CloseButton, { onClick: onClose })] }), _jsx("div", { className: "tab-content", children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: _jsxs(Tabs, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && (_jsx(Tab, { title: "Auto", tabid: SumSetOptions.Auto, children: _jsx(SelectMolecule, { name: "molecule" }) })), _jsx(Tab, { title: "Manual", tabid: SumSetOptions.Manual, children: _jsx("div", { className: "manual-container", children: _jsx(FormikInput, { name: "sum", type: "number", nullable: true, placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), style: { width: '80px' }, children: "Set" }) })] }));
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Modal, useOnOff } from 'react-science/ui';
3
+ import { ChangeSumModalContents, } from './ChangeSumModalContents';
4
+ export default function ChangeSumModal({ renderButton, ...otherProps }) {
5
+ const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
6
+ return (_jsxs(_Fragment, { children: [renderButton(openDialog), _jsx(Modal, { isOpen: isOpenDialog, onRequestClose: closeDialog, width: 500, height: 400, children: _jsx(ChangeSumModalContents, { ...otherProps, onClose: closeDialog }) })] }));
116
7
  }
@@ -0,0 +1,18 @@
1
+ import { SumOptions } from 'nmr-load-save';
2
+ type SaveInput = {
3
+ sum: number;
4
+ sumAuto: false;
5
+ } | {
6
+ moleculeId: string;
7
+ mf: string;
8
+ sumAuto: true;
9
+ };
10
+ export interface ChangeSumModalContentsProps {
11
+ currentSum: number | null;
12
+ sumType: string;
13
+ sumOptions: SumOptions;
14
+ onSave: (saveInput: SaveInput) => void;
15
+ onClose: () => void;
16
+ }
17
+ export declare function ChangeSumModalContents(props: ChangeSumModalContentsProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import styled from '@emotion/styled';
3
+ import { Formik } from 'formik';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ import { Modal } from 'react-science/ui';
6
+ import * as Yup from 'yup';
7
+ import { usePreferences } from '../../context/PreferencesContext';
8
+ import Button from '../../elements/Button';
9
+ import Tab from '../../elements/Tab/Tab';
10
+ import Tabs from '../../elements/Tab/Tabs';
11
+ import FormikInput from '../../elements/formik/FormikInput';
12
+ import SelectMolecule from './SelectMolecule';
13
+ function getValidationSchema(option) {
14
+ switch (option) {
15
+ case 'auto': {
16
+ return Yup.object({
17
+ molecule: Yup.object().required(),
18
+ });
19
+ }
20
+ case 'manual': {
21
+ return Yup.object({
22
+ sum: Yup.number().required(),
23
+ });
24
+ }
25
+ default:
26
+ return null;
27
+ }
28
+ }
29
+ const ManualContainer = styled.div `
30
+ padding: 30px 5px;
31
+
32
+ .input {
33
+ width: 80% !important;
34
+ height: 36px;
35
+ margin: 0 auto;
36
+ }
37
+
38
+ .input input {
39
+ padding: 5px;
40
+ text-align: center;
41
+ }
42
+ `;
43
+ export function ChangeSumModalContents(props) {
44
+ const { currentSum, sumType, sumOptions, onSave, onClose } = props;
45
+ const { current: { display: { panels }, }, } = usePreferences();
46
+ const [setOption, setActiveOption] = useState('auto');
47
+ const formRef = useRef(null);
48
+ useEffect(() => {
49
+ if (sumOptions?.sumAuto && panels?.structuresPanel?.display) {
50
+ setActiveOption('auto');
51
+ const { mf, moleculeId: id } = sumOptions;
52
+ formRef.current.setValues({
53
+ sum: null,
54
+ molecule: id && mf ? { mf, id } : null,
55
+ });
56
+ }
57
+ else {
58
+ setActiveOption('manual');
59
+ formRef.current.setValues({
60
+ sum: sumOptions?.sum ?? '',
61
+ molecule: null,
62
+ });
63
+ }
64
+ }, [panels?.structuresPanel, sumOptions]);
65
+ function handleKeyDown(event) {
66
+ if (event.key === 'Enter') {
67
+ formRef.current.submitForm();
68
+ }
69
+ }
70
+ function onTabChangeHandler(tab) {
71
+ setActiveOption(tab.tabid);
72
+ }
73
+ function saveHandler(values) {
74
+ switch (setOption) {
75
+ case 'auto': {
76
+ const { molecule: { mf, id: moleculeId }, } = values;
77
+ onSave({ sumAuto: true, mf, moleculeId });
78
+ break;
79
+ }
80
+ case 'manual': {
81
+ const { sum } = values;
82
+ onSave({ sum, sumAuto: false });
83
+ break;
84
+ }
85
+ default:
86
+ return;
87
+ }
88
+ onClose();
89
+ }
90
+ const isStructurePanelVisible = panels?.structuresPanel?.display || false;
91
+ return (_jsxs(_Fragment, { children: [_jsx(Modal.Header, { children: currentSum
92
+ ? `Set new ${sumType} sum (Current: ${currentSum.toFixed(2)})`
93
+ : `Set new ${sumType} Sum` }), _jsx(Modal.Body, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: _jsxs(Tabs, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && (_jsx(Tab, { title: "Auto", tabid: "auto", children: _jsx(SelectMolecule, { name: "molecule" }) })), _jsx(Tab, { title: "Manual", tabid: "manual", children: _jsx(ManualContainer, { children: _jsx(FormikInput, { name: "sum", type: "number", placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), _jsx(Modal.Footer, { children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), style: { width: 80 }, children: "Set" }) })] }));
94
+ }
@@ -184,7 +184,7 @@ function MetaImportationModal({ onClose, file }) {
184
184
  padding: '5px',
185
185
  fontSize: '14px',
186
186
  },
187
- }, placeholder: "Example: info.plus", datalist: datalist, nullable: true, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => convertPathArrayToString(paths) }) })] }) }), _jsx(Button.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), _jsx("div", { style: { height: 'calc(100% - 160px)' }, children: _jsx(ReactTable, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
187
+ }, placeholder: "Example: info.plus", datalist: datalist, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => convertPathArrayToString(paths) }) })] }) }), _jsx(Button.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), _jsx("div", { style: { height: 'calc(100% - 160px)' }, children: _jsx(ReactTable, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
188
188
  }
189
189
  function fileValidator(file) {
190
190
  if (!isMetaFile(file)) {
@@ -122,7 +122,7 @@ function GeneralSettingsModal({ height }) {
122
122
  }, [workspaces]);
123
123
  const handleReset = () => {
124
124
  const workSpaceDisplayPreferences = getPreferencesByWorkspace(workspaceName, originalWorkspaces);
125
- refForm.current?.setValues(workSpaceDisplayPreferences);
125
+ void refForm.current?.setValues(workSpaceDisplayPreferences);
126
126
  };
127
127
  function submitHandler(values) {
128
128
  saveSettings(values);
@@ -187,7 +187,7 @@ function GeneralSettingsModal({ height }) {
187
187
  const setWorkspaceSetting = useCallback((inputWorkspace) => {
188
188
  const parseWorkspaceName = Object.keys(inputWorkspace)[0];
189
189
  if (preferences.workspace.current === parseWorkspaceName) {
190
- refForm.current?.setValues(inputWorkspace[parseWorkspaceName]);
190
+ void refForm.current?.setValues(inputWorkspace[parseWorkspaceName]);
191
191
  }
192
192
  else if (preferences.workspaces[parseWorkspaceName]) {
193
193
  pastRef.current = inputWorkspace;
@@ -1,5 +1,5 @@
1
1
  import { CustomWorkspaces } from 'nmr-load-save';
2
- import { NMRiumWorkspace } from '../../../NMRium';
2
+ import type { NMRiumWorkspace } from '../../../main';
3
3
  interface DatabasesTabContentProps {
4
4
  currentWorkspace: NMRiumWorkspace;
5
5
  originalWorkspaces: CustomWorkspaces;
@@ -35,6 +35,6 @@ const LOGS_LEVELS = [
35
35
  value: level,
36
36
  }));
37
37
  function GeneralTabContent() {
38
- return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Spectra", children: _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number" }) }) }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display" }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsx(GroupPane, { text: "Logging settings", children: _jsx(Label, { title: "Level ", children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
38
+ return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Spectra", children: _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1 }) }) }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display" }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsx(GroupPane, { text: "Logging settings", children: _jsx(Label, { title: "Level ", children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
39
39
  }
40
40
  export default GeneralTabContent;
@@ -70,7 +70,7 @@ const COLUMNS = [
70
70
  case 'checkbox':
71
71
  return (_jsx(CheckBoxCell, { name: `nmrLoaders.${row.original.name}`, defaultValue: false }));
72
72
  case 'input':
73
- return (_jsx(FormikInput, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } }, nullable: true }));
73
+ return (_jsx(FormikInput, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } } }));
74
74
  case 'select':
75
75
  return (_jsx(FormikSelect, { name: `nmrLoaders.${row.original.name}`, style: { width: '100%' }, items: row.original.options }));
76
76
  default:
@@ -1,4 +1,4 @@
1
- import { array, lazy, object, string, ValidationError, } from 'yup';
1
+ import { array, lazy, object, string, ValidationError, number, } from 'yup';
2
2
  const formattingElementValidation = (obj) => {
3
3
  return Object.fromEntries(Object.keys(obj.formatting.nuclei).map((key) => [
4
4
  key,
@@ -50,8 +50,12 @@ const infoBlockValidation = object({
50
50
  jpath: array().of(string()).min(1),
51
51
  })),
52
52
  });
53
+ const generalValidation = object({
54
+ dimmedSpectraOpacity: number().required(),
55
+ });
53
56
  export const validation = lazy((obj) => object().shape({
54
57
  formatting: formattingValidation(obj),
55
58
  databases: databasesValidation,
56
59
  infoBlock: infoBlockValidation,
60
+ general: generalValidation,
57
61
  }));
@@ -1,105 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, memo } from 'react';
3
- import Input from '../elements/Input';
4
- import ReactTableFlexLayout from '../elements/ReactTable/ReactTableFlexLayout';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { InfoPanel } from 'react-science/ui';
5
4
  import useSpectrum from '../hooks/useSpectrum';
6
- const styles = {
7
- container: {
8
- height: '100%',
9
- flexDirection: 'column',
10
- display: 'flex',
11
- width: '100%',
12
- },
13
- tableContainer: {
14
- overflow: 'auto',
15
- display: 'block',
16
- },
17
- tableHeader: {
18
- padding: ' 5px 10px',
19
- backgroundColor: ' #f8f8f8',
20
- borderBottom: '1px solid gray',
21
- fontSize: '1em',
22
- cursor: 'pointer',
23
- },
24
- };
25
- function Arrow(props) {
26
- const { isOpen = true } = props;
27
- return (_jsx("div", { style: {
28
- fontSize: '1.3em',
29
- transform: `rotate(${isOpen ? 90 : 0}deg)`,
30
- transformOrigin: '50% 50%',
31
- display: 'inline-block',
32
- lineHeight: 1,
33
- padding: isOpen ? '5px 0 0 0' : '0 5px 0 0',
34
- verticalAlign: 'middle',
35
- }, children: "\u2023" }));
36
- }
37
- function InformationTable(props) {
38
- const { data, columns, title, onClick, isOpen = true } = props;
39
- return (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.tableHeader, onClick: onClick, children: [_jsx(Arrow, { isOpen: isOpen }), _jsx("span", { style: { verticalAlign: 'middle', display: 'inline-block' }, children: title })] }), isOpen && (_jsx(ReactTableFlexLayout, { data: data, columns: columns, style: { height: 'auto' } }))] }));
40
- }
41
- function filter(searchKey, data) {
42
- const result = [];
43
- for (const key in data) {
44
- if (!searchKey || key.toLowerCase().includes(searchKey)) {
45
- result.push({ key, value: data[key] });
46
- }
47
- }
48
- return result;
49
- }
50
- const columns = [
51
- {
52
- Header: 'Parameter',
53
- sortType: 'basic',
54
- minWidth: 100,
55
- width: 20,
56
- maxWidth: 20,
57
- accessor: 'key',
58
- Cell: ({ row }) => (_jsx("p", { style: { padding: '5px', backgroundColor: 'white' }, children: row.original.key })),
59
- },
60
- {
61
- Header: 'Value',
62
- sortType: 'basic',
63
- resizable: true,
64
- accessor: 'value',
65
- Cell: ({ row }) => (_jsx("p", { style: {
66
- backgroundColor: '#efefef',
67
- height: '100%',
68
- padding: '5px',
69
- fontFamily: 'monospace',
70
- whiteSpace: 'pre',
71
- overflow: 'hidden',
72
- }, children: `${row.original.value}` })),
73
- },
74
- ];
75
- function InformationPanelInner({ info, meta, customInfo, }) {
76
- const [searchKey, setSearchKey] = useState();
77
- const [panelsStatus, openPanel] = useState({
78
- info: true,
79
- meta: true,
80
- customInfo: true,
81
- });
82
- function handleSearch(e) {
83
- const searchKey = e.target.value.toLowerCase();
84
- setSearchKey(searchKey);
85
- }
86
- const matchesInfo = filter(searchKey, info);
87
- const matchesMeta = filter(searchKey, meta);
88
- const matchesMetaInfo = filter(searchKey, customInfo);
89
- function handleOpen(key) {
90
- openPanel((prevPanelsStatus) => ({
91
- ...prevPanelsStatus,
92
- [key]: !prevPanelsStatus[key],
93
- }));
94
- }
95
- return (_jsxs("div", { style: styles.container, children: [_jsx("div", { children: _jsx(Input, { placeholder: "Search for parameter...", onChange: handleSearch, debounceTime: 250, style: {
96
- inputWrapper: { width: '100%' },
97
- input: { textAlign: 'left', padding: '5px' },
98
- } }) }), _jsxs("div", { style: styles.tableContainer, children: [_jsx(InformationTable, { data: matchesMetaInfo, columns: columns, title: "Custom information", onClick: () => handleOpen('customInfo'), isOpen: panelsStatus.customInfo }), _jsx(InformationTable, { data: matchesInfo, columns: columns, title: "Spectrum information", onClick: () => handleOpen('info'), isOpen: panelsStatus.info }), _jsx(InformationTable, { data: matchesMeta, columns: columns, title: "Other spectrum parameters", onClick: () => handleOpen('meta'), isOpen: panelsStatus.meta })] })] }));
99
- }
100
- const MemoizedInformationPanel = memo(InformationPanelInner);
101
5
  const emptyData = { info: {}, meta: {} };
102
6
  export default function InformationPanel() {
103
7
  const { info, meta, customInfo } = useSpectrum(emptyData);
104
- return _jsx(MemoizedInformationPanel, { info, meta, customInfo });
8
+ const data = useMemo(() => [
9
+ { description: 'Custom information', data: customInfo || {} },
10
+ { description: 'Spectrum information', data: info || {} },
11
+ { description: 'Other spectrum parameters', data: meta || {} },
12
+ ], [customInfo, info, meta]);
13
+ return _jsx(InfoPanel, { data: data, title: "" });
105
14
  }
@@ -13,7 +13,7 @@ import { useModal } from '../../elements/popup/Modal';
13
13
  import useSpectrum from '../../hooks/useSpectrum';
14
14
  import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
15
15
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
16
- import DefaultPanelHeader from '../header/DefaultPanelHeader';
16
+ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
17
17
  import PreferencesHeader from '../header/PreferencesHeader';
18
18
  import IntegralTable from './IntegralTable';
19
19
  import IntegralsPreferences from './IntegralsPreferences';
@@ -43,16 +43,10 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
43
43
  }, [modal, yesHandler]);
44
44
  const changeIntegralSumHandler = useCallback((options) => {
45
45
  dispatch({ type: 'CHANGE_INTEGRAL_SUM', payload: { options } });
46
- modal.close();
47
- }, [dispatch, modal]);
46
+ }, [dispatch]);
48
47
  const currentSum = useMemo(() => {
49
48
  return lodashGet(integrals, 'options.sum', null);
50
49
  }, [integrals]);
51
- const showChangeIntegralSumModal = useCallback(() => {
52
- modal.show(_jsx(ChangeSumModal, { onClose: () => modal.close(), onSave: changeIntegralSumHandler, header: currentSum
53
- ? `Set new integrals Sum (Current: ${Number(currentSum).toFixed(2)})`
54
- : 'Set new integrals Sum', sumOptions: integrals?.options }));
55
- }, [changeIntegralSumHandler, currentSum, integrals?.options, modal]);
56
50
  const settingsPanelHandler = useCallback(() => {
57
51
  setFlipStatus(!isFlipped);
58
52
  }, [isFlipped]);
@@ -87,6 +81,7 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
87
81
  }
88
82
  return [];
89
83
  }, [filterIsActive, info.dimension, integrals, xDomain]);
84
+ const counter = integrals?.values?.length || 0;
90
85
  return (_jsxs("div", { css: [
91
86
  tablePanelStyle,
92
87
  style,
@@ -96,9 +91,9 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
96
91
  position: relative;
97
92
  }
98
93
  `,
99
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: integrals?.values?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', filterIsActive: filterIsActive, counterFiltered: filteredData.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: currentSum
100
- ? `Change Integrals Sum (${Number(currentSum).toFixed(2)})`
101
- : 'Change Integrals Sum', popupPlacement: "right", children: _jsx("button", { className: "sum-button", type: "button", onClick: showChangeIntegralSumModal, children: _jsx(SvgNmrSum, {}) }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fix integral values", popupPlacement: "right", onClick: toggleConstantSumHandler, value: integrals?.options?.isSumConstant || false, children: _jsx(ImLink, {}) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
94
+ ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: currentSum
95
+ ? `Change integration sum (${currentSum.toFixed(2)})`
96
+ : 'Change integration sum', popupPlacement: "right", children: _jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integrals", currentSum: currentSum, sumOptions: integrals?.options, renderButton: (onClick) => (_jsx("button", { className: "sum-button", type: "button", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration values", popupPlacement: "right", onClick: toggleConstantSumHandler, value: integrals?.options?.isSumConstant || false, children: _jsx(ImLink, {}) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
102
97
  }
103
98
  const MemoizedIntegralPanel = memo(IntegralPanelInner);
104
99
  const emptyData = { integrals: {}, info: {} };
@@ -87,7 +87,7 @@ function IntegralTable({ activeTab, data }) {
87
87
  const value = formatNumber(row.original.integral || 0, integralsPreferences.relative.format);
88
88
  const flag = checkIntegralKind(row.original);
89
89
  const integral = flag ? value : `[ ${value} ]`;
90
- return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
90
+ return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number", validate: (val) => val !== '' }));
91
91
  },
92
92
  },
93
93
  {
@@ -47,7 +47,7 @@ function MoleculePanelInner(props) {
47
47
  const [currentIndex, setCurrentIndex] = useState(0);
48
48
  const [molecules, setMolecules] = useState([]);
49
49
  const dispatch = useDispatch();
50
- const openMoleculeEditor = useMoleculeEditor();
50
+ const { modal, openMoleculeEditor } = useMoleculeEditor();
51
51
  const { currentDiaIDsToHighlight, handleOnAtomHover, handleOnClickAtom, assignedDiaIDsMerged, } = useAtomAssignment({ zones, ranges, activeTab, displayerMode });
52
52
  useEffect(() => {
53
53
  if (moleculesProp) {
@@ -79,7 +79,7 @@ function MoleculePanelInner(props) {
79
79
  currentDiaIDsToHighlight.length > 0
80
80
  ? currentDiaIDsToHighlight
81
81
  : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, showAtomNumber: moleculesView?.[mol.id]?.showAtomNumber || false }) })] }, mol.id)))) : (_jsx("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditor(), children: _jsx("span", { children: "Click to draw molecule" }) })) }));
82
- } }) }) })] }));
82
+ } }) }) }), modal] }));
83
83
  }
84
84
  const MemoizedMoleculePanel = memo(MoleculePanelInner);
85
85
  const emptyData = { ranges: {}, zones: {} };
@@ -22,7 +22,7 @@ const styles = {
22
22
  margin: 0,
23
23
  textAlign: 'right',
24
24
  lineHeight: '22px',
25
- padding: '0 10px',
25
+ padding: '0 5px',
26
26
  whiteSpace: 'nowrap',
27
27
  },
28
28
  atomLabel: {
@@ -160,7 +160,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
160
160
  });
161
161
  }
162
162
  const hasMolecules = molecules && molecules.length > 0;
163
- return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), _jsxs("p", { style: styles.counter, children: [molecules &&
164
- molecules.length > 0 &&
165
- `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
163
+ return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
166
164
  }
@@ -1,12 +1,6 @@
1
1
  import { Range, Zone } from 'nmr-processing';
2
+ import { DiaIDAndInfo } from 'openchemlib-utils';
2
3
  import { AssignmentContext, Axis } from '../../assignment/AssignmentsContext';
3
- export interface Atom {
4
- oclID: string;
5
- atomLabel: string;
6
- nbAtoms: number;
7
- nbHydrogens: number;
8
- hydrogenOCLIDs: string[];
9
- }
10
4
  export interface AtomData {
11
5
  oclIDs: string[];
12
6
  nbAtoms: number;
@@ -17,12 +11,12 @@ export interface AtomData {
17
11
  * In case of an heavy atom with bonded hydrogens the OCL id(s)
18
12
  * and number of these hydrogens are added as well.
19
13
  *
20
- * @param {Atom} atom - atom returned by OCLnmr component
14
+ * @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
21
15
  * @param {string} activeTab - active tab
22
16
  * @param {Axis} axis - current axis
23
17
  *
24
18
  */
25
- export declare function extractFromAtom(atom: Atom, activeTab: string, axis?: Axis | null): AtomData;
19
+ export declare function extractFromAtom(diaIDAndInfo: DiaIDAndInfo | undefined, activeTab: string, axis?: Axis | null): AtomData;
26
20
  export declare function findDatumAndSignalIndex(data: Array<Range | Zone>, id: string): {
27
21
  datum: Range | Zone | undefined;
28
22
  signalIndex: any;