nmrium 0.24.0 → 0.26.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 (220) hide show
  1. package/lib/component/1d/IntegralResizable.js +13 -13
  2. package/lib/component/1d/multiAnalysis/AnalysisRange.js +30 -31
  3. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +5 -5
  4. package/lib/component/1d/ranges/Range.js +24 -33
  5. package/lib/component/2d/zones/Signal.js +8 -8
  6. package/lib/component/2d/zones/Zone.js +3 -3
  7. package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -1
  8. package/lib/component/NMRium.js +22 -29
  9. package/lib/component/assignment/AssignmentsContext.d.ts +35 -0
  10. package/lib/component/assignment/AssignmentsContext.js +83 -0
  11. package/lib/component/assignment/AssignmentsReducer.d.ts +32 -0
  12. package/lib/component/assignment/AssignmentsReducer.js +39 -0
  13. package/lib/component/assignment/actions/initAssignment.d.ts +5 -0
  14. package/lib/component/assignment/actions/initAssignment.js +62 -0
  15. package/lib/component/assignment/actions/removeAssignment.d.ts +16 -0
  16. package/lib/component/assignment/actions/removeAssignment.js +24 -0
  17. package/lib/component/assignment/actions/setActiveAssignment.d.ts +10 -0
  18. package/lib/component/assignment/actions/setActiveAssignment.js +8 -0
  19. package/lib/component/assignment/actions/toggleAssignment.d.ts +7 -0
  20. package/lib/component/assignment/actions/toggleAssignment.js +44 -0
  21. package/lib/component/assignment/index.d.ts +0 -18
  22. package/lib/component/assignment/index.js +12 -266
  23. package/lib/component/assignment/utilities/filterForIDsWithAssignment.d.ts +2 -0
  24. package/lib/component/assignment/utilities/filterForIDsWithAssignment.js +3 -0
  25. package/lib/component/context/GlobalContext.d.ts +12 -3
  26. package/lib/component/context/GlobalContext.js +1 -1
  27. package/lib/component/elements/ActionButtons.d.ts +10 -0
  28. package/lib/component/elements/ActionButtons.js +14 -0
  29. package/lib/component/elements/Button.d.ts +30 -5
  30. package/lib/component/elements/Button.js +151 -4
  31. package/lib/component/elements/ContextMenu.js +6 -6
  32. package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +5 -1
  33. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +38 -10
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +3 -1
  35. package/lib/component/elements/ReactTable/ReactTable.js +7 -2
  36. package/lib/component/elements/ReactTable/Style.d.ts +1 -3
  37. package/lib/component/elements/ReactTable/Style.js +1 -7
  38. package/lib/component/elements/ToolTip/ToolTip.js +3 -2
  39. package/lib/component/elements/resizer/DivResizer.d.ts +2 -0
  40. package/lib/component/elements/resizer/DivResizer.js +107 -0
  41. package/lib/component/elements/resizer/Resizer.d.ts +18 -0
  42. package/lib/component/elements/resizer/Resizer.js +12 -0
  43. package/lib/component/elements/resizer/SVGResizer.d.ts +2 -0
  44. package/lib/component/elements/resizer/SVGResizer.js +71 -0
  45. package/lib/component/elements/resizer/useDraggable.d.ts +19 -0
  46. package/lib/component/elements/resizer/useDraggable.js +52 -0
  47. package/lib/component/header/AutoPeakPickingOptionPanel.js +4 -15
  48. package/lib/component/header/BaseLineCorrectionPanel.js +2 -9
  49. package/lib/component/header/ManualPhaseCorrectionPanel.js +2 -9
  50. package/lib/component/header/RangesPickingOptionPanel.js +3 -16
  51. package/lib/component/header/ZeroFillingOptionsPanel.js +2 -9
  52. package/lib/component/header/Zones2DOptionPanel.js +3 -14
  53. package/lib/component/hooks/useExport.js +11 -9
  54. package/lib/component/loader/DropZone.js +1 -0
  55. package/lib/component/modal/AlignSpectraModal.js +2 -1
  56. package/lib/component/modal/ExportAsMatrixModal.js +2 -1
  57. package/lib/component/modal/ImportPublicationStringModal.js +2 -1
  58. package/lib/component/modal/LoadJCAMPModal.js +7 -6
  59. package/lib/component/modal/ModalStyle.js +4 -26
  60. package/lib/component/modal/MoleculeStructureEditorModal.js +2 -1
  61. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
  62. package/lib/component/modal/PredictSpectraModal.js +2 -7
  63. package/lib/component/modal/SaveAsModal.d.ts +1 -1
  64. package/lib/component/modal/SaveAsModal.js +2 -1
  65. package/lib/component/modal/setting/FormattingTabContent.js +17 -11
  66. package/lib/component/modal/setting/GeneralSettings.js +3 -1
  67. package/lib/component/modal/setting/settingsValidation.d.ts +8 -0
  68. package/lib/component/modal/setting/settingsValidation.js +40 -0
  69. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
  70. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +4 -3
  71. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
  72. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.d.ts +10 -0
  73. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +60 -0
  74. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +11 -5
  75. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +20 -11
  76. package/lib/component/panels/MoleculesPanel/Utilities.js +50 -68
  77. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +2 -2
  78. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
  79. package/lib/component/panels/RangesPanel/RangesHeader.js +2 -2
  80. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  81. package/lib/component/panels/RangesPanel/RangesTableRow.js +12 -11
  82. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +16 -9
  83. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
  84. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -3
  85. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +1 -1
  86. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +5 -18
  87. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  88. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
  89. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +5 -7
  90. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
  91. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +4 -8
  92. package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
  93. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +5 -9
  94. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
  95. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +4 -8
  96. package/lib/component/panels/ZonesPanel/ZonesPanel.js +1 -1
  97. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +20 -20
  99. package/lib/component/panels/header/SpectraAutomaticPickingButton.d.ts +2 -0
  100. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +30 -0
  101. package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -18
  102. package/lib/component/reducer/Reducer.d.ts +2 -0
  103. package/lib/component/reducer/Reducer.js +4 -1
  104. package/lib/component/reducer/actions/AssignmentsActions.d.ts +9 -0
  105. package/lib/component/reducer/actions/AssignmentsActions.js +18 -0
  106. package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
  107. package/lib/component/reducer/actions/LoadActions.js +10 -5
  108. package/lib/component/reducer/preferencesReducer.d.ts +1 -8
  109. package/lib/component/reducer/preferencesReducer.js +16 -16
  110. package/lib/component/reducer/types/Types.d.ts +1 -0
  111. package/lib/component/reducer/types/Types.js +1 -0
  112. package/lib/component/utility/Export.d.ts +3 -3
  113. package/lib/component/utility/Export.js +10 -9
  114. package/lib/component/utility/FormatNumber.js +1 -1
  115. package/lib/component/workspaces/Workspace.d.ts +2 -4
  116. package/lib/component/workspaces/basic.js +8 -9
  117. package/lib/data/SpectraManager.js +23 -15
  118. package/lib/data/data1d/Data1DManager.d.ts +1 -1
  119. package/lib/data/data1d/Data1DManager.js +2 -1
  120. package/lib/data/data1d/Spectrum1D/toJSON.d.ts +2 -0
  121. package/lib/data/data1d/Spectrum1D/toJSON.js +1 -0
  122. package/lib/data/data1d/database.d.ts +1 -2
  123. package/lib/data/data1d/database.js +1 -1
  124. package/lib/data/data1d/filter1d/exclusionZones.d.ts +1 -4
  125. package/lib/data/data2d/Data2DManager.d.ts +1 -1
  126. package/lib/data/data2d/Data2DManager.js +2 -1
  127. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  128. package/lib/data/data2d/Spectrum2D/toJSON.d.ts +2 -0
  129. package/lib/data/data2d/Spectrum2D/toJSON.js +1 -0
  130. package/lib/data/types/common/Source.d.ts +1 -0
  131. package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
  132. package/lib/versionInfo.js +1 -1
  133. package/lib-cjs/component/1d/IntegralResizable.js +12 -12
  134. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +29 -30
  135. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +6 -6
  136. package/lib-cjs/component/1d/ranges/Range.js +26 -35
  137. package/lib-cjs/component/2d/zones/Signal.js +9 -9
  138. package/lib-cjs/component/2d/zones/Zone.js +4 -4
  139. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +2 -2
  140. package/lib-cjs/component/NMRium.js +22 -29
  141. package/lib-cjs/component/assignment/AssignmentsContext.js +88 -0
  142. package/lib-cjs/component/assignment/AssignmentsReducer.js +45 -0
  143. package/lib-cjs/component/assignment/actions/initAssignment.js +65 -0
  144. package/lib-cjs/component/assignment/actions/removeAssignment.js +29 -0
  145. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +11 -0
  146. package/lib-cjs/component/assignment/actions/toggleAssignment.js +47 -0
  147. package/lib-cjs/component/assignment/index.js +15 -269
  148. package/lib-cjs/component/assignment/utilities/filterForIDsWithAssignment.js +7 -0
  149. package/lib-cjs/component/context/GlobalContext.js +1 -1
  150. package/lib-cjs/component/elements/ActionButtons.js +20 -0
  151. package/lib-cjs/component/elements/Button.js +150 -4
  152. package/lib-cjs/component/elements/ContextMenu.js +6 -6
  153. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +42 -14
  154. package/lib-cjs/component/elements/ReactTable/ReactTable.js +7 -2
  155. package/lib-cjs/component/elements/ReactTable/Style.js +1 -9
  156. package/lib-cjs/component/elements/ToolTip/ToolTip.js +3 -2
  157. package/lib-cjs/component/elements/resizer/DivResizer.js +113 -0
  158. package/lib-cjs/component/elements/resizer/Resizer.js +18 -0
  159. package/lib-cjs/component/elements/resizer/SVGResizer.js +77 -0
  160. package/lib-cjs/component/elements/resizer/useDraggable.js +55 -0
  161. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +3 -14
  162. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +2 -9
  163. package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +2 -9
  164. package/lib-cjs/component/header/RangesPickingOptionPanel.js +2 -15
  165. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -9
  166. package/lib-cjs/component/header/Zones2DOptionPanel.js +2 -13
  167. package/lib-cjs/component/hooks/useExport.js +11 -9
  168. package/lib-cjs/component/loader/DropZone.js +1 -0
  169. package/lib-cjs/component/modal/AlignSpectraModal.js +2 -1
  170. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -1
  171. package/lib-cjs/component/modal/ImportPublicationStringModal.js +2 -1
  172. package/lib-cjs/component/modal/LoadJCAMPModal.js +7 -6
  173. package/lib-cjs/component/modal/ModalStyle.js +4 -26
  174. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +5 -1
  175. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
  176. package/lib-cjs/component/modal/PredictSpectraModal.js +2 -7
  177. package/lib-cjs/component/modal/SaveAsModal.js +2 -1
  178. package/lib-cjs/component/modal/setting/FormattingTabContent.js +17 -11
  179. package/lib-cjs/component/modal/setting/GeneralSettings.js +3 -1
  180. package/lib-cjs/component/modal/setting/settingsValidation.js +66 -0
  181. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
  182. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
  183. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +67 -0
  184. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +12 -6
  185. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +50 -68
  186. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
  187. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +3 -3
  188. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  189. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +15 -14
  190. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
  191. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  192. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -16
  193. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -2
  194. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +2 -2
  195. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
  196. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
  197. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
  198. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +2 -2
  199. package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +21 -21
  200. package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +37 -0
  201. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -18
  202. package/lib-cjs/component/reducer/Reducer.js +4 -1
  203. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +21 -0
  204. package/lib-cjs/component/reducer/actions/LoadActions.js +9 -4
  205. package/lib-cjs/component/reducer/preferencesReducer.js +16 -16
  206. package/lib-cjs/component/reducer/types/Types.js +2 -1
  207. package/lib-cjs/component/utility/Export.js +10 -9
  208. package/lib-cjs/component/utility/FormatNumber.js +1 -1
  209. package/lib-cjs/component/workspaces/basic.js +8 -9
  210. package/lib-cjs/data/SpectraManager.js +23 -15
  211. package/lib-cjs/data/data1d/Data1DManager.js +2 -1
  212. package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -0
  213. package/lib-cjs/data/data2d/Data2DManager.js +2 -1
  214. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  215. package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -0
  216. package/lib-cjs/versionInfo.js +1 -1
  217. package/package.json +25 -26
  218. package/lib/component/1d/Resizable.d.ts +0 -12
  219. package/lib/component/1d/Resizable.js +0 -105
  220. package/lib-cjs/component/1d/Resizable.js +0 -110
