nmrium 0.26.0 → 0.27.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 (425) hide show
  1. package/lib/component/1d/Chart1D.js +3 -2
  2. package/lib/component/1d/FooterBanner.js +1 -1
  3. package/lib/component/1d/Integral.d.ts +2 -1
  4. package/lib/component/1d/Integral.js +5 -12
  5. package/lib/component/1d/IntegralResizable.d.ts +2 -1
  6. package/lib/component/1d/IntegralResizable.js +10 -5
  7. package/lib/component/1d/IntegralsSeries.js +3 -3
  8. package/lib/component/1d/Line.d.ts +2 -2
  9. package/lib/component/1d/PeakAnnotation.js +5 -4
  10. package/lib/component/1d/database/DatabaseElements.d.ts +3 -0
  11. package/lib/component/1d/database/DatabaseElements.js +18 -0
  12. package/lib/component/1d/database/DatabaseSpectrum.d.ts +3 -0
  13. package/lib/component/1d/database/DatabaseSpectrum.js +58 -0
  14. package/lib/component/1d/{ResurrectedDatabaseRanges.d.ts → database/ResurrectedDatabaseRanges.d.ts} +0 -0
  15. package/lib/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
  16. package/lib/component/1d/jCouplingGraph/JGraph.js +4 -10
  17. package/lib/component/1d/multiAnalysis/AnalysisRange.js +10 -5
  18. package/lib/component/1d/ranges/Range.d.ts +2 -1
  19. package/lib/component/1d/ranges/Range.js +17 -9
  20. package/lib/component/1d/ranges/Ranges.js +6 -3
  21. package/lib/component/1d/tool/XLabelPointer.js +1 -1
  22. package/lib/component/2d/Chart2D.js +2 -1
  23. package/lib/component/2d/Contours.js +4 -1
  24. package/lib/component/2d/FooterBanner.js +1 -1
  25. package/lib/component/2d/tools/XYLabelPointer.js +1 -1
  26. package/lib/component/2d/tools/slicing/HorizontalSliceChart.d.ts +2 -2
  27. package/lib/component/2d/tools/slicing/SliceScale.d.ts +1 -1
  28. package/lib/component/2d/tools/slicing/VerticalSliceChart.d.ts +2 -2
  29. package/lib/component/EventsTrackers/KeysListenerTracker.js +10 -4
  30. package/lib/component/NMRium.d.ts +5 -1
  31. package/lib/component/NMRium.js +6 -3
  32. package/lib/component/SplitPaneWrapper.d.ts +4 -0
  33. package/lib/component/SplitPaneWrapper.js +8 -0
  34. package/lib/component/context/GlobalContext.d.ts +3 -0
  35. package/lib/component/context/GlobalContext.js +1 -1
  36. package/lib/component/context/PreferencesContext.d.ts +15 -12
  37. package/lib/component/context/PreferencesContext.js +1 -1
  38. package/lib/component/elements/Button.js +1 -1
  39. package/lib/component/elements/ColorInput.js +2 -2
  40. package/lib/component/elements/ContextMenu.d.ts +8 -3
  41. package/lib/component/elements/EditableColumn.d.ts +3 -2
  42. package/lib/component/elements/EditableColumn.js +27 -20
  43. package/lib/component/elements/Input.d.ts +9 -1
  44. package/lib/component/elements/Input.js +18 -5
  45. package/lib/component/elements/Select.d.ts +1 -0
  46. package/lib/component/elements/Select.js +21 -15
  47. package/lib/component/elements/ToggleButton.d.ts +2 -1
  48. package/lib/component/elements/ToggleButton.js +2 -2
  49. package/lib/component/elements/draggble/SVGDraggable.d.ts +17 -0
  50. package/lib/component/elements/draggble/SVGDraggable.js +33 -0
  51. package/lib/component/elements/{resizer → draggble}/useDraggable.d.ts +9 -6
  52. package/lib/component/elements/draggble/useDraggable.js +70 -0
  53. package/lib/component/elements/formik/FormikColorPicker.d.ts +1 -0
  54. package/lib/component/elements/formik/FormikColorPicker.js +10 -7
  55. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +5 -4
  56. package/lib/component/elements/formik/FormikColumnFormatField.js +2 -2
  57. package/lib/component/elements/formik/FormikInput.d.ts +1 -0
  58. package/lib/component/elements/formik/FormikInput.js +6 -3
  59. package/lib/component/elements/formik/FormikSlider.d.ts +1 -0
  60. package/lib/component/elements/formik/FormikSlider.js +6 -3
  61. package/lib/component/elements/popup/Alert/Provider.js +1 -1
  62. package/lib/component/elements/resizer/DivResizer.js +17 -62
  63. package/lib/component/elements/resizer/Resizer.d.ts +3 -1
  64. package/lib/component/elements/resizer/SVGResizer.js +24 -53
  65. package/lib/component/elements/resizer/useResizer.d.ts +11 -0
  66. package/lib/component/elements/resizer/useResizer.js +65 -0
  67. package/lib/component/hooks/useExport.d.ts +1 -1
  68. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +3 -0
  69. package/lib/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +0 -9
  70. package/lib/component/hooks/usePanelPreferences.d.ts +7 -0
  71. package/lib/component/hooks/usePanelPreferences.js +54 -0
  72. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  73. package/lib/component/loader/DefaultSpinnerComponent.d.ts +3 -1
  74. package/lib/component/loader/DefaultSpinnerComponent.js +2 -2
  75. package/lib/component/loader/SpinnerContext.d.ts +3 -3
  76. package/lib/component/loader/SpinnerContext.js +2 -2
  77. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -4
  78. package/lib/component/modal/MoleculeStructureEditorModal.js +22 -1
  79. package/lib/component/modal/editRange/EditRangeModal.js +6 -5
  80. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +2 -0
  81. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
  82. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +3 -1
  83. package/lib/component/modal/editRange/forms/components/SignalsForm.js +12 -9
  84. package/lib/component/modal/setting/DatabasesTabContent.d.ts +6 -0
  85. package/lib/component/modal/setting/DatabasesTabContent.js +75 -0
  86. package/lib/component/modal/setting/DisplayTabContent.js +11 -7
  87. package/lib/component/modal/setting/FormattingTabContent.js +5 -5
  88. package/lib/component/modal/setting/GeneralSettings.js +2 -1
  89. package/lib/component/modal/setting/settingsValidation.d.ts +48 -0
  90. package/lib/component/modal/setting/settingsValidation.js +33 -27
  91. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
  92. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +0 -1
  93. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
  94. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +2 -2
  95. package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -11
  96. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +1 -1
  97. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +26 -74
  98. package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +8 -0
  99. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +38 -0
  100. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
  101. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +10 -2
  102. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +12 -1
  103. package/lib/component/panels/MoleculesPanel/Utilities.js +11 -0
  104. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -1
  105. package/lib/component/panels/Panels.js +2 -3
  106. package/lib/component/panels/PeaksPanel/PeaksPanel.js +3 -3
  107. package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +1 -1
  108. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +29 -82
  109. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -5
  110. package/lib/component/panels/PeaksPanel/PeaksTable.js +18 -25
  111. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  112. package/lib/component/panels/RangesPanel/RangesHeader.js +15 -9
  113. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -10
  114. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +1 -1
  115. package/lib/component/panels/RangesPanel/RangesPreferences.js +55 -66
  116. package/lib/component/panels/RangesPanel/RangesTable.d.ts +11 -6
  117. package/lib/component/panels/RangesPanel/RangesTable.js +3 -7
  118. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +5 -2
  119. package/lib/component/panels/RangesPanel/RangesTableRow.js +3 -3
  120. package/lib/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -2
  121. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.d.ts +2 -1
  122. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
  123. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.d.ts +2 -1
  124. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
  125. package/lib/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -2
  126. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  127. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
  128. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
  129. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.d.ts +13 -0
  130. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +14 -0
  131. package/lib/component/panels/RangesPanel/TableColumns/format.js +2 -2
  132. package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.d.ts +18 -0
  133. package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.js +18 -0
  134. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.d.ts +1 -2
  135. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +7 -68
  136. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
  137. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.d.ts +1 -2
  138. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +7 -68
  139. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
  140. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
  141. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.d.ts +6 -0
  142. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +51 -0
  143. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  144. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +5 -1
  145. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
  146. package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +1 -1
  147. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +20 -84
  148. package/lib/component/panels/ZonesPanel/ZonesTable.js +4 -1
  149. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +5 -1
  150. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  151. package/lib/component/panels/databasePanel/DatabasePanel.js +73 -40
  152. package/lib/component/panels/databasePanel/DatabasePreferences.js +10 -42
  153. package/lib/component/panels/databasePanel/DatabaseTable.js +23 -11
  154. package/lib/component/panels/databasePanel/useDatabases.d.ts +5 -0
  155. package/lib/component/panels/databasePanel/useDatabases.js +10 -0
  156. package/lib/component/panels/extra/placeholder/NoTableData.d.ts +3 -1
  157. package/lib/component/panels/extra/placeholder/NoTableData.js +2 -2
  158. package/lib/component/panels/extra/preferences/ColumnsHelper.js +3 -3
  159. package/lib/component/panels/extra/preferences/NucleusPreferences.d.ts +13 -0
  160. package/lib/component/panels/extra/preferences/NucleusPreferences.js +22 -0
  161. package/lib/component/panels/extra/preferences/PreferencesContainer.d.ts +6 -0
  162. package/lib/component/panels/extra/preferences/PreferencesContainer.js +10 -0
  163. package/lib/component/panels/extra/preferences/PreferencesGroup.d.ts +7 -0
  164. package/lib/component/panels/extra/preferences/PreferencesGroup.js +21 -0
  165. package/lib/component/reducer/Reducer.d.ts +358 -45
  166. package/lib/component/reducer/Reducer.js +5 -1
  167. package/lib/component/reducer/actions/LoadActions.js +2 -2
  168. package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -2
  169. package/lib/component/reducer/actions/MoleculeActions.js +15 -3
  170. package/lib/component/reducer/actions/PreferencesActions.js +1 -1
  171. package/lib/component/reducer/actions/ToolsActions.js +1 -1
  172. package/lib/component/reducer/preferences/actions/addWorkspace.d.ts +3 -0
  173. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -0
  174. package/lib/component/reducer/preferences/actions/initPreferences.d.ts +3 -0
  175. package/lib/component/reducer/preferences/actions/initPreferences.js +60 -0
  176. package/lib/component/reducer/preferences/actions/removeWorkspace.d.ts +3 -0
  177. package/lib/component/reducer/preferences/actions/removeWorkspace.js +20 -0
  178. package/lib/component/reducer/preferences/actions/resetPreferences.d.ts +3 -0
  179. package/lib/component/reducer/preferences/actions/resetPreferences.js +14 -0
  180. package/lib/component/reducer/preferences/actions/setPanelsPreferences.d.ts +3 -0
  181. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +13 -0
  182. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +3 -0
  183. package/lib/component/reducer/preferences/actions/setPreferences.js +34 -0
  184. package/lib/component/reducer/preferences/actions/setWorkspace.d.ts +3 -0
  185. package/lib/component/reducer/preferences/actions/setWorkspace.js +8 -0
  186. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +7 -0
  187. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +55 -0
  188. package/lib/component/reducer/{preferencesReducer.d.ts → preferences/preferencesReducer.d.ts} +131 -7
  189. package/lib/component/reducer/preferences/preferencesReducer.js +80 -0
  190. package/lib/component/reducer/preferences/utilites/checkKeysExists.d.ts +1 -0
  191. package/lib/component/reducer/preferences/utilites/checkKeysExists.js +14 -0
  192. package/lib/component/reducer/preferences/utilites/filterObject.d.ts +1 -0
  193. package/lib/component/reducer/preferences/utilites/filterObject.js +7 -0
  194. package/lib/component/reducer/preferences/utilites/flatObject.d.ts +1 -0
  195. package/lib/component/reducer/preferences/utilites/flatObject.js +9 -0
  196. package/lib/component/reducer/preferences/utilites/getActiveWorkspace.d.ts +3 -0
  197. package/lib/component/reducer/preferences/utilites/getActiveWorkspace.js +3 -0
  198. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.d.ts +2 -0
  199. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +4 -0
  200. package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.d.ts +5 -0
  201. package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.js +8 -0
  202. package/lib/component/reducer/types/Types.d.ts +2 -0
  203. package/lib/component/reducer/types/Types.js +2 -0
  204. package/lib/component/tool/FloatMoleculeStructures/ActionsButton.d.ts +4 -0
  205. package/lib/component/tool/FloatMoleculeStructures/ActionsButton.js +7 -0
  206. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +14 -0
  207. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +43 -0
  208. package/lib/component/tool/FloatMoleculeStructures/index.d.ts +15 -0
  209. package/lib/component/tool/FloatMoleculeStructures/index.js +28 -0
  210. package/lib/component/utility/Export.js +6 -0
  211. package/lib/component/utility/PathBuilder.js +2 -1
  212. package/lib/component/utility/formatNumber.d.ts +3 -0
  213. package/lib/component/utility/formatNumber.js +10 -0
  214. package/lib/component/utility/getUniqueNuclei.d.ts +1 -0
  215. package/lib/component/utility/getUniqueNuclei.js +10 -0
  216. package/lib/component/workspaces/Workspace.d.ts +72 -1
  217. package/lib/component/workspaces/basic.js +9 -1
  218. package/lib/component/workspaces/embedded.d.ts +2 -0
  219. package/lib/component/workspaces/embedded.js +32 -0
  220. package/lib/component/workspaces/exercise.js +2 -0
  221. package/lib/component/workspaces/index.d.ts +1 -0
  222. package/lib/component/workspaces/index.js +2 -1
  223. package/lib/component/workspaces/prediction.js +2 -0
  224. package/lib/component/workspaces/process1D.js +2 -0
  225. package/lib/data/data1d/Data1DManager.js +4 -0
  226. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.d.ts +2 -0
  227. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.js +10 -0
  228. package/lib/data/data1d/Spectrum1D/get1DDataXY.d.ts +2 -2
  229. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  230. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
  231. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
  232. package/lib/data/data1d/database.d.ts +8 -13
  233. package/lib/data/data1d/database.js +14 -19
  234. package/lib/data/data1d/filter1d/absolute.d.ts +3 -2
  235. package/lib/data/data1d/filter1d/autoPhaseCorrection.d.ts +3 -2
  236. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +3 -2
  237. package/lib/data/data1d/filter1d/centerMean.d.ts +3 -2
  238. package/lib/data/data1d/filter1d/digitalFilter.d.ts +3 -2
  239. package/lib/data/data1d/filter1d/equallySpaced.d.ts +3 -2
  240. package/lib/data/data1d/filter1d/exclusionZones.js +4 -4
  241. package/lib/data/data1d/filter1d/fft.d.ts +3 -2
  242. package/lib/data/data1d/filter1d/fft.js +2 -2
  243. package/lib/data/data1d/filter1d/fromTo.d.ts +3 -2
  244. package/lib/data/data1d/filter1d/lineBroadening.d.ts +3 -2
  245. package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
  246. package/lib/data/data1d/filter1d/pareto.d.ts +3 -2
  247. package/lib/data/data1d/filter1d/pareto.js +2 -2
  248. package/lib/data/data1d/filter1d/phaseCorrection.d.ts +3 -2
  249. package/lib/data/data1d/filter1d/shiftX.d.ts +2 -1
  250. package/lib/data/data1d/filter1d/standardDeviation.d.ts +3 -2
  251. package/lib/data/data1d/filter1d/zeroFilling.d.ts +3 -2
  252. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  253. package/lib/data/data2d/Data2DManager.js +4 -0
  254. package/lib/data/data2d/filter2d/shiftX.d.ts +4 -3
  255. package/lib/data/data2d/filter2d/shiftX.js +2 -2
  256. package/lib/data/data2d/filter2d/shiftY.d.ts +4 -3
  257. package/lib/data/data2d/filter2d/shiftY.js +2 -2
  258. package/lib/data/molecules/Molecule.d.ts +3 -3
  259. package/lib/data/molecules/Molecule.js +7 -1
  260. package/lib/data/molecules/MoleculeManager.d.ts +4 -1
  261. package/lib/data/molecules/MoleculeManager.js +33 -2
  262. package/lib/data/types/data1d/Data1D.d.ts +3 -3
  263. package/lib/data/types/data1d/Info1D.d.ts +1 -0
  264. package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
  265. package/lib/versionInfo.js +1 -1
  266. package/lib-cjs/component/1d/Chart1D.js +3 -2
  267. package/lib-cjs/component/1d/FooterBanner.js +2 -2
  268. package/lib-cjs/component/1d/Integral.js +5 -12
  269. package/lib-cjs/component/1d/IntegralResizable.js +10 -5
  270. package/lib-cjs/component/1d/IntegralsSeries.js +3 -3
  271. package/lib-cjs/component/1d/PeakAnnotation.js +5 -4
  272. package/lib-cjs/component/1d/database/DatabaseElements.js +23 -0
  273. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +60 -0
  274. package/lib-cjs/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
  275. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +4 -10
  276. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +10 -5
  277. package/lib-cjs/component/1d/ranges/Range.js +17 -9
  278. package/lib-cjs/component/1d/ranges/Ranges.js +6 -3
  279. package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
  280. package/lib-cjs/component/2d/Chart2D.js +2 -1
  281. package/lib-cjs/component/2d/Contours.js +4 -1
  282. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  283. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  284. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +10 -4
  285. package/lib-cjs/component/NMRium.js +5 -2
  286. package/lib-cjs/component/SplitPaneWrapper.js +12 -0
  287. package/lib-cjs/component/context/GlobalContext.js +1 -1
  288. package/lib-cjs/component/context/PreferencesContext.js +1 -1
  289. package/lib-cjs/component/elements/Button.js +1 -1
  290. package/lib-cjs/component/elements/ColorInput.js +2 -2
  291. package/lib-cjs/component/elements/EditableColumn.js +27 -20
  292. package/lib-cjs/component/elements/Input.js +18 -5
  293. package/lib-cjs/component/elements/Select.js +20 -14
  294. package/lib-cjs/component/elements/ToggleButton.js +2 -2
  295. package/lib-cjs/component/elements/draggble/SVGDraggable.js +39 -0
  296. package/lib-cjs/component/elements/draggble/useDraggable.js +73 -0
  297. package/lib-cjs/component/elements/formik/FormikColorPicker.js +10 -7
  298. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +2 -2
  299. package/lib-cjs/component/elements/formik/FormikInput.js +6 -3
  300. package/lib-cjs/component/elements/formik/FormikSlider.js +6 -3
  301. package/lib-cjs/component/elements/popup/Alert/Provider.js +1 -1
  302. package/lib-cjs/component/elements/resizer/DivResizer.js +17 -62
  303. package/lib-cjs/component/elements/resizer/SVGResizer.js +24 -53
  304. package/lib-cjs/component/elements/resizer/useResizer.js +71 -0
  305. package/lib-cjs/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +1 -11
  306. package/lib-cjs/component/hooks/usePanelPreferences.js +62 -0
  307. package/lib-cjs/component/loader/DefaultSpinnerComponent.js +2 -2
  308. package/lib-cjs/component/loader/SpinnerContext.js +2 -2
  309. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -1
  310. package/lib-cjs/component/modal/editRange/EditRangeModal.js +6 -5
  311. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
  312. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +12 -9
  313. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +80 -0
  314. package/lib-cjs/component/modal/setting/DisplayTabContent.js +11 -7
  315. package/lib-cjs/component/modal/setting/FormattingTabContent.js +4 -4
  316. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -1
  317. package/lib-cjs/component/modal/setting/settingsValidation.js +33 -27
  318. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
  319. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
  320. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -11
  321. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +24 -72
  322. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +44 -0
  323. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
  324. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +9 -1
  325. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +11 -0
  326. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  327. package/lib-cjs/component/panels/Panels.js +2 -3
  328. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -4
  329. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +27 -80
  330. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +18 -48
  331. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +15 -9
  332. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +4 -10
  333. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +53 -64
  334. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +3 -7
  335. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
  336. package/lib-cjs/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -5
  337. package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
  338. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
  339. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -5
  340. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  341. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
  342. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +16 -0
  343. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +2 -2
  344. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/PlotChart.js +21 -0
  345. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +10 -68
  346. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
  347. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +10 -68
  348. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
  349. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
  350. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +55 -0
  351. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  352. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
  353. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +18 -82
  354. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +4 -1
  355. package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  356. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +72 -39
  357. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +10 -42
  358. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +22 -10
  359. package/lib-cjs/component/panels/databasePanel/useDatabases.js +14 -0
  360. package/lib-cjs/component/panels/extra/placeholder/NoTableData.js +2 -2
  361. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +3 -3
  362. package/lib-cjs/component/panels/extra/preferences/NucleusPreferences.js +29 -0
  363. package/lib-cjs/component/panels/extra/preferences/PreferencesContainer.js +14 -0
  364. package/lib-cjs/component/panels/extra/preferences/PreferencesGroup.js +25 -0
  365. package/lib-cjs/component/reducer/Reducer.js +5 -1
  366. package/lib-cjs/component/reducer/actions/LoadActions.js +2 -2
  367. package/lib-cjs/component/reducer/actions/MoleculeActions.js +17 -3
  368. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -1
  369. package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -1
  370. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +26 -0
  371. package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +67 -0
  372. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +24 -0
  373. package/lib-cjs/component/reducer/preferences/actions/resetPreferences.js +18 -0
  374. package/lib-cjs/component/reducer/preferences/actions/setPanelsPreferences.js +17 -0
  375. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +38 -0
  376. package/lib-cjs/component/reducer/preferences/actions/setWorkspace.js +12 -0
  377. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +62 -0
  378. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +87 -0
  379. package/lib-cjs/component/reducer/preferences/utilites/checkKeysExists.js +18 -0
  380. package/lib-cjs/component/reducer/preferences/utilites/filterObject.js +11 -0
  381. package/lib-cjs/component/reducer/preferences/utilites/flatObject.js +13 -0
  382. package/lib-cjs/component/reducer/preferences/utilites/getActiveWorkspace.js +7 -0
  383. package/lib-cjs/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +11 -0
  384. package/lib-cjs/component/reducer/preferences/utilites/mapNucleiFormatting.js +12 -0
  385. package/lib-cjs/component/reducer/types/Types.js +5 -3
  386. package/lib-cjs/component/tool/FloatMoleculeStructures/ActionsButton.js +13 -0
  387. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +50 -0
  388. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +36 -0
  389. package/lib-cjs/component/utility/Export.js +6 -0
  390. package/lib-cjs/component/utility/PathBuilder.js +2 -1
  391. package/lib-cjs/component/utility/formatNumber.js +17 -0
  392. package/lib-cjs/component/utility/getUniqueNuclei.js +14 -0
  393. package/lib-cjs/component/workspaces/basic.js +9 -1
  394. package/lib-cjs/component/workspaces/embedded.js +35 -0
  395. package/lib-cjs/component/workspaces/exercise.js +2 -0
  396. package/lib-cjs/component/workspaces/index.js +2 -1
  397. package/lib-cjs/component/workspaces/prediction.js +2 -0
  398. package/lib-cjs/component/workspaces/process1D.js +2 -0
  399. package/lib-cjs/data/data1d/Data1DManager.js +4 -0
  400. package/lib-cjs/data/data1d/Spectrum1D/convertDataToFloat64Array.js +14 -0
  401. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  402. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
  403. package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
  404. package/lib-cjs/data/data1d/database.js +15 -21
  405. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +4 -4
  406. package/lib-cjs/data/data1d/filter1d/fft.js +2 -2
  407. package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
  408. package/lib-cjs/data/data1d/filter1d/pareto.js +2 -2
  409. package/lib-cjs/data/data1d/filter1d/shiftX.js +2 -2
  410. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  411. package/lib-cjs/data/data2d/Data2DManager.js +4 -0
  412. package/lib-cjs/data/data2d/filter2d/shiftX.js +4 -4
  413. package/lib-cjs/data/data2d/filter2d/shiftY.js +4 -4
  414. package/lib-cjs/data/molecules/Molecule.js +7 -1
  415. package/lib-cjs/data/molecules/MoleculeManager.js +37 -3
  416. package/lib-cjs/versionInfo.js +1 -1
  417. package/package.json +42 -40
  418. package/lib/component/elements/resizer/useDraggable.js +0 -52
  419. package/lib/component/panels/extra/preferences/defaultValues.d.ts +0 -54
  420. package/lib/component/panels/extra/preferences/defaultValues.js +0 -54
  421. package/lib/component/reducer/preferencesReducer.js +0 -269
  422. package/lib/component/utility/FormatNumber.d.ts +0 -6
  423. package/lib-cjs/component/elements/resizer/useDraggable.js +0 -55
  424. package/lib-cjs/component/panels/extra/preferences/defaultValues.js +0 -61
  425. package/lib-cjs/component/reducer/preferencesReducer.js +0 -276
