nmrium 0.40.1 → 0.42.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 (293) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  15. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  16. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  17. package/lib/component/2d/FooterBanner.js +3 -2
  18. package/lib/component/2d/Viewer2D.js +51 -29
  19. package/lib/component/2d/XAxis.js +1 -1
  20. package/lib/component/2d/YAxis.js +1 -1
  21. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  22. package/lib/component/2d/utilities/scale.d.ts +5 -5
  23. package/lib/component/2d/zones/Signal.js +1 -2
  24. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  25. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  26. package/lib/component/NMRium.d.ts +2 -2
  27. package/lib/component/NMRium.js +39 -26
  28. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  29. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  30. package/lib/component/elements/Input.js +1 -0
  31. package/lib/component/elements/InputRange.js +1 -1
  32. package/lib/component/elements/MenuButton.d.ts +1 -1
  33. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  35. package/lib/component/elements/Scroller.d.ts +15 -0
  36. package/lib/component/elements/Scroller.js +31 -0
  37. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  38. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  39. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  40. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  41. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  42. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  43. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  44. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  45. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
  46. package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
  47. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  48. package/lib/component/elements/popup/Alert/Context.js +6 -2
  49. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  50. package/lib/component/elements/popup/Alert/Provider.js +3 -3
  51. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  52. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  53. package/lib/component/elements/popup/options.d.ts +22 -19
  54. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  55. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  56. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  57. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  58. package/lib/component/highlight/index.d.ts +1 -1
  59. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  60. package/lib/component/hooks/useExport.js +2 -1
  61. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  62. package/lib/component/hooks/usePanelPreferences.js +2 -2
  63. package/lib/component/hooks/useSaveSettings.js +9 -11
  64. package/lib/component/hooks/useXScale.d.ts +1 -1
  65. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  66. package/lib/component/modal/AboutPredictionModal.js +1 -1
  67. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  68. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  69. package/lib/component/modal/AlignSpectraModal.js +11 -1
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  78. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  79. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/Panels.js +13 -0
  89. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  90. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
  91. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
  92. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  93. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  94. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  95. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  96. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  97. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  98. package/lib/component/panels/databasePanel/DatabasePanel.js +34 -27
  99. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  100. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  101. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  102. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  103. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  104. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  105. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  106. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  107. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  112. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  113. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  114. package/lib/component/reducer/Reducer.d.ts +13 -12
  115. package/lib/component/reducer/Reducer.js +253 -239
  116. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  117. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  118. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  119. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  120. package/lib/component/reducer/actions/DomainActions.js +30 -1
  121. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  122. package/lib/component/reducer/actions/LoadActions.js +1 -1
  123. package/lib/component/reducer/actions/MoleculeActions.d.ts +8 -2
  124. package/lib/component/reducer/actions/MoleculeActions.js +58 -3
  125. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  126. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  127. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  128. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  129. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  130. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
  131. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  132. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  133. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  134. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  135. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  136. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  137. package/lib/component/utility/PathBuilder.js +11 -0
  138. package/lib/component/utility/export.js +9 -9
  139. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  140. package/lib/component/utility/getUniqueNuclei.js +1 -1
  141. package/lib/component/utility/jpathToArray.js +1 -1
  142. package/lib/component/workspaces/index.d.ts +1 -0
  143. package/lib/component/workspaces/index.js +2 -0
  144. package/lib/component/workspaces/simulation.d.ts +2 -0
  145. package/lib/component/workspaces/simulation.js +68 -0
  146. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -5
  147. package/lib/data/PredictionManager.d.ts +8 -7
  148. package/lib/data/PredictionManager.js +95 -22
  149. package/lib/data/SpectraManager.js +1 -1
  150. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  151. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  152. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  153. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  154. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  156. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  157. package/lib/data/data1d/database.d.ts +9 -7
  158. package/lib/data/data1d/database.js +13 -6
  159. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  160. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  161. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  162. package/lib/data/data1d/spectrumSimulation.js +53 -0
  163. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  164. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  165. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  166. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  167. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  168. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  169. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  170. package/lib/data/matrixGeneration.js +1 -1
  171. package/lib/data/molecules/MoleculeManager.d.ts +2 -1
  172. package/lib/data/molecules/MoleculeManager.js +21 -7
  173. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  174. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  175. package/lib/data/utilities/FindUtilities.js +4 -4
  176. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  177. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  178. package/lib/data/utilities/calculateSanPlot.js +3 -3
  179. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  180. package/lib/utils/clipboard/clipboard.d.ts +1 -1
  181. package/lib/versionInfo.js +1 -1
  182. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  183. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  184. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  185. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  186. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  187. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  188. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  189. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  190. package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  191. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  192. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  193. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  194. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  195. package/lib-cjs/component/2d/XAxis.js +1 -1
  196. package/lib-cjs/component/2d/YAxis.js +1 -1
  197. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  198. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  199. package/lib-cjs/component/NMRium.js +37 -24
  200. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  201. package/lib-cjs/component/elements/Input.js +1 -0
  202. package/lib-cjs/component/elements/InputRange.js +1 -1
  203. package/lib-cjs/component/elements/Scroller.js +35 -0
  204. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  205. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
  206. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  207. package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
  208. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  209. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  210. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  211. package/lib-cjs/component/hooks/useExport.js +2 -1
  212. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  213. package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
  214. package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
  215. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  216. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  217. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  218. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  219. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  220. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  221. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  222. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  223. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  224. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  225. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  226. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  227. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  228. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  229. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  230. package/lib-cjs/component/panels/Panels.js +13 -0
  231. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  232. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
  233. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
  234. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  235. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  236. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  237. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +34 -27
  238. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  239. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  240. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  241. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  242. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  243. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  244. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  245. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  246. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  247. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  248. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  249. package/lib-cjs/component/reducer/Reducer.js +253 -239
  250. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  251. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  252. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  253. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  254. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  255. package/lib-cjs/component/reducer/actions/MoleculeActions.js +62 -3
  256. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  257. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  258. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  259. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
  260. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  261. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  262. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  263. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  264. package/lib-cjs/component/utility/PathBuilder.js +11 -0
  265. package/lib-cjs/component/utility/export.js +9 -9
  266. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  267. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  268. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  269. package/lib-cjs/component/workspaces/index.js +2 -0
  270. package/lib-cjs/component/workspaces/simulation.js +71 -0
  271. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +9 -5
  272. package/lib-cjs/data/PredictionManager.js +96 -22
  273. package/lib-cjs/data/SpectraManager.js +1 -1
  274. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  275. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  276. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  277. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  278. package/lib-cjs/data/data1d/database.js +13 -6
  279. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  280. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  281. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  282. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  283. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  284. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  285. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  286. package/lib-cjs/data/matrixGeneration.js +1 -1
  287. package/lib-cjs/data/molecules/MoleculeManager.js +23 -8
  288. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  289. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  290. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  291. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  292. package/lib-cjs/versionInfo.js +1 -1
  293. package/package.json +21 -20