@@ -1,14 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useRef } from 'react';
3
3
  import { useDispatch } from '../context/DispatchContext';
4
+ import Button from '../elements/Button';
4
5
  import CheckBox from '../elements/CheckBox';
5
6
  import NumberInput from '../elements/NumberInput';
6
- import { AUTO_PEAK_PICKING, RESET_SELECTED_TOOL } from '../reducer/types/Types';
7
+ import { AUTO_PEAK_PICKING } from '../reducer/types/Types';
7
8
  const styles = {
8
9
  container: {
9
10
  height: '100%',
10
11
  display: 'flex',
11
12
  fontSize: '12px',
13
+ alignItems: 'center',
12
14
  },
13
15
  input: {
14
16
  width: '50px',
@@ -19,14 +21,6 @@ const styles = {
19
21
  label: {
20
22
  flex: '5',
21
23
  },
22
- actionButton: {
23
- height: '100%',
24
- width: '60px',
25
- borderRadius: '5px',
26
- border: '0.55px solid #c7c7c7',
27
- margin: '0px 5px',
28
- userSelect: 'none',
29
- },
30
24
  };
31
25
  function AutoPeakPickingOptionPanel() {
32
26
  const dispatch = useDispatch();
@@ -45,11 +39,6 @@ function AutoPeakPickingOptionPanel() {
45
39
  },
46
40
  });
47
41
  }, [dispatch]);
