nmrium 0.30.0 → 0.31.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 (230) hide show
  1. package/lib/component/1d/ApodizationLine.js +3 -1
  2. package/lib/component/1d/FooterBanner.js +3 -1
  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 +3 -1
  17. package/lib/component/2d/FooterBanner.js +3 -1
  18. package/lib/component/2d/Viewer2D.js +4 -4
  19. package/lib/component/2d/XAxis.js +2 -2
  20. package/lib/component/2d/YAxis.js +2 -2
  21. package/lib/component/2d/tools/XYLabelPointer.js +3 -1
  22. package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
  23. package/lib/component/2d/zones/IndicationLines.js +1 -1
  24. package/lib/component/2d/zones/Zones.js +14 -19
  25. package/lib/component/NMRium.d.ts +2 -0
  26. package/lib/component/NMRium.js +14 -3
  27. package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
  28. package/lib/component/elements/popup/Modal/Provider.js +8 -11
  29. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
  30. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
  31. package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  32. package/lib/component/hooks/useExport.d.ts +0 -1
  33. package/lib/component/hooks/useExport.js +1 -17
  34. package/lib/component/hooks/useIntegralPath.js +5 -2
  35. package/lib/component/hooks/useNucleus.js +4 -4
  36. package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
  37. package/lib/component/hooks/useSpectrum.js +3 -1
  38. package/lib/component/loader/DropZone.js +7 -147
  39. package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
  40. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  41. package/lib/component/modal/setting/ToolsTabContent.js +4 -0
  42. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  43. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  44. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  45. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  46. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  47. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
  48. package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
  49. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  50. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  51. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  52. package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  53. package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
  54. package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
  55. package/lib/component/reducer/IgnoreActions.js +1 -0
  56. package/lib/component/reducer/Reducer.d.ts +108 -49
  57. package/lib/component/reducer/Reducer.js +45 -41
  58. package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
  59. package/lib/component/reducer/actions/DomainActions.js +11 -9
  60. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
  61. package/lib/component/reducer/actions/FiltersActions.js +218 -232
  62. package/lib/component/reducer/actions/IntegralsActions.js +13 -8
  63. package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
  64. package/lib/component/reducer/actions/LoadActions.js +19 -34
  65. package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
  66. package/lib/component/reducer/actions/MoleculeActions.js +22 -6
  67. package/lib/component/reducer/actions/PeaksActions.js +18 -12
  68. package/lib/component/reducer/actions/PreferencesActions.js +8 -10
  69. package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
  70. package/lib/component/reducer/actions/RangesActions.js +85 -27
  71. package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  72. package/lib/component/reducer/actions/SpectrumsActions.js +13 -10
  73. package/lib/component/reducer/actions/ToolsActions.js +38 -23
  74. package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
  75. package/lib/component/reducer/actions/ZonesActions.js +68 -17
  76. package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
  77. package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
  78. package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
  79. package/lib/component/reducer/helper/getSpectrum.js +3 -2
  80. package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
  81. package/lib/component/reducer/types/Types.d.ts +5 -0
  82. package/lib/component/reducer/types/Types.js +5 -0
  83. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
  84. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  85. package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
  86. package/lib/component/toolbar/BasicToolBar.js +4 -6
  87. package/lib/component/toolbar/FunctionToolBar.js +3 -1
  88. package/lib/component/utility/assert.d.ts +1 -0
  89. package/lib/component/utility/assert.js +5 -0
  90. package/lib/component/workspaces/exercise.js +6 -0
  91. package/lib/data/SpectraManager.d.ts +0 -4
  92. package/lib/data/SpectraManager.js +2 -87
  93. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  94. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  95. package/lib/data/data1d/filter1d/fft.js +11 -0
  96. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
  97. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
  98. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
  99. package/lib/data/molecules/Molecule.d.ts +5 -0
  100. package/lib/versionInfo.js +1 -1
  101. package/lib-cjs/component/1d/ApodizationLine.js +3 -1
  102. package/lib-cjs/component/1d/FooterBanner.js +3 -1
  103. package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
  104. package/lib-cjs/component/1d/LinesSeries.js +3 -1
  105. package/lib-cjs/component/1d/SpectraTracker.js +1 -1
  106. package/lib-cjs/component/1d/Viewer1D.js +3 -1
  107. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
  108. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
  109. package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
  110. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
  111. package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
  112. package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
  113. package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
  114. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
  115. package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
  116. package/lib-cjs/component/2d/Contours.js +3 -1
  117. package/lib-cjs/component/2d/FooterBanner.js +3 -1
  118. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  119. package/lib-cjs/component/2d/XAxis.js +2 -2
  120. package/lib-cjs/component/2d/YAxis.js +2 -2
  121. package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
  122. package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
  123. package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
  124. package/lib-cjs/component/2d/zones/Zones.js +13 -18
  125. package/lib-cjs/component/NMRium.js +14 -3
  126. package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
  127. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
  128. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
  129. package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
  130. package/lib-cjs/component/hooks/useExport.js +0 -16
  131. package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
  132. package/lib-cjs/component/hooks/useNucleus.js +4 -4
  133. package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
  134. package/lib-cjs/component/hooks/useSpectrum.js +3 -1
  135. package/lib-cjs/component/loader/DropZone.js +6 -149
  136. package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
  137. package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
  138. package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
  139. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
  140. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
  141. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  142. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
  143. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
  144. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
  145. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
  146. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
  147. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  148. package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
  149. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
  150. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
  151. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  152. package/lib-cjs/component/reducer/Reducer.js +48 -43
  153. package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
  154. package/lib-cjs/component/reducer/actions/FiltersActions.js +219 -233
  155. package/lib-cjs/component/reducer/actions/IntegralsActions.js +13 -8
  156. package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
  157. package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
  158. package/lib-cjs/component/reducer/actions/PeaksActions.js +18 -12
  159. package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
  160. package/lib-cjs/component/reducer/actions/RangesActions.js +85 -27
  161. package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
  162. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +13 -10
  163. package/lib-cjs/component/reducer/actions/ToolsActions.js +38 -23
  164. package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
  165. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
  166. package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
  167. package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
  168. package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
  169. package/lib-cjs/component/reducer/types/Types.js +8 -3
  170. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
  171. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
  172. package/lib-cjs/component/toolbar/BasicToolBar.js +4 -6
  173. package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
  174. package/lib-cjs/component/utility/assert.js +9 -0
  175. package/lib-cjs/component/workspaces/exercise.js +6 -0
  176. package/lib-cjs/data/SpectraManager.js +3 -92
  177. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  178. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
  179. package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
  180. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
  181. package/lib-cjs/versionInfo.js +1 -1
  182. package/package.json +22 -22
  183. package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
  184. package/lib/component/utility/nmredataToNmrium.js +0 -66
  185. package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
  186. package/lib/component/utility/nmriumToNmredata.js +0 -80
  187. package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
  188. package/lib/component/utility/util/nmredata/addRanges.js +0 -52
  189. package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
  190. package/lib/component/utility/util/nmredata/addSource.js +0 -54
  191. package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
  192. package/lib/component/utility/util/nmredata/addZones.js +0 -41
  193. package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
  194. package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
  195. package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
  196. package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
  197. package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
  198. package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
  199. package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
  200. package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
  201. package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
  202. package/lib/component/utility/util/nmredata/getLabels.js +0 -66
  203. package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
  204. package/lib/component/utility/util/nmredata/getToFix.js +0 -19
  205. package/lib/data/migration/MigrationManager.d.ts +0 -2
  206. package/lib/data/migration/MigrationManager.js +0 -19
  207. package/lib/data/migration/changeKeys.d.ts +0 -1
  208. package/lib/data/migration/changeKeys.js +0 -9
  209. package/lib/data/migration/migrateToVersion1.d.ts +0 -11
  210. package/lib/data/migration/migrateToVersion1.js +0 -32
  211. package/lib/data/migration/migrateToVersion2.d.ts +0 -1
  212. package/lib/data/migration/migrateToVersion2.js +0 -111
  213. package/lib/data/migration/migrateToVersion3.d.ts +0 -1
  214. package/lib/data/migration/migrateToVersion3.js +0 -55
  215. package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
  216. package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
  217. package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
  218. package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
  219. package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
  220. package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
  221. package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
  222. package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
  223. package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
  224. package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
  225. package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
  226. package/lib-cjs/data/migration/MigrationManager.js +0 -26
  227. package/lib-cjs/data/migration/changeKeys.js +0 -13
  228. package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
  229. package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
  230. package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
