nmrium 0.50.1 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/LinesSeries.js +2 -2
  3. package/lib/component/1d/Viewer1D.js +6 -11
  4. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  5. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  6. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  7. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  15. package/lib/component/2d/Viewer2D.js +16 -15
  16. package/lib/component/2d/ft/Contours.js +6 -3
  17. package/lib/component/2d/utilities/scale.d.ts +2 -1
  18. package/lib/component/2d/utilities/scale.js +12 -2
  19. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  20. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  21. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  22. package/lib/component/EventsTrackers/KeysListenerTracker.js +32 -18
  23. package/lib/component/context/DispatchContext.d.ts +1 -1
  24. package/lib/component/context/ToasterContext.d.ts +13 -0
  25. package/lib/component/context/ToasterContext.js +34 -0
  26. package/lib/component/elements/Label.js +1 -1
  27. package/lib/component/elements/Select.js +2 -2
  28. package/lib/component/elements/ToolbarPopoverItem.js +1 -1
  29. package/lib/component/header/ApodizationOptionsPanel.js +1 -1
  30. package/lib/component/header/AutoPeakPickingOptionPanel.js +7 -4
  31. package/lib/component/header/BaseLineCorrectionPanel.js +2 -2
  32. package/lib/component/header/Header.d.ts +1 -11
  33. package/lib/component/header/Header.js +5 -6
  34. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  35. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  36. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  37. package/lib/component/header/RangesPickingOptionPanel.js +7 -4
  38. package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
  39. package/lib/component/header/Zones2DOptionPanel.js +6 -2
  40. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  41. package/lib/component/hooks/useDialogToggle.js +16 -0
  42. package/lib/component/hooks/useExport.d.ts +9 -1
  43. package/lib/component/hooks/useExport.js +34 -36
  44. package/lib/component/hooks/useSaveSettings.js +6 -3
  45. package/lib/component/hooks/useToolsFunctions.d.ts +1 -1
  46. package/lib/component/hooks/useToolsFunctions.js +9 -7
  47. package/lib/component/loader/DropZone.js +14 -14
  48. package/lib/component/main/InnerNMRium.js +5 -9
  49. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  50. package/lib/component/main/InnerNMRiumContents.js +5 -3
  51. package/lib/component/main/NMRium.js +2 -2
  52. package/lib/component/modal/AboutPredictionModal.js +1 -1
  53. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  54. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  55. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  56. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  57. package/lib/component/modal/LoadJCAMPModal.js +7 -5
  58. package/lib/component/modal/LogsHistoryModal.js +1 -1
  59. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  60. package/lib/component/modal/PredictSpectraModal.js +11 -9
  61. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  62. package/lib/component/modal/SaveAsModal.js +27 -27
  63. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  64. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  65. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  66. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  67. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  68. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  69. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  70. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  71. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  72. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  73. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  74. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  75. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  76. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  77. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  78. package/lib/component/modal/editZone/EditPathLengthFormik.js +2 -2
  79. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  80. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  81. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  82. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  83. package/lib/component/modal/setting/GeneralSettings.js +9 -6
  84. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  85. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
  86. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +1 -1
  87. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  88. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +1 -1
  89. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
  90. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  91. package/lib/component/panels/Panels.js +5 -5
  92. package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
  93. package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
  94. package/lib/component/panels/RangesPanel/RangesPanel.js +5 -5
  95. package/lib/component/panels/RangesPanel/RangesPreferences.js +1 -1
  96. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.d.ts +5 -0
  97. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPanelHeader.js +11 -11
  98. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.js +12 -6
  99. package/lib/component/panels/SpectraPanel/SpectraTabs.d.ts +1 -0
  100. package/lib/component/panels/{SpectrumsPanel/SpectrumsTabs.js → SpectraPanel/SpectraTabs.js} +6 -6
  101. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.js +2 -2
  102. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  103. package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
  104. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
  105. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
  106. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  107. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +7 -5
  108. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  109. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +5 -5
  110. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +6 -6
  111. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +5 -3
  112. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -2
  113. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  114. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -1
  115. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +1 -1
  116. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
  117. package/lib/component/reducer/IgnoreActions.js +1 -1
  118. package/lib/component/reducer/Reducer.d.ts +3 -2
  119. package/lib/component/reducer/Reducer.js +40 -32
  120. package/lib/component/reducer/actions/DomainActions.js +3 -3
  121. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  122. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  123. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  126. package/lib/component/reducer/actions/PreferencesActions.js +2 -2
  127. package/lib/component/reducer/actions/RangesActions.js +16 -6
  128. package/lib/component/reducer/actions/ToolsActions.d.ts +6 -6
  129. package/lib/component/reducer/actions/ToolsActions.js +83 -22
  130. package/lib/component/reducer/actions/ZonesActions.d.ts +2 -0
  131. package/lib/component/reducer/actions/ZonesActions.js +5 -1
  132. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  133. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  134. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  135. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  136. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  137. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  138. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  139. package/lib/component/toolbar/ToolBar.js +32 -27
  140. package/lib/component/toolbar/toolbarMenu.js +4 -4
  141. package/lib/component/utility/Events.d.ts +11 -0
  142. package/lib/component/utility/Events.js +22 -0
  143. package/lib/constants.js +5 -5
  144. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  145. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  146. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  147. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  148. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  149. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  150. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  151. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  152. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  153. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  154. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  155. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  156. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  157. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  158. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  159. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -0
  160. package/lib/data/getDefaultMatrixFilters.js +2 -2
  161. package/lib/data/matrixGeneration.js +1 -1
  162. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  163. package/lib/versionInfo.js +1 -1
  164. package/package.json +32 -30
  165. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  166. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  167. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  168. package/lib/component/elements/popup/Alert/Context.js +0 -10
  169. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  170. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  171. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  172. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  173. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  174. package/lib/component/elements/popup/Alert/index.js +0 -3
  175. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  176. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  177. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  178. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  179. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  180. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  181. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  182. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  183. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  184. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  185. package/lib/component/modal/metaImportation/index.js +0 -17
  186. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.d.ts +0 -5
  187. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.d.ts +0 -1
  188. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  189. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
  190. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.d.ts +0 -0
  191. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.js +0 -0
  192. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.d.ts +0 -0
  193. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.d.ts +0 -0
  194. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.d.ts +0 -0
  195. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.js +0 -0
  196. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.d.ts +0 -0
  197. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.js +0 -0
  198. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.d.ts +0 -0
  199. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.js +0 -0
  200. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.d.ts +0 -0
  201. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.js +0 -0
  202. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.d.ts +0 -0
  203. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.js +0 -0
  204. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.d.ts +0 -0
  205. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.js +0 -0
  206. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.d.ts +0 -0
  207. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.js +0 -0
  208. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.d.ts +0 -0
  209. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.js +0 -0
  210. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.d.ts +0 -0
  211. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.js +0 -0
  212. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.d.ts +0 -0
  213. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.js +0 -0
  214. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.d.ts +0 -0
  215. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.js +0 -0
  216. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.d.ts +0 -0
  217. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.js +0 -0
  218. /package/lib/component/reducer/actions/{SpectrumsActions.d.ts → SpectraActions.d.ts} +0 -0
  219. /package/lib/component/reducer/actions/{SpectrumsActions.js → SpectraActions.js} +0 -0
