nmrium 2.2.0 → 2.3.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 (273) hide show
  1. package/lib/component/1d/PredictionErrorsNotations.js +3 -3
  2. package/lib/component/1d/PredictionErrorsNotations.js.map +1 -1
  3. package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
  4. package/lib/component/1d/peaks/Peaks.js +2 -1
  5. package/lib/component/1d/peaks/Peaks.js.map +1 -1
  6. package/lib/component/1d/peaks/usePeakShapesPath.d.ts.map +1 -1
  7. package/lib/component/1d/peaks/usePeakShapesPath.js.map +1 -1
  8. package/lib/component/1d/ranges/AssignmentLabel.js +1 -1
  9. package/lib/component/1d/ranges/AssignmentLabel.js.map +1 -1
  10. package/lib/component/1d/ranges/FloatingRangeTablePreferencesModal.d.ts +9 -0
  11. package/lib/component/1d/ranges/FloatingRangeTablePreferencesModal.d.ts.map +1 -0
  12. package/lib/component/1d/ranges/FloatingRangeTablePreferencesModal.js +138 -0
  13. package/lib/component/1d/ranges/FloatingRangeTablePreferencesModal.js.map +1 -0
  14. package/lib/component/1d/ranges/FloatingRanges.d.ts.map +1 -0
  15. package/lib/component/1d/ranges/FloatingRanges.js +362 -0
  16. package/lib/component/1d/ranges/FloatingRanges.js.map +1 -0
  17. package/lib/component/1d/ranges/Ranges.js +2 -2
  18. package/lib/component/1d/ranges/Ranges.js.map +1 -1
  19. package/lib/component/1d-2d/FieldEdition.d.ts +2 -2
  20. package/lib/component/1d-2d/FieldEdition.d.ts.map +1 -1
  21. package/lib/component/1d-2d/FieldEdition.js +2 -2
  22. package/lib/component/1d-2d/FieldEdition.js.map +1 -1
  23. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +7 -7
  24. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
  25. package/lib/component/2d/zones/SignalsGuideLines.js +1 -1
  26. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  27. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +1 -1
  28. package/lib/component/2d/zones/ZonesAssignmentsLabels.js.map +1 -1
  29. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  30. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  31. package/lib/component/SVGTable.d.ts +5 -3
  32. package/lib/component/SVGTable.d.ts.map +1 -1
  33. package/lib/component/SVGTable.js +16 -16
  34. package/lib/component/SVGTable.js.map +1 -1
  35. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  36. package/lib/component/context/KeyModifierContext.js.map +1 -1
  37. package/lib/component/context/LoggerContext.d.ts.map +1 -1
  38. package/lib/component/context/LoggerContext.js.map +1 -1
  39. package/lib/component/context/SortSpectraContext.d.ts.map +1 -1
  40. package/lib/component/context/SortSpectraContext.js.map +1 -1
  41. package/lib/component/elements/ActionsButtonsPopover.d.ts +2 -2
  42. package/lib/component/elements/ActionsButtonsPopover.d.ts.map +1 -1
  43. package/lib/component/elements/ActionsButtonsPopover.js +6 -9
  44. package/lib/component/elements/ActionsButtonsPopover.js.map +1 -1
  45. package/lib/component/elements/Button.d.ts.map +1 -1
  46. package/lib/component/elements/Button.js.map +1 -1
  47. package/lib/component/elements/Sections.d.ts.map +1 -1
  48. package/lib/component/elements/Sections.js.map +1 -1
  49. package/lib/component/elements/TabTitle.d.ts.map +1 -1
  50. package/lib/component/elements/TabTitle.js +2 -2
  51. package/lib/component/elements/TabTitle.js.map +1 -1
  52. package/lib/component/elements/ToolbarPopoverItem.d.ts +1 -0
  53. package/lib/component/elements/ToolbarPopoverItem.d.ts.map +1 -1
  54. package/lib/component/elements/ToolbarPopoverItem.js +10 -3
  55. package/lib/component/elements/ToolbarPopoverItem.js.map +1 -1
  56. package/lib/component/elements/dropDownButton/DropDownButton.d.ts.map +1 -1
  57. package/lib/component/elements/dropDownButton/DropDownButton.js +2 -2
  58. package/lib/component/elements/dropDownButton/DropDownButton.js.map +1 -1
  59. package/lib/component/elements/export/ExportOptionsModal.d.ts +1 -1
  60. package/lib/component/elements/export/ExportOptionsModal.d.ts.map +1 -1
  61. package/lib/component/elements/export/ExportOptionsModal.js +31 -110
  62. package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
  63. package/lib/component/elements/export/units.d.ts +0 -28
  64. package/lib/component/elements/export/units.d.ts.map +1 -1
  65. package/lib/component/elements/export/units.js +0 -5
  66. package/lib/component/elements/export/units.js.map +1 -1
  67. package/lib/component/elements/export/utilities/getExportOptions.d.ts.map +1 -1
  68. package/lib/component/elements/export/utilities/getExportOptions.js.map +1 -1
  69. package/lib/component/elements/print/pageSize.d.ts +1 -1
  70. package/lib/component/elements/print/pageSize.d.ts.map +1 -1
  71. package/lib/component/hooks/useExport.d.ts.map +1 -1
  72. package/lib/component/hooks/useExport.js.map +1 -1
  73. package/lib/component/hooks/usePanelPreferences.d.ts +3 -3
  74. package/lib/component/hooks/usePanelPreferences.d.ts.map +1 -1
  75. package/lib/component/hooks/useTextMetrics.d.ts.map +1 -1
  76. package/lib/component/hooks/useTextMetrics.js +1 -0
  77. package/lib/component/hooks/useTextMetrics.js.map +1 -1
  78. package/lib/component/main/NMRiumViewer.js +1 -1
  79. package/lib/component/main/NMRiumViewer.js.map +1 -1
  80. package/lib/component/modal/EditPeakShapeModal.js +2 -2
  81. package/lib/component/modal/EditPeakShapeModal.js.map +1 -1
  82. package/lib/component/modal/SaveAsModal.d.ts +2 -2
  83. package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
  84. package/lib/component/modal/SaveAsModal.js +43 -35
  85. package/lib/component/modal/SaveAsModal.js.map +1 -1
  86. package/lib/component/modal/editRange/EditRangeModal.js +4 -3
  87. package/lib/component/modal/editRange/EditRangeModal.js.map +1 -1
  88. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +2 -2
  89. package/lib/component/modal/editRange/forms/components/NewSignalTab.js.map +1 -1
  90. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +5 -5
  91. package/lib/component/modal/setting/tanstack_general_settings/errors/context.js +3 -3
  92. package/lib/component/modal/setting/tanstack_general_settings/errors/context.js.map +1 -1
  93. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +5 -5
  94. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.js +2 -2
  95. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.js.map +1 -1
  96. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +5 -5
  97. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.js +2 -2
  98. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.js.map +1 -1
  99. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +5 -5
  100. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.js +2 -2
  101. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.js.map +1 -1
  102. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +5 -5
  103. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.js +2 -2
  104. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.js.map +1 -1
  105. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts +14 -14
  106. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js +2 -2
  107. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js.map +1 -1
  108. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
  109. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.js +3 -2
  110. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.js.map +1 -1
  111. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
  112. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.js +3 -2
  113. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.js.map +1 -1
  114. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
  115. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +30 -3
  116. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
  117. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +18 -18
  118. package/lib/component/panels/PeaksPanel/PeaksPreferences.js.map +1 -1
  119. package/lib/component/panels/PeaksPanel/PeaksTable.js +11 -11
  120. package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
  121. package/lib/component/panels/RangesPanel/RangesHeader.d.ts.map +1 -1
  122. package/lib/component/panels/RangesPanel/RangesHeader.js.map +1 -1
  123. package/lib/component/panels/RangesPanel/RangesPreferences.js +22 -22
  124. package/lib/component/panels/RangesPanel/RangesPreferences.js.map +1 -1
  125. package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
  126. package/lib/component/panels/RangesPanel/RangesTable.d.ts.map +1 -1
  127. package/lib/component/panels/RangesPanel/RangesTable.js +5 -4
  128. package/lib/component/panels/RangesPanel/RangesTable.js.map +1 -1
  129. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
  130. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
  131. package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
  132. package/lib/component/panels/SpectraPanel/SpectraTable.d.ts.map +1 -1
  133. package/lib/component/panels/SpectraPanel/SpectraTable.js +5 -1
  134. package/lib/component/panels/SpectraPanel/SpectraTable.js.map +1 -1
  135. package/lib/component/panels/SpectraPanel/base/RenderAsHTML.d.ts.map +1 -1
  136. package/lib/component/panels/SpectraPanel/base/RenderAsHTML.js +7 -4
  137. package/lib/component/panels/SpectraPanel/base/RenderAsHTML.js.map +1 -1
  138. package/lib/component/panels/SpectraPanel/base/SpectrumName.d.ts.map +1 -1
  139. package/lib/component/panels/SpectraPanel/base/SpectrumName.js +5 -1
  140. package/lib/component/panels/SpectraPanel/base/SpectrumName.js.map +1 -1
  141. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.d.ts.map +1 -1
  142. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.js +2 -2
  143. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.js.map +1 -1
  144. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
  145. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  146. package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts +3 -2
  147. package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts.map +1 -1
  148. package/lib/component/panels/hooks/useMoleculeAnnotationCore.js +14 -8
  149. package/lib/component/panels/hooks/useMoleculeAnnotationCore.js.map +1 -1
  150. package/lib/component/panels/informationPanel/MixedValuesBadge.d.ts.map +1 -1
  151. package/lib/component/panels/informationPanel/MixedValuesBadge.js +2 -2
  152. package/lib/component/panels/informationPanel/MixedValuesBadge.js.map +1 -1
  153. package/lib/component/panels/informationPanel/SpectraPicker.d.ts.map +1 -1
  154. package/lib/component/panels/informationPanel/SpectraPicker.js +2 -2
  155. package/lib/component/panels/informationPanel/SpectraPicker.js.map +1 -1
  156. package/lib/component/reducer/actions/DomainActions.d.ts.map +1 -1
  157. package/lib/component/reducer/actions/DomainActions.js.map +1 -1
  158. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  159. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  160. package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -1
  161. package/lib/component/reducer/actions/LoadAction.js.map +1 -1
  162. package/lib/component/reducer/helper/setRangesViewProperty.d.ts.map +1 -1
  163. package/lib/component/reducer/helper/setRangesViewProperty.js.map +1 -1
  164. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts.map +1 -1
  165. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +35 -26
  166. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js.map +1 -1
  167. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  168. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  169. package/lib/component/reducer/preferences/utilities/initWorkspace.d.ts +2 -2
  170. package/lib/component/reducer/preferences/utilities/mapWorkspaces.d.ts +2 -2
  171. package/lib/component/reducer/preferences/utilities/mapWorkspaces.d.ts.map +1 -1
  172. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  173. package/lib/component/utility/export.d.ts.map +1 -1
  174. package/lib/component/utility/export.js +1 -0
  175. package/lib/component/utility/export.js.map +1 -1
  176. package/lib/data/PredictionManager.js.map +1 -1
  177. package/lib/data/constants/signalsKinds.d.ts +1 -2
  178. package/lib/data/constants/signalsKinds.d.ts.map +1 -1
  179. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +2 -2
  180. package/lib/data/matrixGeneration.d.ts.map +1 -1
  181. package/lib/data/matrixGeneration.js.map +1 -1
  182. package/lib/versionInfo.js +1 -1
  183. package/package.json +30 -31
  184. package/src/component/1d/PredictionErrorsNotations.tsx +5 -4
  185. package/src/component/1d/peaks/Peaks.tsx +5 -2
  186. package/src/component/1d/peaks/usePeakShapesPath.ts +0 -1
  187. package/src/component/1d/ranges/AssignmentLabel.tsx +1 -1
  188. package/src/component/1d/ranges/FloatingRangeTablePreferencesModal.tsx +238 -0
  189. package/src/component/1d/ranges/FloatingRanges.tsx +529 -0
  190. package/src/component/1d/ranges/Ranges.tsx +2 -2
  191. package/src/component/1d-2d/FieldEdition.tsx +4 -4
  192. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +8 -8
  193. package/src/component/2d/zones/SignalsGuideLines.tsx +1 -1
  194. package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +1 -1
  195. package/src/component/EventsTrackers/BrushTracker.tsx +1 -2
  196. package/src/component/SVGTable.tsx +35 -33
  197. package/src/component/context/KeyModifierContext.tsx +1 -2
  198. package/src/component/context/LoggerContext.tsx +1 -7
  199. package/src/component/context/SortSpectraContext.tsx +1 -3
  200. package/src/component/elements/ActionsButtonsPopover.tsx +12 -14
  201. package/src/component/elements/Button.tsx +1 -6
  202. package/src/component/elements/Sections.tsx +5 -3
  203. package/src/component/elements/TabTitle.tsx +7 -5
  204. package/src/component/elements/ToolbarPopoverItem.tsx +13 -2
  205. package/src/component/elements/dropDownButton/DropDownButton.tsx +7 -5
  206. package/src/component/elements/export/ExportOptionsModal.tsx +56 -276
  207. package/src/component/elements/export/units.ts +0 -6
  208. package/src/component/elements/export/utilities/getExportOptions.ts +1 -0
  209. package/src/component/elements/print/pageSize.ts +1 -1
  210. package/src/component/hooks/useExport.tsx +1 -3
  211. package/src/component/hooks/usePanelPreferences.ts +4 -4
  212. package/src/component/hooks/useTextMetrics.ts +1 -0
  213. package/src/component/main/NMRiumViewer.tsx +1 -1
  214. package/src/component/modal/EditPeakShapeModal.tsx +2 -2
  215. package/src/component/modal/SaveAsModal.tsx +89 -82
  216. package/src/component/modal/editRange/EditRangeModal.tsx +6 -4
  217. package/src/component/modal/editRange/forms/components/NewSignalTab.tsx +3 -3
  218. package/src/component/modal/setting/WorkspaceItem.tsx +2 -2
  219. package/src/component/modal/setting/tanstack_general_settings/errors/context.tsx +3 -3
  220. package/src/component/modal/setting/tanstack_general_settings/errors/renderer.tsx +2 -2
  221. package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.tsx +2 -2
  222. package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.tsx +2 -2
  223. package/src/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.tsx +2 -2
  224. package/src/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.tsx +2 -2
  225. package/src/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.tsx +3 -2
  226. package/src/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.tsx +3 -2
  227. package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +41 -8
  228. package/src/component/panels/PeaksPanel/PeaksPreferences.tsx +18 -18
  229. package/src/component/panels/PeaksPanel/PeaksTable.tsx +11 -11
  230. package/src/component/panels/RangesPanel/RangesHeader.tsx +1 -2
  231. package/src/component/panels/RangesPanel/RangesPanel.tsx +2 -2
  232. package/src/component/panels/RangesPanel/RangesPreferences.tsx +22 -22
  233. package/src/component/panels/RangesPanel/RangesTable.tsx +19 -17
  234. package/src/component/panels/RangesPanel/RangesTableRow.tsx +25 -25
  235. package/src/component/panels/SpectraPanel/SpectraTable.tsx +12 -1
  236. package/src/component/panels/SpectraPanel/base/RenderAsHTML.tsx +22 -4
  237. package/src/component/panels/SpectraPanel/base/SpectrumName.tsx +15 -6
  238. package/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx +3 -2
  239. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +1 -5
  240. package/src/component/panels/hooks/useMoleculeAnnotationCore.ts +17 -9
  241. package/src/component/panels/informationPanel/MixedValuesBadge.tsx +3 -2
  242. package/src/component/panels/informationPanel/SpectraPicker.tsx +12 -4
  243. package/src/component/panels/multipleAnalysisPanel/AnalysisChart.tsx +2 -2
  244. package/src/component/reducer/actions/DomainActions.ts +1 -4
  245. package/src/component/reducer/actions/FiltersActions.ts +1 -2
  246. package/src/component/reducer/actions/LoadAction.ts +1 -3
  247. package/src/component/reducer/helper/setRangesViewProperty.ts +1 -2
  248. package/src/component/reducer/preferences/panelsPreferencesDefaultValues.ts +32 -19
  249. package/src/component/reducer/preferences/preferencesReducer.ts +2 -2
  250. package/src/component/reducer/preferences/utilities/initWorkspace.ts +2 -2
  251. package/src/component/reducer/preferences/utilities/mapWorkspaces.ts +2 -2
  252. package/src/component/toolbar/ToolTypes.ts +2 -2
  253. package/src/component/utility/export.ts +1 -0
  254. package/src/data/PredictionManager.ts +4 -6
  255. package/src/data/constants/signalsKinds.ts +1 -1
  256. package/src/data/data1d/multipleSpectraAnalysis.ts +2 -2
  257. package/src/data/matrixGeneration.ts +1 -5
  258. package/src/versionInfo.ts +1 -1
  259. package/lib/component/1d/FloatingRanges.d.ts.map +0 -1
  260. package/lib/component/1d/FloatingRanges.js +0 -263
  261. package/lib/component/1d/FloatingRanges.js.map +0 -1
  262. package/lib/component/elements/export/utilities/exportOptionValidationSchema.d.ts +0 -17
  263. package/lib/component/elements/export/utilities/exportOptionValidationSchema.d.ts.map +0 -1
  264. package/lib/component/elements/export/utilities/exportOptionValidationSchema.js +0 -79
  265. package/lib/component/elements/export/utilities/exportOptionValidationSchema.js.map +0 -1
  266. package/lib/component/elements/export/utilities/getModes.d.ts +0 -4
  267. package/lib/component/elements/export/utilities/getModes.d.ts.map +0 -1
  268. package/lib/component/elements/export/utilities/getModes.js +0 -11
  269. package/lib/component/elements/export/utilities/getModes.js.map +0 -1
  270. package/src/component/1d/FloatingRanges.tsx +0 -378
  271. package/src/component/elements/export/utilities/exportOptionValidationSchema.ts +0 -106
  272. package/src/component/elements/export/utilities/getModes.ts +0 -14
  273. /package/lib/component/1d/{FloatingRanges.d.ts → ranges/FloatingRanges.d.ts} +0 -0
