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,12 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import debounce from 'lodash/debounce';
3
- import { useState, useEffect, useRef, forwardRef, useMemo, } from 'react';
3
+ import { useEffect, useRef, forwardRef, useMemo, useState, } from 'react';
4
4
  import useCombinedRefs from '../hooks/useCombinedRefs';
5
5
  const styles = {
6
- label: {
7
- lineHeight: 2,
8
- userSelect: 'none',
9
- },
10
6
  inputWrapper: {
11
7
  borderRadius: '5px',
12
8
  borderWidth: '0.55px',
@@ -21,7 +17,6 @@ const styles = {
21
17
  outline: 'none',
22
18
  flex: 1,
23
19
  height: '100%',
24
- textAlign: 'center',
25
20
  width: '100%',
26
21
  },
27
22
  clearButton: {
@@ -34,103 +29,56 @@ const styles = {
34
29
  padding: 0,
35
30
  },
36
31
  };
37
- function check(value, type) {
38
- if (type === 'number') {
39
- const pattern = /^(?:-?\d*|\d+)(?:\.\d{0,20})?$/;
40
- if (value.trim() === '' || pattern.test(value)) {
41
- return true;
42
- }
43
- return false;
44
- }
45
- return true;
46
- }
47
- function identity(value) {
48
- return value;
49
- }
50
- function preventPropagate(event) {
51
- event.stopPropagation();
32
+ function mapValue(value) {
33
+ return typeof value === 'number' && value === 0 ? value : value || '';
52
34
  }
53
35
  const Input = forwardRef((props, ref) => {
54
- const { value = '', name, style = {
36
+ const { value: externalValue = undefined, name, style = {
55
37
  input: {},
56
38
  inputWrapper: {},
57
- }, onChange = () => null, debounceTime = 0, onKeyDown = () => null, onKeyUp = () => null, checkValue = () => true, type = 'text', enableAutoSelect = false, className, format = () => identity, onBlur = () => null, onFocus = () => null, renderIcon = null, canClear = false, nullable = false, onClear, datalist = [], ...otherProps } = props;
58
- const [val, setVal] = useState(value ?? '');
59
- const valueRef = useRef(value);
39
+ }, onChange, checkValue = () => true, type = 'text', autoSelect = false, className, renderIcon, canClear = false, onClear, datalist = [], debounceTime = 0, ...otherProps } = props;
40
+ const [internalValue, setInternalValue] = useState();
41
+ const value = debounceTime ? internalValue : externalValue;
60
42
  const localRef = useRef();
61
43
  const combinedRef = useCombinedRefs([ref, localRef]);
62
- const debounceOnChange = useMemo(() => debounce((val) => {
63
- onChange?.(val);
44
+ const debounceOnChange = useMemo(() => debounce((e) => {
45
+ onChange?.(e);
64
46
  }, debounceTime), [debounceTime, onChange]);
65
47
  useEffect(() => {
66
- setVal((prevVal) => (prevVal !== value ? value ?? '' : prevVal));
67
- }, [value]);
68
- useEffect(() => {
69
- if (enableAutoSelect) {
48
+ if (autoSelect) {
70
49
  combinedRef?.current?.select();
71
50
  }
72
- }, [enableAutoSelect, combinedRef]);
73
- function getValue(value) {
74
- const val = type === 'number'
75
- ? String(value).trim() === '-'
76
- ? Number(0)
77
- : nullable && !value
78
- ? null
79
- : Number(value)
80
- : nullable && !value
81
- ? null
82
- : value;
83
- return format()(val);
84
- }
51
+ }, [autoSelect, combinedRef]);
52
+ useEffect(() => {
53
+ if (debounceTime) {
54
+ setInternalValue(externalValue);
55
+ }
56
+ }, [debounceTime, externalValue]);
85
57
  function onChangeHandler(e) {
86
58
  e.stopPropagation();
87
59
  e.preventDefault();
88
- const _value = e.target.value;
89
- if (check(_value, type) && checkValue(_value)) {
90
- const formatValue = format();
91
- setVal(formatValue(_value));
92
- valueRef.current = _value;
93
- const val = {
94
- ...e,
95
- target: { name: e.target.name, value: getValue(_value) },
96
- };
60
+ const val = e.target.value;
61
+ if (checkValue(val)) {
97
62
  if (debounceTime) {
98
- debounceOnChange(val);
63
+ setInternalValue(val);
64
+ debounceOnChange(e);
99
65
  }
100
66
  else {
101
- onChange?.(val);
67
+ onChange?.(e);
102
68
  }
103
69
  }
104
70
  }
105
- function handleKeyDown(event) {
106
- onKeyDown({
107
- ...event,
108
- target: {
109
- name: event.target.name,
110
- value: getValue(valueRef.current),
111
- },
112
- });
113
- }
114
- function handleKeyUp(event) {
115
- onKeyUp({
116
- ...event,
117
- target: {
118
- name: event.target.name,
119
- value: getValue(valueRef.current),
120
- },
121
- });
122
- }
123
71
  function clearHandler() {
124
- setVal('');
72
+ localRef.current?.setAttribute('value', '');
125
73
  onClear?.();
126
74
  }
127
75
  return (_jsxs("div", { style: {
128
- ...(renderIcon || (canClear && { padding: '0 5px' })),
76
+ ...((renderIcon || canClear) && { padding: '0 5px' }),
129
77
  ...styles.inputWrapper,
130
78
  ...style?.inputWrapper,
131
79
  }, className: `input ${className || ''}`, children: [renderIcon?.(), _jsx("input", { ...otherProps, ref: combinedRef, name: name, style: {
132
80
  ...styles.input,
133
81
  ...style?.input,
134
- }, type: "text", value: val, onChange: onChangeHandler, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onKeyPress: preventPropagate, onDoubleClick: (e) => e.stopPropagation(), onFocus: onFocus, onBlur: onBlur, list: `${name || ''}-data-list` }), canClear && val && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), _jsx("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => (_jsx("option", { value: value }, value))) })] }));
82
+ }, type: type, value: mapValue(value), onChange: onChangeHandler, list: `${name || ''}-data-list` }), canClear && value && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), _jsx("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => (_jsx("option", { value: value }, value))) })] }));
135
83
  });
136
84
  export default Input;
@@ -24,7 +24,6 @@ export const messagesColorPalettes = {
24
24
  function Message(props) {
25
25
  const { style = {}, type, children } = props;
26
26
  return (_jsx("div", { style: {
27
- fontSize: '1rem',
28
27
  padding: '0.375rem 0.75rem',
29
28
  borderRadius: '0.25rem',
30
29
  backgroundColor: messagesColorPalettes[type].tint,
@@ -7,6 +7,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
7
7
  max?: any;
8
8
  value?: number;
9
9
  style?: CSSProperties;
10
+ autoSelect?: boolean;
10
11
  }
11
12
  declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
12
13
  export default NumberInput;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
2
+ import { forwardRef, useEffect } from 'react';
3
+ import useCombinedRefs from '../hooks/useCombinedRefs';
3
4
  const inputStyle = {
4
5
  height: '100%',
5
6
  width: '100px',
@@ -7,7 +8,13 @@ const inputStyle = {
7
8
  border: '0.55px solid #c7c7c7',
8
9
  textAlign: 'center',
9
10
  };
10
- const NumberInput = forwardRef(({ name, value: valueProp, style = {}, onChange, pattern = '^\\d*.\\d*$', step = 'any', min = 'any', max = 'any', ...otherProps }, ref) => {
11
- return (_jsx("input", { ref: ref, name: name, style: { ...inputStyle, ...style }, type: "number", pattern: pattern, value: valueProp, step: step, onChange: onChange, min: min, max: max, ...otherProps }));
11
+ const NumberInput = forwardRef(({ name, value: valueProp, style = {}, onChange, pattern = '^\\d*.\\d*$', step = 'any', min = 'any', max = 'any', autoSelect = false, ...otherProps }, ref) => {
12
+ const combinedRef = useCombinedRefs([ref]);
13
+ useEffect(() => {
14
+ if (autoSelect) {
15
+ combinedRef?.current?.select();
16
+ }
17
+ }, [autoSelect, combinedRef]);
18
+ return (_jsx("input", { ref: combinedRef, name: name, style: { ...inputStyle, ...style }, type: "number", pattern: pattern, value: valueProp, step: step, onChange: onChange, min: min, max: max, ...otherProps }));
12
19
  });
13
20
  export default NumberInput;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ type PreferencesButtonProps = Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;
3
+ export declare function PreferencesButton({ onClick }: PreferencesButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FaCog } from 'react-icons/fa';
3
+ import ToolTip from './ToolTip/ToolTip';
4
+ export function PreferencesButton({ onClick }) {
5
+ return (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onClick, children: _jsx(FaCog, {}) }) }));
6
+ }
@@ -3,9 +3,9 @@ export interface InputMapValueFunctions {
3
3
  mapOnChangeValue?: (value: string | number) => any;
4
4
  mapValue?: (value: any) => string | number;
5
5
  }
6
- interface FormikInputProps extends InputProps, InputMapValueFunctions {
6
+ interface FormikInputProps extends InputMapValueFunctions {
7
7
  name: string;
8
8
  checkErrorAfterInputTouched?: boolean;
9
9
  }
10
- declare function FormikInput(props: FormikInputProps): import("react/jsx-runtime").JSX.Element;
10
+ declare function FormikInput(props: FormikInputProps & InputProps): import("react/jsx-runtime").JSX.Element;
11
11
  export default FormikInput;
@@ -2,14 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useFormikContext } from 'formik';
3
3
  import lodashGet from 'lodash/get';
4
4
  import Input from '../Input';
5
- function identity(value) {
6
- return value;
7
- }
8
5
  function FormikInput(props) {
9
- const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange = () => null, checkValue = () => true, type = 'text', className = '', value = null, format = () => identity, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
6
+ const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
10
7
  const { values, handleChange, errors, touched, setFieldValue } = useFormikContext();
11
8
  function changeHandler(e) {
12
- onChange(e);
9
+ onChange?.(e);
13
10
  if (mapOnChangeValue) {
14
11
  void setFieldValue(name, mapOnChangeValue(e.target.value));
15
12
  }
@@ -36,6 +33,6 @@ function FormikInput(props) {
36
33
  }
37
34
  : {}),
38
35
  },
39
- }, checkValue: checkValue, className: className, format: format, ...resProps }));
36
+ }, className: className, ...resProps }));
40
37
  }
41
38
  export default FormikInput;
@@ -16,7 +16,7 @@ const FormikOnChange = (props) => {
16
16
  debounceOnChange.current(values);
17
17
  }
18
18
  else {
19
- setTouched(errors);
19
+ void setTouched(errors);
20
20
  }
21
21
  }
22
22
  else {
@@ -60,6 +60,6 @@ function ConfirmationDialog({ style = {}, buttons = [], onClose, message, render
60
60
  onClose();
61
61
  }
62
62
  }, [onClose]);
63
- return (_jsxs("div", { style: style, css: styles, "data-test-id": id, children: [render ? (render({ message, className: 'message' })) : (_jsx("p", { className: "message", children: message })), _jsx("div", { className: "buttons-container", children: buttons.map((option) => (_jsx("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }));
63
+ return (_jsxs("div", { style: style, css: styles, "data-testid": id, children: [render ? (render({ message, className: 'message' })) : (_jsx("p", { className: "message", children: message })), _jsx("div", { className: "buttons-container", children: buttons.map((option) => (_jsx("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }));
64
64
  }
65
65
  export default ConfirmationDialog;
@@ -28,21 +28,30 @@ const initialValues = {
28
28
  };
29
29
  function ApodizationOptionsInnerPanel(props) {
30
30
  const dispatch = useDispatch();
31
- const formRef = useRef(null);
31
+ const previousPreviewRef = useRef(initialValues.livePreview);
32
32
  function handleApplyFilter(values, triggerSource = 'apply') {
33
- const { livePreview, ...filterOptions } = values;
34
- if (livePreview && triggerSource === 'onChange') {
35
- dispatch({
36
- type: 'CALCULATE_APODIZATION_FILTER',
37
- payload: filterOptions,
38
- });
39
- }
40
- else if (triggerSource === 'apply') {
41
- dispatch({
42
- type: 'APPLY_APODIZATION_FILTER',
43
- payload: filterOptions,
44
- });
33
+ const { livePreview, ...options } = values;
34
+ switch (triggerSource) {
35
+ case 'onChange': {
36
+ if (livePreview || previousPreviewRef.current !== livePreview) {
37
+ dispatch({
38
+ type: 'CALCULATE_APODIZATION_FILTER',
39
+ payload: { livePreview, options },
40
+ });
41
+ }
42
+ break;
43
+ }
44
+ case 'apply': {
45
+ dispatch({
46
+ type: 'APPLY_APODIZATION_FILTER',
47
+ payload: { options },
48
+ });
49
+ break;
50
+ }
51
+ default:
52
+ break;
45
53
  }
54
+ previousPreviewRef.current = livePreview;
46
55
  }
47
56
  function handleCancelFilter() {
48
57
  dispatch({
@@ -53,7 +62,7 @@ function ApodizationOptionsInnerPanel(props) {
53
62
  if (props.filter) {
54
63
  formData = { ...initialValues, ...props.filter.value, livePreview: true };
55
64
  }
56
- return (_jsxs(HeaderContainer, { children: [_jsx(Formik, { innerRef: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: formData, validationSchema: validationSchema, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Line broadening : ", shortTitle: "LB :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Gauss broadening :", shortTitle: "GB :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "gaussBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "lineBroadeningCenter [0 - 1] : ", shortTitle: "LB Center :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadeningCenter", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", style: { label: { padding: '0 5px' } }, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true })] }) }), _jsx(ActionButtons, { onDone: () => formRef.current?.submitForm(), onCancel: handleCancelFilter })] }));
65
+ return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: formData, validationSchema: validationSchema, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Line broadening : ", shortTitle: "LB :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Gauss broadening :", shortTitle: "GB :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "gaussBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "lineBroadeningCenter [0 - 1] : ", shortTitle: "LB Center :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "lineBroadeningCenter", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", style: { label: { padding: '0 5px' } }, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) }) }));
57
66
  }
58
67
  const MemoizedApodizationPanel = memo(ApodizationOptionsInnerPanel);
59
68
  export default function ApodizationOptionsPanel() {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Formik } from 'formik';
3
3
  import { Filters } from 'nmr-processing';
4
- import { useRef, useState, memo } from 'react';
4
+ import { useState, memo, useRef } from 'react';
5
5
  import * as Yup from 'yup';
6
6
  import { useDispatch } from '../context/DispatchContext';
7
7
  import ActionButtons from '../elements/ActionButtons';
@@ -65,16 +65,37 @@ const formData = (algorithm, filterValues) => {
65
65
  };
66
66
  function BaseLineCorrectionInnerPanel(props) {
67
67
  const dispatch = useDispatch();
68
- const formRef = useRef(null);
68
+ const previousPreviewRef = useRef(true);
69
69
  const { algorithm: baseAlgorithm = 'polynomial' } = props?.filter?.value || {};
70
70
  const [algorithm, setAlgorithm] = useState(baseAlgorithm);
71
71
  const handleApplyFilter = (values, triggerSource = 'apply') => {
72
- dispatch({
73
- type: triggerSource === 'onChange'
74
- ? 'CALCULATE_BASE_LINE_CORRECTION_FILTER'
75
- : 'APPLY_BASE_LINE_CORRECTION_FILTER',
76
- payload: values,
77
- });
72
+ const { livePreview, ...options } = values;
73
+ switch (triggerSource) {
74
+ case 'onChange': {
75
+ if (livePreview || previousPreviewRef !== livePreview) {
76
+ dispatch({
77
+ type: 'CALCULATE_BASE_LINE_CORRECTION_FILTER',
78
+ payload: {
79
+ options,
80
+ livePreview,
81
+ },
82
+ });
83
+ }
84
+ break;
85
+ }
86
+ case 'apply': {
87
+ dispatch({
88
+ type: 'APPLY_BASE_LINE_CORRECTION_FILTER',
89
+ payload: {
90
+ options,
91
+ },
92
+ });
93
+ break;
94
+ }
95
+ default:
96
+ break;
97
+ }
98
+ previousPreviewRef.current = livePreview;
78
99
  };
79
100
  const handleCancelFilter = () => {
80
101
  dispatch({
@@ -85,8 +106,8 @@ function BaseLineCorrectionInnerPanel(props) {
85
106
  setAlgorithm(selectedAlgorithm);
86
107
  }
87
108
  const form = formData(algorithm, props?.filter?.value || {});
88
- return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), _jsx(Formik, { innerRef: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: form.values, validationSchema: form.validation, enableReinitialize: true, children: _jsxs(_Fragment, { children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "maxIterations", debounceTime: 250, style: inputStyle }) }), _jsx(Label, { title: "tolerance:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "tolerance", debounceTime: 250, style: inputStyle }) })] })), algorithm &&
89
- ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", shortTitle: "degree :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: inputStyle, debounceTime: 250 }) })), _jsx(Label, { title: "live preview ", htmlFor: "livePreview", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true })] }) }), _jsx(ActionButtons, { onDone: () => formRef.current?.submitForm(), onCancel: handleCancelFilter })] }));
109
+ return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: form.values, validationSchema: form.validation, enableReinitialize: true, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "maxIterations", debounceTime: 250, style: inputStyle }) }), _jsx(Label, { title: "tolerance:", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "tolerance", debounceTime: 250, style: inputStyle }) })] })), algorithm &&
110
+ ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", shortTitle: "degree :", style: headerLabelStyle, children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: inputStyle, debounceTime: 250 }) })), _jsx(Label, { title: "live preview ", htmlFor: "livePreview", style: headerLabelStyle, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) })] }));
90
111
  }