@@ -14,6 +14,7 @@ const DispatchContext_1 = require("../../context/DispatchContext");
14
14
  const Alert_1 = require("../../elements/popup/Alert");
15
15
  const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
16
16
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
17
+ const Reducer_1 = require("../../reducer/Reducer");
17
18
  const Types_1 = require("../../reducer/types/Types");
18
19
  const Export_1 = require("../../utility/Export");
19
20
  const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
@@ -22,7 +23,7 @@ const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader
22
23
  const RangesHeader_1 = __importDefault(require("./RangesHeader"));
23
24
  const RangesPreferences_1 = __importDefault(require("./RangesPreferences"));
24
25
  const RangesTable_1 = __importDefault(require("./RangesTable"));
25
- function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activeTab, molecules, showMultiplicityTrees, showJGraph, showRangesIntegrals, }) {
26
+ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, activeTab, molecules, showMultiplicityTrees, showJGraph, showRangesIntegrals, }) {
26
27
  const [isFilterActive, setFilterIsActive] = (0, react_2.useState)(false);
27
28
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
28
29
  const dispatch = (0, DispatchContext_1.useDispatch)();
@@ -112,6 +113,7 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
112
113
  }
113
114
  `,
114
115
  ], children: [!isFlipped && ((0, jsx_runtime_1.jsx)(RangesHeader_1.default, { ...{
116
+ id,
115
117
  ranges,
116
118
  info,
117
119
  activeTab,
@@ -125,10 +127,12 @@ function RangesTablePanelInner({ ranges, data, info, xDomain, preferences, activ
125
127
  const MemoizedRangesTablePanel = (0, react_2.memo)(RangesTablePanelInner);
126
128
  const emptyData = { ranges: {}, data: {}, info: {} };
127
129
  function RangesTablePanel() {
128
- const { displayerKey, xDomain, activeTab, molecules, toolOptions: { selectedTool, data: { showMultiplicityTrees, showRangesIntegrals, showJGraph }, }, } = (0, ChartContext_1.useChartData)();
129
- const { ranges, data, info } = (0, useSpectrum_1.default)(emptyData);
130
+ const { ranges, data, info, id } = (0, useSpectrum_1.default)(emptyData);
131
+ const { displayerKey, xDomain, view: { spectra: { activeTab }, }, molecules, toolOptions: { selectedTool }, view: { ranges: rangeState }, } = (0, ChartContext_1.useChartData)();
132
+ const { showMultiplicityTrees, showRangesIntegrals, showJGraph } = (0, react_2.useMemo)(() => rangeState.find((r) => r.spectrumID === id) || Reducer_1.rangeStateInit, [id, rangeState]);
130
133
  const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
131
134
  return ((0, jsx_runtime_1.jsx)(MemoizedRangesTablePanel, { ...{
135
+ id,
132
136
  ranges,
133
137
  data,
134
138
  info,
@@ -12,6 +12,7 @@ const DispatchContext_1 = require("../../context/DispatchContext");
12
12
  const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
13
13
  const Alert_1 = require("../../elements/popup/Alert");
14
14
  const Modal_1 = require("../../elements/popup/Modal");
15
+ const Reducer_1 = require("../../reducer/Reducer");
15
16
  const Constants_1 = require("../../reducer/core/Constants");
16
17
  const Types_1 = require("../../reducer/types/Types");
17
18
  const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
@@ -74,7 +75,8 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMod
74
75
  }
75
76
  const MemoizedSpectraPanelHeader = (0, react_1.memo)(SpectraPanelHeaderInner);
76
77
  function SpectrumsTabs({ spectrums }) {
77
- const { data, activeSpectrum, activeTab, displayerMode } = (0, ChartContext_1.useChartData)();
78
+ const { data, view: { spectra: { activeTab }, }, displayerMode, } = (0, ChartContext_1.useChartData)();
79
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
78
80
  return ((0, jsx_runtime_1.jsx)(MemoizedSpectraPanelHeader, { ...{
79
81
  data,
80
82
  activeSpectrum,
@@ -12,6 +12,7 @@ const ContextMenu_1 = __importDefault(require("../../elements/ContextMenu"));
12
12
  const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
13
13
  const Tabs_1 = __importDefault(require("../../elements/Tab/Tabs"));
14
14
  const Alert_1 = require("../../elements/popup/Alert");
15
+ const Reducer_1 = require("../../reducer/Reducer");
15
16
  const Types_1 = require("../../reducer/types/Types");
16
17
  const Export_1 = require("../../utility/Export");
17
18
  const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
@@ -133,7 +134,8 @@ function SpectrumsTabsInner({ data, activeSpectrum, activeTab, onTabChange, }) {
133
134
  }
134
135
  const MemoizedSpectra = (0, react_1.memo)(SpectrumsTabsInner);
135
136
  function SpectrumsTabs({ onTabChange }) {
136
- const { data, activeSpectrum, activeTab } = (0, ChartContext_1.useChartData)();
137
+ const { data, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
138
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
137
139
  return ((0, jsx_runtime_1.jsx)(MemoizedSpectra, { ...{ data, activeSpectrum, activeTab, onTabChange } }));
138
140
  }
139
141
  exports.default = SpectrumsTabs;
@@ -58,7 +58,7 @@ const panelStyle = (0, react_1.css) `
58
58
  }
