nmrium 0.31.0 → 0.33.0-pre.1667632695

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 (492) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/FooterBanner.js +17 -10
  3. package/lib/component/1d/LinesSeries.js +1 -1
  4. package/lib/component/1d/SpectraTracker.js +1 -1
  5. package/lib/component/1d/Viewer1D.js +1 -1
  6. package/lib/component/1d/XAxis.js +1 -1
  7. package/lib/component/1d/database/DatabaseSpectrum.js +2 -1
  8. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  9. package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
  10. package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
  11. package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
  12. package/lib/component/1d/integral/IntegralIndicator.js +27 -0
  13. package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
  14. package/lib/component/1d/integral/IntegralResizable.js +69 -0
  15. package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
  16. package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  17. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  18. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  19. package/lib/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  20. package/lib/component/1d/peaks/PeakAnnotation.js +1 -1
  21. package/lib/component/1d/peaks/usePeakShapesPath.js +10 -6
  22. package/lib/component/1d/ranges/Range.js +27 -50
  23. package/lib/component/1d/tool/PeakPointer.js +1 -1
  24. package/lib/component/1d/utilities/scale.js +2 -2
  25. package/lib/component/2d/Contours.js +61 -42
  26. package/lib/component/2d/FooterBanner.js +2 -2
  27. package/lib/component/2d/Left1DChart.js +1 -1
  28. package/lib/component/2d/Top1DChart.js +1 -1
  29. package/lib/component/2d/Viewer2D.js +11 -14
  30. package/lib/component/2d/tools/XYLabelPointer.js +2 -2
  31. package/lib/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  32. package/lib/component/2d/zones/IndicationLines.js +5 -8
  33. package/lib/component/EventsTrackers/BrushTracker.js +30 -21
  34. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -15
  35. package/lib/component/NMRium.d.ts +1 -1
  36. package/lib/component/NMRium.js +6 -6
  37. package/lib/component/SplitPaneWrapper.js +1 -1
  38. package/lib/component/assignment/actions/initAssignment.js +17 -17
  39. package/lib/component/assignment/index.js +2 -2
  40. package/lib/component/context/PreferencesContext.js +3 -6
  41. package/lib/component/elements/Button.js +1 -1
  42. package/lib/component/elements/CheckBoxCell.js +1 -1
  43. package/lib/component/elements/ContextMenu.js +2 -2
  44. package/lib/component/elements/EditableColumn.d.ts +3 -1
  45. package/lib/component/elements/EditableColumn.js +21 -8
  46. package/lib/component/elements/GroupPane.d.ts +12 -0
  47. package/lib/component/elements/GroupPane.js +14 -0
  48. package/lib/component/elements/Input.js +7 -4
  49. package/lib/component/elements/IsotopesViewer.js +1 -1
  50. package/lib/component/elements/Label.js +1 -2
  51. package/lib/component/elements/MolecularFormulaInput.js +2 -0
  52. package/lib/component/elements/NumberInput.js +2 -2
  53. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  54. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -1
  55. package/lib/component/elements/ReactTable/ReactTable.js +72 -38
  56. package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +3 -2
  57. package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  58. package/lib/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  59. package/lib/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  60. package/lib/component/elements/accordion/Accordion.js +2 -2
  61. package/lib/component/elements/draggble/useDraggable.js +1 -3
  62. package/lib/component/elements/dropDownButton/DropDownList.js +1 -2
  63. package/lib/component/elements/formik/FormikCheckBox.js +1 -1
  64. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  65. package/lib/component/elements/formik/FormikColorPicker.js +5 -8
  66. package/lib/component/elements/formik/FormikErrorsSummary.js +2 -2
  67. package/lib/component/elements/formik/FormikForm.js +2 -2
  68. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  69. package/lib/component/elements/formik/FormikInput.js +12 -20
  70. package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
  71. package/lib/component/elements/formik/FormikOnChange.js +13 -10
  72. package/lib/component/elements/formik/FormikSelect.js +1 -1
  73. package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
  74. package/lib/component/elements/formik/FormikSlider.js +8 -11
  75. package/lib/component/elements/formik/FormikTextarea.js +1 -1
  76. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  77. package/lib/component/elements/popup/Alert/Provider.js +7 -7
  78. package/lib/component/elements/popup/Alert/index.d.ts +3 -4
  79. package/lib/component/elements/popup/Alert/index.js +3 -4
  80. package/lib/component/elements/popup/Modal/ModalContent.js +3 -1
  81. package/lib/component/elements/popup/Modal/Provider.js +16 -31
  82. package/lib/component/elements/popup/Modal/index.d.ts +4 -5
  83. package/lib/component/elements/popup/Modal/index.js +4 -5
  84. package/lib/component/header/Header.js +1 -1
  85. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  86. package/lib/component/hooks/useCombinedRefs.js +2 -2
  87. package/lib/component/hooks/useExport.d.ts +1 -1
  88. package/lib/component/hooks/useExport.js +9 -6
  89. package/lib/component/hooks/useFormatNumberByNucleus.js +1 -1
  90. package/lib/component/hooks/usePanelPreferences.js +9 -7
  91. package/lib/component/loader/DropZone.js +10 -2
  92. package/lib/component/modal/AlignSpectraModal.js +1 -1
  93. package/lib/component/modal/ExportAsMatrixModal.js +1 -1
  94. package/lib/component/modal/LoadJCAMPModal.js +2 -2
  95. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  96. package/lib/component/modal/MultipletAnalysisModal.js +3 -3
  97. package/lib/component/modal/PredictSpectraModal.js +5 -5
  98. package/lib/component/modal/editRange/EditRangeModal.js +4 -4
  99. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  100. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  101. package/lib/component/modal/setting/DatabasesTabContent.js +25 -20
  102. package/lib/component/modal/setting/DisplayTabContent.js +21 -27
  103. package/lib/component/modal/setting/FormattingTabContent.js +10 -10
  104. package/lib/component/modal/setting/GeneralSettings.js +11 -14
  105. package/lib/component/modal/setting/GeneralTabContent.js +3 -1
  106. package/lib/component/modal/setting/ToolsTabContent.js +18 -19
  107. package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -1
  108. package/lib/component/modal/setting/WorkspaceItem.js +36 -48
  109. package/lib/component/modal/setting/settingsValidation.d.ts +58 -57
  110. package/lib/component/modal/setting/settingsValidation.js +14 -12
  111. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  112. package/lib/component/panels/InformationPanel.js +52 -56
  113. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  114. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  115. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  116. package/lib/component/panels/MoleculesPanel/Utilities.js +6 -6
  117. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  118. package/lib/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  119. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  120. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  121. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  122. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  123. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  124. package/lib/component/panels/PeaksPanel/PeaksTable.js +2 -2
  125. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  126. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  127. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  128. package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
  129. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  130. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  131. package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  132. package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  133. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  134. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +5 -5
  135. package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  136. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
  137. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  138. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
  139. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  140. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
  141. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  142. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  143. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  144. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  145. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  146. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  147. package/lib/component/panels/ZonesPanel/ZonesTable.js +8 -8
  148. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -4
  149. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +2 -1
  150. package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
  151. package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  152. package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +2 -2
  153. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  154. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  155. package/lib/component/reducer/IgnoreActions.js +3 -3
  156. package/lib/component/reducer/Reducer.d.ts +26 -45
  157. package/lib/component/reducer/Reducer.js +13 -12
  158. package/lib/component/reducer/actions/CorrelationsActions.js +4 -4
  159. package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
  160. package/lib/component/reducer/actions/DomainActions.js +52 -69
  161. package/lib/component/reducer/actions/FiltersActions.js +15 -6
  162. package/lib/component/reducer/actions/HistoryActions.js +5 -5
  163. package/lib/component/reducer/actions/IntegralsActions.js +6 -5
  164. package/lib/component/reducer/actions/LoadActions.js +12 -0
  165. package/lib/component/reducer/actions/PeaksActions.js +7 -6
  166. package/lib/component/reducer/actions/PreferencesActions.js +20 -38
  167. package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
  168. package/lib/component/reducer/actions/RangesActions.js +28 -24
  169. package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
  170. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
  171. package/lib/component/reducer/actions/ToolsActions.js +28 -41
  172. package/lib/component/reducer/actions/ZonesActions.js +11 -10
  173. package/lib/component/reducer/core/Constants.js +1 -1
  174. package/lib/component/reducer/helper/GetClosestNumber.js +2 -1
  175. package/lib/component/reducer/helper/Zoom1DManager.js +11 -10
  176. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
  177. package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
  178. package/lib/component/reducer/helper/getSpectrum.js +3 -5
  179. package/lib/component/reducer/helper/getStrongestPeak.d.ts +1 -1
  180. package/lib/component/reducer/helper/getStrongestPeak.js +2 -3
  181. package/lib/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  182. package/lib/component/reducer/preferences/actions/setPreferences.js +5 -6
  183. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  184. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -4
  185. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  186. package/lib/component/tool/BrushX.js +3 -3
  187. package/lib/component/tool/BrushXY.js +5 -5
  188. package/lib/component/tool/CrossLinePointer.js +3 -3
  189. package/lib/component/toolbar/BasicToolBar.js +9 -8
  190. package/lib/component/utility/Evaluate.js +2 -2
  191. package/lib/component/utility/FileUtility.d.ts +2 -9
  192. package/lib/component/utility/FileUtility.js +11 -28
  193. package/lib/component/utility/GroupByInfoKey.d.ts +1 -1
  194. package/lib/component/utility/GroupByInfoKey.js +11 -13
  195. package/lib/component/utility/PathBuilder.js +1 -1
  196. package/lib/component/utility/PreferencesHelper.js +2 -3
  197. package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
  198. package/lib/component/utility/{Export.js → export.js} +54 -73
  199. package/lib/component/utility/formatNumber.d.ts +6 -1
  200. package/lib/component/utility/formatNumber.js +5 -4
  201. package/lib/component/workspaces/Workspace.d.ts +1 -1
  202. package/lib/component/workspaces/exercise.js +4 -4
  203. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  204. package/lib/data/Filters.d.ts +16 -18
  205. package/lib/data/Filters.js +16 -18
  206. package/lib/data/FiltersManager.js +4 -3
  207. package/lib/data/PredictionManager.js +8 -10
  208. package/lib/data/SpectraManager.d.ts +1 -2
  209. package/lib/data/SpectraManager.js +25 -60
  210. package/lib/data/data1d/MultipleAnalysis.js +74 -70
  211. package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
  212. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  213. package/lib/data/data1d/Spectrum1D/index.d.ts +24 -25
  214. package/lib/data/data1d/Spectrum1D/index.js +24 -25
  215. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  216. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  217. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  218. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  219. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  220. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  221. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  222. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +35 -1
  223. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +35 -1
  224. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  225. package/lib/data/data1d/database.js +45 -28
  226. package/lib/data/data1d/filter1d/apodization.js +2 -1
  227. package/lib/data/data1d/filter1d/fft.js +24 -7
  228. package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
  229. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  230. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  231. package/lib/data/data2d/Processing2D.d.ts +3 -3
  232. package/lib/data/data2d/Processing2D.js +10 -20
  233. package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
  234. package/lib/data/data2d/Spectrum2D/contours.js +132 -0
  235. package/lib/data/data2d/Spectrum2D/index.d.ts +10 -11
  236. package/lib/data/data2d/Spectrum2D/index.js +10 -11
  237. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  238. package/lib/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  239. package/lib/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  240. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  241. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  242. package/lib/data/molecules/MoleculeManager.js +1 -1
  243. package/lib/data/types/common/Source.d.ts +1 -0
  244. package/lib/data/types/data1d/index.d.ts +12 -13
  245. package/lib/data/types/data2d/Data2D.d.ts +2 -0
  246. package/lib/data/types/data2d/Datum2D.d.ts +0 -1
  247. package/lib/data/types/data2d/index.d.ts +8 -9
  248. package/lib/data/utilities/RangeUtilities.js +13 -9
  249. package/lib/data/utilities/ZoneUtilities.js +17 -13
  250. package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
  251. package/lib/data/utilities/calculateSanPlot.js +31 -0
  252. package/lib/data/utilities/checkModifierKeyActivated.js +1 -2
  253. package/lib/data/utilities/generateChar.js +8 -6
  254. package/lib/data/utilities/getAtom.js +1 -1
  255. package/lib/data/utilities/getAtomsFromMF.js +2 -2
  256. package/lib/data/utilities/getColor.js +3 -3
  257. package/lib/data/utilities/getSum.js +6 -3
  258. package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
  259. package/lib/versionInfo.js +1 -1
  260. package/lib-cjs/component/1d/Chart1D.js +1 -1
  261. package/lib-cjs/component/1d/FooterBanner.js +16 -9
  262. package/lib-cjs/component/1d/LinesSeries.js +1 -1
  263. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  264. package/lib-cjs/component/1d/Viewer1D.js +1 -1
  265. package/lib-cjs/component/1d/XAxis.js +1 -1
  266. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
  267. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  268. package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
  269. package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
  270. package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
  271. package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  272. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  273. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  274. package/lib-cjs/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  275. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -1
  276. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +10 -6
  277. package/lib-cjs/component/1d/ranges/Range.js +27 -50
  278. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  279. package/lib-cjs/component/1d/utilities/scale.js +2 -2
  280. package/lib-cjs/component/2d/Contours.js +60 -41
  281. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  282. package/lib-cjs/component/2d/Left1DChart.js +1 -1
  283. package/lib-cjs/component/2d/Top1DChart.js +1 -1
  284. package/lib-cjs/component/2d/Viewer2D.js +11 -14
  285. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  286. package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  287. package/lib-cjs/component/2d/zones/IndicationLines.js +5 -8
  288. package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
  289. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +14 -15
  290. package/lib-cjs/component/NMRium.js +7 -7
  291. package/lib-cjs/component/SplitPaneWrapper.js +1 -1
  292. package/lib-cjs/component/assignment/actions/initAssignment.js +17 -17
  293. package/lib-cjs/component/assignment/index.js +2 -2
  294. package/lib-cjs/component/context/PreferencesContext.js +3 -6
  295. package/lib-cjs/component/elements/Button.js +1 -1
  296. package/lib-cjs/component/elements/CheckBoxCell.js +1 -1
  297. package/lib-cjs/component/elements/ContextMenu.js +2 -2
  298. package/lib-cjs/component/elements/EditableColumn.js +21 -8
  299. package/lib-cjs/component/elements/GroupPane.js +18 -0
  300. package/lib-cjs/component/elements/Input.js +7 -4
  301. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  302. package/lib-cjs/component/elements/Label.js +1 -2
  303. package/lib-cjs/component/elements/MolecularFormulaInput.js +2 -0
  304. package/lib-cjs/component/elements/NumberInput.js +2 -2
  305. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  306. package/lib-cjs/component/elements/ReactTable/ReactTable.js +71 -37
  307. package/lib-cjs/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  308. package/lib-cjs/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  309. package/lib-cjs/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  310. package/lib-cjs/component/elements/accordion/Accordion.js +2 -2
  311. package/lib-cjs/component/elements/draggble/useDraggable.js +1 -3
  312. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +1 -2
  313. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  314. package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
  315. package/lib-cjs/component/elements/formik/FormikErrorsSummary.js +2 -2
  316. package/lib-cjs/component/elements/formik/FormikForm.js +2 -2
  317. package/lib-cjs/component/elements/formik/FormikInput.js +12 -20
  318. package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
  319. package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
  320. package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
  321. package/lib-cjs/component/elements/formik/FormikTextarea.js +1 -1
  322. package/lib-cjs/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  323. package/lib-cjs/component/elements/popup/Alert/Provider.js +8 -8
  324. package/lib-cjs/component/elements/popup/Alert/index.js +5 -5
  325. package/lib-cjs/component/elements/popup/Modal/ModalContent.js +3 -1
  326. package/lib-cjs/component/elements/popup/Modal/Provider.js +16 -31
  327. package/lib-cjs/component/elements/popup/Modal/index.js +7 -7
  328. package/lib-cjs/component/header/Header.js +1 -1
  329. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  330. package/lib-cjs/component/hooks/useCombinedRefs.js +2 -2
  331. package/lib-cjs/component/hooks/useExport.js +14 -11
  332. package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +1 -1
  333. package/lib-cjs/component/hooks/usePanelPreferences.js +9 -7
  334. package/lib-cjs/component/loader/DropZone.js +10 -2
  335. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -1
  336. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
  337. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -2
  338. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  339. package/lib-cjs/component/modal/MultipletAnalysisModal.js +3 -3
  340. package/lib-cjs/component/modal/PredictSpectraModal.js +5 -5
  341. package/lib-cjs/component/modal/editRange/EditRangeModal.js +4 -4
  342. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  343. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  344. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +25 -20
  345. package/lib-cjs/component/modal/setting/DisplayTabContent.js +21 -27
  346. package/lib-cjs/component/modal/setting/FormattingTabContent.js +10 -10
  347. package/lib-cjs/component/modal/setting/GeneralSettings.js +11 -14
  348. package/lib-cjs/component/modal/setting/GeneralTabContent.js +3 -1
  349. package/lib-cjs/component/modal/setting/ToolsTabContent.js +18 -19
  350. package/lib-cjs/component/modal/setting/WorkspaceItem.js +37 -49
  351. package/lib-cjs/component/modal/setting/settingsValidation.js +14 -12
  352. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  353. package/lib-cjs/component/panels/InformationPanel.js +51 -55
  354. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  355. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  356. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
  357. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +6 -6
  358. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  359. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  360. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  361. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
  362. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  363. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  364. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  365. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +2 -2
  366. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
  367. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  368. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +1 -1
  369. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
  370. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  371. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  372. package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  373. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  374. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  375. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +6 -6
  376. package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  377. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  378. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  379. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
  380. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  381. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  382. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  383. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  384. package/lib-cjs/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  385. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  386. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -8
  387. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -4
  388. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +20 -5
  389. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  390. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  391. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +1 -1
  392. package/lib-cjs/component/reducer/IgnoreActions.js +3 -3
  393. package/lib-cjs/component/reducer/Reducer.js +12 -11
  394. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +4 -4
  395. package/lib-cjs/component/reducer/actions/DomainActions.js +52 -69
  396. package/lib-cjs/component/reducer/actions/FiltersActions.js +15 -6
  397. package/lib-cjs/component/reducer/actions/HistoryActions.js +5 -5
  398. package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
  399. package/lib-cjs/component/reducer/actions/LoadActions.js +12 -0
  400. package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
  401. package/lib-cjs/component/reducer/actions/PreferencesActions.js +20 -38
  402. package/lib-cjs/component/reducer/actions/RangesActions.js +28 -24
  403. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
  404. package/lib-cjs/component/reducer/actions/ToolsActions.js +28 -41
  405. package/lib-cjs/component/reducer/actions/ZonesActions.js +11 -10
  406. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  407. package/lib-cjs/component/reducer/helper/GetClosestNumber.js +2 -1
  408. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +11 -10
  409. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
  410. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -5
  411. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -3
  412. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  413. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +5 -9
  414. package/lib-cjs/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  415. package/lib-cjs/component/tool/BrushX.js +3 -3
  416. package/lib-cjs/component/tool/BrushXY.js +5 -5
  417. package/lib-cjs/component/tool/CrossLinePointer.js +3 -3
  418. package/lib-cjs/component/toolbar/BasicToolBar.js +8 -7
  419. package/lib-cjs/component/utility/Evaluate.js +2 -2
  420. package/lib-cjs/component/utility/FileUtility.js +11 -29
  421. package/lib-cjs/component/utility/GroupByInfoKey.js +11 -13
  422. package/lib-cjs/component/utility/PathBuilder.js +1 -1
  423. package/lib-cjs/component/utility/PreferencesHelper.js +2 -3
  424. package/lib-cjs/component/utility/{Export.js → export.js} +78 -74
  425. package/lib-cjs/component/utility/formatNumber.js +5 -4
  426. package/lib-cjs/component/workspaces/exercise.js +4 -4
  427. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
  428. package/lib-cjs/data/Filters.js +17 -35
  429. package/lib-cjs/data/FiltersManager.js +4 -3
  430. package/lib-cjs/data/PredictionManager.js +8 -10
  431. package/lib-cjs/data/SpectraManager.js +26 -62
  432. package/lib-cjs/data/data1d/MultipleAnalysis.js +74 -70
  433. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
  434. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  435. package/lib-cjs/data/data1d/Spectrum1D/index.js +25 -25
  436. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  437. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  438. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  439. package/lib-cjs/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  440. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  441. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  442. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  443. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  444. package/lib-cjs/data/data1d/database.js +45 -28
  445. package/lib-cjs/data/data1d/filter1d/apodization.js +2 -1
  446. package/lib-cjs/data/data1d/filter1d/fft.js +23 -6
  447. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
  448. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  449. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  450. package/lib-cjs/data/data2d/Processing2D.js +10 -20
  451. package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
  452. package/lib-cjs/data/data2d/Spectrum2D/index.js +11 -11
  453. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  454. package/lib-cjs/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  455. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  456. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  457. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  458. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  459. package/lib-cjs/data/utilities/RangeUtilities.js +13 -9
  460. package/lib-cjs/data/utilities/ZoneUtilities.js +17 -13
  461. package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
  462. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +1 -2
  463. package/lib-cjs/data/utilities/generateChar.js +8 -6
  464. package/lib-cjs/data/utilities/getAtom.js +1 -1
  465. package/lib-cjs/data/utilities/getAtomsFromMF.js +2 -2
  466. package/lib-cjs/data/utilities/getColor.js +3 -3
  467. package/lib-cjs/data/utilities/getSum.js +6 -3
  468. package/lib-cjs/versionInfo.js +1 -1
  469. package/package.json +36 -31
  470. package/lib/component/1d/IntegralResizable.js +0 -72
  471. package/lib/component/elements/popup/helpers.d.ts +0 -1
  472. package/lib/component/elements/popup/helpers.js +0 -9
  473. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
  474. package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
  475. package/lib/data/data1d/Data1DManager.d.ts +0 -3
  476. package/lib/data/data1d/Data1DManager.js +0 -98
  477. package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
  478. package/lib/data/data1d/filter1d/absolute.js +0 -26
  479. package/lib/data/data2d/Data2DManager.d.ts +0 -3
  480. package/lib/data/data2d/Data2DManager.js +0 -34
  481. package/lib/data/types/data2d/Contour.d.ts +0 -4
  482. package/lib/data/types/data2d/Contour.js +0 -1
  483. package/lib/data/types/data2d/Contours.d.ts +0 -2
  484. package/lib/data/types/data2d/Contours.js +0 -1
  485. package/lib-cjs/component/1d/IntegralResizable.js +0 -77
  486. package/lib-cjs/component/elements/popup/helpers.js +0 -13
  487. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
  488. package/lib-cjs/data/data1d/Data1DManager.js +0 -104
  489. package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
  490. package/lib-cjs/data/data2d/Data2DManager.js +0 -40
  491. package/lib-cjs/data/types/data2d/Contour.js +0 -2
  492. package/lib-cjs/data/types/data2d/Contours.js +0 -2