@@ -1,14 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useReducer, useRef, useImperativeHandle, } from 'react';
3
- import { useOnOff } from 'react-science/ui';
4
- import { useFullscreen } from 'react-use';
3
+ import { useFullscreen } from 'react-science/ui';
5
4
  import { AssignmentProvider } from '../assignment';
6
5
  import { GlobalProvider } from '../context/GlobalContext';
7
6
  import { KeyModifiersProvider } from '../context/KeyModifierContext';
8
7
  import { LoggerProvider } from '../context/LoggerContext';
9
8
  import { PreferencesProvider } from '../context/PreferencesContext';
9
+ import { ToasterProvider } from '../context/ToasterContext';
10
10
  import { TopicMoleculeProvider } from '../context/TopicMoleculeContext';
11
- import { AlertProvider } from '../elements/popup/Alert';
12
11
  import { ModalProvider } from '../elements/popup/Modal';
13
12
  import { HighlightProvider } from '../highlight';
14
13
  import { defaultGetSpinner, SpinnerProvider } from '../loader/SpinnerContext';
@@ -20,15 +19,12 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
20
19
  const rootRef = useRef(null);
21
20
  const elementsWrapperRef = useRef(null);
22
21
  const viewerRef = useRef(null);
23
- const [enableFullscreen, , disableFullscreen, toggleFullscreen] = useOnOff(false);
24
22
  const mainDivRef = useRef(null);
25
- const isFullscreenEnabled = useFullscreen(rootRef, enableFullscreen, {
26
- onClose: disableFullscreen,
27
- });
23
+ const { isFullScreen } = useFullscreen();
28
24
  const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