48
- const handleCancelFilter = useCallback(() => {
49
- dispatch({
50
- type: RESET_SELECTED_TOOL,
51
- });
52
- }, [dispatch]);
53
42
  return (_jsxs("div", { style: styles.container, children: [_jsx(NumberInput, { ref: maxNumberOfPeaksRef, label: "Max Number Of Peaks:", name: "maxNumberOfPeaks", style: {
54
43
  input: styles.input,
55
44
  inputContainer: styles.inputContainer,
@@ -62,6 +51,6 @@ function AutoPeakPickingOptionPanel() {
62
51
  input: styles.input,
63
52
  inputContainer: styles.inputContainer,
64
53
  label: styles.label,
65
- }, defaultValue: 0.1, step: "0.01" }), _jsxs("div", { style: { justifyItems: 'baseline', marginRight: '3px' }, children: [_jsx("label", { style: { marginRight: '2px', lineHeight: 2, userSelect: 'none' }, htmlFor: "lookNegative", children: "Detect Negative:" }), _jsx(CheckBox, { name: "lookNegative", ref: lookNegativeRef })] }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleApplyFilter, children: "Apply" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleCancelFilter, children: "Cancel" })] }));
54
+ }, defaultValue: 0.1, step: "0.01" }), _jsxs("div", { style: { justifyItems: 'baseline', marginRight: '3px' }, children: [_jsx("label", { style: { marginRight: '2px', lineHeight: 2, userSelect: 'none' }, htmlFor: "lookNegative", children: "Detect Negative:" }), _jsx(CheckBox, { name: "lookNegative", ref: lookNegativeRef })] }), _jsx(Button.Done, { onClick: handleApplyFilter, style: { margin: '0 10px' }, children: "Apply" })] }));
66
55
  }
67
56
  export default AutoPeakPickingOptionPanel;
@@ -3,6 +3,7 @@ import { useCallback, useRef, useState, useMemo } from 'react';
3
3
  import * as Yup from 'yup';
4
4
  import { baselineAlgorithms } from '../../data/data1d/filter1d/baselineCorrection';
5
5
  import { useDispatch } from '../context/DispatchContext';
6
+ import ActionButtons from '../elements/ActionButtons';
6
7
  import Label from '../elements/Label';
7
8
  import Select from '../elements/Select';
8
9
  import FormikForm from '../elements/formik/FormikForm';
@@ -19,14 +20,6 @@ const styles = {
19
20
  lineHeight: 2,
20
21
  userSelect: 'none',
21
22
  },
22
- actionButton: {
23
- height: '100%',
24
- width: '60px',
25
- borderRadius: '5px',
26
- border: '0.55px solid #c7c7c7',
27
- margin: '0px 5px',
28
- userSelect: 'none',
29
- },
30
23
  };
31
24
  function BaseLineCorrectionPanel() {
32
25
  const dispatch = useDispatch();
@@ -92,6 +85,6 @@ function BaseLineCorrectionPanel() {
92
85
  return { validation: {}, initialValue: {} };
93
86
  }
94
87
  }, [algorithm]);
95
- return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Algorithm: " }), _jsx(Select, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, onChange: changeAlgorithmHandler, defaultValue: "polynomial" }), _jsxs(FormikForm, { ref: formRef, onSubmit: handleApplyFilter, initialValues: formData.initialValue, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", children: _jsx(FormikInput, { type: "number", name: "maxIterations" }) }), _jsx(Label, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: _jsx(FormikInput, { type: "number", name: "tolerance" }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } } }) }))] }, JSON.stringify(formData.initialValue)), _jsx("button", { type: "button", style: styles.actionButton, onClick: () => formRef.current.submitForm(), children: "Apply" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleCancelFilter, children: "Cancel" })] }));
88
+ return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Algorithm: " }), _jsx(Select, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, onChange: changeAlgorithmHandler, defaultValue: "polynomial" }), _jsxs(FormikForm, { ref: formRef, onSubmit: handleApplyFilter, initialValues: formData.initialValue, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", children: _jsx(FormikInput, { type: "number", name: "maxIterations" }) }), _jsx(Label, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: _jsx(FormikInput, { type: "number", name: "tolerance" }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } } }) }))] }, JSON.stringify(formData.initialValue)), _jsx(ActionButtons, { onDone: () => formRef.current.submitForm(), onCancel: handleCancelFilter })] }));
96
89
  }
97
90
  export default BaseLineCorrectionPanel;
@@ -3,6 +3,7 @@ import { useMemo, memo, useCallback, useEffect, useRef, useState, } from 'react'
3
3
  import * as Filters from '../../data/Filters';
4
4
  import { useChartData } from '../context/ChartContext';
5
5
  import { useDispatch } from '../context/DispatchContext';
6
+ import ActionButtons from '../elements/ActionButtons';
6
7
  import Input from '../elements/Input';
7
8
  import InputRange from '../elements/InputRange';
8
9
  import Label from '../elements/Label';