@@ -6,101 +6,55 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const PreferencesContext_1 = require("../../context/PreferencesContext");
9
- const IsotopesViewer_1 = __importDefault(require("../../elements/IsotopesViewer"));
10
- const FormikColumnFormatField_1 = __importDefault(require("../../elements/formik/FormikColumnFormatField"));
11
9
  const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
12
10
  const Alert_1 = require("../../elements/popup/Alert");
13
11
  const useNucleus_1 = __importDefault(require("../../hooks/useNucleus"));
14
- const LocalStorage_1 = require("../../utility/LocalStorage");
15
- const defaultValues_1 = require("../extra/preferences/defaultValues");
16
- const styles = {
17
- container: {
18
- padding: 10,
19
- backgroundColor: '#f1f1f1',
20
- height: '100%',
21
- overflowY: 'auto',
22
- },
23
- groupContainer: {
24
- padding: '5px',
25
- borderRadius: '5px',
26
- margin: '10px 0px',
27
- backgroundColor: 'white',
28
- },
29
- row: {
30
- display: 'flex',
31
- margin: '5px 0px',
32
- },
33
- header: {
34
- borderBottom: '1px solid #e8e8e8',
35
- paddingBottom: '5px',
36
- fontWeight: 'bold',
37
- color: '#4a4a4a',
38
- },
39
- inputLabel: {
40
- flex: 2,
41
- fontSize: '11px',
42
- fontWeight: 'bold',
43
- color: '#232323',
44
- },
45
- input: {
46
- width: '30%',
47
- textAlign: 'center',
48
- },
49
- };
12
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
13
+ const getUniqueNuclei_1 = require("../../utility/getUniqueNuclei");
14
+ const NucleusPreferences_1 = require("../extra/preferences/NucleusPreferences");
15
+ const PreferencesContainer_1 = require("../extra/preferences/PreferencesContainer");
50
16
  const formatFields = [
51
17
  {
52
18
  id: 1,
53
19
  label: 'Peak Number :',
54
- checkController: 'showPeakNumber',
55
- formatController: 'peakNumberFormat',
20
+ checkControllerName: 'peakNumber.show',
21
+ formatControllerName: 'peakNumber.format',
56
22
  },
57
23
  {
58
24
  id: 2,
59
- label: 'Peak Index : ',
60
- checkController: 'showPeakIndex',
61
- formatController: 'peakIndexFormat',
25
+ label: 'δ (ppm) :',
26
+ checkControllerName: 'deltaPPM.show',
27
+ formatControllerName: 'deltaPPM.format',
62
28
  },
63
29
  {
64
30
  id: 3,
65
- label: 'δ (ppm) :',
66
- checkController: 'showDeltaPPM',
67
- formatController: 'deltaPPMFormat',
31
+ label: 'δ (Hz) :',
32
+ checkControllerName: 'deltaHz.show',
33
+ formatControllerName: 'deltaHz.format',
68
34
  },
69
35
  {
70
36
  id: 4,
71
- label: 'δ (Hz) :',
72
- checkController: 'showDeltaHz',
73
- formatController: 'deltaHzFormat',
37
+ label: 'Peak Width (Hz)',
38
+ checkControllerName: 'peakWidth.show',
39
+ formatControllerName: 'peakWidth.format',
74
40
  },
75
41
  {
76
42
  id: 5,
77
- label: 'Peak Width',
78
- checkController: 'showPeakWidth',
79
- formatController: 'peakWidthFormat',
80
- },
81
- {
82
- id: 6,
83
43
  label: 'Intensity :',
84
- checkController: 'showIntensity',
85
- formatController: 'intensityFormat',
44
+ checkControllerName: 'intensity.show',
45
+ formatControllerName: 'intensity.format',
86
46
  },
87
47
  ];
