nmrium 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  15. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  16. package/lib/component/2d/FooterBanner.js +3 -2
  17. package/lib/component/2d/Viewer2D.js +51 -29
  18. package/lib/component/2d/XAxis.js +1 -1
  19. package/lib/component/2d/YAxis.js +1 -1
  20. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  21. package/lib/component/2d/utilities/scale.d.ts +5 -5
  22. package/lib/component/2d/zones/Signal.js +1 -2
  23. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  24. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  25. package/lib/component/NMRium.d.ts +2 -2
  26. package/lib/component/NMRium.js +39 -26
  27. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  28. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  29. package/lib/component/context/LoggerContext.js +11 -6
  30. package/lib/component/elements/InputRange.js +1 -1
  31. package/lib/component/elements/MenuButton.d.ts +1 -1
  32. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  33. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  34. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  35. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  36. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  37. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  38. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  39. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  40. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  41. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  42. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +8 -0
  43. package/lib/component/elements/popup/Alert/AlertBlock.js +30 -0
  44. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  45. package/lib/component/elements/popup/Alert/Context.js +6 -2
  46. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  47. package/lib/component/elements/popup/Alert/Provider.js +5 -23
  48. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  49. package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  50. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  51. package/lib/component/elements/popup/options.d.ts +22 -19
  52. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  53. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  54. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  55. package/lib/component/header/Header.js +2 -2
  56. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  57. package/lib/component/highlight/index.d.ts +1 -1
  58. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  59. package/lib/component/hooks/useExport.js +2 -1
  60. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  61. package/lib/component/hooks/usePanelPreferences.js +2 -2
  62. package/lib/component/hooks/useXScale.d.ts +1 -1
  63. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  64. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  65. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  66. package/lib/component/modal/AboutUsModal.js +4 -2
  67. package/lib/component/modal/AlignSpectraModal.js +11 -1
  68. package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
  69. package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +28 -27
  78. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  79. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +19 -19
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  89. package/lib/component/panels/Panels.js +13 -0
  90. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  91. package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
  92. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
  93. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  94. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  95. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  96. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  97. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  99. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  100. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  101. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  102. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  103. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  104. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  105. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  106. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  107. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  112. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  113. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  114. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  115. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  116. package/lib/component/reducer/Reducer.d.ts +13 -12
  117. package/lib/component/reducer/Reducer.js +251 -239
  118. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  119. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  120. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  121. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  122. package/lib/component/reducer/actions/DomainActions.js +30 -1
  123. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -0
  126. package/lib/component/reducer/actions/MoleculeActions.js +51 -2
  127. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  128. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  129. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  130. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  131. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  132. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  133. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  134. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  135. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  136. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  137. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  138. package/lib/component/utility/export.d.ts +5 -4
  139. package/lib/component/utility/export.js +33 -61
  140. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  141. package/lib/component/utility/getUniqueNuclei.js +1 -1
  142. package/lib/component/utility/jpathToArray.js +1 -1
  143. package/lib/component/workspaces/index.d.ts +1 -0
  144. package/lib/component/workspaces/index.js +2 -0
  145. package/lib/component/workspaces/simulation.d.ts +2 -0
  146. package/lib/component/workspaces/simulation.js +68 -0
  147. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  148. package/lib/data/PredictionManager.d.ts +8 -7
  149. package/lib/data/PredictionManager.js +95 -22
  150. package/lib/data/SpectraManager.js +1 -1
  151. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  152. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  154. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  156. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  157. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  158. package/lib/data/data1d/database.d.ts +5 -5
  159. package/lib/data/data1d/database.js +3 -3
  160. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  161. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  162. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  163. package/lib/data/data1d/spectrumSimulation.js +53 -0
  164. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  165. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  166. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  167. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  168. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  169. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  170. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  171. package/lib/data/matrixGeneration.js +1 -1
  172. package/lib/data/molecules/MoleculeManager.d.ts +1 -1
  173. package/lib/data/molecules/MoleculeManager.js +7 -7
  174. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  175. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  176. package/lib/data/utilities/FindUtilities.js +4 -4
  177. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  178. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  179. package/lib/data/utilities/calculateSanPlot.js +3 -3
  180. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  181. package/lib/utils/clipboard/clipboard.d.ts +12 -0
  182. package/lib/utils/clipboard/clipboard.js +15 -0
  183. package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
  184. package/lib/utils/clipboard/clipboardComponents.js +150 -0
  185. package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
  186. package/lib/utils/clipboard/clipboardHooks.js +142 -0
  187. package/lib/utils/clipboard/types.d.ts +1 -0
  188. package/lib/utils/clipboard/types.js +1 -0
  189. package/lib/versionInfo.js +1 -1
  190. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  191. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  192. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  193. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  194. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  195. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  196. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  197. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  198. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  199. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  200. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  201. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  202. package/lib-cjs/component/2d/XAxis.js +1 -1
  203. package/lib-cjs/component/2d/YAxis.js +1 -1
  204. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  205. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  206. package/lib-cjs/component/NMRium.js +37 -24
  207. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  208. package/lib-cjs/component/context/LoggerContext.js +10 -5
  209. package/lib-cjs/component/elements/InputRange.js +1 -1
  210. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  211. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +36 -0
  212. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  213. package/lib-cjs/component/elements/popup/Alert/Provider.js +4 -22
  214. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
  215. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  216. package/lib-cjs/component/header/Header.js +2 -2
  217. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  218. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  219. package/lib-cjs/component/hooks/useExport.js +2 -1
  220. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  221. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  222. package/lib-cjs/component/modal/AboutUsModal.js +4 -2
  223. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  224. package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
  225. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  226. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  227. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  228. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  229. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  230. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  231. package/lib-cjs/component/modal/setting/GeneralSettings.js +28 -27
  232. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  233. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  234. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  235. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  236. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -18
  237. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  238. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
  239. package/lib-cjs/component/panels/Panels.js +13 -0
  240. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  241. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
  242. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
  243. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
  244. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  245. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  246. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  247. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  248. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  249. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  250. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  251. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  252. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  253. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  254. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  255. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  256. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  257. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  258. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  259. package/lib-cjs/component/reducer/Reducer.js +251 -239
  260. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  261. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  262. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  263. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  264. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  265. package/lib-cjs/component/reducer/actions/MoleculeActions.js +54 -2
  266. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  267. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  268. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  269. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  270. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  271. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  272. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  273. package/lib-cjs/component/utility/export.js +33 -63
  274. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  275. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  276. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  277. package/lib-cjs/component/workspaces/index.js +2 -0
  278. package/lib-cjs/component/workspaces/simulation.js +71 -0
  279. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -0
  280. package/lib-cjs/data/PredictionManager.js +96 -22
  281. package/lib-cjs/data/SpectraManager.js +1 -1
  282. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  283. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  284. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  285. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  286. package/lib-cjs/data/data1d/database.js +3 -3
  287. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  288. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  289. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  290. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  291. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  292. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  293. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  294. package/lib-cjs/data/matrixGeneration.js +1 -1
  295. package/lib-cjs/data/molecules/MoleculeManager.js +7 -7
  296. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  297. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  298. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  299. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  300. package/lib-cjs/utils/clipboard/clipboard.js +23 -0
  301. package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
  302. package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
  303. package/lib-cjs/utils/clipboard/types.js +2 -0
  304. package/lib-cjs/versionInfo.js +1 -1
  305. package/package.json +26 -25
  306. package/lib/component/header/LogsHistory.d.ts +0 -1