@@ -1,64 +1,83 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import debounce from 'lodash/debounce';
2
3
  import get from 'lodash/get';
3
- import { memo, useMemo } from 'react';
4
+ import { memo, useMemo, useRef } from 'react';
4
5
  import { getShift } from '../../data/data2d/Spectrum2D';
6
+ import { drawContours, getDefaultContoursLevel, } from '../../data/data2d/Spectrum2D/contours';
5
7
  import { useChartData } from '../context/ChartContext';
6
8
  import { usePreferences } from '../context/PreferencesContext';
9
+ import { useAlert } from '../elements/popup/Alert';
7
10
  import { useActiveSpectrum } from '../reducer/Reducer';
8
11
  import { PathBuilder } from '../utility/PathBuilder';
12
+ import nucleusToString from '../utility/nucleusToString';
9
13
  import { get2DXScale, get2DYScale } from './utilities/scale';
10
- function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
11
- const { margin, width, height, xDomain, yDomain, contours } = useChartData();
12
- const activeSpectrum = useActiveSpectrum();
13
- const preferences = usePreferences();
14
+ function usePath(datum, contours) {
15
+ const { margin, width, height, xDomain, yDomain } = useChartData();
14
16
  const { xShift, yShift } = getShift(datum);
15
- const isActive = useMemo(() => {
16
- return activeSpectrum === null ? true : spectrumID === activeSpectrum.id;
17
- }, [activeSpectrum, spectrumID]);
18
- function buildContourPath(data) {
19
- const _scaleX = get2DXScale({ margin, width, xDomain });
20
- const _scaleY = get2DYScale({ margin, height, yDomain });
21
- const pathBuilder = new PathBuilder();
22
- for (const element of data) {
23
- if (element.lines) {
24
- const lines = element.lines;
25
- if (lines.length < 1e6) {
26
- for (let i = 0; i < lines.length; i += 4) {
27
- pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
28
- pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
29
- }
17
+ const _scaleX = get2DXScale({ margin, width, xDomain });
18
+ const _scaleY = get2DYScale({ margin, height, yDomain });
19
+ const pathBuilder = new PathBuilder();
20
+ for (const element of contours) {
21
+ if (element.lines) {
22
+ const lines = element.lines;
23
+ if (lines.length < 1e6) {
24
+ for (let i = 0; i < lines.length; i += 4) {
25
+ pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
26
+ pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
30
27
  }
31
28
  }
32
- else {
33
- pathBuilder.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
34
- for (let j = 1; j < element.length; j++) {
35
- pathBuilder.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
36
- }
29
+ }
30
+ else {
31
+ pathBuilder.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
32
+ for (let j = 1; j < element.length; j++) {
33
+ pathBuilder.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
37
34
  }
38
35
  }
39
- pathBuilder.closePath();
40
- return pathBuilder.toString();
41
36
  }
42
- const data = useMemo(() => {
43
- return get(contours, `${spectrumID}.${sign}`, []);
44
- }, [contours, sign, spectrumID]);
45
- const path = buildContourPath(data);
46
- if (!path)
47
- return null;
48
- return (_jsx("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", style: {
49
- opacity: isActive
50
- ? 1
51
- : get(preferences.current, 'general.dimmedSpectraTransparency', 0.1),
52
- }, d: path }));
37
+ pathBuilder.closePath();
38
+ return pathBuilder.toString();
39
+ }
40
+ const useContoursLevel = (datum, sign) => {
41
+ const { view: { zoom: { levels }, }, } = useChartData();
42
+ const { id, display: { contourOptions }, } = datum;
43
+ const defaultLevel = getDefaultContoursLevel(contourOptions);
44
+ const level = levels?.[id]?.[sign];
45
+ return typeof level !== 'number' ? defaultLevel[sign] : level;
46
+ };
47
+ function ContoursPaths({ id: spectrumID, sign, color, datum, onTimeout, }) {
48
+ const activeSpectrum = useActiveSpectrum();
49
+ const preferences = usePreferences();
50
+ const level = useContoursLevel(datum, sign);
51
+ const contours = useMemo(() => {
52
+ const { contours, timeout } = drawContours(level, datum, sign === 'negative');
53
+ if (timeout) {
54
+ onTimeout();
55
+ }
56
+ return contours;
57
+ }, [datum, level, onTimeout, sign]);
58
+ const path = usePath(datum, contours);
59
+ const opacity = activeSpectrum === null || spectrumID === activeSpectrum.id
60
+ ? '1'
61
+ : get(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
62
+ return (_jsx("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", opacity: opacity, d: path }));
53
63
  }
54
64
  function ContoursInner({ data, displayerKey }) {
55
- return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum, index) => (_jsxs("g", { children: [datum.display.isPositiveVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "positive", datum: datum, color: datum.display.positiveColor })), datum.display.isNegativeVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "negative", datum: datum, color: datum.display.negativeColor }))] }, `${datum.id + index}`))) }));
65
+ const alert = useAlert();
66
+ const debounceAlert = useRef(debounce(() => {
67
+ alert.error('Too many contour lines, only showing the first ones');
68
+ }, 2000));
69
+ function timeoutHandler() {
70
+ debounceAlert.current();
71
+ }
72
+ return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "contours", children: data?.map((datum) => (_jsxs("g", { children: [datum.display.isPositiveVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "positive", datum: datum, color: datum.display.positiveColor, onTimeout: timeoutHandler })), datum.display.isNegativeVisible && (_jsx(ContoursPaths, { id: datum.id, sign: "negative", datum: datum, color: datum.display.negativeColor, onTimeout: timeoutHandler }))] }, datum.id))) }));
56
73
  }