29
25
  useEffect(() => {
30
26
  rootRef.current?.focus();
31
- }, [isFullscreenEnabled]);
27
+ }, [isFullScreen]);
32
28
  useEffect(() => {
33
29
  dispatchPreferences({
34
30
  type: 'INIT_PREFERENCES',
@@ -49,5 +45,5 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
49
45
  rootRef: rootRef.current,
50
46
  elementsWrapperRef: elementsWrapperRef.current,
51
47
  viewerRef: viewerRef.current,
52
- }, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(TopicMoleculeProvider, { children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { isFullscreenEnabled: isFullscreenEnabled, toggleFullscreen: toggleFullscreen, emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }) }));
48
+ }, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(ToasterProvider, { children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(TopicMoleculeProvider, { children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }) }));
53
49
  }
@@ -2,8 +2,6 @@
2
2
  import { RefObject } from 'react';
3
3
  import { NMRiumProps } from '.';
4
4
  interface InnerNMRiumContentsProps {
5
- isFullscreenEnabled: boolean;
6
- toggleFullscreen: () => void;
7
5
  emptyText: NMRiumProps['emptyText'];
8
6
  mainDivRef: RefObject<HTMLDivElement>;
9
7
  elementsWrapperRef: RefObject<HTMLDivElement>;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { useCallback } from 'react';
5
+ import { useFullscreen } from 'react-science/ui';
5
6
  import checkModifierKeyActivated from '../../data/utilities/checkModifierKeyActivated';
6
7
  import Viewer1D from '../1d/Viewer1D';
7
8
  import FloatMoleculeStructures from '../1d-2d/components/FloatMoleculeStructures';
@@ -56,8 +57,9 @@ const containerStyles = css `
56
57
  }
57
58
  `;
58
59
  export function InnerNMRiumContents(props) {
59
- const { isFullscreenEnabled, toggleFullscreen, emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef, } = props;
60
+ const { emptyText, mainDivRef, elementsWrapperRef, rootRef, viewerRef } = props;
60
61
  const { displayerMode } = useChartData();
62
+ const { isFullScreen } = useFullscreen();
61
63
  const preventContextMenuHandler = useCallback((e) => {
62
64
  if (!checkModifierKeyActivated(e)) {
63
65
  e.preventDefault();
@@ -68,7 +70,7 @@ export function InnerNMRiumContents(props) {
68
70
  flexDirection: 'column',
69
71
  backgroundColor: 'white',
70
72
  width: '100%',
71
- }, children: [_jsx(Header, { isFullscreenEnabled: isFullscreenEnabled, onEnableFullscreen: toggleFullscreen }), _jsxs("div", { style: {
73
+ }, children: [_jsx(Header, {}), _jsxs("div", { style: {
72
74
  display: 'flex',
73
75
  flexDirection: 'row',
74
76
  height: '100%',
@@ -84,5 +86,5 @@ export function InnerNMRiumContents(props) {
84
86
  right: 0,
85
87
  top: 0,
86
88
  bottom: 0,
87
- } }, String(isFullscreenEnabled))] })] }) }) })] }));
89
+ } }, String(isFullScreen))] })] }) }) })] }));
88
90
  }
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo, forwardRef } from 'react';
3
3
  import { ErrorBoundary, } from 'react-error-boundary';
4
- import { RootLayout } from 'react-science/ui';
4
+ import { FullScreenProvider, RootLayout } from 'react-science/ui';
5
5
  import ErrorOverlay from './ErrorOverlay';
6
6
  import { InnerNMRium } from './InnerNMRium';
7
7
  const NMRiumBase = forwardRef(function NMRium(props, ref) {
8
8
  const { noErrorBoundary = false, onError, ...otherProps } = props;
9
9
  const innerNmrium = _jsx(InnerNMRium, { ...otherProps, innerRef: ref });
10
10
  const children = noErrorBoundary ? (innerNmrium) : (_jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, onError: onError, children: innerNmrium }));
11
- return _jsx(RootLayout, { style: { width: '100%' }, children: children });
11
+ return (_jsx(FullScreenProvider, { children: _jsx(RootLayout, { style: { width: '100%' }, children: children }) }));
12
12
  });
13
13
  export const NMRium = memo(NMRiumBase);
@@ -40,6 +40,6 @@ const styles = css `
40
40
  `;
