nmrium 0.30.0 → 0.32.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/ApodizationLine.js +3 -1
  2. package/lib/component/1d/FooterBanner.js +20 -11
  3. package/lib/component/1d/IntegralsSeries.js +3 -1
  4. package/lib/component/1d/LinesSeries.js +3 -1
  5. package/lib/component/1d/SpectraTracker.js +1 -1
  6. package/lib/component/1d/Viewer1D.js +3 -1
  7. package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
  8. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  9. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  10. package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
  11. package/lib/component/1d/peaks/PeaksShapes.js +4 -2
  12. package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
  13. package/lib/component/1d/ranges/Ranges.js +8 -2
  14. package/lib/component/1d/tool/PeakPointer.js +3 -1
  15. package/lib/component/1d/tool/XLabelPointer.js +3 -1
  16. package/lib/component/2d/Contours.js +4 -2
  17. package/lib/component/2d/FooterBanner.js +3 -1
  18. package/lib/component/2d/Left1DChart.js +1 -1
  19. package/lib/component/2d/Top1DChart.js +1 -1
  20. package/lib/component/2d/Viewer2D.js +4 -4
  21. package/lib/component/2d/XAxis.js +2 -2
  22. package/lib/component/2d/YAxis.js +2 -2
  23. package/lib/component/2d/tools/XYLabelPointer.js +3 -1
  24. package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
  25. package/lib/component/2d/zones/IndicationLines.js +1 -1
  26. package/lib/component/2d/zones/Zones.js +14 -19
  27. package/lib/component/EventsTrackers/BrushTracker.js +30 -21
  28. package/lib/component/NMRium.d.ts +2 -0
  29. package/lib/component/NMRium.js +14 -3
  30. package/lib/component/SplitPaneWrapper.js +1 -1
  31. package/lib/component/elements/EditableColumn.d.ts +3 -1
  32. package/lib/component/elements/EditableColumn.js +18 -3
  33. package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
  34. package/lib/component/elements/popup/Modal/Provider.js +8 -11
  35. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
  36. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
  37. package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  38. package/lib/component/hooks/useExport.d.ts +0 -1
  39. package/lib/component/hooks/useExport.js +1 -17
  40. package/lib/component/hooks/useIntegralPath.js +5 -2
  41. package/lib/component/hooks/useNucleus.js +4 -4
  42. package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
  43. package/lib/component/hooks/useSpectrum.js +3 -1
  44. package/lib/component/loader/DropZone.js +15 -147
  45. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  46. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  47. package/lib/component/modal/setting/GeneralTabContent.js +1 -1
  48. package/lib/component/modal/setting/ToolsTabContent.js +4 -0
  49. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  50. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  51. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  52. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  53. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  54. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  55. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  56. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
  57. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
  58. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  59. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  60. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
  61. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  62. package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  63. package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
  64. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  65. package/lib/component/reducer/IgnoreActions.js +1 -0
  66. package/lib/component/reducer/Reducer.d.ts +110 -96
  67. package/lib/component/reducer/Reducer.js +45 -41
  68. package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
  69. package/lib/component/reducer/actions/DomainActions.js +12 -9
  70. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
  71. package/lib/component/reducer/actions/FiltersActions.js +227 -232
  72. package/lib/component/reducer/actions/IntegralsActions.js +14 -8
  73. package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
  74. package/lib/component/reducer/actions/LoadActions.js +19 -34
  75. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
  76. package/lib/component/reducer/actions/MoleculeActions.js +22 -6
  77. package/lib/component/reducer/actions/PeaksActions.js +19 -12
  78. package/lib/component/reducer/actions/PreferencesActions.js +9 -10
  79. package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
  80. package/lib/component/reducer/actions/RangesActions.js +89 -29
  81. package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  82. package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
  83. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
  84. package/lib/component/reducer/actions/ToolsActions.js +44 -27
  85. package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
  86. package/lib/component/reducer/actions/ZonesActions.js +69 -17
  87. package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
  88. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
  89. package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
  90. package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
  91. package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
  92. package/lib/component/reducer/helper/getSpectrum.js +3 -2
  93. package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
  94. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
  95. package/lib/component/reducer/types/Types.d.ts +5 -0
  96. package/lib/component/reducer/types/Types.js +5 -0
  97. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
  98. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  99. package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
  100. package/lib/component/toolbar/BasicToolBar.js +12 -13
  101. package/lib/component/toolbar/FunctionToolBar.js +3 -1
  102. package/lib/component/utility/Export.js +7 -1
  103. package/lib/component/utility/assert.d.ts +1 -0
  104. package/lib/component/utility/assert.js +5 -0
  105. package/lib/component/workspaces/Workspace.d.ts +1 -1
  106. package/lib/component/workspaces/exercise.js +9 -3
  107. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  108. package/lib/data/Filters.d.ts +1 -2
  109. package/lib/data/Filters.js +1 -2
  110. package/lib/data/SpectraManager.d.ts +0 -4
  111. package/lib/data/SpectraManager.js +2 -87
  112. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  113. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  114. package/lib/data/data1d/filter1d/fft.js +11 -0
  115. package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
  116. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
  117. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
  118. package/lib/data/data2d/Processing2D.js +3 -2
  119. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
  120. package/lib/data/molecules/Molecule.d.ts +5 -0
  121. package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
  122. package/lib/data/utilities/calculateSanPlot.js +31 -0
  123. package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
  124. package/lib/versionInfo.js +1 -1
  125. package/lib-cjs/component/1d/ApodizationLine.js +3 -1
  126. package/lib-cjs/component/1d/FooterBanner.js +19 -10
  127. package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
  128. package/lib-cjs/component/1d/LinesSeries.js +3 -1
  129. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  130. package/lib-cjs/component/1d/Viewer1D.js +3 -1
  131. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
  132. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  133. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  134. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
  135. package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
  136. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
  137. package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
  138. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
  139. package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
  140. package/lib-cjs/component/2d/Contours.js +4 -2
  141. package/lib-cjs/component/2d/FooterBanner.js +3 -1
  142. package/lib-cjs/component/2d/Left1DChart.js +1 -1
  143. package/lib-cjs/component/2d/Top1DChart.js +1 -1
  144. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  145. package/lib-cjs/component/2d/XAxis.js +2 -2
  146. package/lib-cjs/component/2d/YAxis.js +2 -2
  147. package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
  148. package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
  149. package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
  150. package/lib-cjs/component/2d/zones/Zones.js +13 -18
  151. package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
  152. package/lib-cjs/component/NMRium.js +14 -3
  153. package/lib-cjs/component/SplitPaneWrapper.js +1 -1
  154. package/lib-cjs/component/elements/EditableColumn.js +18 -3
  155. package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
  156. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
  157. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
  158. package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  159. package/lib-cjs/component/hooks/useExport.js +0 -16
  160. package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
  161. package/lib-cjs/component/hooks/useNucleus.js +4 -4
  162. package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
  163. package/lib-cjs/component/hooks/useSpectrum.js +3 -1
  164. package/lib-cjs/component/loader/DropZone.js +14 -149
  165. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  166. package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
  167. package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
  168. package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
  169. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  170. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
  171. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  172. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  173. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  174. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  175. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
  176. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
  177. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  178. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  179. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
  180. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  181. package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  182. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
  183. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  184. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  185. package/lib-cjs/component/reducer/Reducer.js +48 -43
  186. package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
  187. package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
  188. package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
  189. package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
  190. package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
  191. package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
  192. package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
  193. package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
  194. package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  195. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
  196. package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
  197. package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
  198. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
  199. package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
  200. package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
  201. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
  202. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
  203. package/lib-cjs/component/reducer/types/Types.js +8 -3
  204. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  205. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
  206. package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
  207. package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
  208. package/lib-cjs/component/utility/Export.js +7 -1
  209. package/lib-cjs/component/utility/assert.js +9 -0
  210. package/lib-cjs/component/workspaces/exercise.js +9 -3
  211. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
  212. package/lib-cjs/data/Filters.js +1 -3
  213. package/lib-cjs/data/SpectraManager.js +3 -92
  214. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  215. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  216. package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
  217. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
  218. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
  219. package/lib-cjs/data/data2d/Processing2D.js +3 -2
  220. package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
  221. package/lib-cjs/versionInfo.js +1 -1
  222. package/package.json +26 -25
  223. package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
  224. package/lib/component/utility/nmredataToNmrium.js +0 -66
  225. package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
  226. package/lib/component/utility/nmriumToNmredata.js +0 -80
  227. package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
  228. package/lib/component/utility/util/nmredata/addRanges.js +0 -52
  229. package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
  230. package/lib/component/utility/util/nmredata/addSource.js +0 -54
  231. package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
  232. package/lib/component/utility/util/nmredata/addZones.js +0 -41
  233. package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
  234. package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
  235. package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
  236. package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
  237. package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
  238. package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
  239. package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
  240. package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
  241. package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
  242. package/lib/component/utility/util/nmredata/getLabels.js +0 -66
  243. package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
  244. package/lib/component/utility/util/nmredata/getToFix.js +0 -19
  245. package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
  246. package/lib/data/data1d/filter1d/absolute.js +0 -26
  247. package/lib/data/migration/MigrationManager.d.ts +0 -2
  248. package/lib/data/migration/MigrationManager.js +0 -19
  249. package/lib/data/migration/changeKeys.d.ts +0 -1
  250. package/lib/data/migration/changeKeys.js +0 -9
  251. package/lib/data/migration/migrateToVersion1.d.ts +0 -11
  252. package/lib/data/migration/migrateToVersion1.js +0 -32
  253. package/lib/data/migration/migrateToVersion2.d.ts +0 -1
  254. package/lib/data/migration/migrateToVersion2.js +0 -111
  255. package/lib/data/migration/migrateToVersion3.d.ts +0 -1
  256. package/lib/data/migration/migrateToVersion3.js +0 -55
  257. package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
  258. package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
  259. package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
  260. package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
  261. package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
  262. package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
  263. package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
  264. package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
  265. package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
  266. package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
  267. package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
  268. package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
  269. package/lib-cjs/data/migration/MigrationManager.js +0 -26
  270. package/lib-cjs/data/migration/changeKeys.js +0 -13
  271. package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
  272. package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
  273. package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