57
74
  const MemoizedContours = memo(ContoursInner);
58
75
  export default function Contours() {
59
- const { data: spectra, displayerKey } = useChartData();
76
+ const { data: spectra, displayerKey, view: { spectra: { activeTab }, }, } = useChartData();
60
77
  const data = useMemo(() => {
61
- return spectra.filter((datum) => datum.info.dimension === 2 && datum.info.isFt);
62
- }, [spectra]);
78
+ return spectra.filter((datum) => datum.info.dimension === 2 &&
79
+ datum.info.isFt &&
80
+ activeTab === nucleusToString(datum.info.nucleus));
81
+ }, [activeTab, spectra]);
63
82
  return _jsx(MemoizedContours, { ...{ data, displayerKey } });
64
83
  }
@@ -131,10 +131,10 @@ function FooterBanner({ layout, data1D }) {
131
131
  switch (trackID) {
132
132
  case LAYOUT.CENTER_2D:
133
133
  case LAYOUT.TOP_1D: {
134
- return scaleX.invert(x ? x : position.x);
134
+ return scaleX.invert(x || position.x);
135
135
  }
136
136
  case LAYOUT.LEFT_1D: {
137
- return scaleX.invert(x ? x : position.y);
137
+ return scaleX.invert(x || position.y);
138
138
  }
139
139
  default:
140
140
  return 0;
@@ -41,6 +41,6 @@ function Left1DChart({ margin: marignValue = 10, data: spectrum, }) {
41
41
  const mainHeight = originHeight - margin.bottom - margin.top;
42
42
  if (!mainHeight || !height)
43
43
  return null;
44
- return (_jsxs("svg", { viewBox: `0 0 ${height} ${mainHeight + margin.top}`, width: height, height: mainHeight + margin.top, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-left`, children: _jsx("rect", { width: height, height: mainHeight, x: "0", y: margin.top }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-left)`, children: _jsx("path", { className: "line", stroke: "black", fill: "none", d: paths }) })] }));
44
+ return (_jsxs("svg", { viewBox: `0 0 ${height} ${mainHeight + margin.top}`, width: height, height: mainHeight + margin.top, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-left`, children: _jsx("rect", { width: height, height: mainHeight, x: "0", y: margin.top }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-left)`, children: _jsx("path", { className: "line", stroke: spectrum.display.color, fill: "none", d: paths }) })] }));
45
45
  }