88
- function PeaksPreferencesInner({ nucleus, preferences, innerRef, }) {
48
+ function PeaksPreferences(props, ref) {
89
49
  const alert = (0, Alert_1.useAlert)();
90
50
  const formRef = (0, react_1.useRef)(null);
91
- const updateValues = (0, react_1.useCallback)(() => {
92
- if (nucleus) {
93
- const defaultValues = nucleus.reduce((acc, nucleusLabel) => {
94
- acc[nucleusLabel] = defaultValues_1.peaksDefaultValues;
95
- return acc;
96
- }, {});
97
- const peaksPreferences = (0, LocalStorage_1.getValue)(preferences.current, `formatting.panels.peaks`);
98
- formRef.current.setValues(peaksPreferences ? peaksPreferences : defaultValues);
99
- }
100
- }, [nucleus, preferences]);
51
+ const preferences = (0, PreferencesContext_1.usePreferences)();
52
+ const nucleus = (0, useNucleus_1.default)();
53
+ const nuclei = (0, react_1.useMemo)(() => (0, getUniqueNuclei_1.getUniqueNuclei)(nucleus), [nucleus]);
54
+ const preferencesByNuclei = (0, usePanelPreferences_1.usePanelPreferencesByNuclei)('peaks', nuclei);
101
55
  (0, react_1.useEffect)(() => {
102
- updateValues();
103
- }, [updateValues]);
56
+ formRef.current.setValues(preferencesByNuclei);
57
+ }, [preferencesByNuclei]);
104
58
  const saveHandler = (0, react_1.useCallback)((values) => {
105
59
  preferences.dispatch({
106
60
  type: 'SET_PANELS_PREFERENCES',
@@ -108,18 +62,11 @@ function PeaksPreferencesInner({ nucleus, preferences, innerRef, }) {
108
62
  });
109
63
  alert.success('Peaks preferences saved successfully');
110
64
  }, [alert, preferences]);
111
- (0, react_1.useImperativeHandle)(innerRef, () => ({
65
+ (0, react_1.useImperativeHandle)(ref, () => ({
112
66
  saveSetting: () => {
113
67
  formRef.current.submitForm();
114
68
  },
115
69
  }), []);
116
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { style: styles.header, value: nucleusLabel }), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}`, hideFormat: field.formatController === 'deltaPPMFormat' }, field.id)))] }, nucleusLabel))) }) }));
117
- }
118
- const MemoizedPeaksPreferences = (0, react_1.memo)(PeaksPreferencesInner);
119
- // TODO: remove this hacky use of ref.
120
- function PeaksPreferences(props, ref) {
121
- const nucleus = (0, useNucleus_1.default)();
122
- const preferences = (0, PreferencesContext_1.usePreferences)();
123
- return ((0, jsx_runtime_1.jsx)(MemoizedPeaksPreferences, { innerRef: ref, ...{ nucleus, preferences } }));
70
+ return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nuclei?.map((n) => ((0, jsx_runtime_1.jsx)(NucleusPreferences_1.NucleusPreferences, { nucleus: n, fields: formatFields }, n))) }) }));
124
71
  }
125
- exports.default = (0, react_1.forwardRef)(PeaksPreferences);
72
+ exports.default = (0, react_1.memo)((0, react_1.forwardRef)(PeaksPreferences));
@@ -1,46 +1,22 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const get_1 = __importDefault(require("lodash/get"));
30
8
  const react_1 = require("react");
31
9
  const fa_1 = require("react-icons/fa");
32
10
  const DispatchContext_1 = require("../../context/DispatchContext");
33
11
  const EditableColumn_1 = __importDefault(require("../../elements/EditableColumn"));
34
12
  const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
35
13
  const addCustomColumn_1 = __importDefault(require("../../elements/ReactTable/utility/addCustomColumn"));
14
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
36
15
  const Types_1 = require("../../reducer/types/Types");
37
- const FormatNumber_1 = __importStar(require("../../utility/FormatNumber"));
38
- const LocalStorage_1 = require("../../utility/LocalStorage");
16
+ const formatNumber_1 = require("../../utility/formatNumber");
39
17
  const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
40
- const defaultValues_1 = require("../extra/preferences/defaultValues");
41
- function PeaksTable({ activeTab, preferences, data, info }) {
18
+ function PeaksTable({ activeTab, data }) {
42
19
  const dispatch = (0, DispatchContext_1.useDispatch)();
43
- const format = (0, FormatNumber_1.useFormatNumberByNucleus)(info.nucleus);
44
20
  const deletePeakHandler = (0, react_1.useCallback)((e, row) => {
45
21
  e.preventDefault();
46
22
  e.stopPropagation();
@@ -50,52 +26,46 @@ function PeaksTable({ activeTab, preferences, data, info }) {
50
26
  data: { id: params.id, xIndex: params.xIndex },
51
27
  });
52
28
  }, [dispatch]);
53
- const peaksPreferences = (0, react_1.useMemo)(() => (0, LocalStorage_1.getValue)(preferences.current, `formatting.panels.peaks.[${activeTab}]`, defaultValues_1.peaksDefaultValues), [activeTab, preferences]);
29
+ const peaksPreferences = (0, usePanelPreferences_1.usePanelPreferences)('peaks', activeTab);
54
30
  const saveDeltaPPMRefsHandler = (0, react_1.useCallback)((event, row) => {
55
31
  const shiftValue = parseFloat(event.target.value) - parseFloat(row.value);
56
32
  dispatch({ type: Types_1.SHIFT_SPECTRUM, shiftValue });
57
33
  }, [dispatch]);
58
34
  const COLUMNS = (0, react_1.useMemo)(() => [
59
35
  {
60
- showWhen: 'showPeakNumber',
36
+ showWhen: 'peakNumber.show',
61
37
  index: 1,
62
38
  Header: '#',
63
39
  Cell: ({ row }) => row.index + 1,
64
40
  style: { width: '1%', maxWidth: '40px', minWidth: '40px' },
65
41
  },
66
42
  {
67
- showWhen: 'showPeakIndex',
68
- index: 2,
69
- Header: 'index',
70
- accessor: (row) => (0, FormatNumber_1.default)(row.xIndex, peaksPreferences.peakIndexFormat),
71
- },
72
- {
73
- showWhen: 'showDeltaPPM',
43
+ showWhen: 'deltaPPM.show',
74
44
  index: 3,
75
45
  Header: 'δ (ppm)',
76
- accessor: (row) => format(row.value),
77
- Cell: ({ row }) => ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: format(row.original.value), onSave: (event) => saveDeltaPPMRefsHandler(event, row.original), type: "number" })),
46
+ accessor: (row) => (0, formatNumber_1.formatNumber)(row.value, peaksPreferences.deltaPPM.format),
47
+ Cell: ({ row }) => ((0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: (0, formatNumber_1.formatNumber)(row.original.value, peaksPreferences.deltaPPM.format), onSave: (event) => saveDeltaPPMRefsHandler(event, row.original), type: "number" })),
78
48
  },
79
49
  {
80
- showWhen: 'showDeltaHz',
50
+ showWhen: 'deltaHz.show',
81
51
  index: 4,
82
52
  Header: 'δ (Hz)',
83
- accessor: (row) => (0, FormatNumber_1.default)(row.valueHz, peaksPreferences.deltaHzFormat),
53
+ accessor: (row) => (0, formatNumber_1.formatNumber)(row.valueHz, peaksPreferences.deltaHz.format),
84
54
  },
85
55
  {
86
- showWhen: 'showIntensity',
56
+ showWhen: 'intensity.show',
87
57
  index: 5,
88
58
  Header: 'Intensity',
89
59
  style: { maxWidth: '80px' },
90
- accessor: (row) => (0, FormatNumber_1.default)(row.intensity, peaksPreferences.intensityFormat),
60
+ accessor: (row) => (0, formatNumber_1.formatNumber)(row.intensity, peaksPreferences.intensity.format),
91
61
  },
92
62
  {
93
- showWhen: 'showPeakWidth',
63
+ showWhen: 'peakWidth.show',
94
64
  index: 6,
95
- Header: 'Peak Width',
96
- accessor: (row) => (0, FormatNumber_1.default)(row.peakWidth, peaksPreferences.peakWidthFormat),
65
+ Header: 'Width (Hz)',
66
+ accessor: (row) => (0, formatNumber_1.formatNumber)(row.peakWidth, peaksPreferences.peakWidth.format),
97
67
  },
98
- ], [format, peaksPreferences, saveDeltaPPMRefsHandler]);
68
+ ], [peaksPreferences, saveDeltaPPMRefsHandler]);
99
69
  const initialColumns = (0, react_1.useMemo)(() => [
100
70
  {
101
71
  index: 20,
@@ -113,7 +83,7 @@ function PeaksTable({ activeTab, preferences, data, info }) {
113
83
  let columns = [...initialColumns];
114
84
  for (const col of COLUMNS) {
115
85
  const { showWhen, ...colParams } = col;
116
- if (peaksPreferences[showWhen]) {
86
+ if ((0, get_1.default)(peaksPreferences, showWhen)) {
117
87
  (0, addCustomColumn_1.default)(columns, colParams);
118
88
  }
119
89
  }
@@ -14,16 +14,16 @@ const fa_1 = require("react-icons/fa");
14
14
  const im_1 = require("react-icons/im");
15
15
  const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
16
16
  const DispatchContext_1 = require("../../context/DispatchContext");
17
- const PreferencesContext_1 = require("../../context/PreferencesContext");
18
17
  const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
19
18
  const ToggleButton_1 = __importDefault(require("../../elements/ToggleButton"));
20
19
  const Alert_1 = require("../../elements/popup/Alert");
21
20
  const Modal_1 = require("../../elements/popup/Modal");
21
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
22
22
  const CopyClipboardModal_1 = __importDefault(require("../../modal/CopyClipboardModal"));
23
23
  const ChangeSumModal_1 = __importDefault(require("../../modal/changeSum/ChangeSumModal"));
24
24
  const Types_1 = require("../../reducer/types/Types");
25
25
  const Export_1 = require("../../utility/Export");
26
- const FormatNumber_1 = require("../../utility/FormatNumber");
26
+ const formatNumber_1 = require("../../utility/formatNumber");
27
27
  const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
28
28
  const style = (0, react_1.css) `
29
29
  .btn {
@@ -43,13 +43,13 @@ const style = (0, react_1.css) `
43
43
  margin-right: 2px;
44
44
  }
45
45
  `;
46
- function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, }) {
46
+ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }) {
47
47
  const dispatch = (0, DispatchContext_1.useDispatch)();
48
48
  const modal = (0, Modal_1.useModal)();
49
49
  const alert = (0, Alert_1.useAlert)();
50
- const preferences = (0, PreferencesContext_1.usePreferences)();
51
50
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
52
51
  const currentSum = (0, get_1.default)(ranges, 'options.sum', null);
52
+ const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
53
53
  const changeRangesSumHandler = (0, react_2.useCallback)((value) => {
54
54
  dispatch({ type: Types_1.CHANGE_RANGE_SUM, value });
55
55
  modal.close();
@@ -107,9 +107,8 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
107
107
  }, [alert]);
108
108
  const saveAsHTMLHandler = (0, react_2.useCallback)(() => {
109
109
  const { originFrequency: observedFrequency, nucleus } = info;
110
- const format = (0, get_1.default)(preferences.current, `formatting.nuclei[${nucleus.toLowerCase()}]`, '0.0');
111
- const nbDecimalDelta = (0, FormatNumber_1.getNumberOfDecimals)(format.ppm);
112
- const nbDecimalJ = (0, FormatNumber_1.getNumberOfDecimals)(format.hz);
110
+ const nbDecimalDelta = (0, formatNumber_1.getNumberOfDecimals)(rangesPreferences.deltaPPM.format);
111
+ const nbDecimalJ = (0, formatNumber_1.getNumberOfDecimals)(rangesPreferences.deltaHz.format);
113
112
  const result = (0, nmr_processing_1.rangesToACS)(ranges.values, {
114
113
  nucleus,
115
114
  nbDecimalDelta,
@@ -117,7 +116,14 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
117
116
  observedFrequency, //400
118
117
  });
119
118
  modal.show((0, jsx_runtime_1.jsx)(CopyClipboardModal_1.default, { text: result, onCopyClick: saveToClipboardHandler, onClose: () => modal.close() }), {});
120
- }, [info, modal, preferences, ranges.values, saveToClipboardHandler]);
119
+ }, [
120
+ info,
121
+ modal,
122
+ ranges.values,
123
+ rangesPreferences?.deltaHz?.format,
124
+ rangesPreferences?.deltaPPM?.format,
125
+ saveToClipboardHandler,
126
+ ]);
121
127
  const changeSumConstantFlagHandler = (0, react_2.useCallback)((flag) => {
122
128
  dispatch({
123
129
  type: Types_1.CHANGE_RANGES_SUM_FLAG,
@@ -126,7 +132,7 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
126
132
  }, [dispatch]);
127
133
  return ((0, jsx_runtime_1.jsx)("div", { css: style, children: (0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { counter: ranges?.values?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', filterIsActive: isFilterActive, counterFiltered: filterCounter, showSettingButton: true, onSettingClick: onSettingClick, children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Preview publication string", popupPlacement: "right", onClick: saveAsHTMLHandler, className: "btn preview-publication-icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: currentSum
128
134
  ? `Change Ranges Sum (${Number(currentSum).toFixed(2)})`
129
- : 'Change Ranges Sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Remove all Assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !ranges || !ranges.values || ranges.values.length === 0, className: "btn icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: showMultiplicityTrees
135
+ : 'Change Ranges Sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Remove all Assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !ranges || !ranges.values || ranges.values.length === 0, className: "btn icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { testID: "toggle-multiplicity-tree-btn", popupTitle: showMultiplicityTrees
130
136
  ? 'Hide Multiplicity Trees in Spectrum'
131
137
  : 'Show Multiplicity Trees in Spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, defaultValue: showRangesIntegrals, disabled: !ranges || !ranges.values || ranges.values.length === 0, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { className: "icon", popupTitle: "fix integral values", popupPlacement: "right", onClick: changeSumConstantFlagHandler, children: (0, jsx_runtime_1.jsx)(im_1.ImLink, {}) })] }) }));
132
138
  }
@@ -6,20 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
7
  /** @jsxImportSource @emotion/react */
8
8
  const react_1 = require("@emotion/react");
9
- const get_1 = __importDefault(require("lodash/get"));
10
9
  const ml_spectra_processing_1 = require("ml-spectra-processing");
11
10
  const react_2 = require("react");
12
11
  const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
13
12
  const ChartContext_1 = require("../../context/ChartContext");
14
13
  const DispatchContext_1 = require("../../context/DispatchContext");
15
- const PreferencesContext_1 = require("../../context/PreferencesContext");
16
14
  const Alert_1 = require("../../elements/popup/Alert");
15
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
17
16
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
18
17
  const Types_1 = require("../../reducer/types/Types");
19
18
  const Export_1 = require("../../utility/Export");
20
19
  const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
21
20
  const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
22
- const defaultValues_1 = require("../extra/preferences/defaultValues");
23
21
  const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
24
22
  const RangesHeader_1 = __importDefault(require("./RangesHeader"));
25
23
  const RangesPreferences_1 = __importDefault(require("./RangesPreferences"));
@@ -89,10 +87,6 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
89
87
  }
90
88
  }
91
89
  }, [data, alert]);
92
- const rangesPreferences = (0, react_2.useMemo)(() => {
93
- const _preferences = (0, get_1.default)(preferences.current, `formatting.panels.ranges.[${activeTab}]`) || (0, defaultValues_1.getRangeDefaultValues)(activeTab);
94
- return _preferences;
95
- }, [activeTab, preferences]);
96
90
  const contextMenu = (0, react_2.useMemo)(() => [
97
91
  {
98
92
  label: 'Copy to clipboard',
@@ -126,14 +120,14 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
126
120
  showMultiplicityTrees,
127
121
  showJGraph,
128
122
  isFilterActive,
129
- }, onUnlink: unlinkRangeHandler, onFilterActivated: filterHandler, onSettingClick: settingsPanelHandler, filterCounter: rangesData.length })), 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.jsx)("div", { className: "table-container", children: rangesData && rangesData.length > 0 ? ((0, jsx_runtime_1.jsx)(RangesTable_1.default, { activeTab: activeTab, tableData: rangesData, onUnlink: unlinkRangeHandler, context: contextMenu, preferences: rangesPreferences })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {})) })) : ((0, jsx_runtime_1.jsx)(RangesPreferences_1.default, { ref: settingRef })) })] }) }));
123
+ }, onUnlink: unlinkRangeHandler, onFilterActivated: filterHandler, onSettingClick: settingsPanelHandler, filterCounter: rangesData.length })), 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.jsx)("div", { className: "table-container", children: rangesData && rangesData.length > 0 ? ((0, jsx_runtime_1.jsx)(RangesTable_1.default, { activeTab: activeTab, tableData: rangesData, onUnlink: unlinkRangeHandler, context: contextMenu, preferences: preferences, info: info })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {})) })) : ((0, jsx_runtime_1.jsx)(RangesPreferences_1.default, { ref: settingRef })) })] }) }));
130
124
  }