@@ -18,14 +19,6 @@ const styles = {
18
19
  input: {
19
20
  width: '100px',
20
21
  },
21
- actionButton: {
22
- height: '100%',
23
- width: '60px',
24
- borderRadius: '5px',
25
- border: '0.55px solid #c7c7c7',
26
- margin: '0px 5px',
27
- userSelect: 'none',
28
- },
29
22
  select: {
30
23
  marginLeft: '5px',
31
24
  marginRight: '10px',
@@ -135,7 +128,7 @@ function ManualPhaseCorrectionPanelInner({ data, pivot, filter, }) {
135
128
  const onChangeHandler = useCallback((val) => {
136
129
  setPhaseCorrectionType(val);
137
130
  }, []);
138
- return (_jsxs("div", { style: styles.container, children: [_jsx(Select, { onChange: onChangeHandler, data: algorithms, defaultValue: phaseCorrectionTypes.manual, style: styles.select }), phaseCorrectionType === phaseCorrectionTypes.manual && (_jsxs(_Fragment, { children: [_jsx(Label, { title: "PH0 :", style: { wrapper: { marginRight: '5px' } }, children: _jsx(Input, { name: "ph0", style: { input: styles.input }, onChange: handleInput, value: value.ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1 :", children: _jsx(Input, { name: "ph1", style: { input: styles.input }, onChange: handleInput, value: value.ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change Ph0 By mouse click and drag", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change Ph1 By mouse click and drag", style: { width: '20%' }, onChange: handleRangeChange })] })), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleApplyFilter, children: "Apply" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleCancelFilter, children: "Cancel" })] }));
131
+ return (_jsxs("div", { style: styles.container, children: [_jsx(Select, { onChange: onChangeHandler, data: algorithms, defaultValue: phaseCorrectionTypes.manual, style: styles.select }), phaseCorrectionType === phaseCorrectionTypes.manual && (_jsxs(_Fragment, { children: [_jsx(Label, { title: "PH0 :", style: { wrapper: { marginRight: '5px' } }, children: _jsx(Input, { name: "ph0", style: { input: styles.input }, onChange: handleInput, value: value.ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1 :", children: _jsx(Input, { name: "ph1", style: { input: styles.input }, onChange: handleInput, value: value.ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change Ph0 By mouse click and drag", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change Ph1 By mouse click and drag", style: { width: '20%' }, onChange: handleRangeChange })] })), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
139
132
  }
140
133
  const MemoizedManualPhaseCorrectionPanel = memo(ManualPhaseCorrectionPanelInner);
141
134
  const emptyData = { datum: {}, filter: null };
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useRef } from 'react';
3
3
  import { useDispatch } from '../context/DispatchContext';
4
+ import Button from '../elements/Button';
4
5
  import CheckBox from '../elements/CheckBox';
5
6
  import NumberInput from '../elements/NumberInput';
6
- import { AUTO_RANGES_DETECTION, RESET_SELECTED_TOOL, } from '../reducer/types/Types';
7
+ import { AUTO_RANGES_DETECTION } from '../reducer/types/Types';
7
8
  const styles = {
8
9
  container: {
9
10
  padding: '5px',
@@ -26,15 +27,6 @@ const styles = {
26
27
  label: {
27
28
  flex: 5,
28
29
  },
29
- actionButton: {
30
- height: '100%',
31
- minWidth: '60px',
32
- borderRadius: '5px',
33
- border: '0.55px solid #c7c7c7',
34
- margin: '0px 5px',
35
- userSelect: 'none',
36
- padding: '3px',
37
- },
38
30
  hint: {
39
31
  lineHeight: 2,
40
32
  userSelect: 'none',
@@ -56,15 +48,10 @@ function RangesPickingOptionPanel() {
56
48
  },
57
49
  });
58
50
  }, [dispatch]);
59
- const handleCancelFilter = useCallback(() => {
60
- dispatch({
61
- type: RESET_SELECTED_TOOL,
62
- });
63
- }, [dispatch]);
64
51
  return (_jsxs("div", { style: styles.container, children: [_jsxs("div", { style: { justifyItems: 'baseline', margin: '0 10px' }, children: [_jsx("label", { style: { marginRight: '2px', lineHeight: 2, userSelect: 'none' }, htmlFor: "lookNegative", children: "Detect negative:" }), _jsx(CheckBox, { name: "lookNegative", ref: lookNegativeRef })] }), _jsx(NumberInput, { ref: minMaxRatioRef, label: "Min Max Ratio:", name: "minMaxRatio", style: {
65
52
  input: styles.input,
66
53
  inputContainer: styles.inputContainer,
67
54
  label: styles.label,
68
- }, defaultValue: 0.05, step: "0.01" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleApplyFilter, "data-test-id": "auto-ranges-detection-btn", children: "Auto ranges picking" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleCancelFilter, children: "Cancel" }), _jsx("span", { style: styles.hint, children: "Manual selection using SHIFT + select zone or click on Auto peak picking" })] }));
55
+ }, defaultValue: 0.05, step: "0.01" }), _jsx(Button.Done, { onClick: handleApplyFilter, style: { margin: '0 10px' }, children: "Auto ranges picking" }), _jsx("span", { style: styles.hint, children: "Manual selection using SHIFT + select zone or click on Auto peak picking" })] }));
69
56
  }
70
57
  export default RangesPickingOptionPanel;
@@ -3,6 +3,7 @@ import { useCallback, useRef, useState } from 'react';
3
3
  import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
4
4
  import { useChartData } from '../context/ChartContext';
5
5
  import { useDispatch } from '../context/DispatchContext';
6
+ import ActionButtons from '../elements/ActionButtons';
6
7
  import Select from '../elements/Select';
7
8
  import { APPLY_ZERO_FILLING_FILTER, RESET_SELECTED_TOOL, } from '../reducer/types/Types';
8
9
  const styles = {
@@ -19,14 +20,6 @@ const styles = {
19
20
  margin: '0px 5px 0px 5px',
20
21
  textAlign: 'center',
21
22
  },
22
- actionButton: {
23
- height: '100%',
24
- width: '60px',
25
- borderRadius: '5px',
26
- border: '0.55px solid #c7c7c7',
27
- margin: '0px 5px',
28
- userSelect: 'none',
29
- },
30
23
  label: {
31
24
  lineHeight: 2,
32
25
  userSelect: 'none',
@@ -67,6 +60,6 @@ function ZeroFillingOptionsPanel() {
67
60
  type: RESET_SELECTED_TOOL,
68
61
  });
69
62
  }, [dispatch]);
70
- return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Size: " }), _jsx(Select, { ref: sizeTextInputRef, data: Sizes, style: { marginLeft: 10, marginRight: 10 }, defaultValue: getDefaultValue() }), _jsx("span", { style: styles.label, children: "Line Broadening: " }), _jsx("input", { name: "line-broadening", style: styles.input, type: "number", defaultValue: lineBroadeningValue, onInput: handleInput, pattern: "^\\d*(\\.\\d{0,2})?$", step: "any" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleApplyFilter, children: "Apply" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleCancelFilter, children: "Cancel" })] }));
63
+ return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Size: " }), _jsx(Select, { ref: sizeTextInputRef, data: Sizes, style: { marginLeft: 10, marginRight: 10 }, defaultValue: getDefaultValue() }), _jsx("span", { style: styles.label, children: "Line Broadening: " }), _jsx("input", { name: "line-broadening", style: styles.input, type: "number", defaultValue: lineBroadeningValue, onInput: handleInput, pattern: "^\\d*(\\.\\d{0,2})?$", step: "any" }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
71
64
  }
72
65
  export default ZeroFillingOptionsPanel;
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useRef } from 'react';
3
3
  import { useDispatch } from '../context/DispatchContext';
4
+ import Button from '../elements/Button';
4
5
  import NumberInput from '../elements/NumberInput';
5
- import { RESET_SELECTED_TOOL, AUTO_ZONES_DETECTION, CHANGE_ZONES_NOISE_FACTOR, } from '../reducer/types/Types';
6
+ import { AUTO_ZONES_DETECTION, CHANGE_ZONES_NOISE_FACTOR, } from '../reducer/types/Types';
6
7
  const styles = {
7
8
  container: {
8
9
  padding: '5px',
@@ -19,13 +20,6 @@ const styles = {
19
20
  label: {
20
21
  flex: '5',
21
22
  },
22
- actionButton: {
23
- height: '100%',
24
- borderRadius: '5px',
25
- border: '0.55px solid #c7c7c7',
26
- margin: '0px 5px',
27
- userSelect: 'none',
28
- },
29
23
  };
30
24
  function Zones2DOptionPanel() {
31
25
  const dispatch = useDispatch();
@@ -38,11 +32,6 @@ function Zones2DOptionPanel() {
38
32
  },
39
33
  });
40
34
  }, [dispatch]);
41
- const handleCancelFilter = useCallback(() => {
42
- dispatch({
43
- type: RESET_SELECTED_TOOL,
44
- });
45
- }, [dispatch]);
46
35
  const handleInput = useCallback((e) => {
47
36
  if (e.target) {
48
37
  dispatch({ type: CHANGE_ZONES_NOISE_FACTOR, payload: e.target.value });
@@ -52,6 +41,6 @@ function Zones2DOptionPanel() {
52
41
  input: styles.input,
53
42
  inputContainer: styles.inputContainer,
54
43
  label: styles.label,
55
- }, defaultValue: 1, onChange: handleInput }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleApplyFilter, children: "Auto Zones Picking" }), _jsx("button", { type: "button", style: styles.actionButton, onClick: handleCancelFilter, children: "Cancel" })] }));
44
+ }, defaultValue: 1, onChange: handleInput }), _jsx(Button.Done, { onClick: handleApplyFilter, style: { margin: '0 10px' }, children: "Auto Zones Picking" })] }));
56
45
  }
57
46
  export default Zones2DOptionPanel;
@@ -2,25 +2,27 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCallback } from 'react';
3
3
  import { toJSON } from '../../data/SpectraManager';
