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
@@ -16,10 +16,10 @@ const index_1 = require("../highlight/index");
16
16
  const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
17
17
  const useExport_1 = __importDefault(require("../hooks/useExport"));
18
18
  const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
19
- const Constants_1 = require("../reducer/core/Constants");
20
19
  const ToolTypes_1 = require("../toolbar/ToolTypes");
21
- function KeysListenerTracker() {
22
- const { keysPreferences, displayerMode, overDisplayer, data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
20
+ function KeysListenerTracker(props) {
21
+ const { mainDivRef } = props;
22
+ const { keysPreferences, displayerMode, data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
23
23
  const dispatch = (0, DispatchContext_1.useDispatch)();
24
24
  const { dispatch: dispatchPreferences } = (0, PreferencesContext_1.usePreferences)();
25
25
  const alert = (0, Alert_1.useAlert)();
@@ -29,9 +29,28 @@ function KeysListenerTracker() {
29
29
  const { saveToClipboardHandler, saveAsJSONHandler, saveAsHandler } = (0, useExport_1.default)();
30
30
  const isToolVisible = (0, useCheckToolsVisibility_1.useCheckToolsVisibility)();
31
31
  const { highlight, remove } = (0, index_1.useHighlightData)();
32
+ const mouseIsOverDisplayer = (0, react_1.useRef)(false);
33
+ (0, react_1.useEffect)(() => {
34
+ const div = mainDivRef.current;
35
+ if (!div) {
36
+ return;
37
+ }
38
+ function mouseEnterHandler() {
39
+ mouseIsOverDisplayer.current = true;
40
+ }
41
+ function mouseLeaveHandler() {
42
+ mouseIsOverDisplayer.current = false;
43
+ }
44
+ div.addEventListener('mouseenter', mouseEnterHandler);
45
+ div.addEventListener('mouseleave', mouseLeaveHandler);
46
+ return () => {
47
+ div.removeEventListener('mouseenter', mouseEnterHandler);
48
+ div.removeEventListener('mouseleave', mouseLeaveHandler);
49
+ };
50
+ }, [mainDivRef]);
32
51
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
33
52
  const allow1DTool = (0, react_1.useMemo)(() => {
34
- return displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && data && data.length > 0;
53
+ return displayerMode === '1D' && data && data.length > 0;
35
54
  }, [data, displayerMode]);
36
55
  const deleteHandler = (0, react_1.useCallback)(async (sourceData) => {
37
56
  const { type, extra } = sourceData;
@@ -175,6 +194,15 @@ function KeysListenerTracker() {
175
194
  }
176
195
  break;
177
196
  }
197
+ case index_1.HighlightEventSource.BASELINE_ZONE: {
198
+ const { id } = extra || {};
199
+ if (id) {
200
+ dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
201
+ // remove keys from the highlighted list after delete
202
+ remove();
203
+ }
204
+ break;
205
+ }
178
206
  default:
179
207
  break;
180
208
  }
@@ -228,7 +256,6 @@ function KeysListenerTracker() {
228
256
  handleFullZoomOut();
229
257
  }
230
258
  break;
231
- case 'z':
232
259
  case 'Escape':
233
260
  if (isToolVisible('zoom')) {
234
261
  handleChangeOption(ToolTypes_1.options.zoom.id);
@@ -243,6 +270,12 @@ function KeysListenerTracker() {
243
270
  }
244
271
  break;
245
272
  }
273
+ case 'z': {
274
+ if (isToolVisible('zeroFilling')) {
275
+ handleChangeOption(ToolTypes_1.options.zeroFilling.id);
276
+ }
277
+ break;
278
+ }
246
279
  case 'a': {
247
280
  if (isToolVisible('apodization')) {
248
281
  handleChangeOption(ToolTypes_1.options.apodization.id);
@@ -252,6 +285,14 @@ function KeysListenerTracker() {
252
285
  }
253
286
  break;
254
287
  }
288
+ case 't': {
289
+ if (isToolVisible('fft')) {
290
+ dispatch({
291
+ type: 'APPLY_FFT_FILTER',
292
+ });
293
+ }
294
+ break;
295
+ }
255
296
  case 'b': {
256
297
  if (isToolVisible('baselineCorrection')) {
257
298
  handleChangeOption(ToolTypes_1.options.baselineCorrection.id);
@@ -348,7 +389,7 @@ function KeysListenerTracker() {
348
389
  saveToClipboardHandler,
349
390
  ]);
350
391
  const handleOnKeyDown = (0, react_1.useCallback)((e) => {
351
- if (checkNotInputField(e) && overDisplayer) {
392
+ if (checkNotInputField(e) && mouseIsOverDisplayer.current) {
352
393
  const num = Number(e.code.slice(-1)) || 0;
353
394
  if (num > 0) {
354
395
  keysPreferencesListenerHandler(e, num);
@@ -366,7 +407,6 @@ function KeysListenerTracker() {
366
407
  deleteHandler,
367
408
  highlight,
368
409
  keysPreferencesListenerHandler,
369
- overDisplayer,
370
410
  toolsListenerHandler,
371
411
  ]);
372
412
  (0, react_1.useEffect)(() => {
@@ -6,16 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AssignmentProvider = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
+ const ChartContext_1 = require("../context/ChartContext");
9
10
  const AssignmentsContext_1 = require("./AssignmentsContext");
10
11
  const AssignmentsReducer_1 = __importDefault(require("./AssignmentsReducer"));
11
12
  function AssignmentProvider(props) {
12
- const { spectraData: spectra, children } = props;
13
+ const { children } = props;
14
+ const { data: spectra } = (0, ChartContext_1.useChartData)();
13
15
  const [data, dispatch] = (0, react_1.useReducer)(AssignmentsReducer_1.default, AssignmentsContext_1.assignmentState);
14
16
  const state = (0, react_1.useMemo)(() => ({ data, dispatch }), [data]);
15
17
  (0, react_1.useEffect)(() => {
16
18
  if (spectra) {
17
19
  dispatch({
18
20
  type: 'INITIATE_ASSIGNMENTS',
21
+ // TODO: Fix this type error. It's been here for a long time because this component wasn't typed.
22
+ // @ts-expect-error This should be fixed.
19
23
  payload: { spectra },
20
24
  });
21
25
  }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyModifiersProvider = exports.useKeyModifiers = exports.KeyModifierContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const defaultKeyModifiersState = {
7
+ ctrlKey: false,
8
+ shiftKey: false,
9
+ altKey: false,
10
+ };
11
+ exports.KeyModifierContext = (0, react_1.createContext)(defaultKeyModifiersState);
12
+ function useKeyModifiers() {
13
+ const context = (0, react_1.useContext)(exports.KeyModifierContext);
14
+ if (!context) {
15
+ throw new Error('key modifiers context was not found');
16
+ }
17
+ return context;
18
+ }
19
+ exports.useKeyModifiers = useKeyModifiers;
20
+ const isMac = navigator !== undefined && navigator.userAgent.toLowerCase().includes('mac');
21
+ function getModifiers(event) {
22
+ const { shiftKey, altKey, metaKey } = event;
23
+ const ctrlKey = isMac ? metaKey : event.ctrlKey;
24
+ return { ctrlKey, shiftKey, altKey };
25
+ }
26
+ function KeyModifiersProvider({ children }) {
27
+ const [modifiers, setModifiers] = (0, react_1.useState)(defaultKeyModifiersState);
28
+ (0, react_1.useEffect)(() => {
29
+ function handleKeyDown(event) {
30
+ setModifiers(getModifiers(event));
31
+ }
32
+ function handleKeyUp(event) {
33
+ setModifiers(getModifiers(event));
34
+ }
35
+ document.addEventListener('keydown', handleKeyDown);
36
+ document.addEventListener('keyup', handleKeyUp);
37
+ return () => {
38
+ document.removeEventListener('keydown', handleKeyDown);
39
+ document.removeEventListener('keyup', handleKeyUp);
40
+ };
41
+ }, []);
42
+ return ((0, jsx_runtime_1.jsx)(exports.KeyModifierContext.Provider, { value: modifiers, children: children }));
43
+ }
44
+ exports.KeyModifiersProvider = KeyModifiersProvider;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
4
+ //TODO resolve the eslint rules
5
+ /* eslint-disable react/no-unused-prop-types */
4
6
  /** @jsxImportSource @emotion/react */
5
7
  const react_1 = require("@emotion/react");
6
8
  const fa_1 = require("react-icons/fa");
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CounterLabel = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const labelStyle = {
6
+ margin: 0,
7
+ textAlign: 'right',
8
+ lineHeight: '22px',
9
+ padding: '0 5px',
10
+ whiteSpace: 'nowrap',
11
+ };
12
+ function CounterLabel(props) {
13
+ const { children, style = {} } = props;
14
+ return (0, jsx_runtime_1.jsx)("p", { style: { ...labelStyle, ...style }, children: children });
15
+ }
16
+ exports.CounterLabel = CounterLabel;
@@ -10,6 +10,7 @@ const EditableColumn = (0, react_1.forwardRef)(function EditableColumn(props, re
10
10
  const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, textOverFlowEllipses = false, ...InputProps } = props;
11
11
  const [enabled, enableEdit] = (0, react_1.useState)();
12
12
  const [isValid, setValid] = (0, react_1.useState)(true);
13
+ const [val, setVal] = (0, react_1.useState)(value);
13
14
  (0, react_1.useEffect)(() => {
14
15
  enableEdit(editStatus);
15
16
  }, [editStatus]);
@@ -27,13 +28,13 @@ const EditableColumn = (0, react_1.forwardRef)(function EditableColumn(props, re
27
28
  window.removeEventListener('mousedown', mouseClickCallback);
28
29
  }
29
30
  }, []);
30
- const startEditHandler = (0, react_1.useCallback)(() => {
31
+ function startEditHandler() {
31
32
  window.addEventListener('mousedown', mouseClickCallback);
32
33
  onEditStart(true);
33
34
  enableEdit(true);
34
- }, [mouseClickCallback, onEditStart]);
35
- const editHandler = (0, react_1.useCallback)((event) => {
36
- const valid = validate(event?.target.value);
35
+ }
36
+ function editHandler(event) {
37
+ const valid = validate(val);
37
38
  setValid(valid);
38
39
  // when press Enter or Tab
39
40
  if (valid && ['Enter', 'Tab'].includes(event.key)) {
@@ -45,7 +46,10 @@ const EditableColumn = (0, react_1.forwardRef)(function EditableColumn(props, re
45
46
  enableEdit(false);
46
47
  window.removeEventListener('mousedown', mouseClickCallback);
47
48
  }
48
- }, [mouseClickCallback, onSave, validate]);
49
+ }
50
+ function handleChange(e) {
51
+ setVal(e.target.value);
52
+ }
49
53
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
50
54
  display: 'table',
51
55
  width: '100%',
@@ -67,8 +71,10 @@ const EditableColumn = (0, react_1.forwardRef)(function EditableColumn(props, re
67
71
  width: '100%',
68
72
  },
69
73
  input: {
74
+ padding: '5px',
70
75
  width: '100%',
76
+ minWidth: '60px',
71
77
  },
72
- }, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler, ...InputProps }) }))] }));
78
+ }, autoSelect: true, className: "editable-column", value: val, type: type, onChange: handleChange, onKeyUp: editHandler, onMouseDown: (e) => e.stopPropagation(), ...InputProps }) }))] }));
73
79
  });