@@ -5,6 +5,8 @@ import { Formik } from 'formik';
5
5
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
  import { FaBolt, FaPaste, FaRegCopy, FaWrench } from 'react-icons/fa';
7
7
  import { Modal, Toolbar, useOnOff } from 'react-science/ui';
8
+ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
9
+ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
8
10
  import { usePreferences, useWorkspacesList, } from '../../context/PreferencesContext';
9
11
  import ActionButtons from '../../elements/ActionButtons';
10
12
  import Button from '../../elements/Button';
@@ -15,7 +17,6 @@ import DropDownButton from '../../elements/dropDownButton/DropDownButton';
15
17
  import { useAlert } from '../../elements/popup/Alert';
16
18
  import { useSaveSettings } from '../../hooks/useSaveSettings';
17
19
  import { getPreferencesByWorkspace } from '../../reducer/preferences/utilities/getPreferencesByWorkspace';
18
- import { copyTextToClipboard } from '../../utility/export';
19
20
  import PredefinedWorkspaces from '../../workspaces';
20
21
  import WorkspaceItem from './WorkspaceItem';
21
22
  import DatabasesTabContent from './settings-tabs/DatabasesTabContent';
@@ -28,7 +29,8 @@ import OnLoadProcessingTabContent from './settings-tabs/OnLoadProcessingTabConte
28
29
  import ToolsTabContent from './settings-tabs/ToolsTabContent';
29
30
  import { validation } from './settingsValidation';