4
4
  import { useChartData } from '../context/ChartContext';
5
+ import { useGlobal } from '../context/GlobalContext';
5
6
  import { useAlert } from '../elements/popup/Alert';
6
7
  import { positions, useModal } from '../elements/popup/Modal';
7
8
  import SaveAsModal from '../modal/SaveAsModal';
8
9
  import { copyPNGToClipboard, exportAsJSON, exportAsNMRE, exportAsPng, exportAsSVG, } from '../utility/Export';
9
10
  import { nmriumToNmredata } from '../utility/nmriumToNmredata';
10
11
  export default function useExport() {
12
+ const { rootRef } = useGlobal();
11
13
  const modal = useModal();
12
14
  const alert = useAlert();
13
15
  const state = useChartData();
14
16
  const saveToClipboardHandler = useCallback(async () => {
15
- if (state.data.length > 0) {
17
+ if (state.data.length > 0 && rootRef) {
16
18
  const hideLoading = await alert.showLoading('Exporting as NMRium process in progress');
17
19
  setTimeout(() => {
18
- copyPNGToClipboard('nmrSVG');
20
+ copyPNGToClipboard(rootRef, 'nmrSVG');
19
21
  hideLoading();
20
22
  alert.success('Image copied to clipboard');
21
23
  }, 0);
22
24
  }
23
- }, [alert, state]);
25
+ }, [rootRef, alert, state]);
24
26
  const saveAsJSONHandler = useCallback(async (spaceIndent = 0, isCompressed = true) => {
25
27
  if (state.data.length > 0) {
26
28
  const hideLoading = await alert.showLoading('Exporting as NMRium process in progress');
@@ -51,25 +53,25 @@ export default function useExport() {
51
53
  }
52
54
  }, [alert, state]);
53
55
  const saveAsSVGHandler = useCallback(async () => {
54
- if (state.data.length > 0) {
56
+ if (state.data.length > 0 && rootRef) {
55
57
  const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
56
58
  setTimeout(() => {
57
59
  const fileName = state.data[0]?.display?.name;
58
- exportAsSVG('nmrSVG', fileName);
60
+ exportAsSVG(rootRef, 'nmrSVG', fileName);
59
61
  hideLoading();
60
62
  }, 0);
61
63
  }
62
- }, [alert, state.data]);
64
+ }, [rootRef, alert, state.data]);
63
65
  const saveAsPNGHandler = useCallback(async () => {
64
- if (state.data.length > 0) {
66
+ if (state.data.length > 0 && rootRef) {
65
67
  const hideLoading = await alert.showLoading('Exporting as PNG process in progress');
66
68
  setTimeout(() => {
67
69
  const fileName = state.data[0]?.display?.name;
68
- exportAsPng('nmrSVG', fileName);
70
+ exportAsPng(rootRef, 'nmrSVG', fileName);
69
71
  hideLoading();
70
72
  }, 0);
71
73
  }
72
- }, [alert, state.data]);
74
+ }, [rootRef, alert, state.data]);
73
75
  const saveHandler = useCallback((options) => {
74
76
  async function handler() {
75
77
  const { name, pretty, compressed, dataExportOption } = options;
@@ -195,6 +195,7 @@ function DropZone(props) {
195
195
  const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
196
196
  onDrop,
197
197
  noClick: true,
198
+ noKeyboard: true,
198
199
  });
199
200
  const open = useCallback(() => {
200
201
  openImportDialog();
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
3
3
  import { useCallback, useEffect, useMemo, useRef } from 'react';
4
4
  import { REFERENCES } from '../../data/constants/References';
5
5
  import { useDispatch } from '../context/DispatchContext';
6
+ import Button from '../elements/Button';
6
7
  import CloseButton from '../elements/CloseButton';
7
8
  import Label from '../elements/Label';
8
9
  import Select from '../elements/Select';
@@ -51,6 +52,6 @@ function AlignSpectraModal({ onClose = () => null, nucleus, }) {
51
52
  ...resValues,
52
53
  });
53
54
  }, [nucleus]);
54
- return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsxs(FormikForm, { ref: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, { data: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Number of Peaks : ", children: _jsx(FormikInput, { name: "nbPeaks", type: "number" }) }) }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Target PPM :", children: _jsx(FormikInput, { name: "targetX", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx("button", { type: "button", onClick: handleSave, className: "btn", children: "Done" }) })] }));
55
+ return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsxs(FormikForm, { ref: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Options :" }), _jsx(Select, { data: List, style: { width: 270, height: 30, marginBottom: '20px' }, onChange: optionChangeHandler })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Number of Peaks : ", children: _jsx(FormikInput, { name: "nbPeaks", type: "number" }) }) }), _jsx("div", { className: " margin-10", children: _jsx(Label, { className: "custom-label", title: "Target PPM :", children: _jsx(FormikInput, { name: "targetX", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
55
56
  }
56
57
  export default AlignSpectraModal;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { useCallback, useEffect, useRef } from 'react';
4
4
  import { useChartData } from '../context/ChartContext';
5
+ import Button from '../elements/Button';
5
6
  import CloseButton from '../elements/CloseButton';
6
7
  import Label from '../elements/Label';
7
8
  import FormikForm from '../elements/formik/FormikForm';
@@ -30,6 +31,6 @@ function ExportAsMatrixModal({ onClose = () => null, }) {
30
31
  Events.off('brushEnd', handler);
31
32
  };
32
33
  }, []);
33
- return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Export spectra as a Matrix" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsxs(FormikForm, { ref: refForm, initialValues: INITIAL_VALUE, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: "row margin-10", children: _jsx(Label, { title: "Number of Points :", className: "custom-label", children: _jsx(FormikInput, { name: "nbPoints", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx("button", { type: "button", onClick: handleSave, className: "btn", children: "Export Now" }) })] }));
34
+ return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Export spectra as a Matrix" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsxs(FormikForm, { ref: refForm, initialValues: INITIAL_VALUE, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Range :" }), _jsx(Label, { title: "From : ", children: _jsx(FormikInput, { name: "from", type: "number" }) }), _jsx(Label, { title: "To : ", children: _jsx(FormikInput, { name: "to", type: "number" }) })] }), _jsx("div", { className: "row margin-10", children: _jsx(Label, { title: "Number of Points :", className: "custom-label", children: _jsx(FormikInput, { name: "nbPoints", type: "number" }) }) })] }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Export Now" }) })] }));
34
35
  }