@@ -0,0 +1,529 @@
1
+ import styled from '@emotion/styled';
2
+ import type { Info1D, Range, Ranges, Signal1D } from '@zakodium/nmr-types';
3
+ import type {
4
+ BaseRangesTablePreferences,
5
+ BoundingBox,
6
+ FloatingRangesTablePreferences,
7
+ } from '@zakodium/nmrium-core';
8
+ import { checkMultiplicity } from 'nmr-processing';
9
+ import { memo, useEffect, useMemo, useState } from 'react';
10
+ import { BsArrowsMove } from 'react-icons/bs';
11
+ import { FaCog, FaLink, FaTimes } from 'react-icons/fa';
12
+ import { Rnd } from 'react-rnd';
13
+
14
+ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/index.js';
15
+ import { isSignalRange } from '../../../data/utilities/RangeUtilities.js';
16
+ import type { SVGTableColumn } from '../../SVGTable.js';
17
+ import { SVGTable } from '../../SVGTable.js';
18
+ import { useChartData } from '../../context/ChartContext.js';
19
+ import { useDispatch } from '../../context/DispatchContext.js';
20
+ import { useGlobal } from '../../context/GlobalContext.js';
21
+ import type { ActionsButtonsPopoverProps } from '../../elements/ActionsButtonsPopover.js';
22
+ import { ActionsButtonsPopover } from '../../elements/ActionsButtonsPopover.js';
23
+ import { useActiveNucleusTab } from '../../hooks/useActiveNucleusTab.js';
24
+ import { useDialogToggle } from '../../hooks/useDialogToggle.ts';
25
+ import { usePanelPreferences } from '../../hooks/usePanelPreferences.js';
26
+ import { useSVGUnitConverter } from '../../hooks/useSVGUnitConverter.js';
27
+ import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus.js';
28
+ import { useCheckExportStatus } from '../../hooks/useViewportSize.js';
29
+ import { extractChemicalElement } from '../../utility/extractChemicalElement.js';
30
+ import { formatNumber } from '../../utility/formatNumber.js';
31
+
32
+ import { FloatingRangeTablePreferencesModal } from './FloatingRangeTablePreferencesModal.tsx';
33
+
34
+ const ReactRnd = styled(Rnd)`
35
+ border: 1px solid transparent;
36
+
37
+ :hover {
38
+ background-color: white;
39
+ border: 1px solid #ebecf1;
40
+
41
+ button {
42
+ visibility: visible;
43
+ }
44
+ }
45
+ `;
46
+ interface SpectrumRangesInfo {
47
+ ranges: Ranges['values'];
48
+ info: Info1D;
49
+ }
50
+
51
+ interface RangesTableProps {
52
+ data: SpectrumRangesInfo;
53
+ }
54
+
55
+ interface RangeItem {
56
+ id: string;
57
+ delta: string;
58
+ deltaHz: string;
59
+ multiplicity: string;
60
+ integration: string;
61
+ coupling: string;
62
+ from: string;
63
+ to: string;
64
+ absolute: string;
65
+ kind: string;
66
+ assignment: string;
67
+ nbAssignment: string;
68
+ }
69
+
70
+ function buildRangeBaseItem(
71
+ range: Range,
72
+ info: Info1D,
73
+ preferences: FloatingRangesTablePreferences,
74
+ ) {
75
+ const { id, from, to, integration, absolute } = range;
76
+ const formatHz = preferences.deltaHz.format;
77
+ return {
78
+ id,
79
+ from: formatNumber(from, preferences.from.format),
80
+ to: formatNumber(to, preferences.to.format),
81
+ absolute: formatNumber(absolute, preferences.absolute.format),
82
+ integration: isSignalRange(range)
83
+ ? formatNumber(integration, preferences.relative.format)
84
+ : `[ ${formatNumber(integration, preferences.relative.format)} ]`,
85
+ deltaText: `${formatNumber(from, preferences.from.format)} - ${formatNumber(to, preferences.to.format)}`,
86
+ deltaHzText: `${formatNumber(from * info.originFrequency, formatHz)} - ${formatNumber(to * info.originFrequency, formatHz)}`,
87
+ formatHz,
88
+ };
89
+ }
90
+
91
+ function buildSignalItem(
92
+ signal: Signal1D,
93
+ base: ReturnType<typeof buildRangeBaseItem>,
94
+ info: Info1D,
95
+ preferences: FloatingRangesTablePreferences,
96
+ ): RangeItem {
97
+ const {
98
+ multiplicity,
99
+ delta,
100
+ kind = '',
101
+ assignment = '',
102
+ js = [],
103
+ diaIDs,
104
+ } = signal;
105
+ const isNotMultiplet = !checkMultiplicity(multiplicity, ['m']);
106
+ return {
107
+ id: base.id,
108
+ from: base.from,
109
+ to: base.to,
110
+ absolute: base.absolute,
111
+ integration: base.integration,
112
+ multiplicity,
113
+ kind,
114
+ assignment,
115
+ coupling: js
116
+ .map((j) =>
117
+ !Number.isNaN(j.coupling)
118
+ ? formatNumber(j.coupling, preferences.coupling.format)
119
+ : '',
120
+ )
121
+ .join(','),
122
+ delta: isNotMultiplet
123
+ ? base.deltaText
124
+ : formatNumber(delta, preferences.deltaPPM.format),
125
+ deltaHz: isNotMultiplet
126
+ ? base.deltaHzText
127
+ : info?.originFrequency
128
+ ? formatNumber(delta * info.originFrequency, base.formatHz)
129
+ : '',
130
+ nbAssignment: diaIDs?.length ? String(diaIDs.length) : '',
131
+ };
132
+ }
133
+
134
+ function useMapRanges(data: SpectrumRangesInfo): RangeItem[] {
135
+ const { ranges, info } = data;
136
+ const activeTab = useActiveNucleusTab();
137
+ const { floatingTablePreferences: preferences } = usePanelPreferences(
138
+ 'ranges',
139
+ activeTab,
140
+ );
141
+
142
+ return ranges.flatMap((range) => {
143
+ const base = buildRangeBaseItem(range, info, preferences);
144
+ const { signals = [] } = range;
145
+
146
+ if (signals.length === 0) {
147
+ return [
148
+ {
149
+ ...base,
150
+ delta: base.deltaText,
151
+ deltaHz: '',
152
+ multiplicity: 'm',
153
+ coupling: '',
154
+ kind: '',
155
+ assignment: '',
156
+ nbAssignment: '',
157
+ },
158
+ ];
159
+ }
160
+
161
+ const result = signals.map((signal) =>
162
+ buildSignalItem(signal, base, info, preferences),
163
+ );
164
+ if (preferences.signalKinds.length === 0) {
165
+ return result;
166
+ }
167
+
168
+ return result.filter((signal) =>
169
+ preferences.signalKinds.includes(signal.kind || ''),
170
+ );
171
+ });
172
+ }
173
+
174
+ function isColumnVisible(
175
+ pref: BaseRangesTablePreferences[keyof BaseRangesTablePreferences],
176
+ ): boolean {
177
+ if (typeof pref === 'boolean') return pref;
178
+ return pref?.show;
179
+ }
180
+
181
+ function InnerSVGRangesTable(props: RangesTableProps) {
182
+ const { data } = props;
183
+ const {
184
+ view: {
185
+ spectra: { activeTab },
186
+ },
187
+ } = useChartData();
188
+ const rangesData = useMapRanges(data);
189
+ const { floatingTablePreferences } = usePanelPreferences('ranges', activeTab);
190
+
191
+ const element = extractChemicalElement(activeTab);
192
+
193
+ const columns = useMemo((): Array<SVGTableColumn<RangeItem>> => {
194
+ const allColumns: Array<
195
+ { prefKey: keyof BaseRangesTablePreferences } & SVGTableColumn<RangeItem>
196
+ > = [
197
+ {
198
+ prefKey: 'showSerialNumber',
199
+ accessorFun: (row) => row.index + 1,
200
+ header: '#',
201
+ width: 40,
202
+ },
203
+ {
204
+ prefKey: 'showAssignmentLabel',
205
+ accessorKey: 'assignment',
206
+ header: 'Assignment',
207
+ width: 120,
208
+ },
209
+ {
210
+ prefKey: 'deltaPPM',
211
+ accessorKey: 'delta',
212
+ header: 'δ (ppm)',
213
+ width: 100,
214
+ rowSpanGroupKey: 'id',
215
+ },
216
+ {
217
+ prefKey: 'deltaHz',
218
+ accessorKey: 'deltaHz',
219
+ header: 'δ (Hz)',
220
+ width: 110,
221
+ rowSpanGroupKey: 'id',
222
+ },
223
+ {
224
+ prefKey: 'from',
225
+ accessorKey: 'from',
226
+ header: `From`,
227
+ width: 60,
228
+ },
229
+ {
230
+ prefKey: 'to',
231
+ accessorKey: 'to',
232
+ header: `To`,
233
+ width: 60,
234
+ },
235
+ {
236
+ prefKey: 'relative',
237
+ accessorKey: 'integration',
238
+ header: `Rel. ${element}`,
239
+ width: 60,
240
+ rowSpanGroupKey: 'id',
241
+ },
242
+ {
243
+ prefKey: 'absolute',
244
+ accessorKey: 'absolute',
245
+ header: 'Absolute',
246
+ width: 80,
247
+ rowSpanGroupKey: 'id',
248
+ },
249
+ {
250
+ prefKey: 'showMultiplicity',
251
+ accessorKey: 'multiplicity',
252
+ header: 'Mult.',
253
+ width: 60,
254
+ rowSpanGroupKey: 'id',
255
+ },
256
+ {
257
+ prefKey: 'coupling',
258
+ accessorKey: 'coupling',
259
+ header: 'J (Hz)',
260
+ width: 120,
261
+ },
262
+
263
+ {
264
+ prefKey: 'showAssignment',
265
+ accessorKey: 'nbAssignment',
266
+ header: <FaLink x="15px" y="8px" style={{ fontSize: 10 }} />,
267
+ width: 40,
268
+ },
269
+ {
270
+ prefKey: 'showKind',
271
+ accessorKey: 'kind',
272
+ header: 'Kind',
273
+ width: 120,
274
+ },
275
+ ];
276
+
277
+ return allColumns
278
+ .filter(({ prefKey }) =>
279
+ isColumnVisible(floatingTablePreferences[prefKey]),
280
+ )
281
+ .map(({ prefKey: _, ...col }) => ({
282
+ ...col,
283
+ headerTextProps: { fontWeight: 'bold' },
284
+ cellBoxProps: { stroke: '#dedede', fill: 'white', fillOpacity: 0.8 },
285
+ headerBoxProps: { stroke: '#dedede', fill: '#E5E8EB' },
286
+ }));
287
+ }, [floatingTablePreferences, element]);
288
+ if (!data) return null;
289
+
290
+ return <SVGTable<RangeItem> data={rangesData} columns={columns} />;
291
+ }
292
+
293
+ const SVGRangesTable = memo(InnerSVGRangesTable);
294
+
295
+ interface DraggablePublicationStringProps {
296
+ data: SpectrumRangesInfo | undefined;
297
+ bonding: BoundingBox;
298
+ spectrumKey: string;
299
+ }
300
+
301
+ function DraggableRanges(props: DraggablePublicationStringProps) {
302
+ const { data, bonding: externalBounding, spectrumKey } = props;
303
+ const dispatch = useDispatch();
304
+ const { viewerRef } = useGlobal();
305
+ const [bounding, setBounding] = useState<BoundingBox>(externalBounding);
306
+ const [isMoveActive, setIsMoveActive] = useState(false);
307
+ const { percentToPixel, pixelToPercent } = useSVGUnitConverter();
308
+ const isExportProcessStart = useCheckExportStatus();
309
+ const { dialog, closeDialog, openDialog } = useDialogToggle({
310
+ settingModal: false,
311
+ });
312
+
313
+ useEffect(() => {
314
+ setBounding({ ...externalBounding });
315
+ }, [externalBounding]);
316
+
317
+ function handleResize(
318
+ internalBounding: Pick<BoundingBox, 'height' | 'width'>,
319
+ ) {
320
+ const { width = 0, height = 0 } = convertToPixel(externalBounding);
321
+ internalBounding.width += width;
322
+ internalBounding.height += height;
323
+ setBounding((prevBounding) => ({
324
+ ...prevBounding,
325
+ ...convertToPercent(internalBounding),
326
+ }));
327
+ }
328
+
329
+ function handleDrag(internalBounding: Pick<BoundingBox, 'x' | 'y'>) {
330
+ setBounding((prevBounding) => ({
331
+ ...prevBounding,
332
+ ...convertToPercent(internalBounding),
333
+ }));
334
+ }
335
+ function handleChangeInsetBounding(bounding: Partial<BoundingBox>) {
336
+ if (
337
+ typeof bounding?.width === 'number' &&
338
+ typeof bounding?.height === 'number'
339
+ ) {
340
+ const { width, height } = externalBounding;
341
+ bounding.width += width;
342
+ bounding.height += height;
343
+ }
344
+
345
+ dispatch({
346
+ type: 'CHANGE_RANGES_VIEW_FLOATING_BOX_BOUNDING',
347
+ payload: {
348
+ spectrumKey,
349
+ bounding: convertToPercent(bounding),
350
+ target: 'rangesBounding',
351
+ },
352
+ });
353
+ }
354
+
355
+ function convertToPixel(bounding: Partial<BoundingBox>) {
356
+ const { x, y, height, width } = bounding;
357
+ const output: Partial<BoundingBox> = {};
358
+
359
+ if (x) {
360
+ output.x = percentToPixel(x, 'x');
361
+ }
362
+ if (y) {
363
+ output.y = percentToPixel(y, 'y');
364
+ }
365
+ if (width) {
366
+ output.width = width;
367
+ }
368
+ if (height) {
369
+ output.height = height;
370
+ }
371
+
372
+ return output;
373
+ }
374
+ function convertToPercent(bounding: Partial<BoundingBox>) {
375
+ const { x, y, height, width } = bounding;
376
+ const output: Partial<BoundingBox> = {};
377
+
378
+ if (x) {
379
+ output.x = pixelToPercent(x, 'x');
380
+ }
381
+ if (y) {
382
+ output.y = pixelToPercent(y, 'y');
383
+ }
384
+ if (width) {
385
+ output.width = width;
386
+ }
387
+ if (height) {
388
+ output.height = height;
389
+ }
390
+
391
+ return output;
392
+ }
393
+
394
+ function handleRemove() {
395
+ dispatch({
396
+ type: 'TOGGLE_RANGES_VIEW_PROPERTY',
397
+ payload: { key: 'showRanges', spectrumKey },
398
+ });
399
+ }
400
+
401
+ const actionButtons: ActionsButtonsPopoverProps['buttons'] = [
402
+ {
403
+ icon: <BsArrowsMove />,
404
+ intent: 'none',
405
+ title: 'Move ranges table',
406
+ style: { cursor: 'move' },
407
+ className: 'handle',
408
+ },
409
+ {
410
+ icon: <FaCog />,
411
+ intent: 'none',
412
+ title: 'Table preferences',
413
+ onClick: () => {
414
+ openDialog('settingModal');
415
+ },
416
+ },
417
+ {
418
+ icon: <FaTimes />,
419
+ intent: 'danger',
420
+ title: 'Hide ranges table',
421
+ onClick: handleRemove,
422
+ },
423
+ ];
424
+ if (!viewerRef || !data || data?.ranges?.length === 0) return null;
425
+
426
+ const { x: xInPercent, y: yInPercent } = bounding;
427
+
428
+ const x = percentToPixel(xInPercent, 'x');
429
+ const y = percentToPixel(yInPercent, 'y');
430
+
431
+ if (isExportProcessStart) {
432
+ return (
433
+ <g transform={`translate(${x} ${y})`}>
434
+ <SVGRangesTable data={data} />
435
+ </g>
436
+ );
437
+ }
438
+
439
+ return (
440
+ <>
441
+ <FloatingRangeTablePreferencesModal
442
+ isOpen={dialog.settingModal}
443
+ onCloseDialog={closeDialog}
444
+ />
445
+ <ReactRnd
446
+ default={{ x, y, width: 'auto', height: 'auto' }}
447
+ position={{ x, y }}
448
+ enableResizing={false}
449
+ minWidth={100}
450
+ minHeight={50}
451
+ dragHandleClassName="handle"
452
+ enableUserSelectHack={false}
453
+ bounds={`#${viewerRef.id}`}
454
+ onDragStart={() => setIsMoveActive(true)}
455
+ onResize={(e, dir, eRef, size, position) =>
456
+ handleResize({ ...size, ...position })
457
+ }
458
+ onResizeStop={(e, dir, eRef, size, position) =>
459
+ handleChangeInsetBounding({ ...size, ...position })
460
+ }
461
+ onDrag={(e, { x, y }) => {
462
+ handleDrag({ x, y });
463
+ }}
464
+ onDragStop={(e, { x, y }) => {
465
+ handleChangeInsetBounding({ x, y });
466
+ setIsMoveActive(false);
467
+ }}
468
+ resizeHandleWrapperStyle={{ backgroundColor: 'white' }}
469
+ >
470
+ <ActionsButtonsPopover
471
+ buttons={actionButtons}
472
+ fill
473
+ positioningStrategy="fixed"
474
+ direction="row"
475
+ targetProps={{ style: { width: '100%', height: '100%' } }}
476
+ space={2}
477
+ {...(isMoveActive && { isOpen: true })}
478
+ x={x}
479
+ y={y}
480
+ >
481
+ <SVGRangesTable data={data} />
482
+ </ActionsButtonsPopover>
483
+ </ReactRnd>
484
+ </>
485
+ );
486
+ }
487
+
488
+ function useSpectraRanges() {
489
+ const spectra = useSpectraByActiveNucleus();
490
+ const output: Record<string, { ranges: Ranges['values']; info: Info1D }> = {};
491
+
492
+ for (const spectrum of spectra) {
493
+ if (!isSpectrum1D(spectrum)) {
494
+ continue;
495
+ }
496
+ const { id: spectrumKey, ranges, info } = spectrum;
497
+
498
+ if (!Array.isArray(ranges?.values) || ranges.values.length === 0) {
499
+ continue;
500
+ }
501
+
502
+ output[spectrumKey] = { ranges: ranges.values, info };
503
+ }
504
+
505
+ return output;
506
+ }
507
+
508
+ export function FloatingRanges() {
509
+ const spectraRanges = useSpectraRanges();
510
+ const {
511
+ view: { ranges },
512
+ } = useChartData();
513
+
514
+ const options = Object.entries(ranges);
515
+
516
+ return options.map(([spectrumKey, viewOptions]) => {
517
+ const { showRanges, rangesBounding } = viewOptions;
518
+ if (!showRanges) return null;
519
+
520
+ return (
521
+ <DraggableRanges
522
+ key={spectrumKey}
523
+ spectrumKey={spectrumKey}
524
+ bonding={rangesBounding}
525
+ data={spectraRanges[spectrumKey]}
526
+ />
527
+ );
528
+ });
529
+ }
@@ -100,7 +100,7 @@ export default function Ranges() {
100
100
  toolOptions: { selectedTool },
101
101
  } = useChartData();