41
41
  function AboutPredictionModal() {
42
42
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
43
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(FaInfo, {}), onClick: openDialog, title: "About Prediction" }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About Prediction", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }));
43
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaInfo, {}), onClick: openDialog, title: "About prediction" }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About prediction", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }));
44
44
  }
45
45
  export default AboutPredictionModal;
@@ -40,6 +40,6 @@ const styles = css `
40
40
  `;
41
41
  function AboutSpectrumSimulationModal() {
42
42
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
43
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, title: "About Prediction", icon: _jsx(FaInfo, {}) }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About spectrum simulation", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }));
43
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, title: "About prediction", icon: _jsx(FaInfo, {}) }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About spectrum simulation", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }));
44
44
  }
45
45
  export default AboutSpectrumSimulationModal;
@@ -79,6 +79,6 @@ function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
79
79
  }, [dispatch, onClose, peak.id]);
80
80
  const values = getValues(peak, kind);
81
81
  const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
82
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
82
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Kind:", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "FWHM:", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "Mu:", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
83
83
  }
84
84
  export default EditPeakShapeModal;
@@ -5,10 +5,10 @@ import { css } from '@emotion/react';
5
5
  import { Formik } from 'formik';
6
6
  import { useRef } from 'react';
7
7
  import { DataExportStage, exportAsJcamp, } from '../../data/SpectraManager';
8
+ import { useToaster } from '../context/ToasterContext';
8
9
  import ActionButtons from '../elements/ActionButtons';
9
10
  import FormikCheckBox from '../elements/formik/FormikCheckBox';
10
11
  import FormikSelect from '../elements/formik/FormikSelect';