35
36
  export default ExportAsMatrixModal;
@@ -4,6 +4,7 @@ import { css } from '@emotion/react';
4
4
  import { useCallback, useRef } from 'react';
5
5
  import * as yup from 'yup';
6
6
  import { useDispatch } from '../context/DispatchContext';
7
+ import Button from '../elements/Button';
7
8
  import CloseButton from '../elements/CloseButton';
8
9
  import FormikForm from '../elements/formik/FormikForm';
9
10
  import FormikTextarea from '../elements/formik/FormikTextarea';
@@ -51,6 +52,6 @@ function ImportPublicationStringModal({ onClose, }) {
51
52
  }, [alert, dispatch, onClose]);
52
53
  return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import from publication string" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(FormikForm, { ref: formRef, initialValues: {
53
54
  publicationText: '1H NMR (CDCl3, 400MHz) δ 10.58 (b, 1H), 7.40 (d, 1H, J = 8.0 Hz), 6.19 (d, 1H, J = 7.6 Hz), 4.88 (s, 1H), 2.17 (s, 3H), 1.02 (s, 9H), 1.01 (s, 9H), 0.89 (s, 9H)',
54
- }, validationSchema: validationSchema, onSubmit: publicationStringHandler, children: _jsx(FormikTextarea, { name: "publicationText", className: "text-area", placeholder: "Enter publication string" }) }) }), _jsx("div", { className: "footer-container", children: _jsx("button", { type: "button", onClick: () => formRef.current.submitForm(), className: "btn primary", children: "Import" }) })] }));
55
+ }, validationSchema: validationSchema, onSubmit: publicationStringHandler, children: _jsx(FormikTextarea, { name: "publicationText", className: "text-area", placeholder: "Enter publication string" }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), children: "Import" }) })] }));
55
56
  }
56
57
  export default ImportPublicationStringModal;
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { useRef, useCallback } from 'react';
5
+ import Button from '../elements/Button';
5
6
  import CloseButton from '../elements/CloseButton';
6
7
  import { loadFile, extractFileMetaFromPath } from '../utility/FileUtility';
7
8
  const styles = css `
@@ -33,12 +34,13 @@ const styles = css `
33
34
  .container {
34
35
  display: flex;
35
36
  margin: 30px 5px;
36
- input,
37
- button {
37
+ align-items: center;
38
+ height: 36px;
39
+
40
+ input {
38
41
  padding: 5px;
39
42
  border: 1px solid gray;
40
43
  border-radius: 5px;
41
- height: 36px;
42
44
  margin: 2px;
43
45
  }
44
46
  input {
@@ -46,8 +48,7 @@ const styles = css `
46
48
  }
47
49
  button {
48
50
  flex: 2;
49
- color: white;
50
- background-color: gray;
51
+ height: 100%;
51
52
  }
52
53
  }
53
54
  `;
@@ -73,5 +74,5 @@ export default function LoadJCAMPModal({ onLoadClick, onClose, startLoading, })
73
74
  onLoadClick(null);
74
75
  }
75
76
  }, [onLoadClick, startLoading]);