@@ -7,12 +7,14 @@ import { NMRiumDataReturn } from '../types/NMRiumDataReturn';
7
7
  import { NMRiumGeneralPreferences } from '../types/NMRiumGeneralPreferences';
8
8
  import { NMRiumPanelPreferences } from '../types/NMRiumPanelPreferences';
9
9
  import { NMRiumToolBarPreferences } from '../types/NMRiumToolBarPreferences';
10
+ import { ViewState } from './reducer/Reducer';
10
11
  import { BlobObject } from './utility/Export';
11
12
  export type { NMRiumDataReturn } from '../types/NMRiumDataReturn';
12
13
  export declare type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded';
13
14
  export interface NMRiumProps {
14
15
  data?: NMRiumData;
15
16
  onDataChange?: (data: NMRiumDataReturn) => void;
17
+ onViewChange?: (view: ViewState) => void;
16
18
  workspace?: NMRiumWorkspace;
17
19
  preferences?: NMRiumPreferences;
18
20
  emptyText?: ReactNode;
@@ -87,11 +87,19 @@ const defaultData = {
87
87
  const NMRium = forwardRef(function NMRium(props, ref) {
88
88
  return (_jsx(RootLayout, { style: { width: '100%' }, children: _jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, children: _jsx(InnerNMRium, { ...props, innerRef: ref }) }) }));
89
89
  });