91
112
  const MemoizedBaseLineCorrectionPanel = memo(BaseLineCorrectionInnerPanel);
92
113
  export default function BaseLineCorrectionPanel() {
@@ -1,6 +1,13 @@
1
1
  import { LabelStyle } from '../elements/Label';
2
2
  export declare const headerLabelStyle: LabelStyle;
3
- export default function HeaderWrapper({ isFullscreen, onMaximize }: {
4
- isFullscreen: any;
5
- onMaximize: any;
3
+ interface HeaderInnerProps {
4
+ onEnableFullscreen: () => void;
5
+ isFullscreenEnabled: boolean;
6
+ selectedOptionPanel: string | null;
7
+ height: number;
8
+ }
9
+ export default function HeaderWrapper({ isFullscreenEnabled, onEnableFullscreen, }: {
10
+ isFullscreenEnabled: HeaderInnerProps['isFullscreenEnabled'];
11
+ onEnableFullscreen: HeaderInnerProps['onEnableFullscreen'];
6
12
  }): import("@emotion/react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -11,8 +11,8 @@ import Button from '../elements/Button';
11
11
  import { Header } from '../elements/Header';
12
12
  import DropDownButton from '../elements/dropDownButton/DropDownButton';
13
13
  import { useSaveSettings } from '../hooks/useSaveSettings';
14
- import AboutUsModal from '../modal/AboutUsModal';
15
14
  import { LogsHistoryModal } from '../modal/LogsHistoryModal';
15
+ import AboutUsModal from '../modal/aboutUs/AboutUsModal';
16
16
  import GeneralSettingsModal from '../modal/setting/GeneralSettings';
17
17
  import WorkspaceItem from '../modal/setting/WorkspaceItem';
18
18
  import { options } from '../toolbar/ToolTypes';
@@ -61,7 +61,7 @@ const styles = css `
61
61
  }
62
62
  `;
63
63
  function HeaderInner(props) {
64
- const { isFullscreen, onMaximize = () => null, selectedOptionPanel, height, } = props;
64
+ const { isFullscreenEnabled, onEnableFullscreen, selectedOptionPanel, height, } = props;
65
65
  const { current: { display: { general }, }, workspace, dispatch, } = usePreferences();
66
66
  const workspacesList = useWorkspacesList();
67
67
  const hideGeneralSettings = !!(general?.hideGeneralSettings && workspace.base);
@@ -100,7 +100,7 @@ function HeaderInner(props) {
100
100
  alignItems: 'center',
101
101
  }, children: [_jsx("div", { children: _jsx(Toolbar, { orientation: "horizontal", children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
102
102
  alignItems: 'center',
103
- }, children: [!hideGeneralSettings && (_jsxs(_Fragment, { children: [_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), _jsx(SaveButton, {})] })), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
103
+ }, children: [!hideGeneralSettings && (_jsxs(_Fragment, { children: [_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem }), _jsx(SaveButton, {})] })), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !isFullscreenEnabled && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onEnableFullscreen, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
104
104
  }
105
105
  function SaveButton() {
106
106
  const { workspace, workspaces, originalWorkspaces } = usePreferences();
@@ -117,10 +117,10 @@ function SaveButton() {
117
117
  }), toolTip: "Save workspace locally in the browser", children: _jsx(FaRegSave, {}) }), _jsx(SaveSettingsModal, {})] }));