102
102
  const spectrum = useSpectrum(emptyData) as Spectrum1D;
103
- const rangesPreferences = usePanelPreferences('ranges', activeTab);
103
+ const { tablePreferences } = usePanelPreferences('ranges', activeTab);
104
104
 
105
105
  if (
106
106
  !spectrum.ranges?.values ||
@@ -114,7 +114,7 @@ export default function Ranges() {
114
114
  <MemoizedRanges
115
115
  ranges={spectrum.ranges}
116
116
  selectedTool={selectedTool}
117
- relativeFormat={rangesPreferences.relative.format}
117
+ relativeFormat={tablePreferences.relative.format}
118
118
  />
119
119
  );
120
120
  }
@@ -1,5 +1,5 @@
1
- import type { PopoverProps } from '@blueprintjs/core';
2
- import { Popover } from '@blueprintjs/core';
1
+ import type { PopoverNextProps } from '@blueprintjs/core';
2
+ import { PopoverNext } from '@blueprintjs/core';
3
3
  import styled from '@emotion/styled';
4
4
  import { yupResolver } from '@hookform/resolvers/yup';
5
5
  import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
@@ -10,7 +10,7 @@ import * as Yup from 'yup';
10
10
  import { Input2Controller } from '../elements/Input2Controller.js';