@@ -7,10 +7,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const fa_1 = require("react-icons/fa");
9
9
  const react_inspector_1 = require("react-inspector");
10
+ const ui_1 = require("react-science/ui");
10
11
  const ChartContext_1 = require("../../context/ChartContext");
11
12
  const DispatchContext_1 = require("../../context/DispatchContext");
12
13
  const Button_1 = __importDefault(require("../../elements/Button"));
13
- const CheckBox_1 = __importDefault(require("../../elements/CheckBox"));
14
14
  const ColumnWrapper_1 = require("../../elements/ColumnWrapper");
15
15
  const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
16
16
  const Alert_1 = require("../../elements/popup/Alert");
@@ -114,7 +114,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
114
114
  style: { width: '30px' },
115
115
  Cell: ({ row }) => {
116
116
  const { flag, id } = row.original;
117
- return ((0, jsx_runtime_1.jsx)(ColumnWrapper_1.ColumnWrapper, { children: (0, jsx_runtime_1.jsx)(CheckBox_1.default, { onChange: (event) => handelFilterCheck(id, event.target.checked), checked: flag, style: { display: 'block', margin: 'auto' } }) }));
117
+ return ((0, jsx_runtime_1.jsx)(ColumnWrapper_1.ColumnWrapper, { children: (0, jsx_runtime_1.jsx)(ui_1.Checkbox, { onChange: (checked) => handelFilterCheck(id, checked), checked: flag }) }));
118
118
  },