118
118
  }
119
119
  const MemoizedHeader = memo(HeaderInner);
120
- export default function HeaderWrapper({ isFullscreen, onMaximize }) {
120
+ export default function HeaderWrapper({ isFullscreenEnabled, onEnableFullscreen, }) {
121
121
  const { toolOptions: { selectedOptionPanel }, height, } = useChartData();
122
122
  return (_jsx(MemoizedHeader, { selectedOptionPanel,
123
- isFullscreen,
124
- onMaximize,
123
+ isFullscreenEnabled,
124
+ onEnableFullscreen,
125
125
  height }));
126
126
  }
@@ -1,12 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Formik } from 'formik';
2
3
  import { Filters } from 'nmr-processing';
3
- import { useEffect, useState, memo } from 'react';
4
- import { Checkbox } from 'react-science/ui';
4
+ import { memo, useRef } from 'react';
5
5
  import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
6
6
  import { useDispatch } from '../context/DispatchContext';
7
7
  import ActionButtons from '../elements/ActionButtons';
8
8
  import Label from '../elements/Label';
9
- import Select from '../elements/Select';
9
+ import FormikCheckBox from '../elements/formik/FormikCheckBox';
10
+ import FormikOnChange from '../elements/formik/FormikOnChange';
11
+ import FormikSelect from '../elements/formik/FormikSelect';
10
12
  import { useFilter } from '../hooks/useFilter';