11
- import { useAlert } from '../elements/popup/Alert';
12
12
  const initValues = {
13
13
  onlyReal: true,
14
14
  dataExportStage: 'PROCESSED',
@@ -41,21 +41,21 @@ const DATA_STAGES = Object.keys(DataExportStage).map((key) => ({
41
41
  function ExportAsJcampModal(props) {
42
42
  const { closeDialog, spectrum } = props;
43
43
  const refForm = useRef(null);
44
- const alert = useAlert();
44
+ const toaster = useToaster();
45
45
  function submitHandler(options) {
46
- void (async () => {
47
- const hideLoading = await alert.showLoading('export as JCAMP-DX in progress');
48
- try {
49
- exportAsJcamp(spectrum, options);
50
- }
51
- catch (error) {
52
- alert.error(error.message);
53
- }
54
- finally {
55
- closeDialog?.();
56
- hideLoading();
57
- }
58
- })();
46
+ const hideLoading = toaster.showLoading({
47
+ message: 'export as JCAMP-DX in progress',
48
+ });
49
+ try {
50
+ exportAsJcamp(spectrum, options);
51
+ }
52
+ catch (error) {
53
+ toaster.show({ message: error.message, intent: 'danger' });
54
+ }
55
+ finally {
56
+ closeDialog?.();
57
+ hideLoading();
58
+ }
59
59
  }
60
60
  return (_jsxs(Dialog, { isOpen: true, onClose: closeDialog, title: "Export as JCAMP", children: [_jsx(DialogBody, { css: css `
61
61
  background-color: white;
@@ -7,11 +7,11 @@ import { resurrect } from 'nmr-processing';
7
7
  import { useMemo, useRef, useState } from 'react';
8
8
  import * as yup from 'yup';
9
9
  import { useDispatch } from '../context/DispatchContext';
10
+ import { useToaster } from '../context/ToasterContext';
10
11
  import Button from '../elements/Button';
11
12
  import { GroupPane } from '../elements/GroupPane';
12
13
  import ReactTable from '../elements/ReactTable/ReactTable';
13
14
  import FormikTextarea from '../elements/formik/FormikTextarea';
14
- import { useAlert } from '../elements/popup/Alert';
15
15
  const validationSchema = yup.object({
16
16
  publicationText: yup.string().required(),
17
17
  });
@@ -33,7 +33,7 @@ function ImportPublicationStringModal(props) {
33
33
  const { onClose, isOpen } = props;
34
34
  const formRef = useRef();
35
35
  const dispatch = useDispatch();
36
- const alert = useAlert();
36
+ const toaster = useToaster();
37
37
  const [logs, setLogs] = useState([]);
38
38
  const loggerRef = useRef(new FifoLogger({
39
39
  onChange: (log, logs) => {
@@ -63,7 +63,9 @@ function ImportPublicationStringModal(props) {
63
63
  return;
64
64
  function publicationStringHandler({ publicationText }) {
65
65
  void (async () => {
66
- const hideLoading = await alert.showLoading('Generate spectrum from publication string in progress');
66
+ const hideLoading = toaster.showLoading({
67
+ message: 'Generate spectrum from publication string in progress',
68
+ });
67
69
  const { ranges, info: { nucleus, solvent = '', frequency }, parts, } = resurrect(publicationText, { logger: loggerRef.current });
68
70
  setTimeout(() => {
69
71
  dispatch({
@@ -7,11 +7,11 @@ import { readFromWebSource } from 'nmr-load-save';
7
7
  import { useRef } from 'react';
8
8
  import * as Yup from 'yup';
9
9
  import { useDispatch } from '../context/DispatchContext';
10
+ import { useToaster } from '../context/ToasterContext';
10
11
  import Button from '../elements/Button';
11
12
  import Label from '../elements/Label';
12
13
  import FormikError from '../elements/formik/FormikError';
13
14
  import FormikInput from '../elements/formik/FormikInput';
14
- import { useAlert } from '../elements/popup/Alert/Context';
15
15
  const allowedExtensions = new Set(['dx', 'jdx', 'jcamp']);
16
16
  const loadFormValidation = Yup.object({
17
17
  url: Yup.string()
@@ -36,12 +36,14 @@ const labelStyle = {
36
36
  };
37
37
  export function LoadJCAMPModal({ onCloseDialog, isOpen }) {
38
38
  const dispatch = useDispatch();
39
- const alert = useAlert();
39
+ const toaster = useToaster();
40
40
  const ref = useRef(null);
41
41
  if (!isOpen)
42
42
  return;
43
43
  async function loadJCAMPHandler({ url }) {
44
- const hidLoading = await alert.showLoading('Load JCAMP from external URL in progress ...');
44
+ const hidLoading = toaster.showLoading({
45
+ message: 'Load JCAMP from external URL in progress ...',
46
+ });
45
47
  const { pathname, origin } = new URL(url);
46
48
  try {
47
49
  const nmriumState = await readFromWebSource({
@@ -53,14 +55,14 @@ export function LoadJCAMPModal({ onCloseDialog, isOpen }) {
53
55
  });
54
56
  }
55
57
  catch {
56
- alert.error(`Failed to load ${url}`);
58
+ toaster.show({ message: `Failed to load ${url}`, intent: 'danger' });
57
59
  }
58
60
  finally {
59
61
  hidLoading();
60
62
  onCloseDialog?.();
61
63
  }
62
64
  }
63
- return (_jsxs(Dialog, { isOpen: true, onClose: onCloseDialog, title: "Load JCAMP Dialog", style: { minWidth: '400px' }, children: [_jsx(DialogBody, { css: css `
65
+ return (_jsxs(Dialog, { isOpen: true, onClose: onCloseDialog, title: "Load JCAMP", style: { minWidth: '400px' }, children: [_jsx(DialogBody, { css: css `
64
66
  background-color: white;
65
67
  `, children: _jsx(Formik, { initialValues: { url: '' }, validationSchema: loadFormValidation, onSubmit: loadJCAMPHandler, innerRef: ref, children: _jsx(Label, { title: "URL", style: labelStyle, children: _jsx(FormikError, { name: "url", style: { container: { flex: 1 } }, children: _jsx(FormikInput, { name: "url", type: "string", style: {
66
68
  input: {
@@ -107,7 +107,7 @@ export function LogsHistoryModal(props) {
107
107
  markAsRead();
108
108
  closeDialog();
109
109
  onClose?.();
110
- }, title: "Logs History", style: { width: '50vw', height: '50vh' }, children: [_jsx(DialogBody, { css: css `
110
+ }, title: "Logs history", style: { width: '50vw', height: '50vh' }, children: [_jsx(DialogBody, { css: css `
111
111
  background-color: white;
112
112
  `, children: _jsx(ReactTable, { columns: COLUMNS, data: sortedLogs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle }) }), _jsx(DialogFooter, { children: _jsx(Button.Danger, { onClick: () => logger.clear(), fill: "outline", children: _jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx(FaRegTrashAlt, {}), _jsx("span", { style: { paddingLeft: '5px' }, children: "Clear Logs" })] }) }) })] })] }));
113
113
  }
@@ -74,7 +74,7 @@ const loaderStyles = css `
74
74
  }
75
75
  `;
76
76
  export default function MultipletAnalysisModal({ data, activeSpectrum, scaleX, startX, endX, onClose, isOpen, }) {
77
- return (_jsx(Dialog, { isOpen: isOpen, onClose: () => onClose(), title: "Analyse Multiplet", style: { width: 900, height: 400 }, children: _jsx(DialogBody, { css: styles, children: _jsx(InnerMultipleAnalysis, { data,
77
+ return (_jsx(Dialog, { isOpen: isOpen, onClose: () => onClose(), title: "Analyse multiplet", style: { width: 900, height: 400 }, children: _jsx(DialogBody, { css: styles, children: _jsx(InnerMultipleAnalysis, { data,
78
78
  activeSpectrum,
79
79
  scaleX,
80
80
  startX,
@@ -9,8 +9,8 @@ import { getDefaultPredictionOptions, predictSpectra, } from '../../data/Predict
9
9
  import { useChartData } from '../context/ChartContext';
10
10
  import { useDispatch } from '../context/DispatchContext';
11
11
  import { useLogger } from '../context/LoggerContext';
12
+ import { useToaster } from '../context/ToasterContext';
12
13
  import Button from '../elements/Button';
13
- import { useAlert } from '../elements/popup/Alert';
14
14
  import PredictionPreferences from '../panels/predictionPanel/PredictionOptionsPanel';
15
15
  import { useStateWithLocalStorage } from '../utility/LocalStorage';
16
16
  const styles = css `
@@ -47,7 +47,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
47
47
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
48
48
  const refForm = useRef();
49
49
  const dispatch = useDispatch();
50
- const alert = useAlert();
50
+ const toaster = useToaster();
51
51
  const [predictionPreferences, setPredictionPreferences] = useStateWithLocalStorage('nmrium-prediction-preferences');
52
52
  const { isApproved: isAgree = false, ...options } = predictionPreferences;
53
53
  const [isApproved, setApproved] = useState(isAgree);
@@ -74,7 +74,9 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
74
74
  }
75
75
  onClose();
76
76
  closeDialog();
77
- const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
77
+ const hideLoading = toaster.showLoading({
78
+ message: `Predict ${predictedSpectra.join(',')} in progress`,
79
+ });
78
80
  try {
79
81
  const data = await predictSpectra(molfile, values.spectra);
80
82
  dispatch({
@@ -88,7 +90,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
88
90
  });
89
91
  }
90
92
  catch (error) {
91
- alert.error(error?.message);
93
+ toaster.show({ message: error?.message, intent: 'danger' });
92
94
  }
93
95
  finally {
94
96
  hideLoading();
@@ -96,14 +98,14 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
96
98
  }
97
99
  })();
98
100
  }, [
99
- alert,
100
- dispatch,
101
- isApproved,
102
101
  molecule,
103
- onClose,
104
- logger,
105
102
  setPredictionPreferences,
103
+ isApproved,
104
+ onClose,
106
105
  closeDialog,
106
+ toaster,
107
+ dispatch,
108
+ logger,
107
109
  ]);
108
110
  return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(SvgNmrFt, {}), title: "Predict spectra", onClick: openDialog }) }), _jsxs(Dialog, { isOpen: isOpenDialog, onClose: () => {
109
111
  onClose();
@@ -1,9 +1,8 @@
1
1
  import { LabelStyle } from '../elements/Label';
2
2
  export declare const labelStyle: LabelStyle;
3
3
  interface SaveAsModalProps {
4
- onClose?: (event?: MouseEvent) => void;
5
- onSave: (element: any) => void;
6
- name: string;
4
+ onCloseDialog: () => void;
5
+ isOpen: boolean;
7
6
  }
8
- declare function SaveAsModal({ onClose, onSave, name }: SaveAsModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
+ declare function SaveAsModal(props: SaveAsModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
9
8
  export default SaveAsModal;
@@ -1,30 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
+ import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
3
4
  import { css } from '@emotion/react';
4
5
  import { Field, Formik } from 'formik';
5
- import { useCallback, useRef } from 'react';
6
+ import { useRef } from 'react';
6
7
  import { DataExportOptions } from '../../data/SpectraManager';
7
8
  import { useChartData } from '../context/ChartContext';
8
9
  import ActionButtons from '../elements/ActionButtons';
9
- import { CloseButton } from '../elements/CloseButton';
10
10
  import Label from '../elements/Label';
11
11
  import FormikCheckBox from '../elements/formik/FormikCheckBox';
12
12
  import FormikInput from '../elements/formik/FormikInput';
13
- import { ModalStyles } from './ModalStyle';
13
+ import useExport from '../hooks/useExport';
14
14
  const styles = css `
15
- .inner-content {
16
- flex: 1;
17
- }
15
+ display: flex;
16
+ flex-direction: column;
18
17
 
19
- .data-export-group {
20
- label {
21
- margin-right: 10px;
22
- display: inline-block;
23
- }
18
+ label {
19
+ margin-right: 20px;
20
+ display: inline-block;
21
+ }
24
22
 
25
- input[type='radio'] {
26
- margin-right: 5px;
27
- }
23
+ input[type='radio'] {
24
+ margin-right: 5px;
28
25
  }
29
26
  `;
30
27
  const INITIAL_VALUE = {
@@ -41,7 +38,6 @@ export const labelStyle = {
41
38
  label: {
42
39
  flex: 4,
43
40
  fontSize: '12px',
44
- fontWeight: 'bold',
45
41
  color: '#232323',
46
42
  },
47
43
  wrapper: {
@@ -51,21 +47,25 @@ export const labelStyle = {
51
47
  },
52
48
  container: { padding: '5px 0' },
53
49
  };
54
- function SaveAsModal({ onClose, onSave, name }) {
50
+ function SaveAsModal(props) {
51
+ const { onCloseDialog, isOpen } = props;
55
52
  const refForm = useRef();
56
- const { source } = useChartData();
57
- const handleSave = useCallback(() => {
58
- refForm.current.submitForm();
59
- }, []);
60
- const submitHandler = useCallback((values) => {
61
- onSave(values);
62
- onClose?.();
63
- }, [onClose, onSave]);
64
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Save as ... " }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { innerRef: refForm, initialValues: { ...INITIAL_VALUE, name }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { style: labelStyle, title: "Name", children: _jsx(FormikInput, { name: "name", className: "name", style: {
53
+ const { source, data } = useChartData();
54
+ const { saveHandler } = useExport();
55
+ const fileName = data[0]?.info?.name;
56
+ function submitHandler(values) {
57
+ saveHandler(values);
58
+ onCloseDialog?.();
59
+ }
60
+ if (!isOpen)
61
+ return;
62
+ return (_jsxs(Dialog, { isOpen: true, title: "Save as ... ", onClose: onCloseDialog, style: { width: 500 }, children: [_jsx(DialogBody, { css: css `
63
+ background-color: white;
64
+ `, children: _jsx(Formik, { innerRef: refForm, initialValues: { ...INITIAL_VALUE, name: fileName }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { style: labelStyle, title: "Name", children: _jsx(FormikInput, { name: "name", className: "name", style: {
65
65
  inputWrapper: { width: '100%' },
66
66
  input: { padding: '5px', textAlign: 'left' },
67
- } }) }), _jsx(Label, { style: labelStyle, title: "Compressed", children: _jsx(FormikCheckBox, { name: "compressed" }) }), _jsx(Label, { style: labelStyle, title: "Pretty Format", children: _jsx(FormikCheckBox, { name: "pretty" }) }), _jsx(Label, { style: labelStyle, title: "Include view", children: _jsx(FormikCheckBox, { name: "include.view" }) }), _jsx(Label, { style: labelStyle, title: "Include settings", children: _jsx(FormikCheckBox, { name: "include.settings" }) }), _jsx(Label, { style: labelStyle, title: "Include Data", children: _jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsxs("div", { className: "data-export-group", children: [_jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.ROW_DATA }), "Raw Data"] }), _jsxs("label", { style: {
67
+ } }) }), _jsx(Label, { style: labelStyle, title: "Compressed", children: _jsx(FormikCheckBox, { name: "compressed" }) }), _jsx(Label, { style: labelStyle, title: "Pretty format", children: _jsx(FormikCheckBox, { name: "pretty" }) }), _jsx(Label, { style: labelStyle, title: "Include view", children: _jsx(FormikCheckBox, { name: "include.view" }) }), _jsx(Label, { style: labelStyle, title: "Include settings", children: _jsx(FormikCheckBox, { name: "include.settings" }) }), _jsx(Label, { style: labelStyle, title: "Include data", children: _jsx("div", { css: styles, children: _jsxs("div", { children: [_jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.ROW_DATA }), "Raw data"] }), _jsxs("label", { style: {
68
68
  color: source ? 'black' : 'lightgray',
69
- }, children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.DATA_SOURCE, disabled: !source }), "Data Source"] }), _jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.NO_DATA }), "No Data"] })] }) }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
69
+ }, children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.DATA_SOURCE, disabled: !source }), "Data source"] }), _jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.NO_DATA }), "No data"] })] }) }) })] }) }) }), _jsx(DialogFooter, { children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onCloseDialog?.() }) })] }));
70
70
  }