131
125
  const MemoizedRangesTablePanel = (0, react_2.memo)(RangesTablePanelInner);
132
126
  const emptyData = { ranges: {}, data: {}, info: {} };
133
127
  function RangesTablePanel() {
134
128
  const { displayerKey, xDomain, activeTab, molecules, toolOptions: { selectedTool, data: { showMultiplicityTrees, showRangesIntegrals, showJGraph }, }, } = (0, ChartContext_1.useChartData)();
135
129
  const { ranges, data, info } = (0, useSpectrum_1.default)(emptyData);
136
- const preferences = (0, PreferencesContext_1.usePreferences)();
130
+ const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
137
131
  return ((0, jsx_runtime_1.jsx)(MemoizedRangesTablePanel, { ...{
138
132
  ranges,
139
133
  data,
@@ -143,7 +137,7 @@ function RangesTablePanel() {
143
137
  showRangesIntegrals,
144
138
  selectedTool,
145
139
  displayerKey,
146
- preferences,
140
+ preferences: rangesPreferences,
147
141
  xDomain,
148
142
  activeTab,
149
143
  molecules,
@@ -6,38 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const PreferencesContext_1 = require("../../context/PreferencesContext");
9
- const IsotopesViewer_1 = __importDefault(require("../../elements/IsotopesViewer"));
10
9
  const Label_1 = __importDefault(require("../../elements/Label"));
11
- const FormikColumnFormatField_1 = __importDefault(require("../../elements/formik/FormikColumnFormatField"));
12
10
  const FormikForm_1 = __importDefault(require("../../elements/formik/FormikForm"));
13
11
  const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
14
12
  const Alert_1 = require("../../elements/popup/Alert");
15
13
  const useNucleus_1 = __importDefault(require("../../hooks/useNucleus"));
16
- const LocalStorage_1 = require("../../utility/LocalStorage");
17
- const defaultValues_1 = require("../extra/preferences/defaultValues");
14
+ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
15
+ const getUniqueNuclei_1 = require("../../utility/getUniqueNuclei");
16
+ const NucleusPreferences_1 = require("../extra/preferences/NucleusPreferences");
17
+ const PreferencesContainer_1 = require("../extra/preferences/PreferencesContainer");
18
18
  const styles = {
19
- container: {
20
- padding: 10,
21
- backgroundColor: '#f1f1f1',
22
- height: '100%',
23
- overflowY: 'auto',
24
- },
25
- groupContainer: {
26
- padding: '5px',
27
- borderRadius: '5px',
28
- margin: '10px 0px',
29
- backgroundColor: 'white',
30
- },
31
- row: {
32
- display: 'flex',
33
- margin: '5px 0px',
34
- },
35
- header: {
36
- borderBottom: '1px solid #e8e8e8',
37
- paddingBottom: '5px',
38
- fontWeight: 'bold',
39
- color: '#4a4a4a',
40
- },
41
19
  inputLabel: {
42
20
  flex: 2,
43
21
  },
@@ -50,45 +28,63 @@ const styles = {
50
28
  const formatFields = [
51
29
  {
52
30
  id: 1,
53
- label: 'From :',
54
- checkController: 'showFrom',
55
- formatController: 'fromFormat',
31
+ label: 'From (ppm) :',
32
+ checkControllerName: 'from.show',
33
+ formatControllerName: 'from.format',
56
34
  },
57
35
  {
58
36
  id: 2,
59
- label: 'To :',
60
- checkController: 'showTo',
61
- formatController: 'toFormat',
37
+ label: 'To (ppm) :',
38
+ checkControllerName: 'to.show',
39
+ formatControllerName: 'to.format',
62
40
  },
63
41
  {
64
42
  id: 3,
65
- label: 'Absolute :',
66
- checkController: 'showAbsolute',
67
- formatController: 'absoluteFormat',
43
+ label: 'Absolute integration :',
44
+ checkControllerName: 'absolute.show',
45
+ formatControllerName: 'absolute.format',
68
46
  },
69
47
  {
70
48
  id: 4,
71
- label: 'Relative :',
72
- checkController: 'showRelative',
73
- formatController: 'relativeFormat',
49
+ label: 'Relative integration :',
50
+ checkControllerName: 'relative.show',
51
+ formatControllerName: 'relative.format',
52
+ },
53
+ {
54
+ id: 5,
55
+ label: 'δ (ppm) :',
56
+ checkControllerName: 'deltaPPM.show',
57
+ formatControllerName: 'deltaPPM.format',
58
+ },
59
+ {
60
+ id: 6,
61
+ label: 'δ (Hz) :',
62
+ checkControllerName: 'deltaHz.show',
63
+ formatControllerName: 'deltaHz.format',
64
+ },
65
+ {
66
+ id: 7,
67
+ label: 'Coupling (Hz) :',
68
+ checkControllerName: 'coupling.show',
69
+ formatControllerName: 'coupling.format',
70
+ },
71
+ {
72
+ id: 8,
73
+ label: 'Kind :',
74
+ checkControllerName: 'showKind',
75
+ hideFormatField: true,
74
76
  },
75
77
  ];
76
- function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
78
+ function RangesPreferences(props, ref) {
77
79
  const alert = (0, Alert_1.useAlert)();
78
80
  const formRef = (0, react_1.useRef)();
79
- const updateValues = (0, react_1.useCallback)(() => {
80
- if (nucleus) {
81
- const defaultValues = nucleus.reduce((acc, nucleusLabel) => {
82
- acc[nucleusLabel] = (0, defaultValues_1.getRangeDefaultValues)(nucleusLabel);
83
- return acc;
84
- }, {});
85
- const rangesPreferences = (0, LocalStorage_1.getValue)(preferences.current, `formatting.panels.ranges`);
86
- formRef.current.setValues(rangesPreferences ? rangesPreferences : defaultValues);
87
- }
88
- }, [nucleus, preferences]);
81
+ const preferences = (0, PreferencesContext_1.usePreferences)();
82
+ const nucleus = (0, useNucleus_1.default)();
83
+ const nuclei = (0, react_1.useMemo)(() => (0, getUniqueNuclei_1.getUniqueNuclei)(nucleus), [nucleus]);
84
+ const preferencesByNuclei = (0, usePanelPreferences_1.usePanelPreferencesByNuclei)('ranges', nuclei);
89
85
  (0, react_1.useEffect)(() => {
90
- updateValues();
91
- }, [updateValues]);
86
+ formRef.current.setValues(preferencesByNuclei);
87
+ }, [preferencesByNuclei]);
92
88
  const saveHandler = (0, react_1.useCallback)((values) => {
93
89
  preferences.dispatch({
94
90
  type: 'SET_PANELS_PREFERENCES',
@@ -96,21 +92,14 @@ function RangesPreferencesInner({ nucleus, preferences, innerRef, }) {
96
92
  });
97
93
  alert.success('ranges preferences saved successfully');
98
94
  }, [alert, preferences]);
99
- (0, react_1.useImperativeHandle)(innerRef, () => ({
95
+ (0, react_1.useImperativeHandle)(ref, () => ({
100
96
  saveSetting: () => {
101
97
  formRef.current.submitForm();
102
98
  },
103
99
  }), []);
104
- return ((0, jsx_runtime_1.jsx)("div", { style: styles.container, children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nucleus?.map((nucleusLabel) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.groupContainer, children: [(0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { style: styles.header, value: nucleusLabel }), formatFields.map((field) => ((0, jsx_runtime_1.jsx)(FormikColumnFormatField_1.default, { label: field.label, checkControllerName: `${nucleusLabel}.${field.checkController}`, formatControllerName: `${nucleusLabel}.${field.formatController}` }, field.id))), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "J Graph tolerance (Hz) :", style: { label: styles.inputLabel, wrapper: styles.inputWrapper }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `${nucleusLabel}.jGraphTolerance`, type: "number" }) })] }, nucleusLabel))) }) }));
105
- }
106
- const MemoizedRangesPreferences = (0, react_1.memo)(RangesPreferencesInner);
107
- // TODO: remove this hacky use of ref.
108
- function RangesPreferences(prop, ref) {
109
- const nucleus = (0, useNucleus_1.default)();
110
- const preferences = (0, PreferencesContext_1.usePreferences)();
111
- return ((0, jsx_runtime_1.jsx)(MemoizedRangesPreferences, { innerRef: ref, ...{
112
- preferences,
113
- nucleus,
114
- } }));
100
+ return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { onSubmit: saveHandler, ref: formRef, children: nuclei?.map((n) => ((0, jsx_runtime_1.jsx)(NucleusPreferences_1.NucleusPreferences, { nucleus: n, fields: formatFields, renderBottom: () => ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "J Graph tolerance (Hz) :", style: {
101
+ label: styles.inputLabel,
102
+ wrapper: styles.inputWrapper,
103
+ }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `nuclei.${n}.jGraphTolerance`, type: "number" }) })) }, n))) }) }));
115
104
  }