11
13
  import useSpectrum from '../hooks/useSpectrum';
12
14
  import { headerLabelStyle } from './Header';
@@ -24,40 +26,44 @@ function useInitZeroFillingSize() {
24
26
  return 0;
25
27
  }
26
28
  function ZeroFillingOptionsInnerPanel(props) {
29
+ const { size } = props;
27
30
  const dispatch = useDispatch();
28
- const [livePreview, setLivePreview] = useState(true);
29
- const [size, setSize] = useState(props.size);
30
- function handleApplyFilter() {
31
- dispatch({
32
- type: 'APPLY_ZERO_FILLING_FILTER',
33
- payload: {
34
- nbPoints: size,
35
- },
36
- });
31
+ const previousPreviewRef = useRef(true);
32
+ function handleApplyFilter(values, triggerSource = 'apply') {
33
+ const { livePreview, ...options } = values;
34
+ switch (triggerSource) {
35
+ case 'onChange': {
36
+ if (livePreview || previousPreviewRef !== livePreview) {
37
+ dispatch({
38
+ type: 'CALCULATE_ZERO_FILLING_FILTER',
39
+ payload: {
40
+ options,
41
+ livePreview,
42
+ },
43
+ });
44
+ }
45
+ break;
46
+ }
47
+ case 'apply': {
48
+ dispatch({
49
+ type: 'APPLY_ZERO_FILLING_FILTER',
50
+ payload: {
51
+ options,
52
+ },
53
+ });
54
+ break;
55
+ }
56
+ default:
57
+ break;
58
+ }
59
+ previousPreviewRef.current = livePreview;
37
60
  }
38
61
  function handleCancelFilter() {
39
62
  dispatch({
40
63
  type: 'RESET_SELECTED_TOOL',
41
64
  });
42
65
  }
43
- function dispatchLiveChanges(nbPoints) {
44
- dispatch({
45
- type: 'CALCULATE_ZERO_FILLING_FILTER',
46
- payload: {
47
- nbPoints,
48
- },
49
- });
50
- }
51
- function handleChangeSizeHandler(value) {
52
- setSize(value);
53
- }
54
- useEffect(() => {
55
- if (livePreview && size) {
56
- dispatchLiveChanges(size);
57
- }
58
- // eslint-disable-next-line react-hooks/exhaustive-deps
59
- }, [size, livePreview]);
60
- return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(Select, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, value: size, onChange: handleChangeSizeHandler }) }), _jsx(Checkbox, { label: "Live preview", checked: livePreview, onChange: setLivePreview }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
66
+ return (_jsx(HeaderContainer, { children: _jsx(Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: { nbPoints: size, livePreview: true }, children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Size: ", style: headerLabelStyle, children: _jsx(FormikSelect, { items: Sizes, style: { marginLeft: 10, marginRight: 10 }, name: "nbPoints" }) }), _jsx(Label, { title: "Live preview ", htmlFor: "livePreview", style: { label: { padding: '0 5px' } }, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), _jsx(ActionButtons, { onDone: submitForm, onCancel: handleCancelFilter })] })) }) }));
61
67
  }
62
68
  const MemoizedZeroFillingOptionsPanel = memo(ZeroFillingOptionsInnerPanel);
63
69
  export default function ZeroFillingOptionsPanel() {
@@ -7,6 +7,7 @@ export declare enum HighlightEventSource {
7
7
  SIGNAL = "SIGNAL",
8
8
  RANGE = "RANGE",
9
9
  ZONE = "ZONE",
10
+ BASELINE_ZONE = "BASELINE_ZONE",
10
11
  EXCLUSION_ZONE = "EXCLUSION_ZONE",
11
12
  MATRIX_GENERATION_EXCLUSION_ZONE = "MATRIX_GENERATION_EXCLUSION_ZONE",
12
13
  MULTIPLE_ANALYSIS_ZONE = "MULTIPLE_ANALYSIS_ZONE",
@@ -7,6 +7,7 @@ export var HighlightEventSource;
7
7
  HighlightEventSource["SIGNAL"] = "SIGNAL";
8
8
  HighlightEventSource["RANGE"] = "RANGE";
9
9
  HighlightEventSource["ZONE"] = "ZONE";
10
+ HighlightEventSource["BASELINE_ZONE"] = "BASELINE_ZONE";
10
11
  HighlightEventSource["EXCLUSION_ZONE"] = "EXCLUSION_ZONE";
11
12
  HighlightEventSource["MATRIX_GENERATION_EXCLUSION_ZONE"] = "MATRIX_GENERATION_EXCLUSION_ZONE";
12
13
  HighlightEventSource["MULTIPLE_ANALYSIS_ZONE"] = "MULTIPLE_ANALYSIS_ZONE";
@@ -4,6 +4,7 @@ export const defaultPeaksViewState = {
4
4
  isPeaksVisible: true,
5
5
  showPeaksShapes: false,
6
6
  showPeaksSum: false,
7
+ displayingMode: 'spread',
7
8
  };
8
9
  export function useActiveSpectrumPeaksViewState() {
9
10
  const activeSpectrum = useActiveSpectrum();
@@ -3,24 +3,28 @@ import { useCallback } from 'react';
3
3
  import { useChartData } from '../context/ChartContext';
4
4
  import { usePreferences } from '../context/PreferencesContext';
5
5
  import { options } from '../toolbar/ToolTypes';
6
+ import useCheckExperimentalFeature from './useCheckExperimentalFeature';
6
7
  import useSpectrum from './useSpectrum';
7
8
  export function useCheckToolsVisibility() {
8
9
  const { displayerMode } = useChartData();
9
10
  const preferences = usePreferences();
10
11
  const spectrum = useSpectrum(null);
12
+ const isExperimentalFeatureActivated = useCheckExperimentalFeature();
11
13
  return useCallback((toolKey, checkOptions = {}) => {
12
14
  const { checkMode = true, checkSpectrumType = true, extraInfoCheckParameters, } = checkOptions;
15
+ const { spectraOptions, mode, isExperimental } = options[toolKey];
13
16
  const flag = lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false);
14
- const { spectraOptions, mode } = options[toolKey];
15
17
  const modeFlag = !checkMode || (checkMode && (!mode || displayerMode === mode));
16
18
  const spectrumCheckFlag = !checkSpectrumType ||
17
19
  (checkSpectrumType && checkSpectrum(spectrum, spectraOptions));
18
- return (flag &&
20
+ const isToolActivated = (flag && !isExperimental) ||
21
+ (isExperimental && isExperimentalFeatureActivated);
22
+ return (isToolActivated &&
19
23
  modeFlag &&
20
24
  spectrumCheckFlag &&
21
25
  (!extraInfoCheckParameters ||
22
26
  checkInfo(extraInfoCheckParameters, spectrum?.info)));
23
- }, [displayerMode, preferences, spectrum]);
27
+ }, [displayerMode, isExperimentalFeatureActivated, preferences, spectrum]);
24
28
  }
25
29
  function checkSpectrum(spectrum, options) {
26
30
  let outerConditionResult = false;
@@ -0,0 +1,2 @@
1
+ import { NMRiumToolBarPreferences } from 'nmr-load-save';
2
+ export declare function useResizerStatus(toolKey: keyof NMRiumToolBarPreferences): boolean;
@@ -0,0 +1,7 @@
1
+ import { useChartData } from '../context/ChartContext';
2
+ import { useKeyModifiers } from '../context/KeyModifierContext';
3
+ export function useResizerStatus(toolKey) {
4
+ const { toolOptions: { selectedTool }, } = useChartData();
5
+ const { shiftKey } = useKeyModifiers();
6
+ return !shiftKey && selectedTool === toolKey;
7
+ }
@@ -5,7 +5,7 @@ export default function useSpectrum(defaultValue = null) {
5
5
  const { data } = useChartData();
6
6
  const activeSpectrum = useActiveSpectrum();
7
7
  return useMemo(() => {
8
- if (data && activeSpectrum && activeSpectrum.id) {
8
+ if (data && activeSpectrum?.id) {
9
9
  const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
10
10
  return datum;
11
11
  }