90
- function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, innerRef, }) {
90
+ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, onViewChange, emptyText, innerRef, }) {
91
91
  const rootRef = useRef(null);
92
92
  const elementsWrapperRef = useRef(null);
93
93
  const viewerRef = useRef(null);
94
94
  const [show, toggle] = useToggle(false);
95
+ const handleDataChange = useRef(onDataChange);
96
+ useEffect(() => {
97
+ handleDataChange.current = onDataChange;
98
+ }, [onDataChange]);
99
+ const handleViewChange = useRef(onViewChange);
100
+ useEffect(() => {
101
+ handleViewChange.current = onViewChange;
102
+ }, [onViewChange]);
95
103
  const isFullscreen = useFullscreen(rootRef, show, {
96
104
  onClose: () => {
97
105
  toggle(false);
@@ -102,9 +110,12 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
102
110
  const { displayerMode, data: spectraData } = state;
103
111
  useEffect(() => {
104
112
  if (checkActionType(state.actionType)) {
105
- onDataChange?.(toJSON(state, 'onDataChange'));
113
+ handleDataChange.current?.(toJSON(state, 'onDataChange'));
106
114
  }
107
- }, [onDataChange, state]);
115
+ }, [state]);
116
+ useEffect(() => {
117
+ handleViewChange.current?.(state.view);
118
+ }, [state.view]);
108
119
  const dispatchMiddleWare = useMemo(() => {
109
120
  return dispatchMiddleware(dispatch);
110
121
  }, []);
@@ -4,5 +4,5 @@ import { usePreferences } from './context/PreferencesContext';
4
4
  export function SplitPaneWrapper({ children }) {
5
5
  const { current } = usePreferences();
6
6
  const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
7
- return (_jsx(SplitPane, { initialSeparation: initialPanelWidth, orientation: "horizontal", sideSeparation: "end", ...(hidePanelOnLoad ? { initialClosed: true } : { minimumSize: 600 }), children: children }, hidePanelOnLoad ? 'true' : 'false'));
7
+ return (_jsx(SplitPane, { initialSize: initialPanelWidth, direction: "horizontal", controlledSide: "end", initialClosed: hidePanelOnLoad ? true : 600, children: children }, hidePanelOnLoad ? 'true' : 'false'));
8
8
  }
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
- interface EditableColumnProps {
2
+ import { InputProps } from './Input';
3
+ interface EditableColumnProps extends Omit<InputProps, 'style' | 'value' | 'type'> {
3
4
  onSave?: (element: any) => void;
4
5
  onEditStart?: (element: any) => void;
5
6
  type?: 'number' | 'text';
@@ -7,6 +8,7 @@ interface EditableColumnProps {
7
8
  value: string | number;
8
9
  style?: CSSProperties;
9
10
  validate?: (value?: any) => boolean;
11
+ textOverFlowEllipses?: boolean;
10
12
  }
11
13
  declare const EditableColumn: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
12
14
  export default EditableColumn;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useState, } from 'react';
3
3
  import Input from './Input';
4
4
  const EditableColumn = forwardRef(function EditableColumn(props, ref) {
5
- const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, } = props;
5
+ const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, textOverFlowEllipses = false, ...InputProps } = props;
6
6
  const [enabled, enableEdit] = useState();
7
7
  const [isValid, setValid] = useState(true);
8
8
  useEffect(() => {
@@ -43,11 +43,26 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
43
43
  window.removeEventListener('mousedown', mouseClickCallback);
44
44
  }
45
45
  }, [mouseClickCallback, onSave, validate]);
46
- return (_jsxs("div", { style: { display: 'table', width: '100%', height: '100%', ...style }, onDoubleClick: startEditHandler, children: [!enabled && (_jsx("span", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
46
+ return (_jsxs("div", { style: {
47
+ display: 'table',
48
+ width: '100%',
49
+ height: '100%',
50
+ ...(textOverFlowEllipses
51
+ ? { whiteSpace: 'nowrap', overflow: 'hidden', display: 'inline-flex' }
52
+ : {}),
53
+ ...style,
54
+ }, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (_jsx("span", { style: {
55
+ display: 'table-cell',
56
+ verticalAlign: 'middle',
57
+ width: 'inherit',
58
+ ...(textOverFlowEllipses
59
+ ? { textOverflow: 'ellipsis', overflow: 'hidden' }
60
+ : {}),
61
+ }, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
47
62
  inputWrapper: {
48
63
  width: '100%',
49
64
  ...(!isValid && { borderColor: 'red' }),
50
65
  },
51
- }, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler }) }))] }));
66
+ }, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler, ...InputProps }) }))] }));
52
67
  });
