nmrium 0.32.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 (453) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/LinesSeries.js +1 -1
  3. package/lib/component/1d/SpectraTracker.js +1 -1
  4. package/lib/component/1d/Viewer1D.js +1 -1
  5. package/lib/component/1d/XAxis.js +1 -1
  6. package/lib/component/1d/database/DatabaseSpectrum.js +2 -1
  7. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  8. package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
  9. package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
  10. package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
  11. package/lib/component/1d/integral/IntegralIndicator.js +27 -0
  12. package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
  13. package/lib/component/1d/integral/IntegralResizable.js +69 -0
  14. package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
  15. package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  16. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  17. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  18. package/lib/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  19. package/lib/component/1d/peaks/PeakAnnotation.js +1 -1
  20. package/lib/component/1d/peaks/usePeakShapesPath.js +10 -6
  21. package/lib/component/1d/ranges/Range.js +27 -50
  22. package/lib/component/1d/tool/PeakPointer.js +1 -1
  23. package/lib/component/1d/utilities/scale.js +2 -2
  24. package/lib/component/2d/Contours.js +61 -42
  25. package/lib/component/2d/FooterBanner.js +2 -2
  26. package/lib/component/2d/Viewer2D.js +11 -14
  27. package/lib/component/2d/tools/XYLabelPointer.js +2 -2
  28. package/lib/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  29. package/lib/component/2d/zones/IndicationLines.js +5 -8
  30. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -15
  31. package/lib/component/NMRium.d.ts +1 -1
  32. package/lib/component/NMRium.js +6 -6
  33. package/lib/component/assignment/actions/initAssignment.js +17 -17
  34. package/lib/component/assignment/index.js +2 -2
  35. package/lib/component/context/PreferencesContext.js +3 -6
  36. package/lib/component/elements/Button.js +1 -1
  37. package/lib/component/elements/CheckBoxCell.js +1 -1
  38. package/lib/component/elements/ContextMenu.js +2 -2
  39. package/lib/component/elements/EditableColumn.js +3 -5
  40. package/lib/component/elements/GroupPane.d.ts +12 -0
  41. package/lib/component/elements/GroupPane.js +14 -0
  42. package/lib/component/elements/Input.js +7 -4
  43. package/lib/component/elements/IsotopesViewer.js +1 -1
  44. package/lib/component/elements/Label.js +1 -2
  45. package/lib/component/elements/MolecularFormulaInput.js +2 -0
  46. package/lib/component/elements/NumberInput.js +2 -2
  47. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  48. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -1
  49. package/lib/component/elements/ReactTable/ReactTable.js +72 -38
  50. package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +3 -2
  51. package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  52. package/lib/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  53. package/lib/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  54. package/lib/component/elements/accordion/Accordion.js +2 -2
  55. package/lib/component/elements/draggble/useDraggable.js +1 -3
  56. package/lib/component/elements/dropDownButton/DropDownList.js +1 -2
  57. package/lib/component/elements/formik/FormikCheckBox.js +1 -1
  58. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  59. package/lib/component/elements/formik/FormikColorPicker.js +5 -8
  60. package/lib/component/elements/formik/FormikErrorsSummary.js +2 -2
  61. package/lib/component/elements/formik/FormikForm.js +2 -2
  62. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  63. package/lib/component/elements/formik/FormikInput.js +12 -20
  64. package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
  65. package/lib/component/elements/formik/FormikOnChange.js +13 -10
  66. package/lib/component/elements/formik/FormikSelect.js +1 -1
  67. package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
  68. package/lib/component/elements/formik/FormikSlider.js +8 -11
  69. package/lib/component/elements/formik/FormikTextarea.js +1 -1
  70. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  71. package/lib/component/elements/popup/Alert/Provider.js +7 -7
  72. package/lib/component/elements/popup/Alert/index.d.ts +3 -4
  73. package/lib/component/elements/popup/Alert/index.js +3 -4
  74. package/lib/component/elements/popup/Modal/ModalContent.js +3 -1
  75. package/lib/component/elements/popup/Modal/Provider.js +16 -31
  76. package/lib/component/elements/popup/Modal/index.d.ts +4 -5
  77. package/lib/component/elements/popup/Modal/index.js +4 -5
  78. package/lib/component/header/Header.js +1 -1
  79. package/lib/component/hooks/useCombinedRefs.js +2 -2
  80. package/lib/component/hooks/useExport.d.ts +1 -1
  81. package/lib/component/hooks/useExport.js +9 -6
  82. package/lib/component/hooks/useFormatNumberByNucleus.js +1 -1
  83. package/lib/component/hooks/usePanelPreferences.js +9 -7
  84. package/lib/component/loader/DropZone.js +4 -4
  85. package/lib/component/modal/AlignSpectraModal.js +1 -1
  86. package/lib/component/modal/ExportAsMatrixModal.js +1 -1
  87. package/lib/component/modal/LoadJCAMPModal.js +2 -2
  88. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  89. package/lib/component/modal/MultipletAnalysisModal.js +3 -3
  90. package/lib/component/modal/PredictSpectraModal.js +5 -5
  91. package/lib/component/modal/editRange/EditRangeModal.js +4 -4
  92. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  93. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  94. package/lib/component/modal/setting/DatabasesTabContent.js +25 -20
  95. package/lib/component/modal/setting/DisplayTabContent.js +21 -27
  96. package/lib/component/modal/setting/FormattingTabContent.js +10 -10
  97. package/lib/component/modal/setting/GeneralSettings.js +11 -14
  98. package/lib/component/modal/setting/GeneralTabContent.js +3 -1
  99. package/lib/component/modal/setting/ToolsTabContent.js +18 -19
  100. package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -1
  101. package/lib/component/modal/setting/WorkspaceItem.js +36 -48
  102. package/lib/component/modal/setting/settingsValidation.d.ts +58 -57
  103. package/lib/component/modal/setting/settingsValidation.js +14 -12
  104. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  105. package/lib/component/panels/InformationPanel.js +52 -56
  106. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  107. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  108. package/lib/component/panels/MoleculesPanel/Utilities.js +6 -6
  109. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  110. package/lib/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  111. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  112. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  113. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  114. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  115. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  116. package/lib/component/panels/PeaksPanel/PeaksTable.js +2 -2
  117. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  118. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  119. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  120. package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
  121. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  122. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  123. package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  124. package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  125. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  126. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +5 -5
  127. package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  128. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
  129. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  130. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
  131. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  132. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  133. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  134. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  135. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  136. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  137. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  138. package/lib/component/panels/ZonesPanel/ZonesTable.js +8 -8
  139. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -4
  140. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +2 -1
  141. package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
  142. package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  143. package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +2 -2
  144. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  145. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  146. package/lib/component/reducer/IgnoreActions.js +3 -3
  147. package/lib/component/reducer/Reducer.d.ts +40 -14
  148. package/lib/component/reducer/Reducer.js +12 -11
  149. package/lib/component/reducer/actions/CorrelationsActions.js +4 -4
  150. package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
  151. package/lib/component/reducer/actions/DomainActions.js +49 -67
  152. package/lib/component/reducer/actions/FiltersActions.js +3 -3
  153. package/lib/component/reducer/actions/HistoryActions.js +5 -5
  154. package/lib/component/reducer/actions/LoadActions.js +12 -0
  155. package/lib/component/reducer/actions/PreferencesActions.js +18 -37
  156. package/lib/component/reducer/actions/RangesActions.js +14 -12
  157. package/lib/component/reducer/actions/SpectrumsActions.js +10 -4
  158. package/lib/component/reducer/actions/ToolsActions.js +20 -35
  159. package/lib/component/reducer/actions/ZonesActions.js +2 -2
  160. package/lib/component/reducer/core/Constants.js +1 -1
  161. package/lib/component/reducer/helper/GetClosestNumber.js +2 -1
  162. package/lib/component/reducer/helper/Zoom1DManager.js +11 -10
  163. package/lib/component/reducer/helper/getSpectrum.js +3 -5
  164. package/lib/component/reducer/helper/getStrongestPeak.d.ts +1 -1
  165. package/lib/component/reducer/helper/getStrongestPeak.js +2 -3
  166. package/lib/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  167. package/lib/component/reducer/preferences/actions/setPreferences.js +5 -6
  168. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -4
  169. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  170. package/lib/component/tool/BrushX.js +3 -3
  171. package/lib/component/tool/BrushXY.js +5 -5
  172. package/lib/component/tool/CrossLinePointer.js +3 -3
  173. package/lib/component/toolbar/BasicToolBar.js +1 -1
  174. package/lib/component/utility/Evaluate.js +2 -2
  175. package/lib/component/utility/FileUtility.d.ts +2 -9
  176. package/lib/component/utility/FileUtility.js +11 -28
  177. package/lib/component/utility/GroupByInfoKey.d.ts +1 -1
  178. package/lib/component/utility/GroupByInfoKey.js +11 -13
  179. package/lib/component/utility/PathBuilder.js +1 -1
  180. package/lib/component/utility/PreferencesHelper.js +2 -3
  181. package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
  182. package/lib/component/utility/{Export.js → export.js} +53 -78
  183. package/lib/component/utility/formatNumber.d.ts +6 -1
  184. package/lib/component/utility/formatNumber.js +5 -4
  185. package/lib/data/Filters.d.ts +16 -17
  186. package/lib/data/Filters.js +16 -17
  187. package/lib/data/FiltersManager.js +4 -3
  188. package/lib/data/PredictionManager.js +8 -10
  189. package/lib/data/SpectraManager.d.ts +1 -2
  190. package/lib/data/SpectraManager.js +25 -60
  191. package/lib/data/data1d/MultipleAnalysis.js +74 -70
  192. package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
  193. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  194. package/lib/data/data1d/Spectrum1D/index.d.ts +24 -25
  195. package/lib/data/data1d/Spectrum1D/index.js +24 -25
  196. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  197. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  198. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  199. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  200. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  201. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  202. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  203. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +35 -1
  204. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +35 -1
  205. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  206. package/lib/data/data1d/database.js +45 -28
  207. package/lib/data/data1d/filter1d/apodization.js +2 -1
  208. package/lib/data/data1d/filter1d/fft.js +24 -7
  209. package/lib/data/data1d/filter1d/phaseCorrection.js +2 -2
  210. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  211. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  212. package/lib/data/data2d/Processing2D.d.ts +3 -3
  213. package/lib/data/data2d/Processing2D.js +7 -18
  214. package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
  215. package/lib/data/data2d/Spectrum2D/contours.js +132 -0
  216. package/lib/data/data2d/Spectrum2D/index.d.ts +10 -11
  217. package/lib/data/data2d/Spectrum2D/index.js +10 -11
  218. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  219. package/lib/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  220. package/lib/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  221. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  222. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  223. package/lib/data/molecules/MoleculeManager.js +1 -1
  224. package/lib/data/types/common/Source.d.ts +1 -0
  225. package/lib/data/types/data1d/index.d.ts +12 -13
  226. package/lib/data/types/data2d/Data2D.d.ts +2 -0
  227. package/lib/data/types/data2d/Datum2D.d.ts +0 -1
  228. package/lib/data/types/data2d/index.d.ts +8 -9
  229. package/lib/data/utilities/RangeUtilities.js +13 -9
  230. package/lib/data/utilities/ZoneUtilities.js +17 -13
  231. package/lib/data/utilities/checkModifierKeyActivated.js +1 -2
  232. package/lib/data/utilities/generateChar.js +8 -6
  233. package/lib/data/utilities/getAtom.js +1 -1
  234. package/lib/data/utilities/getAtomsFromMF.js +2 -2
  235. package/lib/data/utilities/getColor.js +3 -3
  236. package/lib/data/utilities/getSum.js +6 -3
  237. package/lib/versionInfo.js +1 -1
  238. package/lib-cjs/component/1d/Chart1D.js +1 -1
  239. package/lib-cjs/component/1d/LinesSeries.js +1 -1
  240. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  241. package/lib-cjs/component/1d/Viewer1D.js +1 -1
  242. package/lib-cjs/component/1d/XAxis.js +1 -1
  243. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
  244. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
  245. package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
  246. package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
  247. package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
  248. package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
  249. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  250. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
  251. package/lib-cjs/component/1d/multiplicityTree/buildTreeNode.js +3 -3
  252. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -1
  253. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +10 -6
  254. package/lib-cjs/component/1d/ranges/Range.js +27 -50
  255. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  256. package/lib-cjs/component/1d/utilities/scale.js +2 -2
  257. package/lib-cjs/component/2d/Contours.js +60 -41
  258. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  259. package/lib-cjs/component/2d/Viewer2D.js +11 -14
  260. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  261. package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
  262. package/lib-cjs/component/2d/zones/IndicationLines.js +5 -8
  263. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +14 -15
  264. package/lib-cjs/component/NMRium.js +7 -7
  265. package/lib-cjs/component/assignment/actions/initAssignment.js +17 -17
  266. package/lib-cjs/component/assignment/index.js +2 -2
  267. package/lib-cjs/component/context/PreferencesContext.js +3 -6
  268. package/lib-cjs/component/elements/Button.js +1 -1
  269. package/lib-cjs/component/elements/CheckBoxCell.js +1 -1
  270. package/lib-cjs/component/elements/ContextMenu.js +2 -2
  271. package/lib-cjs/component/elements/EditableColumn.js +3 -5
  272. package/lib-cjs/component/elements/GroupPane.js +18 -0
  273. package/lib-cjs/component/elements/Input.js +7 -4
  274. package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
  275. package/lib-cjs/component/elements/Label.js +1 -2
  276. package/lib-cjs/component/elements/MolecularFormulaInput.js +2 -0
  277. package/lib-cjs/component/elements/NumberInput.js +2 -2
  278. package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
  279. package/lib-cjs/component/elements/ReactTable/ReactTable.js +71 -37
  280. package/lib-cjs/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
  281. package/lib-cjs/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
  282. package/lib-cjs/component/elements/ReactTable/utility/useRowSpan.js +3 -7
  283. package/lib-cjs/component/elements/accordion/Accordion.js +2 -2
  284. package/lib-cjs/component/elements/draggble/useDraggable.js +1 -3
  285. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +1 -2
  286. package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
  287. package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
  288. package/lib-cjs/component/elements/formik/FormikErrorsSummary.js +2 -2
  289. package/lib-cjs/component/elements/formik/FormikForm.js +2 -2
  290. package/lib-cjs/component/elements/formik/FormikInput.js +12 -20
  291. package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
  292. package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
  293. package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
  294. package/lib-cjs/component/elements/formik/FormikTextarea.js +1 -1
  295. package/lib-cjs/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
  296. package/lib-cjs/component/elements/popup/Alert/Provider.js +8 -8
  297. package/lib-cjs/component/elements/popup/Alert/index.js +5 -5
  298. package/lib-cjs/component/elements/popup/Modal/ModalContent.js +3 -1
  299. package/lib-cjs/component/elements/popup/Modal/Provider.js +16 -31
  300. package/lib-cjs/component/elements/popup/Modal/index.js +7 -7
  301. package/lib-cjs/component/header/Header.js +1 -1
  302. package/lib-cjs/component/hooks/useCombinedRefs.js +2 -2
  303. package/lib-cjs/component/hooks/useExport.js +14 -11
  304. package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +1 -1
  305. package/lib-cjs/component/hooks/usePanelPreferences.js +9 -7
  306. package/lib-cjs/component/loader/DropZone.js +4 -4
  307. package/lib-cjs/component/modal/AlignSpectraModal.js +1 -1
  308. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
  309. package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -2
  310. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
  311. package/lib-cjs/component/modal/MultipletAnalysisModal.js +3 -3
  312. package/lib-cjs/component/modal/PredictSpectraModal.js +5 -5
  313. package/lib-cjs/component/modal/editRange/EditRangeModal.js +4 -4
  314. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  315. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
  316. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +25 -20
  317. package/lib-cjs/component/modal/setting/DisplayTabContent.js +21 -27
  318. package/lib-cjs/component/modal/setting/FormattingTabContent.js +10 -10
  319. package/lib-cjs/component/modal/setting/GeneralSettings.js +11 -14
  320. package/lib-cjs/component/modal/setting/GeneralTabContent.js +3 -1
  321. package/lib-cjs/component/modal/setting/ToolsTabContent.js +18 -19
  322. package/lib-cjs/component/modal/setting/WorkspaceItem.js +37 -49
  323. package/lib-cjs/component/modal/setting/settingsValidation.js +14 -12
  324. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
  325. package/lib-cjs/component/panels/InformationPanel.js +51 -55
  326. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  327. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
  328. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +6 -6
  329. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
  330. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
  331. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
  332. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
  333. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
  334. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  335. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  336. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +2 -2
  337. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
  338. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  339. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +1 -1
  340. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
  341. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
  342. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
  343. package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
  344. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
  345. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
  346. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +6 -6
  347. package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
  348. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  349. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  350. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
  351. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
  352. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
  353. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
  354. package/lib-cjs/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
  355. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
  356. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -8
  357. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -4
  358. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +20 -5
  359. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  360. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  361. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +1 -1
  362. package/lib-cjs/component/reducer/IgnoreActions.js +3 -3
  363. package/lib-cjs/component/reducer/Reducer.js +11 -10
  364. package/lib-cjs/component/reducer/actions/CorrelationsActions.js +4 -4
  365. package/lib-cjs/component/reducer/actions/DomainActions.js +49 -67
  366. package/lib-cjs/component/reducer/actions/FiltersActions.js +3 -3
  367. package/lib-cjs/component/reducer/actions/HistoryActions.js +5 -5
  368. package/lib-cjs/component/reducer/actions/LoadActions.js +12 -0
  369. package/lib-cjs/component/reducer/actions/PreferencesActions.js +18 -37
  370. package/lib-cjs/component/reducer/actions/RangesActions.js +14 -12
  371. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +9 -3
  372. package/lib-cjs/component/reducer/actions/ToolsActions.js +20 -35
  373. package/lib-cjs/component/reducer/actions/ZonesActions.js +2 -2
  374. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  375. package/lib-cjs/component/reducer/helper/GetClosestNumber.js +2 -1
  376. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +11 -10
  377. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -5
  378. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -3
  379. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +3 -10
  380. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +5 -9
  381. package/lib-cjs/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
  382. package/lib-cjs/component/tool/BrushX.js +3 -3
  383. package/lib-cjs/component/tool/BrushXY.js +5 -5
  384. package/lib-cjs/component/tool/CrossLinePointer.js +3 -3
  385. package/lib-cjs/component/toolbar/BasicToolBar.js +1 -1
  386. package/lib-cjs/component/utility/Evaluate.js +2 -2
  387. package/lib-cjs/component/utility/FileUtility.js +11 -29
  388. package/lib-cjs/component/utility/GroupByInfoKey.js +11 -13
  389. package/lib-cjs/component/utility/PathBuilder.js +1 -1
  390. package/lib-cjs/component/utility/PreferencesHelper.js +2 -3
  391. package/lib-cjs/component/utility/{Export.js → export.js} +77 -79
  392. package/lib-cjs/component/utility/formatNumber.js +5 -4
  393. package/lib-cjs/data/Filters.js +17 -33
  394. package/lib-cjs/data/FiltersManager.js +4 -3
  395. package/lib-cjs/data/PredictionManager.js +8 -10
  396. package/lib-cjs/data/SpectraManager.js +26 -62
  397. package/lib-cjs/data/data1d/MultipleAnalysis.js +74 -70
  398. package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
  399. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
  400. package/lib-cjs/data/data1d/Spectrum1D/index.js +25 -25
  401. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
  402. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
  403. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
  404. package/lib-cjs/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
  405. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
  406. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
  407. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  408. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
  409. package/lib-cjs/data/data1d/database.js +45 -28
  410. package/lib-cjs/data/data1d/filter1d/apodization.js +2 -1
  411. package/lib-cjs/data/data1d/filter1d/fft.js +23 -6
  412. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +2 -2
  413. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
  414. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  415. package/lib-cjs/data/data2d/Processing2D.js +7 -18
  416. package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
  417. package/lib-cjs/data/data2d/Spectrum2D/index.js +11 -11
  418. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
  419. package/lib-cjs/data/data2d/Spectrum2D/shift/getShift.js +4 -5
  420. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
  421. package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
  422. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
  423. package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
  424. package/lib-cjs/data/utilities/RangeUtilities.js +13 -9
  425. package/lib-cjs/data/utilities/ZoneUtilities.js +17 -13
  426. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +1 -2
  427. package/lib-cjs/data/utilities/generateChar.js +8 -6
  428. package/lib-cjs/data/utilities/getAtom.js +1 -1
  429. package/lib-cjs/data/utilities/getAtomsFromMF.js +2 -2
  430. package/lib-cjs/data/utilities/getColor.js +3 -3
  431. package/lib-cjs/data/utilities/getSum.js +6 -3
  432. package/lib-cjs/versionInfo.js +1 -1
  433. package/package.json +30 -26
  434. package/lib/component/1d/IntegralResizable.js +0 -72
  435. package/lib/component/elements/popup/helpers.d.ts +0 -1
  436. package/lib/component/elements/popup/helpers.js +0 -9
  437. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
  438. package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
  439. package/lib/data/data1d/Data1DManager.d.ts +0 -3
  440. package/lib/data/data1d/Data1DManager.js +0 -98
  441. package/lib/data/data2d/Data2DManager.d.ts +0 -3
  442. package/lib/data/data2d/Data2DManager.js +0 -34
  443. package/lib/data/types/data2d/Contour.d.ts +0 -4
  444. package/lib/data/types/data2d/Contour.js +0 -1
  445. package/lib/data/types/data2d/Contours.d.ts +0 -2
  446. package/lib/data/types/data2d/Contours.js +0 -1
  447. package/lib-cjs/component/1d/IntegralResizable.js +0 -77
  448. package/lib-cjs/component/elements/popup/helpers.js +0 -13
  449. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
  450. package/lib-cjs/data/data1d/Data1DManager.js +0 -104
  451. package/lib-cjs/data/data2d/Data2DManager.js +0 -40
  452. package/lib-cjs/data/types/data2d/Contour.js +0 -2
  453. package/lib-cjs/data/types/data2d/Contours.js +0 -2