76
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Load JCAMP Dialog" }), _jsx(CloseButton, { onClick: onClose })] }), _jsxs("div", { className: "container", children: [_jsx("input", { ref: pathReft, type: "text", placeholder: "Enter URL to JCAMP-DX file" }), _jsx("button", { type: "button", onClick: loadJCAMPHandler, children: "Load" })] })] }));
77
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Load JCAMP Dialog" }), _jsx(CloseButton, { onClick: onClose })] }), _jsxs("div", { className: "container", children: [_jsx("input", { ref: pathReft, type: "text", placeholder: "Enter URL to JCAMP-DX file" }), _jsx(Button.Done, { onClick: loadJCAMPHandler, children: "Load" })] })] }));
77
78
  }
@@ -28,34 +28,12 @@ export const ModalStyles = css `
28
28
  overflow: auto;
29
29
  }
30
30
 
31
- button:focus {
32
- outline: none;
33
- }
34
- button:not([disabled]):hover {
35
- color: black;
36
- }
37
- .btn:not([disabled]):hover {
38
- background-color: #ffffff;
39
- }
40
- .btn:disabled {
41
- opacity: 0.5;
42
- }
43
- .btn {
44
- border: none;
45
- padding: 0 15px;
46
- background-color: #ffffff5e;
47
- border-radius: 5px;
48
- height: 25px;
49
- }
50
-
51
- .primary {
52
- background-color: #e2e2e2;
53
- }
54
-
55
31
  .footer-container {
56
32
  display: flex;
57
- flex-direction: row-reverse;
58
- align-items: flex-end;
33
+ flex-direction: row;
34
+ align-items: end;
35
+ justify-content: end;
36
+
59
37
  background: rgb(242, 242, 242);
60
38
  background: -moz-linear-gradient(
61
39
  0deg,
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
3
3
  import { useState, useEffect, useCallback } from 'react';
4
4
  import { StructureEditor } from 'react-ocl/full';
5
5
  import { useDispatch } from '../context/DispatchContext';
6
+ import ActionButtons from '../elements/ActionButtons';
6
7
  import { SET_MOLECULE, ADD_MOLECULE } from '../reducer/types/Types';
7
8
  import { ModalStyles } from './ModalStyle';
8
9
  function MoleculeStructureEditorModal(props) {
@@ -34,6 +35,6 @@ function MoleculeStructureEditorModal(props) {
34
35
  onClose('new');
35
36
  }
36
37
  }, [dispatch, selectedMolecule, molfile, onClose]);
37
- return (_jsxs("div", { css: ModalStyles, children: [_jsx(StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }), _jsxs("div", { className: "footer-container", children: [_jsx("button", { type: "button", className: "btn", onClick: handleSave, disabled: !molfile, children: "Save" }), _jsx("button", { type: "button", className: "btn", onClick: handleClose, children: "Close" })] })] }));
38
+ return (_jsxs("div", { css: ModalStyles, children: [_jsx(StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: handleClose }) })] }));
38
39
  }
39
40
  export default MoleculeStructureEditorModal;
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import * as Filters from '../../../data/Filters';
6
6
  import { REFERENCES } from '../../../data/constants/References';
7
7
  import { useDispatch } from '../../context/DispatchContext';
8
+ import ActionButtons from '../../elements/ActionButtons';
8
9
  import CloseButton from '../../elements/CloseButton';
9
10
  import Select from '../../elements/Select';
10
11
  import FormikForm from '../../elements/formik/FormikForm';
@@ -114,6 +115,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
114
115
  break;
115
116
  }
116
117
  }, [filter, submitHandler]);
117
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Apply filters" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content container", children: [_jsx("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Filter :" }), _jsx(Select, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler })] }), filterOptions] }), _jsxs("div", { className: "footer-container", children: [_jsx("button", { type: "button", onClick: handleSave, className: "btn primary", children: "Apply" }), _jsx("button", { type: "button", onClick: onClose, className: "btn", children: "Close" })] })] }));
118
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Apply filters" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content container", children: [_jsx("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Filter :" }), _jsx(Select, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler })] }), filterOptions] }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: onClose, cancelLabel: "Close" }) })] }));
118
119
  }
119
120
  export default MultipleSpectraFiltersModal;
@@ -7,6 +7,7 @@ import { defaultPredictionOptions, FREQUENCIES, } from '../../data/PredictionMan
7
7
  import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
8
8
  import { useChartData } from '../context/ChartContext';
9
9
  import { useDispatch } from '../context/DispatchContext';
10
+ import Button from '../elements/Button';
10
11
  import CheckBox from '../elements/CheckBox';
11
12
  import CloseButton from '../elements/CloseButton';
12
13
  import IsotopesViewer from '../elements/IsotopesViewer';
@@ -60,12 +61,6 @@ const styles = css `
60
61
  }
61
62
  }
62
63
 
63
- button[disabled],
64
- button[disabled]:hover {
65
- opacity: 0.5;
66
- color: black;
67
- }
68
-
69
64
  .middle-x {
70
65
  padding: 0 10px;
71
66
  }