53
68
  export default EditableColumn;
@@ -3,9 +3,9 @@ interface ProviderProps {
3
3
  children: ReactNode;
4
4
  style?: CSSProperties;
5
5
  offset?: string;
6
- position?: any;
7
- transition?: any;
8
- wrapperRef?: any;
6
+ position?: string;
7
+ transition?: string;
8
+ wrapperRef?: HTMLDivElement | null;
9
9
  }
10
10
  declare function Provider({ children, style, offset, position, transition, wrapperRef, }: ProviderProps): import("@emotion/react/jsx-runtime").JSX.Element;
11
11
  export default Provider;
@@ -23,7 +23,7 @@ const transitionStyles = {
23
23
  exited: { transform: 'scale(0)' },
24
24
  },
25
25
  };
26
- function Provider({ children, style = undefined, offset = '0px', position = positions.MIDDLE, transition = transitions.SCALE, wrapperRef = null, }) {
26
+ function Provider({ children, style, offset = '0px', position = positions.MIDDLE, transition = transitions.SCALE, wrapperRef = null, }) {
27
27
  const root = useRef();
28
28
  const modalRef = useRef();
29
29
  const [modal, setModal] = useState();
@@ -44,16 +44,13 @@ function Provider({ children, style = undefined, offset = '0px', position = posi
44
44
  const close = useCallback(function close() {
45
45
  setModal(null);
46
46
  }, [setModal]);
47
- const parentStyle = useMemo(() => {
48
- return wrapperRef
49
- ? wrapperRef.getBoundingClientRect()
50
- : {
51
- top: 0,
52
- left: 0,
53
- width: window.innerWidth,
54
- height: window.innerHeight,
55
- };
56
- }, [wrapperRef]);
47
+ // todo: optimize this
48
+ const parentStyle = wrapperRef?.getBoundingClientRect() || {
49
+ top: 0,
50
+ left: 0,
51
+ width: window.innerWidth,
52
+ height: window.innerHeight,
53
+ };
57
54
  /**
58
55
  *
59
56
  * @param {*} component <component />
@@ -9,13 +9,15 @@ import CheckBox from '../elements/CheckBox';
9
9
  import Label from '../elements/Label';
10
10
  import Select from '../elements/Select';
11
11
  import { useFilter } from '../hooks/useFilter';
12
+ import { useActiveSpectrum } from '../reducer/Reducer';
12
13
  import { APPLY_ZERO_FILLING_FILTER, CALCULATE_ZERO_FILLING_FILTER, DISABLE_FILTER_LIVE_PREVIEW, RESET_SELECTED_TOOL, } from '../reducer/types/Types';
13
14
  import { options } from '../toolbar/ToolTypes';
14
15
  import { HeaderContainer } from './HeaderContainer';
15
16
  const Sizes = generateNumbersPowerOfX(8, 21);
16
17
  function ZeroFillingOptionsPanel() {
17
18
  const dispatch = useDispatch();
18
- const { data, activeSpectrum } = useChartData();
19
+ const { data } = useChartData();
20
+ const activeSpectrum = useActiveSpectrum();
19
21
  const [size, setSize] = useState();
20
22
  const [livePreview, setLivePreview] = useState(true);
21
23
  const filter = useFilter(Filters.zeroFilling.id);
@@ -1,15 +1,15 @@
1
1
  import get from 'lodash/get';
2
2
  import { useMemo } from 'react';
3
- import { useChartData } from '../context/ChartContext';
4
3
  import { usePreferences } from '../context/PreferencesContext';
4
+ import { useActiveSpectrum } from '../reducer/Reducer';
5
5
  export default function useActiveSpectrumStyleOptions(id) {
6
- const { activeSpectrum } = useChartData();
6
+ const activeSpectrum = useActiveSpectrum();
7
7
  const preferences = usePreferences();
8
8
  return useMemo(() => {
9
9
  const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
10
10
  const opacity = isActive
11
11
  ? 1
12
- : get(preferences.current, 'general.dimmedSpectraTransparency', 0.1);
12
+ : get(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
13
13
  return { isActive, opacity };
14
14
  }, [activeSpectrum, id, preferences]);
15
15
  }
@@ -1,9 +1,11 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
+ import { useActiveSpectrum } from '../reducer/Reducer';
3
4
  import nucleusToString from '../utility/nucleusToString';
4
5
  const emptyData = { info: {}, datum: {}, ftCounter: 0, fidCounter: 0 };
5
6
  export default function useDatumWithSpectraStatistics() {
6
- const { data, activeSpectrum, activeTab } = useChartData();
7
+ const { data, view: { spectra: { activeTab }, }, } = useChartData();
8
+ const activeSpectrum = useActiveSpectrum();
7
9
  return useMemo(() => {
8
10
  if (data) {
9
11
  let info = {};
@@ -1,7 +1,6 @@
1
1
  export default function useExport(): {
2
2
  saveToClipboardHandler: () => Promise<void>;
3
3
  saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => Promise<void>;
4
- saveAsNMREHandler: () => Promise<void>;
5
4
  saveAsSVGHandler: () => Promise<void>;
6
5
  saveAsPNGHandler: () => Promise<void>;
7
6
  saveAsHandler: () => Promise<void>;
@@ -6,8 +6,7 @@ import { useGlobal } from '../context/GlobalContext';
6
6
  import { useAlert } from '../elements/popup/Alert';
7
7
  import { positions, useModal } from '../elements/popup/Modal';
8
8
  import SaveAsModal from '../modal/SaveAsModal';
9
- import { copyPNGToClipboard, exportAsJSON, exportAsNMRE, exportAsPng, exportAsSVG, } from '../utility/Export';
10
- import { nmriumToNmredata } from '../utility/nmriumToNmredata';
9
+ import { copyPNGToClipboard, exportAsJSON, exportAsPng, exportAsSVG, } from '../utility/Export';
11
10
  export default function useExport() {
12
11
  const { rootRef } = useGlobal();
13
12
  const modal = useModal();
@@ -38,20 +37,6 @@ export default function useExport() {
38
37
  }, 0);
39
38
  }
40
39
  }, [alert, state]);
41
- const saveAsNMREHandler = useCallback(async () => {
42
- if (state.data.length > 0) {
43
- const hideLoading = await alert.showLoading('Exporting as NMRE process in progress');
44
- setTimeout(() => {
45
- async function handle() {
46
- const fileName = state.data[0]?.display?.name;
47
- const exportedData = await nmriumToNmredata(state);
48
- exportAsNMRE(exportedData, fileName);
49
- hideLoading();
50
- }
51
- void handle();
52
- }, 0);
53
- }
54
- }, [alert, state]);
55
40
  const saveAsSVGHandler = useCallback(async () => {
56
41
  if (state.data.length > 0 && rootRef) {
57
42
  const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
@@ -100,7 +85,6 @@ export default function useExport() {
100
85
  return {
101
86
  saveToClipboardHandler,
102
87
  saveAsJSONHandler,
103
- saveAsNMREHandler,
104
88
  saveAsSVGHandler,
105
89
  saveAsPNGHandler,
106
90
  saveAsHandler,
@@ -2,10 +2,12 @@ import { xyIntegral, xyReduce } from 'ml-spectra-processing';
2
2
  import { useMemo } from 'react';
3
3
  import { getIntegralYScale } from '../1d/utilities/scale';
4
4
  import { useChartData } from '../context/ChartContext';
5
+ import { useActiveSpectrum } from '../reducer/Reducer';
5
6
  import { PathBuilder } from '../utility/PathBuilder';
6
7
  import { useXScale } from './useXScale';
7
8
  function useIntegralYDomain() {
8
- const { height, margin, verticalAlign, activeSpectrum, integralsYDomains } = useChartData();
9
+ const { height, margin, verticalAlign, integralsYDomains } = useChartData();
10
+ const activeSpectrum = useActiveSpectrum();
9
11
  return useMemo(() => getIntegralYScale({
10
12
  height,
11
13
  margin,
@@ -15,7 +17,8 @@ function useIntegralYDomain() {
15
17
  }), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
16
18
  }
17
19
  export default function useIntegralPath(integralOptions) {
18
- const { data, activeSpectrum } = useChartData();
20
+ const { data } = useChartData();
21
+ const activeSpectrum = useActiveSpectrum();
19
22
  const scaleX = useXScale();
20
23
  const scaleY = useIntegralYDomain();
21
24
  const integral = useMemo(() => {
@@ -1,11 +1,11 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
3
  export default function useNucleus() {
4
- const { tabActiveSpectrum } = useChartData();
4
+ const { view: { spectra: { activeSpectra }, }, } = useChartData();
5
5
  return useMemo(() => {
6
- if (tabActiveSpectrum && Object.keys(tabActiveSpectrum).length > 0) {
7
- return Object.keys(tabActiveSpectrum);
6
+ if (activeSpectra && Object.keys(activeSpectra).length > 0) {
7
+ return Object.keys(activeSpectra);
8
8
  }
9
9
  return [];
10
- }, [tabActiveSpectrum]);
10
+ }, [activeSpectra]);
11
11
  }
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
3
  import nucleusToString from '../utility/nucleusToString';
4
4
  export default function useSpectraByActiveNucleus() {
5
- const { data, activeTab } = useChartData();
5
+ const { data, view: { spectra: { activeTab }, }, } = useChartData();
6
6
  return useMemo(() => {
7
7
  if (data) {
8
8
  return (data.filter((spectrum) => activeTab === nucleusToString(spectrum.info.nucleus)) || []);
@@ -1,7 +1,9 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useChartData } from '../context/ChartContext';
3
+ import { useActiveSpectrum } from '../reducer/Reducer';
3
4
  export default function useSpectrum(defaultValue) {
4
- const { data, activeSpectrum } = useChartData();
5
+ const { data } = useChartData();
6
+ const activeSpectrum = useActiveSpectrum();
5
7
  return useMemo(() => {
6
8
  if (data && activeSpectrum && activeSpectrum.id) {
7
9
  const datum = data.find((datum) => datum.id === activeSpectrum.id) || defaultValue;
@@ -1,17 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import Zip from 'jszip';
4
+ import { fileCollectionFromFileList } from 'filelist-utils';
5
5
  import { useCallback } from 'react';
6
6
  import { useDropzone } from 'react-dropzone';
7
7
  import { FaUpload } from 'react-icons/fa';
8
8
  import { useChartData } from '../context/ChartContext';
9
9
  import { useDispatch } from '../context/DispatchContext';
10
10
  import { LoaderProvider } from '../context/LoaderContext';
11
- import { useAlert } from '../elements/popup/Alert';
12
11
  import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
13
- import { LOAD_MOL_FILE, LOAD_JSON_FILE, LOAD_JCAMP_FILE, SET_LOADING_FLAG, LOAD_ZIP_FILE, LOAD_JDF_FILE, LOAD_NMREDATA_FILE, } from '../reducer/types/Types';
14
- import { FILES_TYPES, FILES_SIGNATURES, getFileExtension, getFileSignature, loadFiles, loadFilesFromZip, } from '../utility/FileUtility';
12
+ import { SET_LOADING_FLAG, LOAD_DROP_FILES } from '../reducer/types/Types';
15
13
  const style = css `
16
14
  height: 100%;
17
15
  background-color: #b5b5b599;
@@ -46,153 +44,23 @@ const containerStyle = css `
46
44
  function DropZone(props) {
47
45
  const { width, height } = useChartData();
48
46
  const dispatch = useDispatch();
49
- const alert = useAlert();
50
47
  const isToolEnabled = useCheckToolsVisibility();
51
- const loadSubFilesFromZip = useCallback(async (extractedfiles, uniqueFileExtensions) => {
52
- for (let extension of uniqueFileExtensions) {
53
- const selectedFilesByExtensions = extractedfiles.filter((file) => getFileExtension(file.name) === extension);
54
- switch (extension) {
55
- case FILES_TYPES.MOL: {
56
- const files = await loadFilesFromZip(selectedFilesByExtensions);
57
- dispatch({ type: LOAD_MOL_FILE, files });
58
- break;
59
- }
60
- case FILES_TYPES.NMRIUM:
61
- case FILES_TYPES.JSON: {
62
- const files = await loadFilesFromZip(selectedFilesByExtensions, {
63
- asBuffer: true,
64
- });
65
- if (selectedFilesByExtensions.length === 1) {
66
- const decoder = new TextDecoder('utf8');
67
- files[0].binary = decoder.decode(files[0].binary);
68
- dispatch({ type: LOAD_JSON_FILE, files });
69
- }
70
- else {
71
- throw new Error('You can add only one json file');
72
- }
73
- break;
74
- }
75
- case FILES_TYPES.JDX:
76
- case FILES_TYPES.DX: {
77
- const files = await loadFilesFromZip(selectedFilesByExtensions, {
78
- asBuffer: true,
79
- });
80
- dispatch({ type: LOAD_JCAMP_FILE, files });
81
- break;
82
- }
83
- case FILES_TYPES.JDF: {
84
- const files = await loadFilesFromZip(selectedFilesByExtensions, {
85
- asBuffer: true,
86
- });
87
- dispatch({ type: LOAD_JDF_FILE, files });
88
- break;
89
- }
90
- default:
91
- break;
92
- }
93
- }
48
+ const loadFilesHandler = useCallback((files) => {
49
+ files.forEach((file) => {
50
+ Object.defineProperty(file, 'webkitRelativePath', { value: file.path });
51
+ });
52
+ fileCollectionFromFileList(files)
53
+ .then((fileCollection) => {
54
+ dispatch({ type: LOAD_DROP_FILES, fileCollection });
55
+ })
56
+ .catch((e) => {
57
+ dispatch({ type: SET_LOADING_FLAG, isLoading: false });
58
+ reportError(e);
59
+ });
94
60
  }, [dispatch]);
95
- const loadFilesHandler = useCallback(async (files) => {
96
- const uniqueFileExtensions = [
97
- ...new Set(files.map((file) => getFileExtension(file.name))),
98
- ];
99
- for (let extension of uniqueFileExtensions) {
100
- const selectedFilesByExtensions = files.filter((file) => getFileExtension(file.name) === extension);
101
- try {
102
- switch (extension) {
103
- case FILES_TYPES.MOL: {
104
- const files = await loadFiles(selectedFilesByExtensions);
105
- dispatch({ type: LOAD_MOL_FILE, files });
106
- break;
107
- }
108
- case FILES_TYPES.NMRIUM:
109
- case FILES_TYPES.JSON:
110
- if (selectedFilesByExtensions.length === 1) {
111
- const files = await loadFiles(selectedFilesByExtensions, {
112
- asBuffer: true,
113
- });
114
- // InputFileFormat
115
- const fileSignature = getFileSignature(files[0].binary);
116
- if (fileSignature === FILES_SIGNATURES.ZIP) {
117
- const unzipResult = await Zip.loadAsync(files[0].binary);
118
- await loadSubFilesFromZip(Object.values(unzipResult.files), [
119
- FILES_TYPES.NMRIUM,
120
- ]);
121
- }
122
- else {
123
- const decoder = new TextDecoder('utf8');
124
- files[0].binary = decoder.decode(files[0].binary);
125
- dispatch({ type: LOAD_JSON_FILE, files });
126
- }
127
- }
128
- else {
129
- throw new Error('You can add only one json file');
130
- }
131
- break;
132
- case FILES_TYPES.JDX:
133
- case FILES_TYPES.DX: {
134
- const files = await loadFiles(selectedFilesByExtensions, {
135
- asBuffer: true,
136
- });
137
- dispatch({ type: LOAD_JCAMP_FILE, files });
138
- break;
139
- }
140
- case FILES_TYPES.JDF: {
141
- const files = await loadFiles(selectedFilesByExtensions, {
142
- asBuffer: true,
143
- });
144
- dispatch({ type: LOAD_JDF_FILE, files });
145
- break;
146
- }
147
- case FILES_TYPES.ZIP: {
148
- const files = await loadFiles(selectedFilesByExtensions, {
149
- asBuffer: true,
150
- });
151
- for (const zipFile of files) {
152
- const unzipResult = await Zip.loadAsync(zipFile.binary);
153
- const uniqueFileExtensions = [
154
- ...new Set(Object.values(unzipResult.files).map((file) => getFileExtension(file.name))),
155
- ];
156
- const isNotZip = uniqueFileExtensions.some((ex) => FILES_TYPES[ex.toUpperCase()] && ex !== FILES_TYPES.ZIP);
157
- if (isNotZip) {
158
- const hasBruker = Object.keys(unzipResult.files).some((path) => {
159
- return ['2rr', 'fid', '1r'].some((brukerFile) => path.endsWith(brukerFile));
160
- });
161
- if (hasBruker)
162
- dispatch({ type: LOAD_ZIP_FILE, files });
163
- await loadSubFilesFromZip(Object.values(unzipResult.files), uniqueFileExtensions);
164
- }
165
- else {
166
- dispatch({ type: LOAD_ZIP_FILE, files });
167
- }
168
- }
169
- break;
170
- }
171
- case FILES_TYPES.NMREDATA:
172
- void loadFiles(selectedFilesByExtensions, {
173
- asBuffer: true,
174
- }).then(async (files) => {
175
- for (const zipFile of files) {
176
- dispatch({
177
- type: LOAD_NMREDATA_FILE,
178
- file: zipFile,
179
- });
180
- }
181
- });
182
- break;
183
- default:
184
- throw new Error('The file extension must be zip, dx, jdx, json, mol, nmredata or nmrium.');
185
- }
186
- }
187
- catch (e) {
188
- dispatch({ type: SET_LOADING_FLAG, isLoading: false });
189
- alert.error(e.message);
190
- }
191
- }
192
- }, [alert, dispatch, loadSubFilesFromZip]);
193
61
  const onDrop = useCallback((droppedFiles) => {
194
62
  dispatch({ type: SET_LOADING_FLAG, isLoading: true });
195
- void loadFilesHandler(droppedFiles);
63
+ loadFilesHandler(droppedFiles);
196
64
  }, [dispatch, loadFilesHandler]);
197
65
  const isImportEnabled = isToolEnabled('import');
198
66
  const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
@@ -41,7 +41,7 @@ const styles = css `
41
41
  export default function SelectMolecule(props) {
42
42
  const [currentIndex, setCurrentIndex] = useState();
43
43
  const { setFieldValue, errors, values } = useFormikContext();
44
- const { molecules, activeTab } = useChartData();
44
+ const { molecules, view: { spectra: { activeTab }, }, } = useChartData();
45
45
  const element = getAtom(activeTab);
46
46
  const newSum = useMemo(() => {
47
47
  return element &&
@@ -51,7 +51,7 @@ const styles = css `
51
51
  `;
52
52
  function EditRangeModal({ onSaveEditRangeModal = () => null, onCloseEditRangeModal = () => null, onZoomEditRangeModal = () => null, manualRange = false, range: originRange, }) {
53
53
  const formRef = useRef(null);
54
- const { activeTab } = useChartData();
54
+ const { view: { spectra: { activeTab }, }, } = useChartData();
55
55
  const dispatch = useDispatch();
56
56
  const rangesPreferences = usePanelPreferences('ranges', activeTab);
57
57
  const validation = useRangeFormValidation();
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import Label from '../../elements/Label';
3
3
  import FormikInput from '../../elements/formik/FormikInput';
4
4
  function GeneralTabContent() {
5
- return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }), _jsx(Label, { title: "Transparency of Dimmed Spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraTransparency", checkValue: (value) => value >= 0 && value <= 1, type: "number" }) })] }));
5
+ return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }), _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => value >= 0 && value <= 1, type: "number" }) })] }));
6
6
  }
7
7
  export default GeneralTabContent;
@@ -51,6 +51,10 @@ const LIST = [
51
51
  label: 'Slicing',
52
52
  name: 'toolBarButtons.slicing',
53
53
  },
54
+ {
55
+ label: 'Apodization',
56
+ name: 'toolBarButtons.apodization',
57
+ },
54
58
  {
55
59
  label: 'Zero filling',
56
60
  name: 'toolBarButtons.zeroFilling',
@@ -110,7 +110,7 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
110
110
  const MemoizedIntegralPanel = memo(IntegralPanelInner);
111
111
  const emptyData = { integrals: {}, info: {} };
112
112
  export default function IntegralPanel() {
113
- const { xDomain, activeTab } = useChartData();
113
+ const { xDomain, view: { spectra: { activeTab }, }, } = useChartData();
114
114
  const { integrals, info } = useSpectrum(emptyData);
115
115
  return (_jsx(MemoizedIntegralPanel, { ...{
116
116
  integrals,
@@ -34,5 +34,5 @@ export default function MoleculeHeader(props) {
34
34
  const label = event.target.value;
35
35
  dispatch({ type: CHANGE_MOLECULE_LABEL, payload: { label, id } });
36
36
  }, [dispatch]);
37
- return (_jsxs("div", { style: styles.toolbar, children: [_jsxs("div", { style: { display: 'flex' }, children: [_jsx("span", { children: "Label" }), _jsx(EditableColumn, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event) })] }), _jsxs("span", { children: [_jsx(MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
37
+ return (_jsxs("div", { style: styles.toolbar, children: [_jsxs("div", { style: { display: 'flex' }, children: [_jsx("span", { children: "Label" }), _jsx(EditableColumn, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event), textOverFlowEllipses: true })] }), _jsxs("span", { children: [_jsx(MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
38
38
  }
@@ -87,7 +87,7 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, floatingM
87
87
  const MemoizedMoleculePanel = memo(MoleculePanelInner);
88
88
  const emptyData = { ranges: {}, zones: {} };
89
89
  export default function MoleculePanel({ onMoleculeChange, children, actionsOptions, emptyTextStyle, }) {
90
- const { molecules, view: { floatingMolecules }, displayerMode, activeTab, } = useChartData();
90
+ const { molecules, view: { floatingMolecules, spectra: { activeTab }, }, displayerMode, } = useChartData();
91
91
  const data = useSpectrum(emptyData);
92
92
  const ranges = data?.ranges || {};
93
93
  const zones = data?.zones || {};
@@ -82,7 +82,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
82
82
  }
83
83
  const MemoizedMultipleSpectraAnalysisPanel = memo(MultipleSpectraAnalysisPanelInner);
84
84
  export default function MultipleSpectraAnalysisPanel() {
85
- const { activeTab, spectraAnalysis, displayerKey } = useChartData();
85
+ const { view: { spectra: { activeTab }, }, spectraAnalysis, displayerKey, } = useChartData();
86
86
  if (!activeTab) {
87
87
  return _jsx("div", {});
88
88
  }
@@ -109,7 +109,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksOptions, }) {
109
109
  const MemoizedPeaksPanel = memo(PeaksPanelInner);
110
110
  const emptyData = { peaks: null, info: {} };
111
111
  export default function PeaksPanel() {
112
- const { xDomain, activeTab, toolOptions: { data: { peaksOptions }, }, } = useChartData();
112
+ const { xDomain, view: { spectra: { activeTab }, }, toolOptions: { data: { peaksOptions }, }, } = useChartData();
113
113
  const { peaks, info } = useSpectrum(emptyData);
114
114
  const preferences = usePreferences();
115
115
  return (_jsx(MemoizedPeaksPanel, { ...{ peaks, info, xDomain, activeTab, preferences, peaksOptions } }));
@@ -36,7 +36,7 @@ function PeaksTable({ activeTab, data }) {
36
36
  });
37
37
  }, [modal, peaksPreferences]);
38
38
  const saveDeltaPPMRefsHandler = useCallback((event, row) => {
39
- const shiftValue = parseFloat(event.target.value) - parseFloat(row.value);
39
+ const shiftValue = parseFloat(event.target.value) - parseFloat(row.x);
40
40
  dispatch({ type: SHIFT_SPECTRUM, shiftValue });
41
41
  }, [dispatch]);
42
42
  const COLUMNS = useMemo(() => [
@@ -1,4 +1,5 @@
1
- declare function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }: {
1
+ declare function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, showMultiplicityTrees, showJGraph, showRangesIntegrals, activeTab, }: {
2
+ id: any;
2
3
  ranges: any;
3
4
  info: any;
4
5
  onUnlink: any;