59
59
  `;
60
60
  function SummaryPanel() {
61
- const { molecules, correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, activeTab, } = (0, ChartContext_1.useChartData)();
61
+ const { molecules, correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
62
62
  const dispatch = (0, DispatchContext_1.useDispatch)();
63
63
  const modal = (0, Modal_1.useModal)();
64
64
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const react_1 = require("react");
4
4
  const ChartContext_1 = require("../../../context/ChartContext");
5
+ const Reducer_1 = require("../../../reducer/Reducer");
5
6
  const Utilities_1 = require("./Utilities");
6
7
  function useInView({ correlation }) {
7
- const { data: spectraData, xDomain, yDomain, displayerMode, activeTab, activeSpectrum, } = (0, ChartContext_1.useChartData)();
8
+ const { data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
9
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
8
10
  return (0, react_1.useMemo)(() => (0, Utilities_1.isInView)(spectraData, activeTab, activeSpectrum, xDomain, yDomain, displayerMode, correlation), [
9
11
  activeSpectrum,
10
12
  activeTab,
@@ -11,12 +11,12 @@ const fa_1 = require("react-icons/fa");
11
11
  const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
12
12
  const ChartContext_1 = require("../../context/ChartContext");
13
13
  const DispatchContext_1 = require("../../context/DispatchContext");
14
- const ToggleButton_1 = __importDefault(require("../../elements/ToggleButton"));
14
+ const ActiveButton_1 = __importDefault(require("../../elements/ActiveButton"));
15
15
  const ToolTip_1 = __importDefault(require("../../elements/ToolTip/ToolTip"));
16
16
  const Modal_1 = require("../../elements/popup/Modal");
17
17
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
18
+ const Reducer_1 = require("../../reducer/Reducer");
18
19
  const Types_1 = require("../../reducer/types/Types");
19
- const Events_1 = __importDefault(require("../../utility/Events"));
20
20
  const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
21
21
  const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
22
22
  const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
@@ -44,7 +44,7 @@ const style = (0, react_1.css) `
44
44
  align-items: center;