119
119
  },
120
120
  {
@@ -46,6 +46,7 @@ const NUMBER_OF_POINTS_2D = (0, generateNumbersPowerOfX_1.default)(10, 10, {
46
46
  const predictionFormValidation = Yup.object().shape({
47
47
  name: Yup.string().label('Name'),
48
48
  frequency: Yup.number().integer().required().label('Frequency'),
49
+ autoExtendRange: Yup.boolean(),
49
50
  '1d': Yup.object({
50
51
  '1H': Yup.object({
51
52
  from: Yup.number().required().label("1H ' From ' "),
@@ -106,7 +107,7 @@ function PredictionOptionsPanel(props, ref) {
106
107
  const { options, onSubmit, hideName = false } = props;
107
108
  return ((0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: options, validationSchema: predictionFormValidation, enableReinitialize: true, onSubmit: onSubmit, innerRef: ref, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}), !hideName && ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "Name", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "name", style: inputStyle }) })), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: styles.select, name: "frequency" }) }), (0, jsx_runtime_1.jsxs)(GroupPane_1.GroupPane, { text: "1D Options", style: {
108
109
  header: styles.groupHeader,
109
- }, children: [(0, jsx_runtime_1.jsxs)(Label_1.default, { title: "1H", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "13C", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: inputStyle }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Points", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "2D Options", style: {
110
+ }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Auto extend range", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "autoExtendRange" }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "1H", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "13C", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: inputStyle }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Points", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "2D Options", style: {
110
111
  header: styles.groupHeader,
111
112
  }, children: (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Number of Points", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), (0, jsx_runtime_1.jsx)("span", { style: { padding: '0 10px' }, children: " X " }), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Spectra", style: {
112
113
  header: styles.groupHeader,
@@ -77,10 +77,11 @@ function PredictionPanel() {
77
77
  }
78
78
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
79
79
  try {
80
- const data = await (0, PredictionManager_1.predictSpectra)(molfile, logger);
80
+ const data = await (0, PredictionManager_1.predictSpectra)(molfile);
81
81
  dispatch({
82
82
  type: 'PREDICT_SPECTRA',
83
83
  payload: {
84
+ logger,
84
85
  predictedSpectra: data.spectra,
85
86
  options: predictionPreferences,
86
87
  molecule: { ...molecules[currentIndex], molfile },
@@ -123,7 +124,7 @@ function PredictionPanel() {
123
124
  }, children: molecules && molecules.length > 0 ? (molecules.map((mol, molIndex) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.flexColumnContainer, children: [(0, jsx_runtime_1.jsx)(MoleculeHeader_1.default, { currentMolecule: mol, molecules: molecules }), (0, jsx_runtime_1.jsx)("div", { style: {
124
125
  ...styles.slider,
125
126
  height: height - 31,
126
- }, children: molIndex === currentIndex && ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
127
+ }, children: molIndex === currentIndex && ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: molfile || '', width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
127
128
  } }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', padding: '5px' }, children: [(0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && ((0, jsx_runtime_1.jsx)(Button_1.default.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] }))] }));
128
129
  }
129
130
  exports.default = PredictionPanel;
@@ -53,7 +53,7 @@ function PredictionSimpleOptions() {
53
53
  const { dispatch } = (0, PreferencesContext_1.usePreferences)();
54
54
  const predictionPreferences = (0, usePanelPreferences_1.usePanelPreferences)('prediction');
55
55
  const optionsChangeHandler = (0, react_1.useCallback)((values) => {
56
- const value = (0, merge_1.default)({}, PredictionManager_1.defaultPredictionOptions, values);
56
+ const value = (0, merge_1.default)({}, (0, PredictionManager_1.getDefaultPredictionOptions)(), values);
57
57
  dispatch({
58
58
  type: 'SET_PANELS_PREFERENCES',
59
59
  payload: { key: 'prediction', value },
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
+ /** @jsxImportSource @emotion/react */
8
+ const react_1 = require("@emotion/react");
9
+ const formik_1 = require("formik");
10
+ const react_2 = require("react");
11
+ const spectrumSimulation_1 = require("../../../data/data1d/spectrumSimulation");
12
+ const DispatchContext_1 = require("../../context/DispatchContext");
13
+ const Button_1 = __importDefault(require("../../elements/Button"));
14
+ const FormikOnChange_1 = __importDefault(require("../../elements/formik/FormikOnChange"));
15
+ const AboutSpectrumSimulationModal_1 = __importDefault(require("../../modal/AboutSpectrumSimulationModal"));
16
+ const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
17
+ const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
18
+ const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
19
+ const SpectrumSimulationPreferences_1 = __importDefault(require("./SpectrumSimulationPreferences"));
20
+ const SpectrumSimulationSimpleOptions_1 = __importDefault(require("./SpectrumSimulationSimpleOptions"));
21
+ const SpinSystemTable_1 = require("./SpinSystemTable");
22
+ function SpectrumSimulation() {
23
+ const dispatch = (0, DispatchContext_1.useDispatch)();
24
+ const [isFlipped, setFlipStatus] = (0, react_2.useState)(false);
25
+ const [spinSystem, setSpinSystem] = (0, react_2.useState)('AB');
26
+ const spinSystemRef = (0, react_2.useRef)('AB');
27
+ const formRef = (0, react_2.useRef)(null);
28
+ const settingRef = (0, react_2.useRef)(null);
29
+ const settingsPanelHandler = (0, react_2.useCallback)(() => {
30
+ setFlipStatus(!isFlipped);
31
+ }, [isFlipped]);
32
+ const saveSettingHandler = (0, react_2.useCallback)(() => {
33
+ settingRef.current?.saveSetting();
34
+ setFlipStatus(false);
35
+ }, []);
36
+ function spinSystemChangeHandler(system) {
37
+ spinSystemRef.current = system;
38
+ setSpinSystem(system);
39
+ }
40
+ const data = (0, react_2.useMemo)(() => {
41
+ const rows = [];
42
+ const spinLength = spinSystem.length;
43
+ for (let i = 1; i <= spinLength; i++) {
44
+ const columns = [];
45
+ for (let j = 0; j < spinLength; j++) {
46
+ if (j < i && i !== 1) {
47
+ columns.push(0);
48
+ }
49
+ else {
50
+ columns.push(null);
51
+ }
52
+ }
53
+ columns[0] = i;
54
+ rows.push(columns);
55
+ }
56
+ return rows;
57
+ }, [spinSystem]);
58
+ function simulateHandler(values, keepSpectrum = false) {
59
+ dispatch({
60
+ type: 'SIMULATE_SPECTRUM',
61
+ payload: { ...values, spinSystem: spinSystemRef.current, keepSpectrum },
62
+ });
63
+ }
64
+ function addSpectrumHandler() {
65
+ const values = formRef.current?.values;
66
+ if (values) {
67
+ simulateHandler(values, true);
68
+ }
69
+ }
70
+ function saveSettingsHandler(values) {
71
+ simulateHandler(values);
72
+ formRef.current?.setValues(values);
73
+ }
74
+ return ((0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: { ...spectrumSimulation_1.defaultSimulationOptions, data }, enableReinitialize: true,
75
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
76
+ onSubmit: () => { }, innerRef: formRef, children: ({ values }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { css: [
77
+ BasicPanelStyle_1.tablePanelStyle,
78
+ isFlipped &&
79
+ (0, react_1.css) `
80
+ .table-container {
81
+ table,
82
+ th {
83
+ position: relative !important;
84
+ }
85
+ }
86
+ `,
87
+ ], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { showSettingButton: true, onSettingClick: settingsPanelHandler, canDelete: false, children: [(0, jsx_runtime_1.jsx)(AboutSpectrumSimulationModal_1.default, {}), (0, jsx_runtime_1.jsx)(SpectrumSimulationSimpleOptions_1.default, { onSpinSystemChange: spinSystemChangeHandler, spinSystem: spinSystem })] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsxs)("div", { style: {
88
+ display: 'flex',
89
+ flexDirection: 'column',
90
+ height: '100%',
91
+ overflow: 'auto',
92
+ }, children: [(0, jsx_runtime_1.jsx)(SpinSystemTable_1.SpinSystemTable, { spinSystem: spinSystem }), (0, jsx_runtime_1.jsx)("div", { style: { padding: '5px' }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: addSpectrumHandler, children: "Add Spectrum" }) })] })) : ((0, jsx_runtime_1.jsx)(SpectrumSimulationPreferences_1.default, { ref: settingRef, options: values, onSave: saveSettingsHandler })) })] }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => simulateHandler(values) }, Boolean(isFlipped).toString())] })) }));
93
+ }
94
+ exports.default = SpectrumSimulation;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const formik_1 = require("formik");
8
+ const react_1 = require("react");
9
+ const PredictionManager_1 = require("../../../data/PredictionManager");
10
+ const generateNumbersPowerOfX_1 = __importDefault(require("../../../data/utilities/generateNumbersPowerOfX"));
11
+ const Label_1 = __importDefault(require("../../elements/Label"));
12
+ const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
13
+ const FormikSelect_1 = __importDefault(require("../../elements/formik/FormikSelect"));
14
+ const PreferencesContainer_1 = require("../extra/preferences/PreferencesContainer");
15
+ const SIMULATION_NUMBER_OF_POINTS = (0, generateNumbersPowerOfX_1.default)(12, 19);
16
+ const selectStyles = {
17
+ width: '100%',
18
+ minWidth: '50px',
19
+ maxWidth: '280px',
20
+ height: 30,
21
+ margin: 0,
22
+ };
23
+ const labelStyle = {
24
+ label: { flex: 3, fontWeight: '500' },
25
+ wrapper: { flex: 9, display: 'flex', alignItems: 'center' },
26
+ container: { padding: '5px' },
27
+ };
28
+ const inputStyle = {
29
+ input: {
30
+ padding: '5px',
31
+ },
32
+ };
33
+ function SpectrumSimulationPreferences({ options, onSave }, ref) {
34
+ const formRef = (0, react_1.useRef)(null);
35
+ (0, react_1.useImperativeHandle)(ref, () => ({
36
+ saveSetting: () => {
37
+ void formRef.current?.submitForm();
38
+ },
39
+ }), []);
40
+ return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { style: { backgroundColor: 'white' }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: options, onSubmit: onSave, innerRef: formRef, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Points", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: SIMULATION_NUMBER_OF_POINTS, name: "options.nbPoints", style: selectStyles }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Range", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "options.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "options.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "options.lineWidth", type: "number", style: inputStyle }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] })] }) }) }));
41
+ }
42
+ exports.default = (0, react_1.forwardRef)(SpectrumSimulationPreferences);
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const PredictionManager_1 = require("../../../data/PredictionManager");
8
+ const spectrumSimulation_1 = require("../../../data/data1d/spectrumSimulation");
9
+ const Label_1 = __importDefault(require("../../elements/Label"));
10
+ const Select_1 = __importDefault(require("../../elements/Select"));
11
+ const FormikNumberInput_1 = __importDefault(require("../../elements/formik/FormikNumberInput"));
12
+ const FormikSelect_1 = __importDefault(require("../../elements/formik/FormikSelect"));
13
+ const SPIN_SYSTEMS = (0, spectrumSimulation_1.getSpinSystems)().map((key) => ({
14
+ label: key,
15
+ value: key,
16
+ }));
17
+ const labelStyle = {
18
+ label: { fontSize: '10px' },
19
+ wrapper: { display: 'flex', alignItems: 'center', height: '100%' },
20
+ container: { padding: '0 5px', height: '100%' },
21
+ };
22
+ const selectStyles = { width: '100%', minWidth: '75px', fontSize: '10px' };
23
+ function SpectrumSimulationSimpleOptions({ onSpinSystemChange, spinSystem, }) {
24
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
25
+ display: 'flex',
26
+ justifyContent: 'flex-end',
27
+ flex: '1',
28
+ padding: '0 10px',
29
+ }, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Spin system", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikNumberInput_1.default, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), (0, jsx_runtime_1.jsx)("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
30
+ }
31
+ exports.default = SpectrumSimulationSimpleOptions;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SpinSystemTable = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const formik_1 = require("formik");
9
+ const react_1 = require("react");
10
+ const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
11
+ const addCustomColumn_1 = __importDefault(require("../../elements/ReactTable/utility/addCustomColumn"));
12
+ const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
13
+ const cellStyle = {
14
+ padding: '1px',
15
+ border: 'none',
16
+ borderWidth: 0,
17
+ };
18
+ const inputStyle = {
19
+ input: {
20
+ padding: '5px',
21
+ },
22
+ inputWrapper: {
23
+ borderRadius: 0,
24
+ },
25
+ };
26
+ function SpinSystemTable(props) {
27
+ const { spinSystem } = props;
28
+ const { values: { data }, } = (0, formik_1.useFormikContext)();
29
+ const tableColumns = (0, react_1.useMemo)(() => {
30
+ const columns = [
31
+ {
32
+ id: 'rowLabel',
33
+ Header: '',
34
+ accessor: (_, index) => spinSystem.at(index),
35
+ },
36
+ {
37
+ Header: 'Delta',
38
+ style: cellStyle,
39
+ Cell: ({ row }) => ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `data.${row.index}.0`, style: inputStyle, value: row.original[0] || 0, type: "number" })),
40
+ },
41
+ ];
42
+ let i = 0;
43
+ for (const label of spinSystem.slice(0, -1)) {
44
+ const columnIndex = i + 1;
45
+ (0, addCustomColumn_1.default)(columns, {
46
+ id: label,
47
+ index: i,
48
+ style: cellStyle,
49
+ Cell: function cellRender({ row }) {
50
+ const val = row.original?.[columnIndex] ?? null;
51
+ if (val !== null) {
52
+ return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `data.${row.index}.${columnIndex}`, style: inputStyle, type: "number" }));
53
+ }
54
+ return (0, jsx_runtime_1.jsx)("div", {});
55
+ },
56
+ Header: () => ((0, jsx_runtime_1.jsxs)("span", { children: ["J", (0, jsx_runtime_1.jsxs)("sub", { children: [label, "-"] }), "(Hz)"] })),
57
+ });
58
+ i++;
59
+ }
60
+ return columns;
61
+ }, [spinSystem]);
62
+ if (!spinSystem) {
63
+ return null;
64
+ }
65
+ return (0, jsx_runtime_1.jsx)(ReactTable_1.default, { columns: tableColumns, data: data });
66
+ }
67
+ exports.SpinSystemTable = SpinSystemTable;