@@ -161,6 +156,6 @@ function PredictSpectraModal({ onClose = () => null, molfile, }) {
161
156
  const approveCheckHandler = useCallback((e) => {
162
157
  setApproved(e.target.checked);
163
158
  }, []);
164
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Prediction of NMR spectrum" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content", children: [_jsxs(FormikForm, { ref: refForm, initialValues: initValues, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [_jsx(FormikErrorsSummary, {}), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Name :" }), _jsx(FormikInput, { name: "name", style: { input: { width: '200px', textAlign: 'left' } } })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Spectrometer Frequency :" }), _jsx(FormikSelect, { data: FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" })] }), _jsx("span", { className: "group-label", children: "1D Options " }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx(IsotopesViewer, { value: "1H", className: "custom-label" }), _jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number" }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number" }) })] }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx(IsotopesViewer, { value: "13C", className: "custom-label" }), _jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number" }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number" }) })] }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Line Width : " }), _jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Number of Points : " }), _jsx(FormikSelect, { data: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: { width: 290, height: 30, margin: 0 } })] }), _jsx("span", { className: "group-label", children: "2D Options " }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Number of Points : " }), _jsx(FormikSelect, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), _jsx("span", { className: "middle-x", children: " X " }), _jsx(FormikSelect, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }), _jsx("div", { className: "row margin-10", children: _jsx("span", { className: "group-label", children: "Spectra " }) }), _jsxs("div", { className: "row margin-10 padding-h-10", style: { justifyContent: 'space-between' }, children: [_jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.proton" }), _jsx(IsotopesViewer, { value: "1H", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.carbon" }), _jsx(IsotopesViewer, { value: "13C", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.cosy" }), _jsx(IsotopesViewer, { value: "COSY", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.hsqc" }), _jsx(IsotopesViewer, { value: "HSQC", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.hmbc" }), _jsx(IsotopesViewer, { value: "HMBC", className: "nucleus-label" })] })] })] }), _jsx("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), _jsxs("div", { className: "warning-container", children: [_jsx(CheckBox, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), _jsx("p", { children: "I confirm that the chemical structure is not confidential." })] })] }), _jsx("div", { className: "footer-container", children: _jsx("button", { type: "button", onClick: handleSave, className: "btn", disabled: !isApproved, children: "Predict spectrum" }) })] }));
159
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Prediction of NMR spectrum" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content", children: [_jsxs(FormikForm, { ref: refForm, initialValues: initValues, validationSchema: predictionFormValidation, onSubmit: submitHandler, children: [_jsx(FormikErrorsSummary, {}), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Name :" }), _jsx(FormikInput, { name: "name", style: { input: { width: '200px', textAlign: 'left' } } })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Spectrometer Frequency :" }), _jsx(FormikSelect, { data: FREQUENCIES, style: { width: 290, height: 30, margin: 0 }, name: "frequency" })] }), _jsx("span", { className: "group-label", children: "1D Options " }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx(IsotopesViewer, { value: "1H", className: "custom-label" }), _jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number" }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number" }) })] }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx(IsotopesViewer, { value: "13C", className: "custom-label" }), _jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number" }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number" }) })] }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Line Width : " }), _jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: { input: { margin: 0 } } }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Number of Points : " }), _jsx(FormikSelect, { data: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: { width: 290, height: 30, margin: 0 } })] }), _jsx("span", { className: "group-label", children: "2D Options " }), _jsxs("div", { className: "row margin-10 padding-h-10", children: [_jsx("span", { className: "custom-label", children: "Number of Points : " }), _jsx(FormikSelect, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), _jsx("span", { className: "middle-x", children: " X " }), _jsx(FormikSelect, { data: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }), _jsx("div", { className: "row margin-10", children: _jsx("span", { className: "group-label", children: "Spectra " }) }), _jsxs("div", { className: "row margin-10 padding-h-10", style: { justifyContent: 'space-between' }, children: [_jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.proton" }), _jsx(IsotopesViewer, { value: "1H", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.carbon" }), _jsx(IsotopesViewer, { value: "13C", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.cosy" }), _jsx(IsotopesViewer, { value: "COSY", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.hsqc" }), _jsx(IsotopesViewer, { value: "HSQC", className: "nucleus-label" })] }), _jsxs("div", { className: "row", children: [_jsx(FormikCheckBox, { name: "spectra.hmbc" }), _jsx(IsotopesViewer, { value: "HMBC", className: "nucleus-label" })] })] })] }), _jsx("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), _jsxs("div", { className: "warning-container", children: [_jsx(CheckBox, { onChange: approveCheckHandler, checked: isApproved }, String(isApproved)), _jsx("p", { children: "I confirm that the chemical structure is not confidential." })] })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }));
165
160
  }
166
161
  export default PredictSpectraModal;
@@ -1,5 +1,5 @@
1
1
  interface SaveAsModalProps {
2
- onClose?: (element?: any) => void;
2
+ onClose?: (event?: MouseEvent) => void;
3
3
  onSave: (element: any) => void;
4
4
  name: string;
5
5
  }
@@ -4,6 +4,7 @@ import { css } from '@emotion/react';
4
4
  import { Field } from 'formik';
5
5
  import { useCallback, useRef } from 'react';
6
6
  import { DataExportOptions } from '../../data/SpectraManager';
7
+ import ActionButtons from '../elements/ActionButtons';
7
8
  import CloseButton from '../elements/CloseButton';
8
9
  import FormikCheckBox from '../elements/formik/FormikCheckBox';
9
10
  import FormikForm from '../elements/formik/FormikForm';
@@ -56,6 +57,6 @@ function SaveAsModal({ onClose, onSave, name }) {
56
57
  }, [onClose, onSave]);
57
58
  return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Save as ... " }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsxs(FormikForm, { ref: refForm, initialValues: { ...INITIAL_VALUE, name }, onSubmit: submitHandler, children: [_jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Name" }), _jsx(FormikInput, { name: "name", className: "name", style: {
58
59
  inputWrapper: { width: '100%' },
59
- } })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Compressed" }), _jsx(FormikCheckBox, { name: "compressed" })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Pretty Format" }), _jsx(FormikCheckBox, { name: "pretty" })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: " Include " }), _jsxs("div", { className: "data-export-group", children: [_jsxs("label", { children: [_jsx(Field, { type: "radio", name: "dataExportOption", value: DataExportOptions.ROW_DATA }), "Raw Data"] }), _jsxs("label", { children: [_jsx(Field, { type: "radio", name: "dataExportOption", value: DataExportOptions.DATA_SOURCE }), "Data Source"] })] })] })] }) }), _jsxs("div", { className: "footer-container", children: [_jsx("button", { type: "button", onClick: handleSave, className: "btn primary", children: "Save" }), _jsx("button", { type: "button", onClick: onClose, className: "btn", children: "Close" })] })] }));
60
+ } })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Compressed" }), _jsx(FormikCheckBox, { name: "compressed" })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: "Pretty Format" }), _jsx(FormikCheckBox, { name: "pretty" })] }), _jsxs("div", { className: "row margin-10", children: [_jsx("span", { className: "custom-label", children: " Include " }), _jsxs("div", { className: "data-export-group", children: [_jsxs("label", { children: [_jsx(Field, { type: "radio", name: "dataExportOption", value: DataExportOptions.ROW_DATA }), "Raw Data"] }), _jsxs("label", { children: [_jsx(Field, { type: "radio", name: "dataExportOption", value: DataExportOptions.DATA_SOURCE }), "Data Source"] })] })] })] }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
60
61
  }
61
62
  export default SaveAsModal;