45
45
  }
46
46
  `;
47
- function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment }) {
47
+ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZones, showSignals, showPeaks, id, }) {
48
48
  const [filterIsActive, setFilterIsActive] = (0, react_2.useState)(false);
49
49
  const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
50
50
  const dispatch = (0, DispatchContext_1.useDispatch)();
@@ -127,9 +127,15 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment }) {
127
127
  settingRef.current.saveSetting();
128
128
  setFlipStatus(false);
129
129
  }, []);
130
- const visibilityHandler = (0, react_2.useCallback)((key) => {
131
- Events_1.default.emit('onZonesVisibilityChange', { key });
132
- }, []);
130
+ const handleSetShowZones = () => {
131
+ dispatch({ type: Types_1.SHOW_ZONES, payload: { id } });
132
+ };
133
+ const handleSetShowSignals = () => {
134
+ dispatch({ type: Types_1.SHOW_ZONES_SIGNALS, payload: { id } });
135
+ };
136
+ const handleSetShowPeaks = () => {
137
+ dispatch({ type: Types_1.SHOW_ZONES_PEAKS, payload: { id } });
138
+ };
133
139
  return ((0, jsx_runtime_1.jsxs)("div", { css: [
134
140
  BasicPanelStyle_1.tablePanelStyle,
135
141
  style,
@@ -139,22 +145,25 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment }) {
139
145
  position: relative;
140
146
  }
141
147
  `,