30
31
  const styles = css `
31
- width: 800px;
32
+ width: 50vw;
33
+ min-width: 800px;
32
34
 
33
35
  .main-content {
34
36
  width: 100%;
@@ -175,20 +177,16 @@ function GeneralSettingsModal({ height }) {
175
177
  function handleDisabledRestButton(values) {
176
178
  setRestDisabled(isRestButtonDisable(values, workspaceName, originalWorkspaces));
177
179
  }
180
+ const { readText, rawWriteWithType, shouldFallback, cleanShouldFallback, text, } = useClipboard();
178
181
  function handleCopyWorkspace() {
179
182
  const data = { [workspaceName]: refForm.current?.values };
180
- void copyTextToClipboard(JSON.stringify(data)).then((flag) => {
181
- if (flag) {
182
- alert.success('Workspace copied to clipboard');
183
- }
184
- else {
185
- alert.error('copied not completed');
186
- }
183
+ void rawWriteWithType(JSON.stringify(data)).then(() => {
184
+ alert.success('Workspace copied to clipboard');
187
185
  });
188
186
  }
189
187
  const setWorkspaceSetting = useCallback((inputWorkspace) => {
190
188
  const parseWorkspaceName = Object.keys(inputWorkspace)[0];
191
- if (preferences?.workspace.current === parseWorkspaceName) {
189
+ if (preferences.workspace.current === parseWorkspaceName) {
192
190
  refForm.current?.setValues(inputWorkspace[parseWorkspaceName]);
193
191
  }
194
192
  else if (preferences.workspaces[parseWorkspaceName]) {
@@ -201,41 +199,44 @@ function GeneralSettingsModal({ height }) {
201
199
  },
202
200
  });
203
201
  }
204
- }, [dispatch, preferences?.workspace, preferences.workspaces]);
205
- function handlePastWorkspace() {
206
- void navigator.clipboard.readText().then((text) => {
207
- try {
208
- const parseWorkspaces = JSON.parse(text);
209
- setWorkspaceSetting(parseWorkspaces);
210
- }
211
- catch {
212
- alert.error('object parse error');
213
- }
214
- });
215
- }
202
+ }, [dispatch, preferences.workspace, preferences.workspaces]);
216
203
  useEffect(() => {
217
204
  if (pastRef.current) {
218
205
  setWorkspaceSetting(pastRef.current);
219
206
  pastRef.current = null;
220
207
  }
221
208
  }, [setWorkspaceSetting]);
222
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", children: _jsx(FaWrench, {}) }), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, children: [_jsx(Modal.Header, { children: _jsxs("div", { style: {
209
+ function handlePastWorkspace(text) {
210
+ if (!text)
211
+ return;
212
+ try {
213
+ const parseWorkspaces = JSON.parse(text);
214
+ setWorkspaceSetting(parseWorkspaces);
215
+ }
216
+ catch {
217
+ alert.error('object parse error');
218
+ }
219
+ cleanShouldFallback();
220
+ }
221
+ function handlePastWorkspaceAction() {
222
+ void readText().then(handlePastWorkspace);
223
+ }
224
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", children: _jsx(FaWrench, {}) }), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: [_jsx(Modal.Header, { children: _jsxs("div", { style: {
223
225
  display: 'flex',
224
226
  flexDirection: 'column',
225
- width: '100%',
226
227
  }, children: [_jsx("span", { children: "General Settings" }), _jsxs("div", { style: {
227
228
  display: 'flex',
228
229
  alignItems: 'center',
229
230
  cursor: 'default',
230
231
  paddingTop: '10px',
231
- }, children: [_jsx(Label, { title: "Workspace", children: _jsx(DropDownButton, { data: workspacesList, renderItem: renderItem, selectedKey: preferences?.workspace.current, onSelect: ChangeWorkspaceHandler }) }), _jsx(Button.Action, { size: "xSmall", onClick: handleReset, toolTip: "Reset workspace preferences", tooltipOrientation: "horizontal", style: {
232
+ }, children: [_jsx(Label, { title: "Workspace", children: _jsx(DropDownButton, { data: workspacesList, renderItem: renderItem, selectedKey: preferences.workspace.current, onSelect: ChangeWorkspaceHandler }) }), _jsx(Button.Action, { size: "xSmall", onClick: handleReset, toolTip: "Reset workspace preferences", tooltipOrientation: "horizontal", style: {
232
233
  marginLeft: '10px',
233
234
  }, disabled: isRestDisabled, children: _jsx(FaBolt, {}) }), _jsx(Button.Done, { size: "xSmall", fill: "outline", onClick: handleCopyWorkspace, toolTip: "Copy workspace preferences", tooltipOrientation: "horizontal", style: {
234
235
  marginLeft: '10px',
235
- }, children: _jsx(FaRegCopy, {}) }), _jsx(Button.Action, { size: "xSmall", fill: "outline", onClick: handlePastWorkspace, toolTip: "Past workspace preferences", tooltipOrientation: "horizontal", style: {
236
+ }, children: _jsx(FaRegCopy, {}) }), _jsx(Button.Action, { size: "xSmall", fill: "outline", onClick: handlePastWorkspaceAction, toolTip: "Past workspace preferences", tooltipOrientation: "horizontal", style: {
236
237
  marginLeft: '10px',
237
238
  }, children: _jsx(FaPaste, {}) })] })] }) }), _jsx(Modal.Body, { children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { title: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { title: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { title: "Panels", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { title: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { title: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), _jsx(Tab, { title: "Import filters", tabid: "importation-filters", children: _jsx("div", { className: "inner-content", children: _jsx(ImportationFiltersTabContent, {}) }) }), _jsx(Tab, { title: "Title Block", tabid: "title-block", children: _jsx("div", { className: "inner-content", children: _jsx(InfoBlockTabContent, {}) }) }), _jsx(Tab, { title: "On Load Processing", tabid: "on-load-processing", children: _jsx("div", { className: "inner-content", children: _jsx(OnLoadProcessingTabContent, {}) }) })] }) }) }) }), _jsx(Modal.Footer, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
238
239
  closeDialog?.();
239
- } }), _jsx(Button.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), _jsx(SaveSettingsModal, {})] }));
240
+ } }), _jsx(Button.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), _jsx(SaveSettingsModal, {}), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePastWorkspace, text: text, label: "Workspace" })] }));
240
241
  }
241
242
  export default GeneralSettingsModal;
@@ -58,6 +58,10 @@ const LIST = [
58
58
  label: 'Matrix generation Panel',
59
59
  name: 'panels.matrixGenerationPanel',
60
60
  },
61
+ {
62
+ label: 'Simulation panel',
63
+ name: 'panels.simulationPanel',
64
+ },
61
65
  ];
62
66
  const COLUMNS = [
63
67
  {
@@ -53,7 +53,7 @@ function FormattingTabContent() {
53
53
  const { values, setFieldValue } = useFormikContext();
54
54
  const nuclei = lodashGet(values, 'formatting.nuclei', {});
55
55
  function deleteHandler(key) {
56
- let _nuclei = {};
56
+ const _nuclei = {};
57
57
  for (const nucleus in nuclei) {
58
58
  if (nucleus !== key) {
59
59
  _nuclei[nucleus] = nuclei[nucleus];
@@ -13,7 +13,7 @@ const formattingValidation = (obj) => object().shape({
13
13
  nuclei: object()
14
14
  .shape(formattingElementValidation(obj))
15
15
  .test('Unique', 'Nuclei need te be unique', function check(nuclei) {
16
- let nucleusFrequencies = {};
16
+ const nucleusFrequencies = {};
17
17
  for (const key of Object.keys(nuclei)) {
18
18
  const _key = nuclei[key].name?.toLowerCase() || '';
19
19
  if (_key) {
@@ -30,7 +30,7 @@ const formattingValidation = (obj) => object().shape({
30
30
  for (const key in nucleusFrequencies) {
31
31
  const { value, fields } = nucleusFrequencies[key];
32
32
  if (value > 1) {
33
- for (let field of fields) {
33
+ for (const field of fields) {
34
34
  errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
35
35
  }
36
36
  }
@@ -3,6 +3,6 @@ export interface IntegralPanelInnerProps {
3
3
  integrals: Integrals;
4
4
  info: Info1D;
5
5
  activeTab: string;
6
- xDomain: Array<number>;
6
+ xDomain: number[];
7
7
  }
8
8
  export default function IntegralPanel(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@
2
2
  import { Integral } from 'nmr-processing';
3
3
  import { IntegralPanelInnerProps } from './IntegralPanel';
4
4
  interface IntegralTableProps extends Pick<IntegralPanelInnerProps, 'activeTab'> {
5
- data: Array<Integral>;
5
+ data: Integral[];
6
6
  }
7
7
  declare function IntegralTable({ activeTab, data }: IntegralTableProps): import("react/jsx-runtime").JSX.Element;
8
8
  declare const _default: import("react").MemoExoticComponent<typeof IntegralTable>;
@@ -84,12 +84,9 @@ function IntegralTable({ activeTab, data }) {
84
84
  },
85
85
  accessor: 'integral',
86
86
  Cell: ({ row }) => {
87
- let integral = '';
88
- if (row.original?.integral) {
89
- const value = formatNumber(row.original.integral, integralsPreferences.relative.format);
90
- const flag = checkIntegralKind(row.original);
91
- integral = flag ? value : `[ ${value} ]`;
92
- }
87
+ const value = formatNumber(row.original.integral || 0, integralsPreferences.relative.format);
88
+ const flag = checkIntegralKind(row.original);
89
+ const integral = flag ? value : `[ ${value} ]`;
93
90
  return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
94
91
  },
95
92
  },
@@ -109,7 +106,7 @@ function IntegralTable({ activeTab, data }) {
109
106
  saveRelativeHandler,
110
107
  ]);
111
108
  const tableColumns = useMemo(() => {
112
- let columns = [...initialColumns];
109
+ const columns = [...initialColumns];
113
110
  for (const col of COLUMNS) {
114
111
  const { showWhen, ...colParams } = col;
115
112
  if (lodashGet(integralsPreferences, showWhen)) {
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { MoleculesView, StateMoleculeExtended } from '../../../data/molecules/Molecule';
3
3
  interface MoleculePanelHeaderProps {
4
4
  currentIndex: number;
5
- molecules: Array<StateMoleculeExtended>;
5
+ molecules: StateMoleculeExtended[];
6
6
  moleculesView: MoleculesView;
7
7
  onMoleculeIndexChange?: (index: number) => void;
8
8
  onOpenMoleculeEditor: () => void;
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { SvgNmrFt } from 'cheminfo-font';
3
2
  import { Molecule as OCLMolecule } from 'openchemlib/full';
4
3
  import { useCallback } from 'react';
5
4
  import { FaCog, FaCopy, FaDownload, FaFileExport, FaFileImage, FaPaste, FaPlus, FaRegTrashAlt, } from 'react-icons/fa';
6
5
  import { IoOpenOutline } from 'react-icons/io5';
7
6
  import { DropdownMenu } from 'react-science/ui';
7
+ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
8
+ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
8
9
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
9
10
  import { useDispatch } from '../../context/DispatchContext';
10
11
  import { useGlobal } from '../../context/GlobalContext';
@@ -12,8 +13,8 @@ import ActiveButton from '../../elements/ActiveButton';
12
13
  import Button from '../../elements/Button';
13
14
  import { useAlert } from '../../elements/popup/Alert';
14
15
  import AboutPredictionModal from '../../modal/AboutPredictionModal';
15
- import { usePredictSpectraModal } from '../../modal/PredictSpectraModal';
16
- import { copyPNGToClipboard, copyTextToClipboard, exportAsSVG, } from '../../utility/export';
16
+ import PredictSpectraModal from '../../modal/PredictSpectraModal';
17
+ import { copyPNGToClipboard, exportAsSVG } from '../../utility/export';
17
18
  import PanelHeader from '../header/PanelHeader';
18
19
  const styles = {
19
20
  counter: {
@@ -75,7 +76,6 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
75
76
  const dispatch = useDispatch();
76
77
  const assignmentData = useAssignmentData();
77
78
  const moleculeKey = molecules?.[currentIndex]?.id;
78
- const openPredictSpectraModal = usePredictSpectraModal();
79
79
  const saveAsSVGHandler = useCallback(() => {
80
80
  if (!rootRef)
81
81
  return;
@@ -87,16 +87,12 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
87
87
  copyPNGToClipboard(rootRef, `molSVG${currentIndex} `);
88
88
  alert.success('MOL copied as PNG to clipboard');
89
89
  }, [rootRef, alert, currentIndex]);
90
+ const { rawWriteWithType, readText, shouldFallback, cleanShouldFallback, text, } = useClipboard();
90
91
  const saveAsMolHandler = useCallback((molfile) => {
91
- void copyTextToClipboard(molfile).then((flag) => {
92
- if (flag) {
93
- alert.success('MOLFile copied to clipboard');
94
- }
95
- else {
96
- alert.error('copied not completed');
97
- }
92
+ void rawWriteWithType(molfile).then(() => {
93
+ alert.success('MOLFile copied to clipboard');
98
94
  });
99
- }, [alert]);
95
+ }, [alert, rawWriteWithType]);
100
96
  const exportHandler = useCallback((selected) => {
101
97
  const molecule = molecules?.[currentIndex];
102
98
  if (molecule) {
@@ -125,11 +121,15 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
125
121
  saveAsPNGHandler,
126
122
  saveAsSVGHandler,
127
123
  ]);
128
- const handlePaste = useCallback(() => {
129
- void navigator.clipboard.readText().then((molfile) => {
130
- dispatch({ type: 'ADD_MOLECULE', payload: { molfile } });
131
- });
132
- }, [dispatch]);
124
+ function handlePasteMolfileAction() {
125
+ void readText().then(handlePasteMolfile);
126
+ }
127
+ function handlePasteMolfile(molfile) {
128
+ if (!molfile)
129
+ return;
130
+ dispatch({ type: 'ADD_MOLECULE', payload: { molfile } });
131
+ cleanShouldFallback();
132
+ }
133
133
  const handleDelete = useCallback(() => {
134
134
  if (molecules[currentIndex]?.id) {
135
135
  onMoleculeIndexChange?.(0);
@@ -158,7 +158,7 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
158
158
  });
159
159
  }
160
160
  const hasMolecules = molecules && molecules.length > 0;
161
- return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePaste, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(Button.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: () => openPredictSpectraModal(molecules[currentIndex]), toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: _jsx(SvgNmrFt, {}) }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), _jsxs("p", { style: styles.counter, children: [molecules &&
161
+ return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), _jsxs("p", { style: styles.counter, children: [molecules &&
162
162
  molecules.length > 0 &&
163
- `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) }))] }));
163
+ `${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
164
164
  }
@@ -23,7 +23,7 @@ export interface AtomData {
23
23
  *
24
24
  */
25
25
  export declare function extractFromAtom(atom: Atom, activeTab: string, axis?: Axis | null): AtomData;
26
- export declare function findDatumAndSignalIndex(data: (Range | Zone)[], id: string): {
26
+ export declare function findDatumAndSignalIndex(data: Array<Range | Zone>, id: string): {
27
27
  datum: Range | Zone | undefined;
28
28
  signalIndex: any;
29
29
  };
@@ -41,12 +41,10 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
41
41
  }, [onAtomHoverAction, onAtomHoverHighlights, highlightData]);
42
42
  const data = useMemo(() => {
43
43
  if (zones || ranges) {
44
- if (displayerMode === DISPLAYER_MODE.DM_1D && ranges && ranges.values) {
44
+ if (displayerMode === DISPLAYER_MODE.DM_1D && ranges?.values) {
45
45
  return ranges.values;
46
46
  }
47
- else if (displayerMode === DISPLAYER_MODE.DM_2D &&
48
- zones &&
49
- zones.values) {
47
+ else if (displayerMode === DISPLAYER_MODE.DM_2D && zones?.values) {
50
48
  return zones.values;
51
49
  }
52
50
  }
@@ -58,7 +56,7 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
58
56
  y: [],
59
57
  };
60
58
  const assignment = assignments.data.assignments;
61
- for (let id in assignment) {
59
+ for (const id in assignment) {
62
60
  if (assignment[id].x) {
63
61
  assignedDiaID.x.push(...assignment[id].x);
64
62
  }
@@ -6,6 +6,8 @@ import { useCallback, useState, useRef, memo } from 'react';
6
6
  import { FaFileExport } from 'react-icons/fa';
7
7
  import { IoPulseOutline } from 'react-icons/io5';
8
8
  import { getDataAsString, generateAnalyzeSpectra, } from '../../../data/data1d/multipleSpectraAnalysis';
9
+ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
10
+ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
9
11
  import { useChartData } from '../../context/ChartContext';
10
12
  import { useDispatch } from '../../context/DispatchContext';
11
13
  import Button from '../../elements/ButtonToolTip';
@@ -14,7 +16,6 @@ import { positions, useAlert } from '../../elements/popup/Alert';
14
16
  import { useModal } from '../../elements/popup/Modal';
15
17
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
16
18
  import AlignSpectraModal from '../../modal/AlignSpectraModal';
17
- import { copyTextToClipboard } from '../../utility/export';
18
19
  import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
19
20
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
20
21
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
@@ -50,18 +51,13 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, })
50
51
  width: 500,
51
52
  });
52
53
  }, [activeTab, modal, dispatch]);
54
+ const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = useClipboard();
53
55
  const copyToClipboardHandler = useCallback(() => {
54
- void (async () => {
55
- const data = getDataAsString(spectraAnalysis, spectra, spectraPreferences);
56
- const success = await copyTextToClipboard(data);
57
- if (success) {
58
- alert.success('Data copied to clipboard');
59
- }
60
- else {
61
- alert.error('copy to clipboard failed');
62
- }
63
- })();
64
- }, [alert, spectra, spectraAnalysis, spectraPreferences]);
56
+ const data = getDataAsString(spectraAnalysis, spectra, spectraPreferences);
57
+ if (!data)
58
+ return;
59
+ void rawWriteWithType(data).then(() => alert.success('Data copied to clipboard'));
60
+ }, [alert, rawWriteWithType, spectra, spectraAnalysis, spectraPreferences]);
65
61
  return (_jsxs("div", { css: [
66
62
  tablePanelStyle,
67
63
  isFlipped &&
@@ -70,7 +66,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, })
70
66
  position: relative;
71
67
  }
72
68
  `,