11
11
  import { NumberInput2Controller } from '../elements/NumberInput2Controller.js';
12
12
 
13
- const StyledPopover = styled(Popover)`
13
+ const StyledPopover = styled(PopoverNext)`
14
14
  .field-edition-popover {
15
15
  border-radius: 5px;
16
16
  }
@@ -25,7 +25,7 @@ interface FieldProps {
25
25
  }
26
26
  interface FieldEditionsProps extends FieldProps {
27
27
  children: ReactNode;
28
- PopoverProps?: PopoverProps;
28
+ PopoverProps?: PopoverNextProps;
29
29
  }
30
30
  const InputDimension = { height: 28, width: 100 };
31
31
 
@@ -101,8 +101,8 @@ export function DraggableStructure(props: DraggableStructureProps) {
101
101
  }
102
102
 
103
103
  const {
104
- handleChangeAtomAnnotation,
105
- isAnnotation,
104
+ toggleAtomAnnotation,
105
+ isActiveAnnotation,
106
106
  handleToggleMoleculeLabel,
107
107
  } = useMoleculeAnnotationCore(molecule.id, moleculeView);
108
108
 
@@ -136,15 +136,15 @@ export function DraggableStructure(props: DraggableStructureProps) {
136
136
  },
137
137
  {
138
138
  icon: <MdNumbers />,
139
- title: `${booleanToString(!isAnnotation('atom-numbers'))} atom number`,
140
- onClick: () => handleChangeAtomAnnotation('atom-numbers'),
141
- active: isAnnotation('atom-numbers'),
139
+ title: `${booleanToString(!isActiveAnnotation('atom-numbers'))} atom number`,
140
+ onClick: () => toggleAtomAnnotation('atom-numbers'),
141
+ active: isActiveAnnotation('atom-numbers'),
142
142
  },