142
- ], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { counter: zones.values ? zones.values.length : 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', filterIsActive: filterIsActive, counterFiltered: tableData?.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: `Remove all Assignments`, popupPlacement: "right", children: (0, jsx_runtime_1.jsx)("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "show/hide zones", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('zones'), children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "show/hide signals", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('signals'), children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "show/hide peaks", popupPlacement: "right", defaultValue: true, onClick: () => visibilityHandler('peaks'), children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }) })] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)("div", { className: "table-container", children: tableData && tableData.length > 0 ? ((0, jsx_runtime_1.jsx)(ZonesTable_1.default, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
148
+ ], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { counter: zones.values ? zones.values.length : 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', filterIsActive: filterIsActive, counterFiltered: tableData?.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [(0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: `Remove all Assignments`, popupPlacement: "right", children: (0, jsx_runtime_1.jsx)("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: "show/hide zones", popupPlacement: "right", value: showZones, onClick: handleSetShowZones, children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: "show/hide signals", popupPlacement: "right", value: showSignals, onClick: handleSetShowSignals, children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: "show/hide peaks", popupPlacement: "right", value: showPeaks, onClick: handleSetShowPeaks, children: (0, jsx_runtime_1.jsx)("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }) })] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)("div", { className: "table-container", children: tableData && tableData.length > 0 ? ((0, jsx_runtime_1.jsx)(ZonesTable_1.default, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
143
149
  ? activeTab.split(',')
144
150
  : ['?', '?'], experiment: experiment })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {})) })) : ((0, jsx_runtime_1.jsx)(ZonesPreferences_1.default, { ref: settingRef })) })] }));
145
151
  }
146
152
  const MemoizedZonesPanel = (0, react_2.memo)(ZonesPanelInner);
147
153
  const emptyData = { zones: {}, info: {} };