73
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [_jsx(Button, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: _jsx(FaFileExport, {}) }), _jsx(Button, { popupTitle: "Spectra calibration", onClick: openAlignSpectra, children: _jsx(SvgNmrOverlay, { style: { fontSize: '18px' } }) }), _jsx(ToggleButton, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, defaultValue: showLegend, children: _jsx(IoPulseOutline, {}) }, `${showLegend}`)] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(MultipleSpectraAnalysisTable, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })) : (_jsx(MultipleSpectraAnalysisPreferences, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) })] }));
69
+ ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [_jsx(Button, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: _jsx(FaFileExport, {}) }), _jsx(Button, { popupTitle: "Spectra calibration", onClick: openAlignSpectra, children: _jsx(SvgNmrOverlay, { style: { fontSize: '18px' } }) }), _jsx(ToggleButton, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, defaultValue: showLegend, children: _jsx(IoPulseOutline, {}) }, `${showLegend}`)] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(MultipleSpectraAnalysisTable, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })) : (_jsx(MultipleSpectraAnalysisPreferences, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra Analysis" })] }));
74
70
  }
75
71
  const MemoizedMultipleSpectraAnalysisPanel = memo(MultipleSpectraAnalysisPanelInner);
76
72
  export default function MultipleSpectraAnalysisPanel() {
@@ -20,6 +20,7 @@ import ZonesPanel from './ZonesPanel/ZonesPanel';
20
20
  import DatabasePanel from './databasePanel/DatabasePanel';
21
21
  import FilterPanel from './filtersPanel/FilterPanel';
22
22
  import PredictionPane from './predictionPanel/PredictionPanel';
23
+ import SpectrumSimulation from './spectrumSimulation/SpectrumSimulation';
23
24
  const accordionItems = [
24
25
  {
25
26
  title: 'Spectra',
@@ -106,6 +107,12 @@ const accordionItems = [
106
107
  hidePreferenceKey: 'predictionPanel',
107
108
  mode: null,
108
109
  },
110
+ {
111
+ title: 'Spectrum Simulation',
112
+ component: _jsx(SpectrumSimulation, {}),
113
+ hidePreferenceKey: 'simulationPanel',
114
+ mode: DISPLAYER_MODE.DM_1D,
115
+ },
109
116
  ];
110
117
  export const TOOLS_PANELS_ACCORDION = {
111
118
  null: 'Spectra',
@@ -122,6 +129,12 @@ function usePanelPreferences() {
122
129
  display: false,
123
130
  open: false,
124
131
  };
132
+ if (item?.isExperimental && !item.hidePreferenceKey) {
133
+ return {
134
+ display: true,
135
+ open: false,
136
+ };
137
+ }
125
138
  return lodashGet(preferences.current, `display.panels.${item.hidePreferenceKey}`, defaultValue);
126
139
  }, [preferences]);
127
140
  }
@@ -126,7 +126,7 @@ function PeaksTable({ activeTab, data }) {
126
126
  },
127
127
  ], [deletePeakHandler, editPeakHandler]);