116
- exports.default = (0, react_1.forwardRef)(RangesPreferences);
105
+ exports.default = (0, react_1.memo)((0, react_1.forwardRef)(RangesPreferences));
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
7
7
  /** @jsxImportSource @emotion/react */
8
8
  const react_1 = require("@emotion/react");
9
- const get_1 = __importDefault(require("lodash/get"));
10
9
  const react_2 = require("react");
11
10
  const fa_1 = require("react-icons/fa");
12
11
  const checkModifierKeyActivated_1 = __importDefault(require("../../../data/utilities/checkModifierKeyActivated"));
@@ -53,22 +52,19 @@ const tableStyle = (0, react_1.css) `
53
52
  }
54
53
  }
55
54
  `;
56
- function RangesTable({ tableData, onUnlink, context, activeTab, preferences }) {
55
+ function RangesTable({ tableData, onUnlink, context, activeTab, preferences, info, }) {
57
56
  const element = activeTab?.replace(/[0-9]/g, '');
58
57
  const contextRef = (0, react_2.useRef)();
59
58
  const { items: sortedData, isSortedDesc, onSort } = (0, useTableSortBy_1.default)(tableData);
60
59
  const data = (0, useMapRanges_1.default)(sortedData);
61
- const isVisible = (key) => {
62
- return (0, get_1.default)(preferences, key, false);
63
- };
64
60
  const contextMenuHandler = (0, react_2.useCallback)((e, rowData) => {
65
61
  if (!(0, checkModifierKeyActivated_1.default)(e)) {
66
62
  e.preventDefault();
67
63
  contextRef.current.handleContextMenu(e, rowData);
68
64
  }
69
65
  }, [contextRef]);
70
- return ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsxs)("table", { css: tableStyle, children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "#" }), isVisible('showFrom') ? ((0, jsx_runtime_1.jsxs)("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })) : null, isVisible('showTo') ? ((0, jsx_runtime_1.jsxs)("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })) : null, (0, jsx_runtime_1.jsx)("th", { children: "\u03B4 (ppm) " }), isVisible('showRelative') ? ((0, jsx_runtime_1.jsxs)("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })) : null, isVisible('showAbsolute') ? (0, jsx_runtime_1.jsx)("th", { children: "Absolute" }) : null, (0, jsx_runtime_1.jsx)("th", { children: "Mult." }), (0, jsx_runtime_1.jsx)("th", { children: "J (Hz)" }), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(fa_1.FaLink, { style: { fontSize: 10 } }) }), (0, jsx_runtime_1.jsx)("th", { children: "\u03A3" }), (0, jsx_runtime_1.jsx)("th", { children: "Kind" }), (0, jsx_runtime_1.jsx)("th", { children: '' })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: data?.map((range) => {
71
- return ((0, jsx_runtime_1.jsx)(RangesTableRow_1.default, { rowData: range, onUnlink: onUnlink, onContextMenu: (e, rowData) => contextMenuHandler(e, rowData), preferences: preferences }, range.rowKey));
66
+ return ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsxs)("table", { css: tableStyle, children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { children: "#" }), preferences.from.show && ((0, jsx_runtime_1.jsxs)("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && ((0, jsx_runtime_1.jsxs)("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show && (0, jsx_runtime_1.jsx)("th", { children: "\u03B4 (ppm) " }), preferences.deltaHz.show && (0, jsx_runtime_1.jsx)("th", { children: "\u03B4 (Hz) " }), preferences.relative.show && ((0, jsx_runtime_1.jsxs)("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })), preferences.absolute.show && (0, jsx_runtime_1.jsx)("th", { children: "Absolute" }), (0, jsx_runtime_1.jsx)("th", { children: "Mult." }), preferences.coupling.show && (0, jsx_runtime_1.jsx)("th", { children: "J (Hz)" }), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(fa_1.FaLink, { style: { fontSize: 10 } }) }), (0, jsx_runtime_1.jsx)("th", { children: "\u03A3" }), preferences.showKind && (0, jsx_runtime_1.jsx)("th", { children: "Kind" }), (0, jsx_runtime_1.jsx)("th", { children: '' })] }) }), (0, jsx_runtime_1.jsx)("tbody", { children: data?.map((range) => {
67
+ return ((0, jsx_runtime_1.jsx)(RangesTableRow_1.default, { rowData: range, onUnlink: onUnlink, onContextMenu: (e, rowData) => contextMenuHandler(e, rowData), preferences: preferences, info: info }, range.rowKey));
72
68
  }) })] }), (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: context })] }));
73
69
  }
74
70
  exports.default = RangesTable;