148
154
  function ZonesPanel() {
149
- const { displayerKey, xDomain, yDomain, activeTab } = (0, ChartContext_1.useChartData)();
150
- const { zones, info } = (0, useSpectrum_1.default)(emptyData);
155
+ const { displayerKey, xDomain, yDomain, view: { zones: zoneState, spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
156
+ const { zones, info, id } = (0, useSpectrum_1.default)(emptyData);
157
+ const zoneProps = zoneState.find((r) => r.spectrumID === id) || Reducer_1.zoneStateInit;
151
158
  return ((0, jsx_runtime_1.jsx)(MemoizedZonesPanel, { ...{
159
+ id,
152
160
  xDomain,
153
161
  yDomain,
154
162
  activeTab,
155
163
  displayerKey,
156
164
  zones,
157
165
  experiment: info.experiment,
166
+ ...zoneProps,
158
167
  } }));
159
168
  }
160
169
  exports.default = ZonesPanel;
@@ -261,7 +261,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
261
261
  }
262
262
  const MemoizedDatabasePanel = (0, react_2.memo)(DatabasePanelInner);
263
263
  function PeaksPanel() {
264
- const { activeTab, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
264
+ const { view: { spectra: { activeTab }, }, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
265
265
  const { current } = (0, PreferencesContext_1.usePreferences)();
266
266
  const { data, defaultDatabase } = current.databases;
267
267
  const databases = database_1.DATA_BASES.concat(data.filter((datum) => datum.enabled));
@@ -58,6 +58,7 @@ const ignoreActions = [
58
58
  types.SHOW_J_GRAPH,
59
59
  types.SHOW_MULTIPLICTY_TREES,
60
60
  types.SHOW_RANGES_INTEGRALS,
61
+ types.CHANGE_FLOAT_MOLECULE_POSITION,
61
62
  ];
62
63
  function checkActionType(type) {
63
64
  if (!ignoreActions.includes(type))
@@ -23,16 +23,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.spectrumReducer = exports.dispatchMiddleware = exports.initState = exports.initialState = exports.getInitialState = void 0;
26
+ exports.spectrumReducer = exports.dispatchMiddleware = exports.initState = exports.useActiveSpectrum = exports.initialState = exports.getInitialState = exports.zoneStateInit = exports.rangeStateInit = void 0;
27
27
  const uuid_1 = require("@lukeed/uuid");
28
28
  const immer_1 = require("immer");
29
29
  const nmr_correlation_1 = require("nmr-correlation");
30
+ const nmr_load_save_1 = require("nmr-load-save");
30
31
  const PredictionManager_1 = require("../../data/PredictionManager");
31
32
  const SpectraManager = __importStar(require("../../data/SpectraManager"));
32
- const MigrationManager_1 = require("../../data/migration/MigrationManager");
33
+ const ChartContext_1 = require("../context/ChartContext");
33
34
  const Constants_1 = require("../panels/SummaryPanel/CorrelationTable/Constants");
34
35
  const ToolTypes_1 = require("../toolbar/ToolTypes");
35
- const nmredataToNmrium_1 = require("../utility/nmredataToNmrium");
36
36
  const AssignmentsActions = __importStar(require("./actions/AssignmentsActions"));
37
37
  const CorrelationsActions = __importStar(require("./actions/CorrelationsActions"));
38
38
  const DatabaseActions = __importStar(require("./actions/DatabaseActions"));
@@ -54,6 +54,16 @@ const ZonesActions = __importStar(require("./actions/ZonesActions"));
54
54
  const Constants_2 = require("./core/Constants");
55
55
  const HistoryTypes_1 = require("./types/HistoryTypes");
56
56
  const types = __importStar(require("./types/Types"));
57
+ exports.rangeStateInit = {
58
+ showMultiplicityTrees: false,
59
+ showRangesIntegrals: true,
60
+ showJGraph: false,
61
+ };
62
+ exports.zoneStateInit = {
63
+ showZones: true,
64
+ showSignals: true,
65
+ showPeaks: true,
66
+ };
57
67
  const getInitialState = () => ({
58
68
  actionType: '',
59
69
  data: [],
@@ -71,7 +81,6 @@ const getInitialState = () => ({
71
81
  shareYDomain: false,
72
82
  },
73
83
  integralsYDomains: {},
74
- activeTab: '',
75
84
  width: 0,
76
85
  height: 0,
77
86
  margin: {
@@ -80,10 +89,14 @@ const getInitialState = () => ({
80
89
  bottom: 70,
81
90
  left: 0,
82
91
  },
83
- activeSpectrum: null,
84
92
  mode: 'RTL',
85
93
  molecules: [],
86
- view: { floatingMolecules: [] },
94
+ view: {
95
+ floatingMolecules: [],
96
+ ranges: [],
97
+ zones: [],
98
+ spectra: { activeSpectra: {}, activeTab: '' },
99
+ },
87
100
  verticalAlign: {
88
101
  align: 'bottom',
89
102
  verticalShift: Constants_2.DEFAULT_YAXIS_SHIFT_VALUE,
@@ -98,7 +111,6 @@ const getInitialState = () => ({
98
111
  isLoading: false,
99
112
  keysPreferences: {},
100
113
  displayerMode: Constants_2.DISPLAYER_MODE.DM_1D,
101
- tabActiveSpectrum: {},
102
114
  spectraAnalysis: {},
103
115
  correlations: {},
104
116
  displayerKey: '',
@@ -118,9 +130,6 @@ const getInitialState = () => ({
118
130
  pivot: { value: 0, index: 0 },
119
131
  zonesNoiseFactor: 1,
120
132
  activeFilterID: null,
121
- showMultiplicityTrees: false,
122
- showRangesIntegrals: true,
123
- showJGraph: false,
124
133
  predictionIndex: 0,
125
134
  peaksOptions: {
126
135
  showPeaksShapes: false,
@@ -132,6 +141,11 @@ const getInitialState = () => ({
132
141
  });
133
142
  exports.getInitialState = getInitialState;
134
143
  exports.initialState = (0, exports.getInitialState)();
144
+ function useActiveSpectrum() {
145
+ const { view: { spectra: { activeSpectra, activeTab }, }, } = (0, ChartContext_1.useChartData)();
146
+ return activeSpectra[activeTab] || null;
147
+ }
148
+ exports.useActiveSpectrum = useActiveSpectrum;
135
149
  function initState(state) {
136
150
  const displayerKey = (0, uuid_1.v4)();
137
151
  const correlations = (0, nmr_correlation_1.buildCorrelationData)([], {
@@ -151,7 +165,7 @@ function dispatchMiddleware(dispatch) {
151
165
  switch (action.type) {
152
166
  case types.INITIATE: {
153
167
  if (action.payload) {
154
- const { spectra, ...res } = (0, MigrationManager_1.migrate)(action.payload);
168
+ const { spectra, ...res } = (0, nmr_load_save_1.migrate)(action.payload);
155
169
  void SpectraManager.fromJSON(spectra, usedColors).then((data) => {
156
170
  action.payload = { spectra: data, ...res, usedColors };
157
171
  dispatch(action);
@@ -159,28 +173,17 @@ function dispatchMiddleware(dispatch) {
159
173
  }
160
174
  break;
161
175
  }
162
- case types.LOAD_JSON_FILE: {
163
- const parsedData = JSON.parse(action.files[0].binary.toString());
164
- const data = (0, MigrationManager_1.migrate)(parsedData);
165
- void SpectraManager.fromJSON(data.spectra, usedColors).then((spectra) => {
166
- action.payload = Object.assign(data, { spectra, usedColors });
167
- dispatch(action);
168
- });
169
- break;
170
- }
171
- case types.LOAD_ZIP_FILE: {
172
- for (let zipFile of action.files) {
173
- void SpectraManager.addBruker({ display: { name: zipFile.name } }, zipFile.binary, usedColors).then((data) => {
174
- action.payload = { data, usedColors };
175
- dispatch(action);
176
- });
177
- }
178
- break;
179
- }
180
- case types.LOAD_NMREDATA_FILE: {
181
- void (0, nmredataToNmrium_1.nmredataToNmrium)(action.file, usedColors).then((data) => {
182
- action.payload = Object.assign(data, { usedColors });
176
+ case types.LOAD_DROP_FILES: {
177
+ const { files } = action;
178
+ action.usedColors = usedColors;
179
+ (0, nmr_load_save_1.read)(files, usedColors)
180
+ .then((data) => {
181
+ action.data = data;
183
182
  dispatch(action);
183
+ })
184
+ .catch((e) => {
185
+ dispatch({ type: types.SET_LOADING_FLAG, isLoading: false });
186
+ reportError(e);
184
187
  });
185
188
  break;
186
189
  }
@@ -209,20 +212,14 @@ function innerSpectrumReducer(draft, action) {
209
212
  switch (action.type) {
210
213
  case types.INITIATE:
211
214
  return LoadActions.initiate(draft, action);
215
+ case types.LOAD_DROP_FILES:
216
+ return LoadActions.loadDropFiles(draft, action);
212
217
  case types.SET_LOADING_FLAG:
213
218
  return LoadActions.setIsLoading(draft, action.isLoading);
214
219
  case types.LOAD_JSON_FILE:
215
220
  return LoadActions.handleLoadJsonFile(draft, action);
216
221
  case types.LOAD_JCAMP_FILE:
217
222
  return LoadActions.loadJcampFile(draft, action);
218
- case types.LOAD_JDF_FILE:
219
- return LoadActions.loadJDFFile(draft, action);
220
- case types.LOAD_MOL_FILE:
221
- return LoadActions.handleLoadMOLFile(draft, action);
222
- case types.LOAD_ZIP_FILE:
223
- return LoadActions.handleLoadZIPFile(draft, action);
224
- case types.LOAD_NMREDATA_FILE:
225
- return LoadActions.handleLoadNmredata(draft, action);
226
223
  case types.ADD_PEAK:
227
224
  return PeaksActions.addPeak(draft, action.mouseCoordinates);
228
225
  case types.ADD_PEAKS:
@@ -349,6 +346,8 @@ function innerSpectrumReducer(draft, action) {
349
346
  return MoleculeActions.predictSpectraFromMoleculeHandler(draft, action);
350
347
  case types.FLOAT_MOLECULE_OVER_SPECTRUM:
351
348
  return MoleculeActions.floatMoleculeOverSpectrum(draft, action);
349
+ case types.CHANGE_FLOAT_MOLECULE_POSITION:
350
+ return MoleculeActions.changeFloatMoleculePosition(draft, action);
352
351
  case types.SET_CORRELATIONS_MF:
353
352
  return CorrelationsActions.handleSetMF(draft, action.payload);
354
353
  case types.SET_CORRELATIONS_TOLERANCE:
@@ -398,13 +397,13 @@ function innerSpectrumReducer(draft, action) {
398
397
  case types.UPDATE_RANGE:
399
398
  return RangesActions.handleUpdateRange(draft, action);
400
399
  case types.SHOW_MULTIPLICTY_TREES:
401
- return RangesActions.handleShowMultiplicityTrees(draft);
400
+ return RangesActions.handleShowMultiplicityTrees(draft, action);
402
401
  case types.SHOW_RANGES_INTEGRALS:
403
- return RangesActions.handleShowRangesIntegrals(draft);
402
+ return RangesActions.handleShowRangesIntegrals(draft, action);
404
403
  case types.AUTO_RANGES_SPECTRA_PICKING:
405
404
  return RangesActions.handleAutoSpectraRangesDetection(draft);
406
405
  case types.SHOW_J_GRAPH:
407
- return RangesActions.handleShowJGraph(draft);
406
+ return RangesActions.handleShowJGraph(draft, action);
408
407
  case types.SET_ACTIVE_TAB:
409
408
  return ToolsActions.handelSetActiveTab(draft, action.tab);
410
409
  case types.ADD_BASE_LINE_ZONE:
@@ -437,6 +436,12 @@ function innerSpectrumReducer(draft, action) {
437
436
  return ZonesActions.handleSetDiaIDZone(draft, action);
438
437
  case types.AUTO_ZONES_SPECTRA_PICKING:
439
438
  return ZonesActions.handleAutoSpectraZonesDetection(draft);
439
+ case types.SHOW_ZONES:
440
+ return ZonesActions.handleShowZones(draft, action);
441
+ case types.SHOW_ZONES_SIGNALS:
442
+ return ZonesActions.handleShowSignals(draft, action);
443
+ case types.SHOW_ZONES_PEAKS:
444
+ return ZonesActions.handleShowPeaks(draft, action);
440
445
  case types.SAVE_EDITED_ZONE:
441
446
  return ZonesActions.handleSaveEditedZone(draft, action);
442
447
  case types.ANALYZE_SPECTRA:
@@ -10,10 +10,12 @@ const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
10
10
  const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
11
11
  const Constants_1 = require("../core/Constants");
12
12
  function getActiveData(draft) {
13
- let data = draft.data.filter((datum) => (0, nucleusToString_1.default)(datum.info.nucleus) === draft.activeTab &&
13
+ let data = draft.data.filter((datum) => (0, nucleusToString_1.default)(datum.info.nucleus) === draft.view.spectra.activeTab &&
14
14
  datum.info.dimension === 1);
15
- if (draft.activeSpectrum) {
16
- const activeSpectrumIndex = data.findIndex((datum) => datum.id === draft.activeSpectrum?.id);
15
+ // todo: refactor this
16
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
17
+ if (activeSpectrum) {
18
+ const activeSpectrumIndex = data.findIndex((datum) => datum.id === activeSpectrum?.id);
17
19
  if (activeSpectrumIndex !== -1) {
18
20
  const isFid = data[activeSpectrumIndex].info.isFid || false;
19
21
  data = data.filter((datum) => datum.info.isFid === isFid);
@@ -24,12 +26,12 @@ function getActiveData(draft) {
24
26
  }
25
27
  return data;
26
28
  }
27
- function getDomain(drfat) {
29
+ function getDomain(draft) {
28
30
  let xArray = [];
29
31
  let yArray = [];
30
32
  let yDomains = {};
31
33
  let xDomains = {};
32
- const data = getActiveData(drfat);
34
+ const data = getActiveData(draft);
33
35
  try {
34
36
  xArray = data.reduce((acc, d) => {
35
37
  const { display, data } = d;
@@ -68,7 +70,7 @@ function get2DDomain(state) {
68
70
  let yArray = [];
69
71
  let yDomains = {};
70
72
  let xDomains = {};
71
- const { activeTab, tabActiveSpectrum, data } = state;
73
+ const { view: { spectra: { activeSpectra, activeTab }, }, data, } = state;
72
74
  const nucleus = activeTab.split(',');
73
75
  try {
74
76
  xArray = data.reduce((acc, datum) => {
@@ -92,7 +94,7 @@ function get2DDomain(state) {
92
94
  // eslint-disable-next-line no-console
93
95
  console.log(e);
94
96
  }
95
- const spectrumsIDs = nucleus.map((n) => tabActiveSpectrum[n]?.id);
97
+ const spectrumsIDs = nucleus.map((n) => activeSpectra[n]?.id);
96
98
  const filteredData = data.reduce((acc, datum) => {
97
99
  return spectrumsIDs.includes(datum.id) && datum.info.dimension === 1
98
100
  ? acc.concat(datum)
@@ -125,7 +127,7 @@ function get2DDomain(state) {
125
127
  function setDomain(draft, options) {
126
128
  const { yDomain = { isChanged: true, isShared: true } } = options || {};
127
129
  let domain;
128
- if (draft.activeTab) {
130
+ if (draft.view.spectra.activeTab) {
129
131
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
130
132
  domain = getDomain(draft);
131
133
  }
@@ -199,7 +201,7 @@ function handelResetDomain(draft) {
199
201
  exports.handelResetDomain = handelResetDomain;
200
202
  function setMode(draft) {
201
203
  const data = draft.data.filter((datum) => draft.xDomains[datum.id] &&
202
- (0, nucleusToString_1.default)(datum.info.nucleus) === draft.activeTab);
204
+ (0, nucleusToString_1.default)(datum.info.nucleus) === draft.view.spectra.activeTab);
203
205
  draft.mode = data[0]?.info.isFid ? 'LTR' : 'RTL';
204
206
  }
205
207
  exports.setMode = setMode;