128
128
  const tableColumns = useMemo(() => {
129
- let columns = [...initialColumns];
129
+ const columns = [...initialColumns];
130
130
  for (const col of COLUMNS) {
131
131
  const { showWhen, ...colParams } = col;
132
132
  if (lodashGet(peaksPreferences, showWhen)) {
@@ -6,6 +6,8 @@ import lodashGet from 'lodash/get';
6
6
  import { rangesToACS } from 'nmr-processing';
7
7
  import { FaFileExport, FaUnlink, FaSitemap, FaChartBar } from 'react-icons/fa';
8
8
  import { ImLink } from 'react-icons/im';
9
+ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
10
+ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
9
11
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
10
12
  import { useDispatch } from '../../context/DispatchContext';
11
13
  import ActiveButton from '../../elements/ActiveButton';
@@ -15,7 +17,6 @@ import { useModal } from '../../elements/popup/Modal';
15
17
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
16
18
  import CopyClipboardModal from '../../modal/CopyClipboardModal';
17
19
  import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
18
- import { copyHTMLToClipboard } from '../../utility/export';
19
20
  import { getNumberOfDecimals } from '../../utility/formatNumber';
20
21
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
21
22
  const style = css `
@@ -87,16 +88,9 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
87
88
  function handleShowJGraph() {
88
89
  dispatch({ type: 'SHOW_J_GRAPH', payload: { id } });
89
90
  }
91
+ const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = useClipboard();
90
92
  function saveToClipboardHandler(value) {
91
- void (async () => {
92
- const success = await copyHTMLToClipboard(value);
93
- if (success) {
94
- alert.success('Data copied to clipboard');
95
- }
96
- else {
97
- alert.error('copy to clipboard failed');
98
- }
99
- })();
93
+ void rawWriteWithType(value, 'text/html').then(() => alert.success('Data copied to clipboard'));
100
94
  }
101
95
  function saveAsHTMLHandler() {
102
96
  if (Array.isArray(ranges?.values) && ranges.values.length > 0) {
@@ -118,10 +112,10 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
118
112
  });
119
113
  }
120
114
  const hasRanges = Array.isArray(ranges?.values) && ranges.values.length > 0;
121
- return (_jsx("div", { css: style, children: _jsxs(DefaultPanelHeader, { counter: ranges?.values?.length || 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', filterIsActive: isFilterActive, counterFiltered: filterCounter, showSettingButton: true, onSettingClick: onSettingClick, children: [_jsx(Button, { popupTitle: "Preview publication string", popupPlacement: "right", onClick: saveAsHTMLHandler, className: "btn preview-publication-icon", disabled: !hasRanges, children: _jsx(FaFileExport, {}) }), _jsx(Button, { popupTitle: currentSum
122
- ? `Change ranges sum (${Number(currentSum).toFixed(2)})`
123
- : 'Change ranges sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: _jsx(SvgNmrSum, {}) }), _jsx(Button, { popupTitle: "Remove all assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !hasRanges, className: "btn icon", children: _jsx(FaUnlink, {}) }), _jsx(ActiveButton, { popupTitle: showMultiplicityTrees
124
- ? 'Hide multiplicity trees in spectrum'
125
- : 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: _jsx(FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: _jsx(FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showRangesIntegrals, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fix integral values", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: _jsx(ImLink, {}) })] }) }));
115
+ return (_jsxs("div", { css: style, children: [_jsxs(DefaultPanelHeader, { counter: ranges?.values?.length || 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', filterIsActive: isFilterActive, counterFiltered: filterCounter, showSettingButton: true, onSettingClick: onSettingClick, children: [_jsx(Button, { popupTitle: "Preview publication string", popupPlacement: "right", onClick: saveAsHTMLHandler, className: "btn preview-publication-icon", disabled: !hasRanges, children: _jsx(FaFileExport, {}) }), _jsx(Button, { popupTitle: currentSum
116
+ ? `Change ranges sum (${Number(currentSum).toFixed(2)})`
117
+ : 'Change ranges sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: _jsx(SvgNmrSum, {}) }), _jsx(Button, { popupTitle: "Remove all assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !hasRanges, className: "btn icon", children: _jsx(FaUnlink, {}) }), _jsx(ActiveButton, { popupTitle: showMultiplicityTrees
118
+ ? 'Hide multiplicity trees in spectrum'
119
+ : 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: _jsx(FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: _jsx(FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showRangesIntegrals, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fix integral values", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: _jsx(ImLink, {}) })] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
126
120
  }
127
121
  export default RangesHeader;
@@ -4,6 +4,8 @@ import { css } from '@emotion/react';
4
4
  import { xGetFromToIndex } from 'ml-spectra-processing';
5
5
  import { useCallback, useMemo, memo, useState, useRef } from 'react';
6
6
  import { FaCopy } from 'react-icons/fa';
7
+ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
8
+ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
7
9
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
8
10
  import { useChartData } from '../../context/ChartContext';
9
11
  import { useDispatch } from '../../context/DispatchContext';
@@ -11,7 +13,6 @@ import { useAlert } from '../../elements/popup/Alert';
11
13
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
12
14
  import useSpectrum from '../../hooks/useSpectrum';
13
15
  import { rangeStateInit } from '../../reducer/Reducer';
14
- import { copyTextToClipboard } from '../../utility/export';
15
16
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
16
17
  import NoTableData from '../extra/placeholder/NoTableData';
17
18
  import PreferencesHeader from '../header/PreferencesHeader';
@@ -68,6 +69,7 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
68
69
  },
69
70
  });
70
71
  }, [assignmentData, dispatch]);
72
+ const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = useClipboard();
71
73
  const saveJSONToClipboardHandler = useCallback(async (value) => {
72
74
  if (data.x && data.re) {
73
75
  const { x, re } = data;
@@ -81,15 +83,10 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
81
83
  y: Array.from(re.slice(fromIndex, toIndex)),
82
84
  ...value,
83
85
  };
84
- const success = await copyTextToClipboard(JSON.stringify(dataToClipboard, undefined, 2));
85
- if (success) {
86
- alert.show('Data copied to clipboard');
87
- }
88
- else {
89
- alert.error('copy to clipboard failed');
90
- }
86
+ await rawWriteWithType(JSON.stringify(dataToClipboard, undefined, 2));
87
+ alert.show('Data copied to clipboard');
91
88
  }
92
- }, [data, alert]);
89
+ }, [data, rawWriteWithType, alert]);
93
90
  const contextMenuSelectHandler = useCallback((option, data) => {
94
91
  void saveJSONToClipboardHandler(data);
95
92
  }, [saveJSONToClipboardHandler]);
@@ -119,7 +116,7 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
119
116
  showRangesIntegrals,
120
117
  showMultiplicityTrees,
121
118
  showJGraph,
122
- isFilterActive, onUnlink: unlinkRangeHandler, onFilterActivated: filterHandler, onSettingClick: settingsPanelHandler, filterCounter: rangesData.length })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: rangesData && rangesData.length > 0 ? (_jsx(RangesTable, { activeTab: activeTab, tableData: rangesData, onUnlink: unlinkRangeHandler, contextMenu: rangesContextMenuOptions, onContextMenuSelect: contextMenuSelectHandler, preferences: preferences, info: info })) : (_jsx(NoTableData, {})) })) : (_jsx(RangesPreferences, { ref: settingRef })) })] }));
119
+ isFilterActive, onUnlink: unlinkRangeHandler, onFilterActivated: filterHandler, onSettingClick: settingsPanelHandler, filterCounter: rangesData.length })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: rangesData && rangesData.length > 0 ? (_jsx(RangesTable, { activeTab: activeTab, tableData: rangesData, onUnlink: unlinkRangeHandler, contextMenu: rangesContextMenuOptions, onContextMenuSelect: contextMenuSelectHandler, preferences: preferences, info: info })) : (_jsx(NoTableData, {})) })) : (_jsx(RangesPreferences, { ref: settingRef })) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Range" })] }));
123
120
  }
124
121
  const MemoizedRangesTablePanel = memo(RangesTablePanelInner);
125
122
  const emptyData = { ranges: {}, data: {}, info: {} };
@@ -4,12 +4,13 @@ import { useMemo, useCallback, useState } from 'react';
4
4
  import { FaCopy, FaRegTrashAlt, FaFileExport } from 'react-icons/fa';
5
5
  import { IoColorPaletteOutline } from 'react-icons/io5';
6
6
  import { DropdownMenu } from 'react-science/ui';
7
+ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
8
+ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
7
9
  import { useDispatch } from '../../context/DispatchContext';
8
10
  import ReactTable from '../../elements/ReactTable/ReactTable';
9
11
  import { useAlert } from '../../elements/popup/Alert';
10
12
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
11
13
  import ExportAsJcampModal from '../../modal/ExportAsJcampModal';
12
- import { copyTextToClipboard } from '../../utility/export';
13
14
  import ColorIndicator from './base/ColorIndicator';
14
15
  import ShowHideSpectrumButton from './base/ShowHideSpectrumButton';
15
16
  import { SpectrumName } from './base/SpectrumName';
@@ -130,19 +131,15 @@ export function SpectraTable(props) {
130
131
  },
131
132
  },
132
133
  }), [onChangeVisibility, onOpenSettingModal]);
134
+ const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = useClipboard();
133
135
  const selectContextMenuHandler = useCallback((option, spectrum) => {
134
136
  const { id } = option.data;
135
137
  switch (id) {
136
138
  case SpectraContextMenuOptionsKeys.CopyToClipboard: {
137
139
  void (async () => {
138
140
  const { data, info } = spectrum;
139
- const success = await copyTextToClipboard(JSON.stringify({ data, info }, (_, value) => ArrayBuffer.isView(value) ? Array.from(value) : value, 2));
140
- if (success) {
141
- alert.success('Data copied to clipboard');
142
- }
143
- else {
144
- alert.error('Copy to clipboard failed');
145
- }
141
+ await rawWriteWithType(JSON.stringify({ data, info }, (_, value) => ArrayBuffer.isView(value) ? Array.from(value) : value, 2));
142
+ alert.success('Data copied to clipboard');
146
143
  })();
147
144
  break;
148
145
  }
@@ -160,12 +157,12 @@ export function SpectraTable(props) {
160
157
  break;
161
158
  }
162
159
  }
163
- }, [alert, dispatch]);
160
+ }, [alert, dispatch, rawWriteWithType]);
164
161
  function handleActiveRow(row) {
165
162
  return activeSpectraObj?.[row?.original.id] || false;
166
163
  }
167
164
  const tableColumns = useMemo(() => {
168
- let columns = [];
165
+ const columns = [];
169
166
  let index = 0;
170
167
  const visibleColumns = spectraPreferences.columns.filter((col) => col.visible);
171
168
  for (const col of visibleColumns) {
@@ -214,7 +211,7 @@ export function SpectraTable(props) {
214
211
  ? Spectra1DContextMenuOptions
215
212
  : Spectra2DContextMenuOptions, onContextMenuSelect: selectContextMenuHandler, onSortEnd: handleSortEnd, style: { 'table td': { paddingTop: 0, paddingBottom: 0 } } }), exportedSpectrum && (_jsx(ExportAsJcampModal, { spectrum: exportedSpectrum, closeDialog: () => {
216
213
  setExportedSpectrum(null);
217
- } }))] }));
214
+ } })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra" })] }));
218
215
  }
219
216
  const ColumnHeader = ({ label, col, }) => {
220
217
  const dispatch = useDispatch();
@@ -19,7 +19,9 @@ const style = css `
19
19
  flex-direction: row-reverse;
20
20
  border-radius: 4px;
21
21
  background-color: white;
22
- box-shadow: rgb(0 0 0 / 15%) 0 0 0 1px, rgb(0 0 0 / 15%) 0 8px 16px;
22
+ box-shadow:
23
+ rgb(0 0 0 / 15%) 0 0 0 1px,
24
+ rgb(0 0 0 / 15%) 0 8px 16px;
23
25
  overflow: auto;
24
26
  height: 350px;
25
27
  }