46
46
  export default memo(Left1DChart);
@@ -37,6 +37,6 @@ function Top1DChart({ margin: marginProps = 10, data: spectrum, }) {
37
37
  if (!width || !height) {
38
38
  return null;
39
39
  }
40
- return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-top`, children: _jsx("rect", { width: width - originMargin.left - originMargin.right, height: height, x: originMargin.left, y: `${0}` }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-top)`, children: _jsx("path", { className: "line", stroke: "red", fill: "none", strokeWidth: "1px", d: paths }) })] }));
40
+ return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-top`, children: _jsx("rect", { width: width - originMargin.left - originMargin.right, height: height, x: originMargin.left, y: `${0}` }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-top)`, children: _jsx("path", { className: "line", stroke: spectrum.display.color, fill: "none", strokeWidth: "1px", d: paths }) })] }));
41
41
  }
42
42
  export default memo(Top1DChart);
@@ -12,6 +12,7 @@ import { BRUSH_END, FULL_ZOOM_OUT, SET_DIMENSIONS, SET_2D_LEVEL, SET_ZOOM, ADD_2
12
12
  import BrushXY, { BRUSH_TYPE } from '../tool/BrushXY';
13
13
  import CrossLinePointer from '../tool/CrossLinePointer';
14
14
  import { options } from '../toolbar/ToolTypes';
15
+ import { assert } from '../utility/assert';
15
16
  import Chart2D from './Chart2D';
16
17
  import FooterBanner from './FooterBanner';
17
18
  import XYLabelPointer from './tools/XYLabelPointer';
@@ -25,19 +26,15 @@ function Viewer2D({ emptyText = undefined }) {
25
26
  const isVisible = info.isFt || !('isFt' in info);
26
27
  const spectrumData = useMemo(() => {
27
28
  const nucleuses = activeTab.split(',');
28
- return nucleuses.reduce((acc, n) => {
29
- if (activeSpectra[n]?.id) {
30
- const id = activeSpectra[n]?.id;
31
- const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
32
- if (spectrum) {
33
- acc.push(spectrum);
34
- }
35
- }
36
- else {
37
- acc.push(null);
38
- }
39
- return acc;
40
- }, []);
29
+ return nucleuses
30
+ .filter((n) => activeSpectra[n]?.id)
31
+ .map((nucleus) => {
32
+ const id = activeSpectra[nucleus]?.id;
33
+ assert(id, `Error in Viewer2D: id is not defined`);
34
+ const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
35
+ assert(spectrum, `Spectrum with id ${id} not found`);
36
+ return spectrum;
37
+ });
41
38
  }, [activeTab, data, activeSpectra]);
42
39
  const DIMENSION = get2DDimensionLayout(state);
43
40
  const handelBrushEnd = useCallback((brushData) => {
@@ -114,7 +111,7 @@ export function ViewerResponsiveWrapper(props) {
114
111
  const dispatch = useDispatch();
115
112
  const { width, height, children } = props;
116
113
  useEffect(() => {
117
- dispatch({ type: SET_DIMENSIONS, ...{ width, height } });
114
+ dispatch({ type: SET_DIMENSIONS, width, height });
118
115
  }, [width, height, dispatch]);
119
116
  return children;
120
117
  }
@@ -91,10 +91,10 @@ function XYLabelPointer({ layout, data1D }) {
91
91
  switch (trackID) {
92
92
  case LAYOUT.CENTER_2D:
93
93
  case LAYOUT.TOP_1D: {
94
- return scaleX?.invert(x ? x : position.x);
94
+ return scaleX?.invert(x || position.x);
95
95
  }
96
96
  case LAYOUT.LEFT_1D: {
97
- return scaleX?.invert(x ? x : position.y);
97
+ return scaleX?.invert(x || position.y);
98
98
  }
99
99
  default:
100
100
  return 0;
@@ -12,7 +12,7 @@ function VerticalSliceChart({ margin: marignValue = 10, data, }) {
12
12
  const paths = useMemo(() => {
13
13
  if (data) {
14
14
  const { x, re: y } = data;
15
- const scaleX = get2DYScale({ height: originHeight, margin, yDomain });
15
+ const scaleX = get2DYScale({ height: originHeight, margin, yDomain }, true);
16
16
  const scaleY = getYScale(height, y, marignValue);
17
17
  const pathPoints = xyReduce({ x, y });
18
18
  const pathBuilder = new PathBuilder();
@@ -21,14 +21,11 @@ function IndicationLines({ axis, show }) {
21
21
  if (nucleus !== null) {
22
22
  const ranges = data
23
23
  .filter((_datum) => _datum.display.isVisible && _datum.info.nucleus === nucleus)
24
- .filter(isSpectrum1D)
25
- .map((_datum) => _datum.ranges.values)
26
- .flat();
27
- const deltas = ranges
28
- .map((_range) => _range.signals
29
- .filter((_signal) => SignalKindsToInclude.some((_kind) => _signal.kind === _kind))
30
- .map((_signal) => _signal.delta))
31
- .flat();
24
+ .filter((element) => isSpectrum1D(element))
25
+ .flatMap((_datum) => _datum.ranges.values);
26
+ const deltas = ranges.flatMap((_range) => _range.signals
27
+ .filter((_signal) => SignalKindsToInclude.includes(_signal.kind))
28
+ .map((_signal) => _signal.delta));
32
29
  setDeltas1D(deltas);
33
30
  }
34
31
  else {
@@ -13,6 +13,9 @@ const initialState = {
13
13
  startY: 0,
14
14
  endY: 0,
15
15
  };
16
+ function stopPageScrolling(event) {
17
+ event.preventDefault();
18
+ }
16
19
  export const BrushContext = createContext(initialState);
17
20
  export function BrushTracker({ children, className, style, onBrush = () => null, onZoom = () => null, onDoubleClick = () => null, onClick = () => null, noPropagation, }) {
18
21
  const [state, dispatch] = useReducer(reducer, initialState);
@@ -35,6 +38,24 @@ export function BrushTracker({ children, className, style, onBrush = () => null,
35
38
  });
36
39
  setMouseDownTime(event.timeStamp);
37
40
  }
41
+ function moveCallback(event) {
42
+ dispatch({
43
+ type: 'MOVE',
44
+ screenX: event.screenX,
45
+ screenY: event.screenY,
46
+ clientX: event.clientX,
47
+ clientY: event.clientY,
48
+ });
49
+ }
50
+ function mouseUpCallback() {
51
+ dispatch({
52
+ type: 'UP',
53
+ });
54
+ window.removeEventListener('mousemove', moveCallback);
55
+ window.removeEventListener('mouseup', mouseUpCallback);
56
+ }
57
+ window.addEventListener('mousemove', moveCallback);
58
+ window.addEventListener('mouseup', mouseUpCallback);
38
59
  return false;
39
60
  }, [noPropagation]);
40
61
  const clickHandler = useCallback((e) => {
@@ -74,34 +95,22 @@ export function BrushTracker({ children, className, style, onBrush = () => null,
74
95
  });
75
96
  }
76
97
  }, [onBrush, state]);
77
- const moveCallback = useCallback((event) => {
78
- dispatch({
79
- type: 'MOVE',
80
- screenX: event.screenX,
81
- screenY: event.screenY,
82
- clientX: event.clientX,
83
- clientY: event.clientY,
84
- });
85
- }, []);
86
- const upCallback = useCallback((event) => {
87
- dispatch({
88
- type: 'UP',
89
- clientX: event.clientX,
90
- clientY: event.clientY,
91
- });
92
- return false;
93
- }, []);
94
- return (_jsx(BrushContext.Provider, { value: state, children: _jsx("div", { className: className, style: style, onMouseDown: mouseDownHandler, onMouseUp: upCallback, onMouseMove: moveCallback, onClick: clickHandler, onWheel: handleMouseWheel, children: children }) }));
98
+ return (_jsx(BrushContext.Provider, { value: state, children: _jsx("div", { className: className, style: style, onMouseDown: mouseDownHandler, onClick: clickHandler, onWheel: handleMouseWheel, onMouseEnter: () => {
99
+ // disable page scrolling once the mouse over the Displayer
100
+ window.addEventListener('wheel', stopPageScrolling, {
101
+ passive: false,
102
+ });
103
+ }, onMouseLeave: () => {
104
+ // disable page scrolling once the mouse over the Displayer
105
+ window.removeEventListener('wheel', stopPageScrolling);
106
+ }, children: children }) }));
95
107
  }
96
108
  function reducer(state, action) {
97
109
  switch (action.type) {
98
110
  case 'UP':
99
111
  if (state.step === 'brushing' || state.step === 'start') {
100
- const { clientX, clientY } = action;
101
112
  return {
102
113
  ...state,
103
- endX: clientX - state.boundingRect.x,
104
- endY: clientY - state.boundingRect.y,
105
114
  step: state.step === 'start' ? 'initial' : 'end',
106
115
  };
107
116
  }
@@ -28,7 +28,7 @@ function KeysListenerTracker() {
28
28
  return displayerMode === DISPLAYER_MODE.DM_1D && data && data.length > 0;
29
29
  }, [data, displayerMode]);
30
30
  const deleteHandler = useCallback(async (sourceData) => {
31
- const { type, extra: { id }, } = sourceData;
31
+ const { type, extra: { id, zone, spectrumID, colKey }, } = sourceData;
32
32
  switch (type) {
33
33
  case HighlightEventSource.INTEGRAL: {
34
34
  dispatch({
@@ -80,7 +80,6 @@ function KeysListenerTracker() {
80
80
  text: 'Yes, for all spectra',
81
81
  handler: async () => {
82
82
  const hideLoading = await alert.showLoading('Delete all spectra exclusive zones in progress');
83
- const { zone } = sourceData.extra;
84
83
  dispatch({
85
84
  type: DELETE_EXCLUSION_ZONE,
86
85
  payload: {
@@ -94,7 +93,6 @@ function KeysListenerTracker() {
94
93
  text: 'Yes',
95
94
  handler: async () => {
96
95
  const hideLoading = await alert.showLoading('Delete exclusive zone in progress');
97
- const { spectrumID, zone } = sourceData.extra;
98
96
  dispatch({
99
97
  type: DELETE_EXCLUSION_ZONE,
100
98
  payload: {
@@ -116,7 +114,7 @@ function KeysListenerTracker() {
116
114
  case HighlightEventSource.MULTIPLE_ANALYSIS_ZONE: {
117
115
  dispatch({
118
116
  type: DELETE_ANALYZE_SPECTRA_RANGE,
119
- colKey: sourceData.extra.colKey,
117
+ colKey,
120
118
  });
121
119
  // remove keys from the highlighted list after delete
122
120
  remove();
@@ -263,7 +261,7 @@ function KeysListenerTracker() {
263
261
  break;
264
262
  case 's':
265
263
  if (isToolVisible('exportAs')) {
266
- void saveAsJSONHandler();
264
+ saveAsJSONHandler();
267
265
  e.preventDefault();
268
266
  }
269
267
  break;
@@ -285,8 +283,9 @@ function KeysListenerTracker() {
285
283
  }
286
284
  }
287
285
  }
288
- catch (e) {
289
- alert.error(e.message);
286
+ catch (error) {
287
+ reportError(error);
288
+ alert.error(error.message);
290
289
  }
291
290
  }, [
292
291
  alert,
@@ -302,16 +301,9 @@ function KeysListenerTracker() {
302
301
  saveAsJSONHandler,
303
302
  saveToClipboardHandler,
304
303
  ]);
305
- function checkNotInputField(e) {
306
- const tags = ['input', 'textarea'];
307
- const tagName = e.composedPath()[0].tagName.toLowerCase();
308
- if (!tags.includes(tagName))
309
- return true;
310
- return false;
311
- }
312
304
  const handleOnKeyDown = useCallback((e) => {
313
305
  if (checkNotInputField(e) && overDisplayer) {
314
- const num = Number(e.code.substr(e.code.length - 1)) || 0;
306
+ const num = Number(e.code.slice(-1)) || 0;
315
307
  if (num > 0) {
316
308
  keysPreferencesListenerHandler(e, num);
317
309
  }
@@ -337,4 +329,11 @@ function KeysListenerTracker() {
337
329
  }, [handleOnKeyDown]);
338
330
  return null;
339
331
  }
332
+ function checkNotInputField(e) {
333
+ const tags = ['input', 'textarea'];
334
+ const tagName = e.composedPath()[0].tagName.toLowerCase();
335
+ if (!tags.includes(tagName))
336
+ return true;
337
+ return false;
338
+ }
340
339
  export default KeysListenerTracker;
@@ -8,7 +8,7 @@ import { NMRiumGeneralPreferences } from '../types/NMRiumGeneralPreferences';
8
8
  import { NMRiumPanelPreferences } from '../types/NMRiumPanelPreferences';
9
9
  import { NMRiumToolBarPreferences } from '../types/NMRiumToolBarPreferences';
10
10
  import { ViewState } from './reducer/Reducer';
11
- import { BlobObject } from './utility/Export';
11
+ import { BlobObject } from './utility/export';
12
12
  export type { NMRiumDataReturn } from '../types/NMRiumDataReturn';
13
13
  export declare type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded';
14
14
  export interface NMRiumProps {
@@ -30,7 +30,7 @@ import { DISPLAYER_MODE } from './reducer/core/Constants';
30
30
  import preferencesReducer, { preferencesInitialState, initPreferencesState, } from './reducer/preferences/preferencesReducer';
31
31
  import { INITIATE, SET_LOADING_FLAG, SET_MOUSE_OVER_DISPLAYER, } from './reducer/types/Types';
32
32
  import ToolBar from './toolbar/ToolBar';
33
- import { getBlob } from './utility/Export';
33
+ import { getBlob } from './utility/export';
34
34
  const viewerContainerStyle = css `
35
35
  border: 0.55px #e6e6e6 solid;
36
36
  display: flex;
@@ -107,15 +107,15 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
107
107
  });
108
108
  const [state, dispatch] = useReducer(spectrumReducer, initialState, initState);
109
109
  const [preferencesState, dispatchPreferences] = useReducer(preferencesReducer, preferencesInitialState, initPreferencesState);
110
- const { displayerMode, data: spectraData } = state;
110
+ const { displayerMode, data: spectraData, actionType, view } = state;
111
111
  useEffect(() => {
112
- if (checkActionType(state.actionType)) {
112
+ if (checkActionType(actionType)) {
113
113
  handleDataChange.current?.(toJSON(state, 'onDataChange'));
114
114
  }
115
- }, [state]);
115
+ }, [actionType, state]);
116
116
  useEffect(() => {
117
- handleViewChange.current?.(state.view);
118
- }, [state.view]);
117
+ handleViewChange.current?.(view);
118
+ }, [view]);
119
119
  const dispatchMiddleWare = useMemo(() => {
120
120
  return dispatchMiddleware(dispatch);
121
121
  }, []);
@@ -4,5 +4,5 @@ import { usePreferences } from './context/PreferencesContext';
4
4
  export function SplitPaneWrapper({ children }) {
5
5
  const { current } = usePreferences();
6
6
  const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
7
- return (_jsx(SplitPane, { initialSeparation: initialPanelWidth, orientation: "horizontal", sideSeparation: "end", ...(hidePanelOnLoad ? { initialClosed: true } : { minimumSize: 600 }), children: children }, hidePanelOnLoad ? 'true' : 'false'));
7
+ return (_jsx(SplitPane, { initialSize: initialPanelWidth, direction: "horizontal", controlledSide: "end", initialClosed: hidePanelOnLoad ? true : 600, children: children }, hidePanelOnLoad ? 'true' : 'false'));
8
8
  }
@@ -16,13 +16,13 @@ export default function initAssignment(action) {
16
16
  return newState;
17
17
  }
18
18
  function setRangesAssignments(state, ranges) {
19
- const diaIDRecords = ranges.values.reduce((acc, { id, diaIDs, signals }) => {
20
- acc.push({ id, diaIDs: diaIDs || [] });
19
+ const diaIDRecords = [];
20
+ for (const { id, diaIDs, signals } of ranges.values) {
21
+ diaIDRecords.push({ id, diaIDs: diaIDs || [] });
21
22
  for (const signal of signals) {
22
- acc.push({ id: signal.id, diaIDs: signal.diaIDs || [] });
23
+ diaIDRecords.push({ id: signal.id, diaIDs: signal.diaIDs || [] });
23
24
  }
24
- return acc;
25
- }, []);
25
+ }
26
26
  for (const { id, diaIDs } of diaIDRecords) {
27
27
  for (const diaID of diaIDs) {
28
28
  setAssignment(state, id, 'x', diaID);
@@ -30,22 +30,22 @@ function setRangesAssignments(state, ranges) {
30
30
  }
31
31
  }
32
32
  function setZonesAssignments(state, zones) {
33
- const diaIDRecords = zones.values.reduce((acc, { id, x, y, signals }) => {
34
- acc.push({ id, diaIDs: { x: x.diaIDs || [], y: y.diaIDs || [] } });
35
- for (const signal of signals) {
36
- acc.push({
37
- id: signal.id,
38
- diaIDs: { x: signal.x.diaIDs || [], y: signal.y.diaIDs || [] },
39
- });
40
- }
41
- return acc;
42
- }, []);
33
+ const diaIDRecords = zones.values.flatMap(({ id, x, y, signals }) => {
34
+ const diaIDRecords = signals.map((signal) => ({
35
+ id: signal.id,
36
+ diaIDs: { x: signal.x.diaIDs || [], y: signal.y.diaIDs || [] },
37
+ }));
38
+ return [
39
+ { id, diaIDs: { x: x.diaIDs || [], y: y.diaIDs || [] } },
40
+ ...diaIDRecords,
41
+ ];
42
+ });
43
43
  for (const { id, diaIDs } of diaIDRecords) {
44
- ['x', 'y'].forEach((axis) => {
44
+ for (const axis of ['x', 'y']) {
45
45
  for (const diaID of diaIDs[axis]) {
46
46
  setAssignment(state, id, axis, diaID);
47
47
  }
48
- });
48
+ }
49
49
  }
50
50
  }
51
51
  function setAssignment(state, id, axis, diaID) {
@@ -3,7 +3,7 @@ import { useReducer, useMemo, useEffect } from 'react';
3
3
  import { assignmentState, assignmentContext, } from './AssignmentsContext';
4
4
  import assignmentReducer from './AssignmentsReducer';
5
5
  export function AssignmentProvider(props) {
6
- const { spectraData: spectra } = props;
6
+ const { spectraData: spectra, children } = props;
7
7
  const [data, dispatch] = useReducer(assignmentReducer, assignmentState);
8
8
  const state = useMemo(() => ({ data, dispatch }), [data]);
9
9
  useEffect(() => {
@@ -14,5 +14,5 @@ export function AssignmentProvider(props) {
14
14
  });
15
15
  }
16
16
  }, [spectra]);
17
- return (_jsx(assignmentContext.Provider, { value: state, children: props.children }));
17
+ return (_jsx(assignmentContext.Provider, { value: state, children: children }));
18
18
  }
@@ -21,12 +21,9 @@ export function usePreferences() {
21
21
  export function useWorkspacesList() {
22
22
  const { workspaces } = usePreferences();
23
23
  return useMemo(() => {
24
- const currentWorkspaces = Object.keys(workspaces).reduce((acc, key) => {
25
- if (!Workspaces[key]) {
26
- acc.push({ key, label: workspaces[key].label });
27
- }
28
- return acc;
29
- }, []);
24
+ const currentWorkspaces = Object.keys(workspaces)
25
+ .filter((k) => !Workspaces[k])
26
+ .map((key) => ({ key, label: workspaces[key].label }));
30
27
  return [...WORKSPACES, ...currentWorkspaces];
31
28
  }, [workspaces]);
32
29
  }
@@ -132,7 +132,7 @@ function Button(props) {
132
132
  }
133
133
  function ThemeButton(props) {
134
134
  const { colorTheme, ...buttonProps } = props;
135
- const { base, shade, tint } = colorPalettes[props.colorTheme];
135
+ const { base, shade, tint } = colorPalettes[colorTheme];
136
136
  const { color = { base: shade, hover: 'white' }, backgroundColor = {
137
137
  base,
138
138
  hover: shade,
@@ -4,5 +4,5 @@ export function CheckBoxCell(props) {
4
4
  const { name, ...otherProps } = props;
5
5
  return (_jsx(FormikCheckBox, { style: {
6
6
  container: { display: 'block', margin: '0 auto', width: 'fit-content' },
7
- }, name: props.name, ...otherProps }, props.name));
7
+ }, name: name, ...otherProps }, name));
8
8
  }
@@ -55,11 +55,11 @@ function ContextMenu({ context }, ref) {
55
55
  useEffect(() => {
56
56
  root.current = document.createElement('div');
57
57
  if (elementsWrapperRef) {
58
- elementsWrapperRef.appendChild(root.current);
58
+ elementsWrapperRef.append(root.current);
59
59
  }
60
60
  return () => {
61
61
  if (root.current && elementsWrapperRef) {
62
- elementsWrapperRef.removeChild(root.current);
62
+ root.current.remove();
63
63
  }
64
64
  };
65
65
  }, [elementsWrapperRef]);
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
- interface EditableColumnProps {
2
+ import { InputProps } from './Input';
3
+ interface EditableColumnProps extends Omit<InputProps, 'style' | 'value' | 'type'> {
3
4
  onSave?: (element: any) => void;
4
5
  onEditStart?: (element: any) => void;
5
6
  type?: 'number' | 'text';
@@ -7,6 +8,7 @@ interface EditableColumnProps {
7
8
  value: string | number;
8
9
  style?: CSSProperties;
9
10
  validate?: (value?: any) => boolean;
11
+ textOverFlowEllipses?: boolean;
10
12
  }
11
13
  declare const EditableColumn: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
12
14
  export default EditableColumn;