@@ -12,14 +12,13 @@ export const FILES_SIGNATURES = {
12
12
  ZIP: '504b0304',
13
13
  };
14
14
  function getFileSignature(fileArrayBuffer) {
15
- return new Uint8Array(fileArrayBuffer)
16
- .slice(0, 4)
17
- .reduce((acc, byte) => (acc += byte.toString(16).padStart(2, '0')), '');
15
+ return Array.from(new Uint8Array(fileArrayBuffer).slice(0, 4), (byte) => byte.toString(16).padStart(2, '0')).join('');
18
16
  }
19
- async function loadFile(file, options = { asBuffer: false }) {
17
+ async function loadFile(file, options = {}) {
18
+ const { asBuffer = false } = options;
20
19
  const response = await fetch(file);
21
20
  checkStatus(response);
22
- const data = options.asBuffer ? response.arrayBuffer() : response.text();
21
+ const data = asBuffer ? response.arrayBuffer() : response.text();
23
22
  return data;
24
23
  }
25
24
  function checkStatus(response) {
@@ -32,10 +31,10 @@ function getFileExtension(name) {
32
31
  return name.replace(/^.*\./, '').toLowerCase();
33
32
  }
34
33
  function getFileName(name) {
35
- return name.substr(0, name.lastIndexOf('.'));
34
+ return name.slice(0, Math.max(0, name.lastIndexOf('.')));
36
35
  }
37
36
  function extractFileMetaFromPath(path) {
38
- const meta = path.replace(/^.*[\\/]/, '').split('.');
37
+ const meta = path.replace(/^.*[/\\]/, '').split('.');
39
38
  return { name: meta[0].toLowerCase(), extension: meta[1].toLowerCase() };
40
39
  }
41
40
  /**
@@ -49,16 +48,16 @@ function loadFiles(acceptedFiles, options = {}) {
49
48
  return Promise.all([].map.call(acceptedFiles, (file) => {
50
49
  return new Promise((resolve, reject) => {
51
50
  const reader = new FileReader();
52
- reader.onabort = (e) => reject(e);
53
- reader.onerror = (e) => reject(e);
54
- reader.onload = () => {
51
+ reader.addEventListener('abort', (e) => reject(e));
52
+ reader.addEventListener('error', (e) => reject(e));
53
+ reader.addEventListener('load', () => {
55
54
  if (reader.result) {
56
55
  const binary = reader.result;
57
56
  const name = getFileName(file.name);
58
57
  const extension = getFileExtension(file.name);
59
58
  resolve({ binary, name, extension });
60
59
  }
61
- };
60
+ });
62
61
  if (options.asBuffer) {
63
62
  reader.readAsArrayBuffer(file);
64
63
  }
@@ -68,20 +67,4 @@ function loadFiles(acceptedFiles, options = {}) {
68
67
  });
69
68
  }));
70
69
  }
71
- async function loadFilesFromZip(files, options = {}) {
72
- const result = [];
73
- for (const file of files) {
74
- try {
75
- const binary = await file.async(options.asBuffer ? 'uint8array' : 'text');
76
- const name = getFileName(file.name);
77
- const extension = getFileExtension(file.name);
78
- result.push({ binary, name, extension });
79
- }
80
- catch (e) {
81
- // eslint-disable-next-line no-console
82
- console.error(e);
83
- }
84
- }
85
- return result;
86
- }
87
- export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
70
+ export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
@@ -1 +1 @@
1
- export default function GroupByInfoKey(key: any): (array: any, orderByNucleus?: boolean) => any;
1
+ export default function GroupByInfoKey(key: string): (array: any, orderByNucleus?: boolean) => {};
@@ -1,28 +1,26 @@
1
1
  function getNucleusSum(input) {
2
2
  const nucleus = input.split(',');
3
- return nucleus.reduce((acc, i) => {
3
+ let output = 0;
4
+ for (const i of nucleus) {
4
5
  const additions = nucleus.length === 2 ? 100 : 0;
5
- acc += Number(i.replace(/\D/g, '')) + additions;
6
- return acc;
7
- }, 0);
6
+ output += Number(i.replace(/\D/g, '')) + additions;
7
+ }
8
+ return output;
8
9
  }
9
10
  export default function GroupByInfoKey(key) {
10
11
  return (array, orderByNucleus = false) => {
11
- const unorderedGroup = array.reduce((objectsByKeyValue, obj) => {
12
+ const unorderedGroup = {};
13
+ for (const obj of array) {
12
14
  const value = obj.info[key];
13
- objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
14
- return objectsByKeyValue;
15
- }, {});
15
+ unorderedGroup[value] = (unorderedGroup[value] || []).concat(obj);
16
+ }
16
17
  if (!orderByNucleus) {
17
18
  return unorderedGroup;
18
19
  }
19
20
  else {
20
- return Object.keys(unorderedGroup)
21
+ return Object.fromEntries(Object.keys(unorderedGroup)
21
22
  .sort((a, b) => getNucleusSum(a) - getNucleusSum(b))
22
- .reduce((acc, key) => {
23
- acc[key] = unorderedGroup[key];
24
- return acc;
25
- }, {});
23
+ .map((key) => [key, unorderedGroup[key]]));
26
24
  }
27
25
  };
28
26
  }
@@ -9,7 +9,7 @@ export class PathBuilder {
9
9
  this.array.push(`L ${x} ${y}`);
10
10
  }
11
11
  closePath() {
12
- if (this.array.length !== 0)
12
+ if (this.array.length > 0)
13
13
  this.array.push('Z');
14
14
  }
15
15
  toString() {
@@ -1,9 +1,8 @@
1
1
  import { getLocalStorage, getValue } from './LocalStorage';
2
2
  function GetPreference(preferences, key) {
3
3
  const localData = getLocalStorage('nmr-general-settings');
4
- const val = getValue(preferences, `formatting.panels.[${key}]`)
5
- ? getValue(preferences, `formatting.panels.[${key}]`)
6
- : getValue(localData, `formatting.panels.[${key}]`);
4
+ const val = getValue(preferences, `formatting.panels.[${key}]`) ||
5
+ getValue(localData, `formatting.panels.[${key}]`);
7
6
  return val;
8
7
  }
9
8
  export { GetPreference };
@@ -1,58 +1,34 @@
1
+ import * as clipboard from 'clipboard-polyfill';
1
2
  import { saveAs } from 'file-saver';
2
3
  import JSZip from 'jszip';
3
- function copyFormattedHtml(html) {
4
- // Create an iframe (isolated container) for the HTML
5
- let container = document.createElement('div');
6
- container.innerHTML = html;
7
- // Hide element
8
- container.style.position = 'fixed';
9
- container.style.pointerEvents = 'none';
10
- container.style.opacity = '0';
11
- // Detect all style sheets of the page
12
- let activeSheets = Array.prototype.slice
13
- .call(document.styleSheets)
14
- .filter((sheet) => {
15
- return !sheet.disabled;
16
- });
17
- // Mount the iframe to the DOM to make `contentWindow` available
18
- document.body.appendChild(container);
19
- // Copy to clipboard
20
- window.getSelection()?.removeAllRanges();
21
- let range = document.createRange();
22
- range.selectNode(container);
23
- window.getSelection()?.addRange(range);
24
- document.execCommand('copy');
25
- for (const active of activeSheets) {
26
- active.disabled = true;
27
- }
28
- document.execCommand('copy');
29
- for (const active of activeSheets) {
30
- active.disabled = false;
31
- }
32
- // Remove the iframe
33
- document.body.removeChild(container);
34
- }
35
4
  async function copyHTMLToClipboard(data) {
36
- try {
37
- copyFormattedHtml(data);
38
- return true;
39
- }
40
- catch (err) {
41
- return false;
42
- }
5
+ return copyToClipboard(data, 'text/html');
43
6
  }
44
7
  async function copyTextToClipboard(data) {
8
+ return copyToClipboard(data, 'text/plain');
9
+ }
10
+ async function copyToClipboard(data, type) {
45
11
  try {
46
- void navigator.clipboard.write([
47
- new ClipboardItem({
48
- 'text/plain': new Promise((resolve) => {
49
- resolve(new Blob([data], { type: 'text/plain' }));
12
+ if (typeof ClipboardItem !== 'undefined') {
13
+ void navigator.clipboard.write([
14
+ new ClipboardItem({
15
+ [type]: new Promise((resolve) => {
16
+ resolve(new Blob([data], { type }));
17
+ }),
50
18
  }),
51
- }),
52
- ]);
19
+ ]);
20
+ }
21
+ else {
22
+ //TODO when Firefox team implement ClipboardItem this code should be removed
23
+ // this library is used mainly to solve the problem of copy HTML to a clipboard in Firefox but we use it for both HTML and plain text
24
+ const item = new clipboard.ClipboardItem({
25
+ [type]: new Blob([data], { type }),
26
+ });
27
+ await clipboard.write([item]);
28
+ }
53
29
  return true;
54
30
  }
55
- catch (err) {
31
+ catch {
56
32
  return false;
57
33
  }
58
34
  }
@@ -79,9 +55,9 @@ async function exportAsJSON(data, fileName = 'experiment', spaceIndent = 0, isCo
79
55
  });
80
56
  saveAs(blob, `${fileName}.nmrium`);
81
57
  }
82
- catch (e) {
83
- // eslint-disable-next-line no-console
84
- console.log(e);
58
+ catch (error) {
59
+ // TODO: handle error.
60
+ reportError(error);
85
61
  }
86
62
  }
87
63
  }
@@ -132,33 +108,34 @@ function exportAsPng(rootRef, elementID, fileName = 'experiment') {
132
108
  }
133
109
  let img = new Image();
134
110
  let url = URL.createObjectURL(blob);
135
- img.onload = async () => {
111
+ img.addEventListener('load', () => {
136
112
  context?.drawImage(img, 0, 0);
137
113
  let png = canvas.toDataURL('image/png', 1);
138
114
  saveAs(png, `${fileName}.png`);
139
115
  URL.revokeObjectURL(png);
140
- };
116
+ });
141
117
  img.src = url;
142
118
  }
143
- catch (e) {
144
- // eslint-disable-next-line no-console
145
- console.log(e);
119
+ catch (error) {
120
+ // TODO: handle error.
121
+ reportError(error);
146
122
  }
147
123
  }
148
- function copyDataURLCliboard(image) {
124
+ // hack way to copy the image to the clipboard
125
+ function copyDataURLClipboardFireFox(image) {
149
126
  const img = document.createElement('img');
150
127
  img.src = image;
151
128
  img.style.position = 'fixed';
152
129
  img.style.pointerEvents = 'none';
153
130
  img.style.opacity = '0';
154
- document.body.appendChild(img);
131
+ document.body.append(img);
155
132
  const range = document.createRange();
156
133
  range.selectNode(img);
157
134
  window.getSelection()?.addRange(range);
158
135
  document.execCommand('Copy');
159
- document.body.removeChild(img);
136
+ img.remove();
160
137
  }
161
- function copyBlobToCliboard(canvas) {
138
+ function copyBlobToClipboard(canvas) {
162
139
  canvas.toBlob((b) => {
163
140
  const clip = new ClipboardItem({
164
141
  [b.type]: b,
@@ -166,9 +143,9 @@ function copyBlobToCliboard(canvas) {
166
143
  navigator.clipboard.write([clip]).then(() => {
167
144
  // eslint-disable-next-line no-console
168
145
  console.log('experiment copied.');
169
- }, (err) => {
170
- // eslint-disable-next-line no-console
171
- console.log(err);
146
+ }, (error) => {
147
+ // TODO: handle error;
148
+ reportError(error);
172
149
  });
173
150
  });
174
151
  }
@@ -185,44 +162,42 @@ function copyPNGToClipboard(rootRef, elementID) {
185
162
  }
186
163
  let img = new Image();
187
164
  const url = URL.createObjectURL(blob);
188
- img.onload = async () => {
165
+ img.addEventListener('load', async () => {
189
166
  context?.drawImage(img, 0, 0);
190
167
  const png = canvas.toDataURL('image/png', 1);
191
168
  // @ts-expect-error write exists in some browsers
192
169
  if (navigator.clipboard.write) {
193
- copyBlobToCliboard(canvas);
170
+ copyBlobToClipboard(canvas);
194
171
  }
195
172
  else {
196
- copyDataURLCliboard(png);
173
+ copyDataURLClipboardFireFox(png);
197
174
  }
198
175
  URL.revokeObjectURL(png);
199
- };
176
+ });
200
177
  img.src = url;
201
178
  }
202
- catch (e) {
203
- if (e instanceof ReferenceError) {
179
+ catch (error) {
180
+ if (error instanceof ReferenceError) {
204
181
  // eslint-disable-next-line no-alert
205
182
  alert('Your browser does not support this feature, please use Google Chrome');
206
183
  }
207
- // eslint-disable-next-line no-console
208
- console.log(e);
184
+ // TODO: handle error.
185
+ reportError(error);
209
186
  }
210
187
  }
211
188
  function getBlob(rootRef, elementID) {
212
189
  let _svg = rootRef.getRootNode()
213
- .getElementById(elementID)
190
+ .querySelector(`#${elementID}`)
214
191
  ?.cloneNode(true);
215
192
  const width = Number(_svg?.getAttribute('width').replace('px', ''));
216
193
  const height = Number(_svg?.getAttribute('height').replace('px', ''));
217
- _svg
218
- .querySelectorAll('[data-no-export="true"]')
219
- .forEach((element) => element.remove());
220
- _svg
221
- .querySelectorAll('[data-replace-float-structure="true"]')
222
- .forEach((element) => {
194
+ for (const element of _svg.querySelectorAll('[data-no-export="true"]')) {
195
+ element.remove();
196
+ }
197
+ const elements = _svg.querySelectorAll('[data-replace-float-structure="true"]');
198
+ for (const element of elements) {
223
199
  element.replaceWith(element.childNodes[0].childNodes[0]);
224
- return element;
225
- });
200
+ }
226
201
  const head = `<svg class="nmr-svg" viewBox='0 0 ${width} ${height}' width="${width}" height="${height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;
227
202
  const style = `<style>.grid line,.grid path{stroke:none;} .peaks-text{fill:#730000} .x path{stroke-width:1px} .x text{
228
203
  font-size: 12px;
@@ -1,3 +1,8 @@
1
- declare function formatNumber(value: any, format: any, prefix?: string, suffix?: string): any;
1
+ interface FormatOptions {
2
+ prefix?: string;
3
+ suffix?: string;
4
+ defaultFormat?: string;
5
+ }
6
+ declare function formatNumber(value: string | number, format: string | undefined, options?: FormatOptions): string;
2
7
  declare function getNumberOfDecimals(value: number | string): number;
3
8
  export { formatNumber, getNumberOfDecimals };
@@ -1,12 +1,13 @@
1
1
  import numeral from 'numeral';
2
- function formatNumber(value, format, prefix = '', suffix = '') {
3
- return (value || value === 0) && !isNaN(value)
4
- ? prefix + numeral(value).format(format) + suffix
2
+ function formatNumber(value, format, options = {}) {
3
+ const { prefix = '', suffix = '', defaultFormat = '0.00' } = options;
4
+ return typeof value === 'number' || !Number.isNaN(Number(value))
5
+ ? prefix + numeral(value).format(format || defaultFormat) + suffix
5
6
  : value;
6
7
  }
7
8
  function getNumberOfDecimals(value) {
8
9
  value = String(value).trim();
9
10
  const lastIndex = value.lastIndexOf('.');
10
- return lastIndex > 0 ? value.substr(lastIndex).split('').length - 1 : 0;
11
+ return lastIndex > 0 ? value.slice(lastIndex).split('').length - 1 : 0;
11
12
  }
12
13
  export { formatNumber, getNumberOfDecimals };
@@ -1,17 +1,16 @@
1
- import * as apodization from './data1d/filter1d/apodization';
2
- import * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
3
- import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
4
- import * as centerMean from './data1d/filter1d/centerMean';
5
- import * as digitalFilter from './data1d/filter1d/digitalFilter';
6
- import * as equallySpaced from './data1d/filter1d/equallySpaced';
7
- import * as exclusionZones from './data1d/filter1d/exclusionZones';
8
- import * as fft from './data1d/filter1d/fft';
9
- import * as fromTo from './data1d/filter1d/fromTo';
10
- import * as pareto from './data1d/filter1d/pareto';
11
- import * as phaseCorrection from './data1d/filter1d/phaseCorrection';
12
- import * as shiftX from './data1d/filter1d/shiftX';
13
- import * as standardDeviation from './data1d/filter1d/standardDeviation';
14
- import * as zeroFilling from './data1d/filter1d/zeroFilling';
15
- import * as shift2DX from './data2d/filter2d/shiftX';
16
- import * as shift2DY from './data2d/filter2d/shiftY';
17
- export { baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
1
+ export * as apodization from './data1d/filter1d/apodization';
2
+ export * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
3
+ export * as baselineCorrection from './data1d/filter1d/baselineCorrection';
4
+ export * as centerMean from './data1d/filter1d/centerMean';
5
+ export * as digitalFilter from './data1d/filter1d/digitalFilter';
6
+ export * as equallySpaced from './data1d/filter1d/equallySpaced';
7
+ export * as exclusionZones from './data1d/filter1d/exclusionZones';
8
+ export * as fft from './data1d/filter1d/fft';
9
+ export * as fromTo from './data1d/filter1d/fromTo';
10
+ export * as pareto from './data1d/filter1d/pareto';
11
+ export * as phaseCorrection from './data1d/filter1d/phaseCorrection';
12
+ export * as shiftX from './data1d/filter1d/shiftX';
13
+ export * as standardDeviation from './data1d/filter1d/standardDeviation';
14
+ export * as zeroFilling from './data1d/filter1d/zeroFilling';
15
+ export * as shift2DX from './data2d/filter2d/shiftX';
16
+ export * as shift2DY from './data2d/filter2d/shiftY';
@@ -1,17 +1,16 @@
1
- import * as apodization from './data1d/filter1d/apodization';
2
- import * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
3
- import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
4
- import * as centerMean from './data1d/filter1d/centerMean';
5
- import * as digitalFilter from './data1d/filter1d/digitalFilter';
6
- import * as equallySpaced from './data1d/filter1d/equallySpaced';
7
- import * as exclusionZones from './data1d/filter1d/exclusionZones';
8
- import * as fft from './data1d/filter1d/fft';
9
- import * as fromTo from './data1d/filter1d/fromTo';
10
- import * as pareto from './data1d/filter1d/pareto';
11
- import * as phaseCorrection from './data1d/filter1d/phaseCorrection';
12
- import * as shiftX from './data1d/filter1d/shiftX';
13
- import * as standardDeviation from './data1d/filter1d/standardDeviation';
14
- import * as zeroFilling from './data1d/filter1d/zeroFilling';
15
- import * as shift2DX from './data2d/filter2d/shiftX';
16
- import * as shift2DY from './data2d/filter2d/shiftY';
17
- export { baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
1
+ export * as apodization from './data1d/filter1d/apodization';
2
+ export * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
3
+ export * as baselineCorrection from './data1d/filter1d/baselineCorrection';
4
+ export * as centerMean from './data1d/filter1d/centerMean';
5
+ export * as digitalFilter from './data1d/filter1d/digitalFilter';
6
+ export * as equallySpaced from './data1d/filter1d/equallySpaced';
7
+ export * as exclusionZones from './data1d/filter1d/exclusionZones';
8
+ export * as fft from './data1d/filter1d/fft';
9
+ export * as fromTo from './data1d/filter1d/fromTo';
10
+ export * as pareto from './data1d/filter1d/pareto';
11
+ export * as phaseCorrection from './data1d/filter1d/phaseCorrection';
12
+ export * as shiftX from './data1d/filter1d/shiftX';
13
+ export * as standardDeviation from './data1d/filter1d/standardDeviation';
14
+ export * as zeroFilling from './data1d/filter1d/zeroFilling';
15
+ export * as shift2DX from './data2d/filter2d/shiftX';
16
+ export * as shift2DY from './data2d/filter2d/shiftY';
@@ -14,6 +14,7 @@ function applyFilter(datum, filters = []) {
14
14
  };
15
15
  const previousFilter = lookupForFilter(datum, filter.name);
16
16
  if (previousFilter) {
17
+ // eslint-disable-next-line unicorn/no-array-reduce
17
18
  const reduceResult = Filters[filter.name].reduce(previousFilter.value, filterOption.value);
18
19
  if (reduceResult.once) {
19
20
  if (!isReduced) {
@@ -60,7 +61,7 @@ function lookupForFilter(datum, filterName) {
60
61
  return datum.filters.find((f) => f.name === filterName);
61
62
  }
62
63
  function reapplyFilters(datum, filters = null) {
63
- const _filters = filters ? filters : datum.filters;
64
+ const _filters = filters || datum.filters;
64
65
  enableFilter(datum, null, null, _filters);
65
66
  }
66
67
  // id filter id
@@ -69,11 +70,11 @@ function enableFilter(datum, id, checked, filters = null) {
69
70
  if (id) {
70
71
  datum.filters = datum.filters.map((filter) => {
71
72
  return { ...filter, flag: filter.id === id ? checked : filter.flag };
72
- }, []);
73
+ });
73
74
  }
74
75
  datum.data = { ...datum.data, ...datum.originalData };
75
76
  datum.info = { ...datum.info, ...datum.originalInfo };
76
- const _filters = filters ? filters : datum.filters;
77
+ const _filters = filters || datum.filters;
77
78
  for (let filterIndex in _filters) {
78
79
  const filter = datum.filters[filterIndex];
79
80
  datum.filters[filterIndex] = {
@@ -115,27 +115,25 @@ function generated1DSpectrum(params) {
115
115
  return datum;
116
116
  }
117
117
  function mapZones(zones) {
118
- return zones.reduce((zonesAcc, zone) => {
118
+ return zones.map((zone) => {
119
119
  const { signals, ...resZone } = zone;
120
- const newSignals = signals.reduce((signalsAcc, signal) => {
120
+ const newSignals = signals.map((signal) => {
121
121
  const { x, y, id, ...resSignal } = signal;
122
- signalsAcc.push({
122
+ return {
123
123
  id: id || v4(),
124
124
  kind: 'signal',
125
125
  x: { ...x, originDelta: x.delta || 0 },
126
126
  y: { ...y, originDelta: y.delta || 0 },
127
127
  ...resSignal,
128
- });
129
- return signalsAcc;
130
- }, []);
131
- zonesAcc.push({
128
+ };
129
+ });
130
+ return {
132
131
  id: v4(),
133
132
  ...resZone,
134
133
  signals: newSignals,
135
134
  kind: DatumKind.signal,
136
- });
137
- return zonesAcc;
138
- }, []);
135
+ };
136
+ });
139
137
  }
140
138
  function generated2DSpectrum(params) {
141
139
  const { spectrum, inputOptions, experiment, color } = params;
@@ -6,8 +6,7 @@ export declare enum DataExportOptions {
6
6
  }
7
7
  export declare type DataExportOptionsType = keyof typeof DataExportOptions;
8
8
  export declare function addJcampFromURL(spectra: any, jcampURL: any, options: any, usedColors: any): Promise<void>;
9
- export declare function addJcamp(spectra: any, jcamp: any, options: any, usedColors: any): void;
10
- export declare function fromJSON(data?: any[], usedColors?: any): Promise<any[]>;
9
+ export declare function addJcamp(output: any, jcamp: any, options: any, usedColors: any): void;
11
10
  export declare function addJcamps(files: any, usedColors: any): never[];
12
11
  /**
13
12
  *