71
71
  export default SaveAsModal;
@@ -16,7 +16,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
16
16
  import useSpectrum from '../../hooks/useSpectrum';
17
17
  import { hasCouplingConstant } from '../../panels/extra/utilities/MultiplicityUtilities';
18
18
  import { formatNumber } from '../../utility/formatNumber';
19
- import SignalsForm from './forms/components/SignalsForm';
19
+ import SignalsContent from './forms/components/SignalsContent';
20
20
  import editRangeFormValidation from './forms/validation/EditRangeValidation';
21
21
  const styles = css `
22
22
  min-height: 500px;
@@ -154,7 +154,7 @@ function EditRangeModal({ onSave, onClose, onZoom, onRest, rangeId, }) {
154
154
  if (!rangesPreferences || !range) {
155
155
  return;
156
156
  }
157
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsForm, { range: range, preferences: rangesPreferences }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
157
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsContent, { range: range }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
158
158
  }
159
159
  function useRange(rangeId) {
160
160
  const { ranges } = useSpectrum({
@@ -1,7 +1,6 @@
1
1
  interface DeltaInputProps {
2
2
  signal: any;
3
3
  index: number;
4
- onFocus: (element: any) => void;
5
4
  }
6
- declare function DeltaInput({ signal, index, onFocus }: DeltaInputProps): import("react/jsx-runtime").JSX.Element;
7
- export default DeltaInput;
5
+ export declare function DeltaInput({ signal, index }: DeltaInputProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -11,9 +11,8 @@ const style = {
11
11
  margin: '0 5px',
12
12
  },
13
13
  };
14
- function DeltaInput({ signal, index, onFocus }) {
15
- return (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("span", { children: "\uD835\uDEC5: " }), _jsx(FormikInput, { name: `signals.${index}.delta`, type: "number", placeholder: 'J (Hz)', onFocus: onFocus, style: style, checkErrorAfterInputTouched: false }), _jsx("span", { children: signal.js
14
+ export function DeltaInput({ signal, index }) {
15
+ return (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("span", { children: "\uD835\uDEC5: " }), _jsx(FormikInput, { name: `signals.${index}.delta`, type: "number", placeholder: 'J (Hz)', style: style, checkErrorAfterInputTouched: false }), _jsx("span", { children: signal.js
16
16
  .map((_coupling) => translateMultiplet(_coupling.multiplicity))
17
17
  .join('') })] }));
18
18
  }
19
- export default DeltaInput;
@@ -0,0 +1 @@
1
+ export declare function InfoBlock(): import("react/jsx-runtime").JSX.Element;
@@ -24,11 +24,11 @@ const InfoText = (props) => {
24
24
  const { value, type = 'info' } = props;
25
25
  return (_jsx("p", { style: { ...styles.infoText, ...(type === 'error' && styles.errorText) }, children: value }));
26
26
  };
27
- export function SignalFormInfo() {
27
+ export function InfoBlock() {
28
28
  const { values, errors, } = useFormikContext();
29
29
  return (_jsx("div", { style: {
30
30
  textAlign: 'center',
31
31
  width: '100%',
32
32
  }, children: errors.signals &&
33
- (errors.signals.noSignals || errors.signals.noCouplings) ? (_jsxs("div", { children: [_jsx("p", { className: "error-text", children: errors.signals.noSignals || errors.signals.noCouplings[0].message }), errors.signals.noSignals && (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT }))] })) : values.activeTab === 'addSignalTab' ? (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT })) : (_jsx(InfoText, { value: EDIT_SIGNAL_INFO_TEXT })) }));
33
+ (errors.signals.noSignals || errors.signals.noCouplings) ? (_jsxs("div", { children: [_jsx("p", { className: "error-text", children: errors.signals.noSignals || errors.signals.noCouplings[0].message }), errors.signals.noSignals && (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT }))] })) : values.signalIndex === '-1' ? (_jsx(InfoText, { value: ADD_SIGNAL_INFO_TEXT })) : (_jsx(InfoText, { value: EDIT_SIGNAL_INFO_TEXT })) }));
34
34
  }
@@ -0,0 +1,5 @@
1
+ interface NewSignalTabProps {
2
+ range: any;
3
+ }
4
+ export declare function NewSignalTab(props: NewSignalTabProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};