143
143
  {
144
144
  icon: <FaRegBookmark />,
145
- title: `${booleanToString(!isAnnotation('custom-labels'))} custom labels`,
146
- onClick: () => handleChangeAtomAnnotation('custom-labels'),
147
- active: isAnnotation('custom-labels'),
145
+ title: `${booleanToString(!isActiveAnnotation('custom-labels'))} custom labels`,
146
+ onClick: () => toggleAtomAnnotation('custom-labels'),
147
+ active: isActiveAnnotation('custom-labels'),
148
148
  },
149
149
  ];
150
150
  const { x: xInPercent, y: yInPercent, width, height } = bounding;
@@ -389,7 +389,7 @@ function AssignmentLabel(props: AssignmentLabelProps) {
389
389
  inputType="text"
390
390
  value={assignment || ''}
391
391
  PopoverProps={{
392
- position: 'bottom',
392
+ placement: 'bottom',
393
393
  targetTagName: 'g',
394
394
  ...(isNewAssignment
395
395
  ? { isOpen: true, onClose: () => dismissNewLabel() }
@@ -451,7 +451,7 @@ function AssignmentLabel(props: AssignmentLabelProps) {
451
451
  inputType="text"
452
452
  value={assignment || ''}
453
453
  PopoverProps={{
454
- position: 'top',
454
+ placement: 'top',
455
455
  targetTagName: 'g',
456
456
  ...(newAssignmentLabelState?.id === id
457
457
  ? { isOpen: true, onClose: () => dismissNewLabel() }
@@ -533,8 +533,7 @@ interface DetectBrushingThresholdSize {
533
533
  type BrushDetectionThresholdAxis = 'both' | 'x' | 'y';
534
534
 
535
535
  type DetectBrushingOptions = { thresholdAxis?: BrushDetectionThresholdAxis } & (
536
- | DetectBrushingThreshold
537
- | DetectBrushingThresholdSize
536
+ DetectBrushingThreshold | DetectBrushingThresholdSize
538
537
  );
539
538
 
540
539
  export function detectBrushing(