74
80
  exports.default = EditableColumn;
@@ -8,10 +8,6 @@ const debounce_1 = __importDefault(require("lodash/debounce"));
8
8
  const react_1 = require("react");
9
9
  const useCombinedRefs_1 = __importDefault(require("../hooks/useCombinedRefs"));
10
10
  const styles = {
11
- label: {
12
- lineHeight: 2,
13
- userSelect: 'none',
14
- },
15
11
  inputWrapper: {
16
12
  borderRadius: '5px',
17
13
  borderWidth: '0.55px',
@@ -26,7 +22,6 @@ const styles = {
26
22
  outline: 'none',
27
23
  flex: 1,
28
24
  height: '100%',
29
- textAlign: 'center',
30
25
  width: '100%',
31
26
  },
32
27
  clearButton: {
@@ -39,103 +34,56 @@ const styles = {
39
34
  padding: 0,
40
35
  },
41
36
  };
42
- function check(value, type) {
43
- if (type === 'number') {
44
- const pattern = /^(?:-?\d*|\d+)(?:\.\d{0,20})?$/;
45
- if (value.trim() === '' || pattern.test(value)) {
46
- return true;
47
- }
48
- return false;
49
- }
50
- return true;
51
- }
52
- function identity(value) {
53
- return value;
54
- }
55
- function preventPropagate(event) {
56
- event.stopPropagation();
37
+ function mapValue(value) {
38
+ return typeof value === 'number' && value === 0 ? value : value || '';
57
39
  }
58
40
  const Input = (0, react_1.forwardRef)((props, ref) => {
59
- const { value = '', name, style = {
41
+ const { value: externalValue = undefined, name, style = {
60
42
  input: {},
61
43
  inputWrapper: {},
62
- }, 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;
63
- const [val, setVal] = (0, react_1.useState)(value ?? '');
64
- const valueRef = (0, react_1.useRef)(value);
44
+ }, onChange, checkValue = () => true, type = 'text', autoSelect = false, className, renderIcon, canClear = false, onClear, datalist = [], debounceTime = 0, ...otherProps } = props;
45
+ const [internalValue, setInternalValue] = (0, react_1.useState)();
46
+ const value = debounceTime ? internalValue : externalValue;
65
47
  const localRef = (0, react_1.useRef)();
66
48
  const combinedRef = (0, useCombinedRefs_1.default)([ref, localRef]);
67
- const debounceOnChange = (0, react_1.useMemo)(() => (0, debounce_1.default)((val) => {
68
- onChange?.(val);
49
+ const debounceOnChange = (0, react_1.useMemo)(() => (0, debounce_1.default)((e) => {
50
+ onChange?.(e);
69
51
  }, debounceTime), [debounceTime, onChange]);
70
52
  (0, react_1.useEffect)(() => {
71
- setVal((prevVal) => (prevVal !== value ? value ?? '' : prevVal));
72
- }, [value]);
73
- (0, react_1.useEffect)(() => {
74
- if (enableAutoSelect) {
53
+ if (autoSelect) {
75
54
  combinedRef?.current?.select();
76
55
  }
77
- }, [enableAutoSelect, combinedRef]);
78
- function getValue(value) {
79
- const val = type === 'number'
80
- ? String(value).trim() === '-'
81
- ? Number(0)
82
- : nullable && !value
83
- ? null
84
- : Number(value)
85
- : nullable && !value
86
- ? null
87
- : value;
88
- return format()(val);
89
- }
56
+ }, [autoSelect, combinedRef]);
57
+ (0, react_1.useEffect)(() => {
58
+ if (debounceTime) {
59
+ setInternalValue(externalValue);
60
+ }
61
+ }, [debounceTime, externalValue]);
90
62
  function onChangeHandler(e) {
91
63
  e.stopPropagation();
92
64
  e.preventDefault();
93
- const _value = e.target.value;
94
- if (check(_value, type) && checkValue(_value)) {
95
- const formatValue = format();
96
- setVal(formatValue(_value));
97
- valueRef.current = _value;
98
- const val = {
99
- ...e,
100
- target: { name: e.target.name, value: getValue(_value) },
101
- };
65
+ const val = e.target.value;
66
+ if (checkValue(val)) {
102
67
  if (debounceTime) {
103
- debounceOnChange(val);
68
+ setInternalValue(val);
69
+ debounceOnChange(e);
104
70
  }
105
71
  else {
106
- onChange?.(val);
72
+ onChange?.(e);
107
73
  }
108
74
  }
109
75
  }
110
- function handleKeyDown(event) {
111
- onKeyDown({
112
- ...event,
113
- target: {
114
- name: event.target.name,
115
- value: getValue(valueRef.current),
116
- },
117
- });
118
- }
119
- function handleKeyUp(event) {
120
- onKeyUp({
121
- ...event,
122
- target: {
123
- name: event.target.name,
124
- value: getValue(valueRef.current),
125
- },
126
- });
127
- }
128
76
  function clearHandler() {
129
- setVal('');
77
+ localRef.current?.setAttribute('value', '');
130
78
  onClear?.();
131
79
  }
132
80
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
133
- ...(renderIcon || (canClear && { padding: '0 5px' })),
81
+ ...((renderIcon || canClear) && { padding: '0 5px' }),
134
82
  ...styles.inputWrapper,
135
83
  ...style?.inputWrapper,
136
84
  }, className: `input ${className || ''}`, children: [renderIcon?.(), (0, jsx_runtime_1.jsx)("input", { ...otherProps, ref: combinedRef, name: name, style: {
137
85
  ...styles.input,
138
86
  ...style?.input,
139
- }, 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 && ((0, jsx_runtime_1.jsx)("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: (0, jsx_runtime_1.jsx)("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), (0, jsx_runtime_1.jsx)("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => ((0, jsx_runtime_1.jsx)("option", { value: value }, value))) })] }));
87
+ }, type: type, value: mapValue(value), onChange: onChangeHandler, list: `${name || ''}-data-list` }), canClear && value && ((0, jsx_runtime_1.jsx)("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: (0, jsx_runtime_1.jsx)("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), (0, jsx_runtime_1.jsx)("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => ((0, jsx_runtime_1.jsx)("option", { value: value }, value))) })] }));
140
88
  });
141
89
  exports.default = Input;
@@ -27,7 +27,6 @@ exports.messagesColorPalettes = {
27
27
  function Message(props) {
28
28
  const { style = {}, type, children } = props;
29
29
  return ((0, jsx_runtime_1.jsx)("div", { style: {
30
- fontSize: '1rem',
31
30
  padding: '0.375rem 0.75rem',
32
31
  borderRadius: '0.25rem',
33
32
  backgroundColor: exports.messagesColorPalettes[type].tint,
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const jsx_runtime_1 = require("react/jsx-runtime");
4
7
  const react_1 = require("react");
8
+ const useCombinedRefs_1 = __importDefault(require("../hooks/useCombinedRefs"));
5
9
  const inputStyle = {
6
10
  height: '100%',
7
11
  width: '100px',
@@ -9,7 +13,13 @@ const inputStyle = {
9
13
  border: '0.55px solid #c7c7c7',
10
14
  textAlign: 'center',
11
15
  };
12
- const NumberInput = (0, react_1.forwardRef)(({ name, value: valueProp, style = {}, onChange, pattern = '^\\d*.\\d*$', step = 'any', min = 'any', max = 'any', ...otherProps }, ref) => {
13
- return ((0, jsx_runtime_1.jsx)("input", { ref: ref, name: name, style: { ...inputStyle, ...style }, type: "number", pattern: pattern, value: valueProp, step: step, onChange: onChange, min: min, max: max, ...otherProps }));
16
+ const NumberInput = (0, react_1.forwardRef)(({ name, value: valueProp, style = {}, onChange, pattern = '^\\d*.\\d*$', step = 'any', min = 'any', max = 'any', autoSelect = false, ...otherProps }, ref) => {
17
+ const combinedRef = (0, useCombinedRefs_1.default)([ref]);
18
+ (0, react_1.useEffect)(() => {
19
+ if (autoSelect) {
20
+ combinedRef?.current?.select();
21
+ }
22
+ }, [autoSelect, combinedRef]);
23
+ return ((0, jsx_runtime_1.jsx)("input", { ref: combinedRef, name: name, style: { ...inputStyle, ...style }, type: "number", pattern: pattern, value: valueProp, step: step, onChange: onChange, min: min, max: max, ...otherProps }));
14
24
  });
15
25
  exports.default = NumberInput;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PreferencesButton = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const fa_1 = require("react-icons/fa");
9
+ const ToolTip_1 = __importDefault(require("./ToolTip/ToolTip"));
10
+ function PreferencesButton({ onClick }) {
11
+ return ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Preferences", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClick, children: (0, jsx_runtime_1.jsx)(fa_1.FaCog, {}) }) }));
12
+ }
13
+ exports.PreferencesButton = PreferencesButton;
@@ -7,14 +7,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const formik_1 = require("formik");
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const Input_1 = __importDefault(require("../Input"));
10
- function identity(value) {
11
- return value;
12
- }
13
10
  function FormikInput(props) {
14
- const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange = () => null, checkValue = () => true, type = 'text', className = '', value = null, format = () => identity, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
11
+ const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
15
12
  const { values, handleChange, errors, touched, setFieldValue } = (0, formik_1.useFormikContext)();
16
13
  function changeHandler(e) {
17
- onChange(e);
14
+ onChange?.(e);
18
15
  if (mapOnChangeValue) {
19
16
  void setFieldValue(name, mapOnChangeValue(e.target.value));
20
17
  }
@@ -41,6 +38,6 @@ function FormikInput(props) {
41
38
  }
42
39
  : {}),
43
40
  },
44
- }, checkValue: checkValue, className: className, format: format, ...resProps }));
41
+ }, className: className, ...resProps }));
45
42
  }
46
43
  exports.default = FormikInput;
@@ -21,7 +21,7 @@ const FormikOnChange = (props) => {
21
21
  debounceOnChange.current(values);
22
22
  }
23
23
  else {
24
- setTouched(errors);
24
+ void setTouched(errors);
25
25
  }
26
26
  }
27
27
  else {
@@ -62,6 +62,6 @@ function ConfirmationDialog({ style = {}, buttons = [], onClose, message, render
62
62
  onClose();
63
63
  }
64
64
  }, [onClose]);
65
- return ((0, jsx_runtime_1.jsxs)("div", { style: style, css: styles, "data-test-id": id, children: [render ? (render({ message, className: 'message' })) : ((0, jsx_runtime_1.jsx)("p", { className: "message", children: message })), (0, jsx_runtime_1.jsx)("div", { className: "buttons-container", children: buttons.map((option) => ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }));
65
+ return ((0, jsx_runtime_1.jsxs)("div", { style: style, css: styles, "data-testid": id, children: [render ? (render({ message, className: 'message' })) : ((0, jsx_runtime_1.jsx)("p", { className: "message", children: message })), (0, jsx_runtime_1.jsx)("div", { className: "buttons-container", children: buttons.map((option) => ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }));
66
66
  }
67
67
  exports.default = ConfirmationDialog;
@@ -56,21 +56,30 @@ const initialValues = {
56
56
  };
57
57
  function ApodizationOptionsInnerPanel(props) {
58
58
  const dispatch = (0, DispatchContext_1.useDispatch)();
59
- const formRef = (0, react_1.useRef)(null);
59
+ const previousPreviewRef = (0, react_1.useRef)(initialValues.livePreview);
60
60
  function handleApplyFilter(values, triggerSource = 'apply') {
61
- const { livePreview, ...filterOptions } = values;
62
- if (livePreview && triggerSource === 'onChange') {
63
- dispatch({
64
- type: 'CALCULATE_APODIZATION_FILTER',
65
- payload: filterOptions,
66
- });
67
- }
68
- else if (triggerSource === 'apply') {
69
- dispatch({
70
- type: 'APPLY_APODIZATION_FILTER',
71
- payload: filterOptions,
72
- });
61
+ const { livePreview, ...options } = values;
62
+ switch (triggerSource) {
63
+ case 'onChange': {
64
+ if (livePreview || previousPreviewRef.current !== livePreview) {
65
+ dispatch({
66
+ type: 'CALCULATE_APODIZATION_FILTER',
67
+ payload: { livePreview, options },
68
+ });
69
+ }
70
+ break;
71
+ }
72
+ case 'apply': {
73
+ dispatch({
74
+ type: 'APPLY_APODIZATION_FILTER',
75
+ payload: { options },
76
+ });
77
+ break;
78
+ }
79
+ default:
80
+ break;
73
81
  }
82
+ previousPreviewRef.current = livePreview;
74
83
  }
75
84
  function handleCancelFilter() {
76
85
  dispatch({
@@ -81,7 +90,7 @@ function ApodizationOptionsInnerPanel(props) {
81
90
  if (props.filter) {
82
91
  formData = { ...initialValues, ...props.filter.value, livePreview: true };
83
92
  }
84
- return ((0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: formData, validationSchema: validationSchema, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Line broadening : ", shortTitle: "LB :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "lineBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Gauss broadening :", shortTitle: "GB :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "gaussBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "lineBroadeningCenter [0 - 1] : ", shortTitle: "LB Center :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "lineBroadeningCenter", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Live preview ", htmlFor: "livePreview", style: { label: { padding: '0 5px' } }, children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "livePreview" }) }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true })] }) }), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: () => formRef.current?.submitForm(), onCancel: handleCancelFilter })] }));
93
+ return ((0, jsx_runtime_1.jsx)(HeaderContainer_1.HeaderContainer, { children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: formData, validationSchema: validationSchema, children: ({ submitForm }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Line broadening : ", shortTitle: "LB :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "lineBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Gauss broadening :", shortTitle: "GB :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "gaussBroadening", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "lineBroadeningCenter [0 - 1] : ", shortTitle: "LB Center :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "lineBroadeningCenter", min: 0, max: 1, style: inputStyle, debounceTime: 250 }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Live preview ", htmlFor: "livePreview", style: { label: { padding: '0 5px' } }, children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "livePreview" }) }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: submitForm, onCancel: handleCancelFilter })] })) }) }));
85
94
  }
86
95
  const MemoizedApodizationPanel = (0, react_1.memo)(ApodizationOptionsInnerPanel);
87
96
  function ApodizationOptionsPanel() {
@@ -93,16 +93,37 @@ const formData = (algorithm, filterValues) => {
93
93
  };
94
94
  function BaseLineCorrectionInnerPanel(props) {
95
95
  const dispatch = (0, DispatchContext_1.useDispatch)();
96
- const formRef = (0, react_1.useRef)(null);
96
+ const previousPreviewRef = (0, react_1.useRef)(true);
97
97
  const { algorithm: baseAlgorithm = 'polynomial' } = props?.filter?.value || {};
98
98
  const [algorithm, setAlgorithm] = (0, react_1.useState)(baseAlgorithm);
99
99
  const handleApplyFilter = (values, triggerSource = 'apply') => {
100
- dispatch({
101
- type: triggerSource === 'onChange'
102
- ? 'CALCULATE_BASE_LINE_CORRECTION_FILTER'
103
- : 'APPLY_BASE_LINE_CORRECTION_FILTER',
104
- payload: values,
105
- });
100
+ const { livePreview, ...options } = values;
101
+ switch (triggerSource) {
102
+ case 'onChange': {
103
+ if (livePreview || previousPreviewRef !== livePreview) {
104
+ dispatch({
105
+ type: 'CALCULATE_BASE_LINE_CORRECTION_FILTER',
106
+ payload: {
107
+ options,
108
+ livePreview,
109
+ },
110
+ });
111
+ }
112
+ break;
113
+ }
114
+ case 'apply': {
115
+ dispatch({
116
+ type: 'APPLY_BASE_LINE_CORRECTION_FILTER',
117
+ payload: {
118
+ options,
119
+ },
120
+ });
121
+ break;
122
+ }
123
+ default:
124
+ break;
125
+ }
126
+ previousPreviewRef.current = livePreview;
106
127
  };
107
128
  const handleCancelFilter = () => {
108
129
  dispatch({
@@ -113,8 +134,8 @@ function BaseLineCorrectionInnerPanel(props) {
113
134
  setAlgorithm(selectedAlgorithm);
114
135
  }
115
136
  const form = formData(algorithm, props?.filter?.value || {});
116
- return ((0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Algorithm: ", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: form.values, validationSchema: form.validation, enableReinitialize: true, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [algorithm && algorithm === 'airpls' && ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "maxIterations:", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "maxIterations", debounceTime: 250, style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "tolerance:", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "tolerance", debounceTime: 250, style: inputStyle }) })] })), algorithm &&
117
- ['autoPolynomial', 'polynomial'].includes(algorithm) && ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "degree [ 1 - 6 ]:", shortTitle: "degree :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "degree", min: 1, max: 6, style: inputStyle, debounceTime: 250 }) })), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "live preview ", htmlFor: "livePreview", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "livePreview" }) }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true })] }) }), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: () => formRef.current?.submitForm(), onCancel: handleCancelFilter })] }));
137
+ return ((0, jsx_runtime_1.jsxs)(HeaderContainer_1.HeaderContainer, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Algorithm: ", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: getAlgorithmsList(), value: algorithm, onChange: handleChangeAlgorithm }) }), (0, jsx_runtime_1.jsx)(formik_1.Formik, { onSubmit: (values) => handleApplyFilter(values), initialValues: form.values, validationSchema: form.validation, enableReinitialize: true, children: ({ submitForm }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [algorithm && algorithm === 'airpls' && ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "maxIterations:", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "maxIterations", debounceTime: 250, style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "tolerance:", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "tolerance", debounceTime: 250, style: inputStyle }) })] })), algorithm &&
138
+ ['autoPolynomial', 'polynomial'].includes(algorithm) && ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "degree [ 1 - 6 ]:", shortTitle: "degree :", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { type: "number", name: "degree", min: 1, max: 6, style: inputStyle, debounceTime: 250 }) })), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "live preview ", htmlFor: "livePreview", style: Header_1.headerLabelStyle, children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "livePreview" }) }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => handleApplyFilter(values, 'onChange'), enableOnload: true }), (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { onDone: submitForm, onCancel: handleCancelFilter })] })) })] }));
118
139
  }
119
140
  const MemoizedBaseLineCorrectionPanel = (0, react_1.memo)(BaseLineCorrectionInnerPanel);
120
141
  function BaseLineCorrectionPanel() {