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
@@ -12,9 +12,11 @@ const DimensionLayout_1 = require("../../2d/utilities/DimensionLayout");
12
12
  const scale_2 = require("../../2d/utilities/scale");
13
13
  const ToolTypes_1 = require("../../toolbar/ToolTypes");
14
14
  const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
15
+ const Reducer_1 = require("../Reducer");
15
16
  const Constants_1 = require("../core/Constants");
16
17
  const Zoom1DManager_1 = require("../helper/Zoom1DManager");
17
18
  const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
19
+ const getActiveSpectrumOrFail_1 = require("../helper/getActiveSpectrumOrFail");
18
20
  const DomainActions_1 = require("./DomainActions");
19
21
  const FiltersActions_1 = require("./FiltersActions");
20
22
  const PreferencesActions_1 = require("./PreferencesActions");
@@ -47,7 +49,18 @@ function setSelectedTool(draft, action) {
47
49
  if (selectedTool) {
48
50
  // start Range edit mode
49
51
  if (selectedTool === ToolTypes_1.options.editRange.id) {
50
- draft.toolOptions.data.showMultiplicityTrees = true;
52
+ const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
53
+ const range = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum?.id);
54
+ if (range) {
55
+ range.showMultiplicityTrees = true;
56
+ }
57
+ else {
58
+ draft.view.ranges.push({
59
+ spectrumID: activeSpectrum.id,
60
+ ...Reducer_1.rangeStateInit,
61
+ showMultiplicityTrees: true,
62
+ });
63
+ }
51
64
  }
52
65
  if (selectedTool !== draft.toolOptions.selectedTool) {
53
66
  resetTool(draft, false);
@@ -130,7 +143,7 @@ function handleBrushEnd(draft, action) {
130
143
  const endY = yScale.invert(action.endY);
131
144
  const domainX = startX > endX ? [endX, startX] : [startX, endX];
132
145
  const domainY = startY > endY ? [endY, startY] : [startY, endY];
133
- const brushHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.activeTab);
146
+ const brushHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
134
147
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
135
148
  switch (action.trackID) {
136
149
  case DimensionLayout_1.LAYOUT.CENTER_2D:
@@ -159,22 +172,26 @@ function handleBrushEnd(draft, action) {
159
172
  }
160
173
  exports.handleBrushEnd = handleBrushEnd;
161
174
  function setVerticalIndicatorXPosition(draft, position) {
162
- if (draft.activeSpectrum?.id) {
175
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
176
+ if (activeSpectrum?.id) {
163
177
  const scaleX = (0, scale_1.getXScale)(draft);
164
178
  const value = scaleX.invert(position);
165
- const datum = draft.data[draft.activeSpectrum.index];
179
+ const datum = draft.data[activeSpectrum.index];
166
180
  const index = (0, ml_spectra_processing_1.xFindClosestIndex)(datum.data.x, value);
167
181
  draft.toolOptions.data.pivot = { value, index };
168
182
  }
169
183
  }
170
184
  exports.setVerticalIndicatorXPosition = setVerticalIndicatorXPosition;
171
185
  function getSpectrumID(draft, index) {
172
- const spectrum = draft.tabActiveSpectrum[draft.activeTab.split(',')[index]];
173
- return spectrum?.id ? spectrum.id : null;
186
+ const spectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab.split(',')[index]];
187
+ return spectrum?.id || null;
174
188
  }
175
189
  function handleZoom(draft, action) {
176
190
  const { event, trackID, selectedTool } = action;
177
- const { activeSpectrum, toolOptions: { data: { showRangesIntegrals }, }, displayerMode, } = draft;
191
+ const { view: { ranges: rangeState }, displayerMode, } = draft;
192
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
193
+ const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
194
+ Reducer_1.rangeStateInit;
178
195
  if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
179
196
  const index = trackID === DimensionLayout_1.LAYOUT.TOP_1D ? 0 : trackID === DimensionLayout_1.LAYOUT.LEFT_1D ? 1 : null;
180
197
  if (index !== null) {
@@ -207,7 +224,7 @@ exports.handleZoom = handleZoom;
207
224
  function zoomOut(draft, action) {
208
225
  if (draft?.data.length > 0) {
209
226
  const { zoomType, trackID } = action;
210
- const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.activeTab);
227
+ const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
211
228
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
212
229
  switch (zoomType) {
213
230
  case Zoom1DManager_1.ZoomType.HORIZONTAL: {
@@ -251,8 +268,8 @@ function zoomOut(draft, action) {
251
268
  }
252
269
  exports.zoomOut = zoomOut;
253
270
  function hasAcceptedSpectrum(draft, index) {
254
- const nucleuses = draft.activeTab.split(',');
255
- const activeSpectrum = draft.tabActiveSpectrum[nucleuses[index]];
271
+ const nucleuses = draft.view.spectra.activeTab.split(',');
272
+ const activeSpectrum = draft.view.spectra.activeSpectra[nucleuses[index]];
256
273
  return (activeSpectrum?.id &&
257
274
  !draft.data[activeSpectrum.index].info.isFid);
258
275
  }
@@ -277,7 +294,7 @@ function setMargin(draft) {
277
294
  function processing2DData(draft, data) {
278
295
  if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
279
296
  let _data = {};
280
- for (const datum of data[draft.activeTab]) {
297
+ for (const datum of data[draft.view.spectra.activeTab]) {
281
298
  _data[datum.id] = datum.processingController.drawContours();
282
299
  }
283
300
  draft.contours = _data;
@@ -323,29 +340,26 @@ function setTabActiveSpectrum(draft, dataGroupByTab) {
323
340
  }
324
341
  }
325
342
  }
326
- draft.tabActiveSpectrum = tabActiveSpectrum;
343
+ draft.view.spectra.activeSpectra = tabActiveSpectrum;
327
344
  return tabs2D;
328
345
  }
329
346
  function setTab(draft, dataGroupByTab, tab, refresh = false) {
330
347
  const groupByTab = Object.keys(dataGroupByTab).sort((a, b) => a.split(',').length > b.split(',').length ? -1 : 1);
331
348
  if (JSON.stringify(groupByTab) !==
332
- JSON.stringify(Object.keys(draft.tabActiveSpectrum)) ||
349
+ JSON.stringify(Object.keys(draft.view.spectra.activeSpectra)) ||
333
350
  refresh) {
334
351
  const tabs2D = setTabActiveSpectrum(draft, dataGroupByTab);
335
352
  if (tabs2D.length > 0 && tab == null) {
336
- draft.activeSpectrum = draft.tabActiveSpectrum[tabs2D[0]];
337
- draft.activeTab = tabs2D[0];
353
+ draft.view.spectra.activeTab = tabs2D[0];
338
354
  }
339
355
  else {
340
- draft.activeSpectrum = tab ? draft.tabActiveSpectrum[tab] : tab;
341
- draft.activeTab = tab;
356
+ draft.view.spectra.activeTab = tab;
342
357
  }
343
358
  }
344
359
  else {
345
- draft.activeTab = tab;
346
- draft.activeSpectrum = draft.tabActiveSpectrum[tab];
360
+ draft.view.spectra.activeTab = tab;
347
361
  }
348
- setDisplayerMode(draft, dataGroupByTab[draft.activeTab]);
362
+ setDisplayerMode(draft, dataGroupByTab[draft.view.spectra.activeTab]);
349
363
  setMargin(draft);
350
364
  }
351
365
  exports.setTab = setTab;
@@ -360,7 +374,7 @@ function setActiveTab(draft, options) {
360
374
  processing2DData(draft, dataGroupByNucleus);
361
375
  (0, DomainActions_1.setDomain)(draft, domainOptions);
362
376
  (0, DomainActions_1.setIntegralsYDomain)(draft, dataGroupByNucleus[currentTab]);
363
- const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.activeTab);
377
+ const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
364
378
  const zoomValue = zoomHistory.getLast();
365
379
  if (zoomValue) {
366
380
  draft.xDomain = zoomValue.xDomain;
@@ -376,9 +390,10 @@ function handelSetActiveTab(draft, tab) {
376
390
  }
377
391
  exports.handelSetActiveTab = handelSetActiveTab;
378
392
  function levelChangeHandler(draft, { deltaY, shiftKey }) {
393
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
379
394
  try {
380
- if (draft.activeSpectrum?.id) {
381
- const { index, id } = draft.activeSpectrum;
395
+ if (activeSpectrum?.id) {
396
+ const { index, id } = activeSpectrum;
382
397
  const processingController = draft.data[index]
383
398
  .processingController;
384
399
  if (shiftKey) {
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.handleAutoSpectraZonesDetection = exports.changeZonesFactorHandler = exports.handleSetSignalPathLength = exports.handleSetDiaIDZone = exports.handleSaveEditedZone = exports.handleUnlinkZone = exports.handleChangeZoneSignalKind = exports.changeZoneSignalDelta = exports.handleDeleteZone = exports.handleDeleteSignal = exports.handleAutoZonesDetection = exports.add2dZoneHandler = void 0;
29
+ exports.handleShowPeaks = exports.handleShowSignals = exports.handleShowZones = exports.handleAutoSpectraZonesDetection = exports.changeZonesFactorHandler = exports.handleSetSignalPathLength = exports.handleSetDiaIDZone = exports.handleSaveEditedZone = exports.handleUnlinkZone = exports.handleChangeZoneSignalKind = exports.changeZoneSignalDelta = exports.handleDeleteZone = exports.handleDeleteSignal = exports.handleAutoZonesDetection = exports.add2dZoneHandler = void 0;
30
30
  const immer_1 = require("immer");
31
31
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
32
32
  const nmr_correlation_1 = require("nmr-correlation");
@@ -35,6 +35,7 @@ const FiltersManager = __importStar(require("../../../data/FiltersManager"));
35
35
  const SignalsKinds_1 = require("../../../data/constants/SignalsKinds");
36
36
  const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
37
37
  const ZoneUtilities_1 = require("../../../data/utilities/ZoneUtilities");
38
+ const Reducer_1 = require("../Reducer");
38
39
  const get2DRange_1 = __importDefault(require("../helper/get2DRange"));
39
40
  const CorrelationsActions_1 = require("./CorrelationsActions");
40
41
  const DomainActions_1 = require("./DomainActions");
@@ -43,8 +44,9 @@ function changeZonesFactorHandler(draft, action) {
43
44
  }
44
45
  exports.changeZonesFactorHandler = changeZonesFactorHandler;
45
46
  function add2dZoneHandler(draft, action) {
46
- if (draft.activeSpectrum?.id) {
47
- const { index } = draft.activeSpectrum;
47
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
48
+ if (activeSpectrum?.id) {
49
+ const { index } = activeSpectrum;
48
50
  const drawnZone = (0, get2DRange_1.default)(draft, action);
49
51
  const datum = draft.data[index];
50
52
  const zones = (0, Spectrum2D_1.detectZonesManual)((0, immer_1.original)(datum), {
@@ -58,8 +60,9 @@ function add2dZoneHandler(draft, action) {
58
60
  }
59
61
  exports.add2dZoneHandler = add2dZoneHandler;
60
62
  function handleAutoZonesDetection(draft, detectionOptions) {
61
- if (draft.activeSpectrum?.id) {
62
- const { index } = draft.activeSpectrum;
63
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
64
+ if (activeSpectrum?.id) {
65
+ const { index } = activeSpectrum;
63
66
  const [fromX, toX] = draft.xDomain;
64
67
  const [fromY, toY] = draft.yDomain;
65
68
  detectionOptions.selectedZone = { fromX, toX, fromY, toY };
@@ -87,8 +90,9 @@ function handleAutoSpectraZonesDetection(draft) {
87
90
  exports.handleAutoSpectraZonesDetection = handleAutoSpectraZonesDetection;
88
91
  function changeZoneSignalDelta(draft, action) {
89
92
  const { zoneID, signal } = action.payload;
90
- if (draft.activeSpectrum?.id) {
91
- const { index } = draft.activeSpectrum;
93
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
94
+ if (activeSpectrum?.id) {
95
+ const { index } = activeSpectrum;
92
96
  const { xShift, yShift } = (0, Spectrum2D_1.changeZoneSignal)(draft.data[index], zoneID, signal);
93
97
  let filters = [];
94
98
  if (xShift !== 0) {
@@ -109,8 +113,9 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
109
113
  }
110
114
  function handleChangeZoneSignalKind(draft, action) {
111
115
  const state = (0, immer_1.original)(draft);
112
- if (state.activeSpectrum?.id) {
113
- const { index } = state.activeSpectrum;
116
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
117
+ if (activeSpectrum?.id) {
118
+ const { index } = activeSpectrum;
114
119
  const { rowData, value } = action.payload;
115
120
  const zoneIndex = getZoneIndex(state, index, rowData.id);
116
121
  const _zone = draft.data[index].zones.values[zoneIndex];
@@ -124,8 +129,9 @@ function handleChangeZoneSignalKind(draft, action) {
124
129
  exports.handleChangeZoneSignalKind = handleChangeZoneSignalKind;
125
130
  function handleDeleteZone(draft, action) {
126
131
  const state = (0, immer_1.original)(draft);
127
- if (state.activeSpectrum?.id) {
128
- const { index } = state.activeSpectrum;
132
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
133
+ if (activeSpectrum?.id) {
134
+ const { index } = activeSpectrum;
129
135
  const { id, assignmentData } = action.payload;
130
136
  if (id) {
131
137
  const zone = draft.data[index].zones.values.find((zone) => zone.id === id);
@@ -181,8 +187,9 @@ function handleSetSignalPathLength(draft, action) {
181
187
  exports.handleSetSignalPathLength = handleSetSignalPathLength;
182
188
  function handleUnlinkZone(draft, action) {
183
189
  const state = (0, immer_1.original)(draft);
184
- if (state.activeSpectrum?.id) {
185
- const { index } = state.activeSpectrum;
190
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
191
+ if (activeSpectrum?.id) {
192
+ const { index } = activeSpectrum;
186
193
  const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
187
194
  if (zoneData) {
188
195
  // remove assignments in global state
@@ -204,8 +211,9 @@ function handleUnlinkZone(draft, action) {
204
211
  exports.handleUnlinkZone = handleUnlinkZone;
205
212
  function handleSetDiaIDZone(draft, action) {
206
213
  const state = (0, immer_1.original)(draft);
207
- if (state.activeSpectrum?.id) {
208
- const { index } = state.activeSpectrum;
214
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
215
+ if (activeSpectrum?.id) {
216
+ const { index } = activeSpectrum;
209
217
  const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
210
218
  const getNbAtoms = (input, current = 0) => input + current;
211
219
  const zoneIndex = getZoneIndex(state, index, zoneData.id);
@@ -223,8 +231,9 @@ function handleSetDiaIDZone(draft, action) {
223
231
  exports.handleSetDiaIDZone = handleSetDiaIDZone;
224
232
  function handleSaveEditedZone(draft, action) {
225
233
  const state = (0, immer_1.original)(draft);
226
- if (state.activeSpectrum?.id) {
227
- const { index } = state.activeSpectrum;
234
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
235
+ if (activeSpectrum?.id) {
236
+ const { index } = activeSpectrum;
228
237
  const { editedRowData } = action.payload;
229
238
  delete editedRowData.tableMetaInfo;
230
239
  const zoneIndex = getZoneIndex(state, index, editedRowData.id);
@@ -238,6 +247,51 @@ function handleSaveEditedZone(draft, action) {
238
247
  }
239
248
  }
240
249
  exports.handleSaveEditedZone = handleSaveEditedZone;
250
+ function handleShowZones(draft, action) {
251
+ const { id } = action.payload;
252
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
253
+ if (zone) {
254
+ zone.showZones = !zone.showZones;
255
+ }
256
+ else {
257
+ draft.view.zones.push({
258
+ spectrumID: id,
259
+ ...Reducer_1.zoneStateInit,
260
+ showZones: !Reducer_1.zoneStateInit.showZones,
261
+ });
262
+ }
263
+ }
264
+ exports.handleShowZones = handleShowZones;
265
+ function handleShowSignals(draft, action) {
266
+ const { id } = action.payload;
267
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
268
+ if (zone) {
269
+ zone.showSignals = !zone.showSignals;
270
+ }
271
+ else {
272
+ draft.view.zones.push({
273
+ spectrumID: id,
274
+ ...Reducer_1.zoneStateInit,
275
+ showSignals: !Reducer_1.zoneStateInit.showSignals,
276
+ });
277
+ }
278
+ }
279
+ exports.handleShowSignals = handleShowSignals;
280
+ function handleShowPeaks(draft, action) {
281
+ const { id } = action.payload;
282
+ const zone = draft.view.zones.find((r) => r.spectrumID === id);
283
+ if (zone) {
284
+ zone.showPeaks = !zone.showPeaks;
285
+ }
286
+ else {
287
+ draft.view.zones.push({
288
+ spectrumID: id,
289
+ ...Reducer_1.zoneStateInit,
290
+ showPeaks: !Reducer_1.zoneStateInit.showPeaks,
291
+ });
292
+ }
293
+ }
294
+ exports.handleShowPeaks = handleShowPeaks;
241
295
  function handleOnChangeZonesData(draft) {
242
296
  (0, CorrelationsActions_1.handleUpdateCorrelations)(draft);
243
297
  }
@@ -18,7 +18,8 @@ function wheelZoom(event, domain, zoomOptions = {}) {
18
18
  }
19
19
  exports.wheelZoom = wheelZoom;
20
20
  function setZoom(draft, options = {}) {
21
- const { height, margin, activeSpectrum } = draft;
21
+ const { height, margin } = draft;
22
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
22
23
  const { scale = 1, spectrumID = null } = options;
23
24
  if (activeSpectrum === null && spectrumID === null) {
24
25
  const { shareYDomain, yDomain, yDomains } = draft.originDomain;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActiveSpectrumOrFail = void 0;
4
+ const assert_1 = require("../../utility/assert");
5
+ function getActiveSpectrumOrFail(draft) {
6
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
7
+ (0, assert_1.assert)(activeSpectrum !== null, 'Active spectrum must have id');
8
+ return activeSpectrum;
9
+ }
10
+ exports.getActiveSpectrumOrFail = getActiveSpectrumOrFail;
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSpectrum = void 0;
4
4
  function getSpectrum(state, value) {
5
+ const activeSpectrum = state.view.spectra.activeSpectra[state.view.spectra.activeTab];
5
6
  if (value === undefined) {
6
- if (state.activeSpectrum?.id) {
7
- const index = state.activeSpectrum.index;
7
+ if (activeSpectrum?.id) {
8
+ const index = activeSpectrum.index;
8
9
  return state.data[index];
9
10
  }
10
11
  }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStrongestPeak = void 0;
4
4
  const d3_1 = require("d3");
5
5
  function getStrongestPeak(draft) {
6
- const { activeSpectrum, data } = draft;
6
+ const { data } = draft;
7
+ const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
7
8
  if (activeSpectrum) {
8
9
  const activeData = data[activeSpectrum?.index].data;
9
10
  const strongestPeakValue = (0, d3_1.max)(activeData.re);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APPLY_ZERO_FILLING_FILTER = exports.DELETE_SPECTRA_FILTER = exports.DELETE_FILTER = exports.ENABLE_FILTER = exports.RESET_DOMAIN = exports.BRUSH_END = exports.RESIZE_INTEGRAL = exports.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE = exports.DELETE_SPECTRA = exports.SET_CORRELATIONS_TOLERANCE = exports.SET_CORRELATIONS_MF = exports.DELETE_CORRELATION = exports.SET_CORRELATIONS = exports.SET_CORRELATION = exports.CHANGE_MOLECULE_LABEL = exports.FLOAT_MOLECULE_OVER_SPECTRUM = exports.DELETE_MOLECULE = exports.SET_MOLECULE = exports.ADD_MOLECULE = exports.SET_ZOOM = exports.TOGGLE_REAL_IMAGINARY_VISIBILITY = exports.DELETE_INTEGRAL = exports.ADD_INTEGRAL = exports.CHANGE_SPECTRUM_COLOR = exports.CHANGE_ACTIVE_SPECTRUM = exports.CHANGE_PEAKS_MARKERS_VISIBILITY = exports.CHANGE_VISIBILITY = exports.FULL_ZOOM_OUT = exports.CHANGE_SPECTRUM_TYPE = exports.CHANGE_SPECTRUM_SETTING = exports.SET_SELECTED_FILTER = exports.SET_SELECTED_TOOL = exports.SET_DIMENSIONS = exports.SET_WIDTH = exports.SET_ORIGINAL_DOMAIN = exports.SET_Y_DOMAIN = exports.SET_X_DOMAIN = exports.SHIFT_SPECTRUM = exports.DELETE_PEAK_NOTATION = exports.CHANGE_PEAK_SHAPE = exports.ADD_PEAKS = exports.ADD_PEAK = exports.LOAD_JDF_FILE = exports.LOAD_ZIP_FILE = exports.LOAD_MOL_FILE = exports.LOAD_NMREDATA_FILE = exports.LOAD_JCAMP_FILE = exports.LOAD_JSON_FILE = exports.SAVE_DATA_AS_JSON = exports.INITIATE = void 0;
4
- exports.RESIZE_ANALYZE_SPECTRA_RANGE = exports.DELETE_ANALYZE_SPECTRA_RANGE = exports.ANALYZE_SPECTRA = exports.CHANGE_INTEGRAL_RELATIVE = exports.SET_DIAID_RANGE = exports.UNLINK_RANGE = exports.SAVE_EDITED_RANGE = exports.CHANGE_RANGE_SIGNAL_KIND = exports.CHANGE_RANGE_SIGNAL_VALUE = exports.CHANGE_RANGE_RELATIVE = exports.SET_FILTER_SNAPSHOT = exports.ADD_MISSING_PROJECTION = exports.SET_2D_SIGNAL_PATH_LENGTH = exports.DELETE_2D_SIGNAL = exports.DELETE_2D_ZONE = exports.ADD_2D_ZONE = exports.SET_2D_LEVEL = exports.ADD_RANGE = exports.CHANGE_RANGE_SUM = exports.RESIZE_RANGE = exports.APPLY_KEY_PREFERENCES = exports.SET_KEY_PREFERENCES = exports.APPLY_BASE_LINE_CORRECTION_FILTER = exports.DELETE_BASE_LINE_ZONE = exports.ADD_BASE_LINE_ZONE = exports.CHANGE_INTEGRAL_SUM = exports.SET_ACTIVE_TAB = exports.CHANGE_INTEGRAL_DATA = exports.SAVE_AS_SVG = exports.SET_SPECTRUMS_VERTICAL_ALIGN = exports.RESET_SELECTED_TOOL = exports.SET_LOADING_FLAG = exports.SET_SELECTED_OPTIONS_PANEL = exports.DELETE_1D_SIGNAL = exports.DELETE_RANGE = exports.AUTO_ZONES_DETECTION = exports.AUTO_RANGES_DETECTION = exports.OPTIMIZE_PEAKS = exports.AUTO_PEAK_PICKING = exports.SET_VERTICAL_INDICATOR_X_POSITION = exports.DISABLE_FILTER_LIVE_PREVIEW = exports.APPLY_ABSOLUTE_FILTER = exports.APPLY_AUTO_PHASE_CORRECTION_FILTER = exports.APPLY_MANUAL_PHASE_CORRECTION_FILTER = exports.CALCULATE_ZERO_FILLING_FILTER = exports.CALCULATE_APODIZATION_FILTER = exports.CALCULATE_BASE_LINE_CORRECTION_FILTER = exports.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = exports.APPLY_FFT_FILTER = exports.APPLY_APODIZATION_FILTER = void 0;
5
- exports.TOGGLE_PEAKS_SHAPES = exports.SET_AUTOMATIC_ASSIGNMENTS = exports.SHOW_J_GRAPH = exports.RESURRECTING_SPECTRUM_FROM_JCAMP = exports.RESURRECTING_SPECTRUM_FROM_RANGES = exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = exports.AUTO_ZONES_SPECTRA_PICKING = exports.AUTO_RANGES_SPECTRA_PICKING = exports.SHOW_RANGES_INTEGRALS = exports.SHOW_MULTIPLICTY_TREES = exports.UPDATE_RANGE = exports.CHANGE_ZONES_NOISE_FACTOR = exports.CHANGE_INTEGRALS_SUM_FLAG = exports.CHANGE_RANGES_SUM_FLAG = exports.DELETE_EXCLUSION_ZONE = exports.ADD_EXCLUSION_ZONE = exports.APPLY_MULTIPLE_SPECTRA_FILTER = exports.SET_MOUSE_OVER_DISPLAYER = exports.RESET_SPECTRA_SCALE = exports.SET_SPECTRA_SAME_TOP = exports.PREDICT_SPECTRA = exports.SET_DIAID_ZONE = exports.UNLINK_ZONE = exports.SAVE_EDITED_ZONE = exports.CHANGE_ZONE_SIGNAL_KIND = exports.CHANGE_ZONE_SIGNAL_VALUE = exports.ALIGN_SPECTRA = exports.FILTER_SPECTRA_COLUMN = exports.SET_ANALYZE_SPECTRA_COLUMNS = void 0;
3
+ exports.DELETE_FILTER = exports.ENABLE_FILTER = exports.RESET_DOMAIN = exports.BRUSH_END = exports.RESIZE_INTEGRAL = exports.CHANGE_SPECTRUM_DISPLAY_VIEW_MODE = exports.DELETE_SPECTRA = exports.SET_CORRELATIONS_TOLERANCE = exports.SET_CORRELATIONS_MF = exports.DELETE_CORRELATION = exports.SET_CORRELATIONS = exports.SET_CORRELATION = exports.CHANGE_MOLECULE_LABEL = exports.CHANGE_FLOAT_MOLECULE_POSITION = exports.FLOAT_MOLECULE_OVER_SPECTRUM = exports.DELETE_MOLECULE = exports.SET_MOLECULE = exports.ADD_MOLECULE = exports.SET_ZOOM = exports.TOGGLE_REAL_IMAGINARY_VISIBILITY = exports.DELETE_INTEGRAL = exports.ADD_INTEGRAL = exports.CHANGE_SPECTRUM_COLOR = exports.CHANGE_ACTIVE_SPECTRUM = exports.CHANGE_PEAKS_MARKERS_VISIBILITY = exports.CHANGE_VISIBILITY = exports.FULL_ZOOM_OUT = exports.CHANGE_SPECTRUM_TYPE = exports.CHANGE_SPECTRUM_SETTING = exports.SET_SELECTED_FILTER = exports.SET_SELECTED_TOOL = exports.SET_DIMENSIONS = exports.SET_WIDTH = exports.SET_ORIGINAL_DOMAIN = exports.SET_Y_DOMAIN = exports.SET_X_DOMAIN = exports.SHIFT_SPECTRUM = exports.DELETE_PEAK_NOTATION = exports.CHANGE_PEAK_SHAPE = exports.ADD_PEAKS = exports.ADD_PEAK = exports.LOAD_DROP_FILES = exports.LOAD_JDF_FILE = exports.LOAD_ZIP_FILE = exports.LOAD_MOL_FILE = exports.LOAD_NMREDATA_FILE = exports.LOAD_JCAMP_FILE = exports.LOAD_JSON_FILE = exports.SAVE_DATA_AS_JSON = exports.INITIATE = void 0;
4
+ exports.ANALYZE_SPECTRA = exports.CHANGE_INTEGRAL_RELATIVE = exports.SET_DIAID_RANGE = exports.UNLINK_RANGE = exports.SAVE_EDITED_RANGE = exports.CHANGE_RANGE_SIGNAL_KIND = exports.CHANGE_RANGE_SIGNAL_VALUE = exports.CHANGE_RANGE_RELATIVE = exports.SET_FILTER_SNAPSHOT = exports.ADD_MISSING_PROJECTION = exports.SET_2D_SIGNAL_PATH_LENGTH = exports.DELETE_2D_SIGNAL = exports.DELETE_2D_ZONE = exports.ADD_2D_ZONE = exports.SET_2D_LEVEL = exports.ADD_RANGE = exports.CHANGE_RANGE_SUM = exports.RESIZE_RANGE = exports.APPLY_KEY_PREFERENCES = exports.SET_KEY_PREFERENCES = exports.APPLY_BASE_LINE_CORRECTION_FILTER = exports.DELETE_BASE_LINE_ZONE = exports.ADD_BASE_LINE_ZONE = exports.CHANGE_INTEGRAL_SUM = exports.SET_ACTIVE_TAB = exports.CHANGE_INTEGRAL_DATA = exports.SAVE_AS_SVG = exports.SET_SPECTRUMS_VERTICAL_ALIGN = exports.RESET_SELECTED_TOOL = exports.SET_LOADING_FLAG = exports.SET_SELECTED_OPTIONS_PANEL = exports.DELETE_1D_SIGNAL = exports.DELETE_RANGE = exports.AUTO_ZONES_DETECTION = exports.AUTO_RANGES_DETECTION = exports.OPTIMIZE_PEAKS = exports.AUTO_PEAK_PICKING = exports.SET_VERTICAL_INDICATOR_X_POSITION = exports.DISABLE_FILTER_LIVE_PREVIEW = exports.APPLY_ABSOLUTE_FILTER = exports.APPLY_AUTO_PHASE_CORRECTION_FILTER = exports.APPLY_MANUAL_PHASE_CORRECTION_FILTER = exports.CALCULATE_ZERO_FILLING_FILTER = exports.CALCULATE_APODIZATION_FILTER = exports.CALCULATE_BASE_LINE_CORRECTION_FILTER = exports.CALCULATE_MANUAL_PHASE_CORRECTION_FILTER = exports.APPLY_FFT_FILTER = exports.APPLY_APODIZATION_FILTER = exports.APPLY_ZERO_FILLING_FILTER = exports.DELETE_SPECTRA_FILTER = void 0;
5
+ exports.TOGGLE_PEAKS_SHAPES = exports.SET_AUTOMATIC_ASSIGNMENTS = exports.SHOW_J_GRAPH = exports.RESURRECTING_SPECTRUM_FROM_JCAMP = exports.RESURRECTING_SPECTRUM_FROM_RANGES = exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = exports.SHOW_ZONES_PEAKS = exports.SHOW_ZONES_SIGNALS = exports.SHOW_ZONES = exports.AUTO_ZONES_SPECTRA_PICKING = exports.AUTO_RANGES_SPECTRA_PICKING = exports.SHOW_RANGES_INTEGRALS = exports.SHOW_MULTIPLICTY_TREES = exports.UPDATE_RANGE = exports.CHANGE_ZONES_NOISE_FACTOR = exports.CHANGE_INTEGRALS_SUM_FLAG = exports.CHANGE_RANGES_SUM_FLAG = exports.DELETE_EXCLUSION_ZONE = exports.ADD_EXCLUSION_ZONE = exports.APPLY_MULTIPLE_SPECTRA_FILTER = exports.SET_MOUSE_OVER_DISPLAYER = exports.RESET_SPECTRA_SCALE = exports.SET_SPECTRA_SAME_TOP = exports.PREDICT_SPECTRA = exports.SET_DIAID_ZONE = exports.UNLINK_ZONE = exports.SAVE_EDITED_ZONE = exports.CHANGE_ZONE_SIGNAL_KIND = exports.CHANGE_ZONE_SIGNAL_VALUE = exports.ALIGN_SPECTRA = exports.FILTER_SPECTRA_COLUMN = exports.SET_ANALYZE_SPECTRA_COLUMNS = exports.RESIZE_ANALYZE_SPECTRA_RANGE = exports.DELETE_ANALYZE_SPECTRA_RANGE = void 0;
6
6
  exports.INITIATE = 'INITIATE';
7
7
  exports.SAVE_DATA_AS_JSON = 'SAVE_DATA_AS_JSON';
8
8
  exports.LOAD_JSON_FILE = 'LOAD_JSON_FILE';
@@ -11,6 +11,7 @@ exports.LOAD_NMREDATA_FILE = 'LOAD_NMREDATA_FILE';
11
11
  exports.LOAD_MOL_FILE = 'LOAD_MOL_FILE';
12
12
  exports.LOAD_ZIP_FILE = 'LOAD_ZIP_FILE';
13
13
  exports.LOAD_JDF_FILE = 'LOAD_JDF_FILE';
14
+ exports.LOAD_DROP_FILES = 'LOAD_DROP_FILES';
14
15
  exports.ADD_PEAK = 'ADD_PEAK';
15
16
  exports.ADD_PEAKS = 'ADD_PEAKS';
16
17
  exports.CHANGE_PEAK_SHAPE = 'CHANGE_PEAK_SHAPE';
@@ -38,6 +39,7 @@ exports.ADD_MOLECULE = 'ADD_MOLECULE';
38
39
  exports.SET_MOLECULE = 'SET_MOLECULE';
39
40
  exports.DELETE_MOLECULE = 'DELETE_MOLECULE';
40
41
  exports.FLOAT_MOLECULE_OVER_SPECTRUM = 'FLOAT_MOLECULE_OVER_SPECTRUM';
42
+ exports.CHANGE_FLOAT_MOLECULE_POSITION = 'CHANGE_FLOAT_MOLECULE_POSITION';
41
43
  exports.CHANGE_MOLECULE_LABEL = 'CHANGE_MOLECULE_LABEL';
42
44
  exports.SET_CORRELATION = 'SET_CORRELATION';
43
45
  exports.SET_CORRELATIONS = 'SET_CORRELATIONS';
@@ -126,6 +128,9 @@ exports.SHOW_MULTIPLICTY_TREES = 'SHOW_MULTIPLICTY_TREES';
126
128
  exports.SHOW_RANGES_INTEGRALS = 'SHOW_RANGES_INTEGRALS';
127
129
  exports.AUTO_RANGES_SPECTRA_PICKING = 'AUTO_RANGES_SPECTRA_PICKING';
128
130
  exports.AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
131
+ exports.SHOW_ZONES = 'SHOW_ZONES';
132
+ exports.SHOW_ZONES_SIGNALS = 'SHOW_ZONES_SIGNALS';
133
+ exports.SHOW_ZONES_PEAKS = 'SHOW_ZONES_PEAKS';
129
134
  exports.GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
130
135
  exports.RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
131
136
  exports.RESURRECTING_SPECTRUM_FROM_JCAMP = 'RESURRECTING_SPECTRUM_FROM_JCAMP';
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DraggableStructure = void 0;
6
+ exports.DraggableStructure = exports.DRAGGABLE_STRUCTURE_INITIAL_POSITION = void 0;
7
7
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
8
8
  /** @jsxImportSource @emotion/react */
9
9
  const react_1 = require("@emotion/react");
@@ -31,8 +31,9 @@ const style = (0, react_1.css) `
31
31
  }
32
32
  }
33
33
  `;
34
+ exports.DRAGGABLE_STRUCTURE_INITIAL_POSITION = { x: 100, y: 50 };
34
35
  function DraggableStructure(props) {
35
- const { zones, ranges, molecule, activeTab, displayerMode, index } = props;
36
+ const { zones, ranges, molecule, activeTab, displayerMode, index, position = exports.DRAGGABLE_STRUCTURE_INITIAL_POSITION, } = props;
36
37
  const { viewerRef } = (0, GlobalContext_1.useGlobal)();
37
38
  const dispatch = (0, DispatchContext_1.useDispatch)();
38
39
  const openMoleculeEditor = (0, MoleculeStructureEditorModal_1.useMoleculeEditor)();
@@ -43,7 +44,13 @@ function DraggableStructure(props) {
43
44
  payload: { id: molecule.id },
44
45
  });
45
46
  }, [dispatch, molecule]);
46
- return ((0, jsx_runtime_1.jsx)(SVGDraggable_1.default, { width: 150, height: 100, initialPosition: { x: 100, y: 50 }, dragHandleClassName: "handle", parentElement: viewerRef, children: (width, height) => ((0, jsx_runtime_1.jsxs)("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [(0, jsx_runtime_1.jsx)(ActionsButton_1.default, { onFloatBtnClick: floatMoleculeHandler }), (0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
47
+ const dragFloatMoleculeHandler = (0, react_2.useCallback)((position) => {
48
+ dispatch({
49
+ type: Types_1.CHANGE_FLOAT_MOLECULE_POSITION,
50
+ payload: { id: molecule.id, position },
51
+ });
52
+ }, [dispatch, molecule]);
53
+ return ((0, jsx_runtime_1.jsx)(SVGDraggable_1.default, { width: 150, height: 100, initialPosition: position, dragHandleClassName: "handle", parentElement: viewerRef, onEnd: dragFloatMoleculeHandler, children: (width, height) => ((0, jsx_runtime_1.jsxs)("foreignObject", { width: width, height: height + 30, "data-replace-float-structure": "true", css: style, onDoubleClick: () => openMoleculeEditor(molecule), children: [(0, jsx_runtime_1.jsx)(ActionsButton_1.default, { onFloatBtnClick: floatMoleculeHandler }), (0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, autoCrop: true, id: `molSVG${index || ''}`, width: width - 20, height: height, molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
47
54
  ? currentDiaIDsToHighlight
48
55
  : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
49
56
  dispatch({
@@ -8,6 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
9
  const ChartContext_1 = require("../../context/ChartContext");
10
10
  const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
11
+ const assert_1 = require("../../utility/assert");
11
12
  const DraggableStructure_1 = require("./DraggableStructure");
12
13
  function FloatMoleculeStructuresInner(props) {
13
14
  const { zones, ranges, floatingMolecules, molecules, activeTab, displayerMode, } = props;
@@ -15,19 +16,24 @@ function FloatMoleculeStructuresInner(props) {
15
16
  return null;
16
17
  return ((0, jsx_runtime_1.jsx)("g", { children: floatingMolecules
17
18
  .filter((molecule) => molecule.visible)
18
- .map((molecule) => ((0, jsx_runtime_1.jsx)(DraggableStructure_1.DraggableStructure, { ...{
19
- zones,
20
- ranges,
21
- activeTab,
22
- displayerMode,
23
- molecule: molecules.find((m) => m.id === molecule.id),
24
- } }, molecule.id))) }));
19
+ .map(({ id, position }) => {
20
+ const molecule = molecules.find((m) => m.id === id);
21
+ (0, assert_1.assert)(molecule !== undefined, 'molecule should be defined');
22
+ return ((0, jsx_runtime_1.jsx)(DraggableStructure_1.DraggableStructure, { ...{
23
+ zones,
24
+ ranges,
25
+ activeTab,
26
+ displayerMode,
27
+ position,
28
+ molecule,
29
+ } }, id));
30
+ }) }));
25
31
  }
26
32
  exports.FloatMoleculeStructuresInner = FloatMoleculeStructuresInner;
27
33
  const MemoizedFloatMoleculeStructures = (0, react_1.memo)(FloatMoleculeStructuresInner);
28
34
  const emptyData = { ranges: {}, zones: {} };
29
35
  function FloatMoleculeStructures() {
30
- const { molecules, displayerMode, activeTab, view: { floatingMolecules }, } = (0, ChartContext_1.useChartData)();
36
+ const { molecules, displayerMode, view: { floatingMolecules, spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
31
37
  const data = (0, useSpectrum_1.default)(emptyData);
32
38
  const ranges = data?.ranges || {};
33
39
  const zones = data?.zones || {};
@@ -21,6 +21,7 @@ const useExport_1 = __importDefault(require("../hooks/useExport"));
21
21
  const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
22
22
  const ImportPublicationStringModal_1 = __importDefault(require("../modal/ImportPublicationStringModal"));
23
23
  const LoadJCAMPModal_1 = __importDefault(require("../modal/LoadJCAMPModal"));
24
+ const Reducer_1 = require("../reducer/Reducer");
24
25
  const Types_1 = require("../reducer/types/Types");
25
26
  const IMPORT_MENU = [
26
27
  {
@@ -84,7 +85,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
84
85
  : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
85
86
  }, [isExperimentalFeature]);
86
87
  const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = (0, useToolsFunctions_1.default)();
87
- const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveAsNMREHandler, saveToClipboardHandler, saveAsHandler, } = (0, useExport_1.default)();
88
+ const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = (0, useExport_1.default)();
88
89
  const LoadJacmpHandler = (0, react_1.useCallback)((file) => {
89
90
  if (file) {
90
91
  dispatch({ type: Types_1.LOAD_JCAMP_FILE, files: [file] });
@@ -132,9 +133,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
132
133
  case 'advance_save':
133
134
  void saveAsHandler();
134
135
  break;
135
- case 'nmre':
136
- void saveAsNMREHandler();
137
- break;
138
136
  case 'copy':
139
137
  void saveToClipboardHandler();
140
138
  break;
@@ -146,7 +144,6 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
146
144
  saveAsPNGHandler,
147
145
  saveAsJSONHandler,
148
146
  saveAsHandler,
149
- saveAsNMREHandler,
150
147
  saveToClipboardHandler,
151
148
  ]);
152
149
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [isButtonVisible('import') && ((0, jsx_runtime_1.jsx)(ToolbarMenu_1.default, { component: (0, jsx_runtime_1.jsx)(fa_1.FaFileImport, {}), toolTip: "Import", onClick: (element) => {
@@ -164,7 +161,8 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
164
161
  }
165
162
  const MemoizedBasicToolBar = (0, react_1.memo)(BasicToolBarInner);
166
163
  function BasicToolBar() {
167
- const { activeSpectrum, verticalAlign, displayerMode, activeTab } = (0, ChartContext_1.useChartData)();
164
+ const { verticalAlign, displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
165
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
168
166
  const { info, fidCounter, ftCounter } = (0, useDatumWithSpectraStatistics_1.default)();
169
167
  return ((0, jsx_runtime_1.jsx)(MemoizedBasicToolBar, { ...{
170
168
  info,
@@ -39,6 +39,7 @@ const ToggleButtonGroup_1 = __importDefault(require("../elements/toggle/ToggleBu
39
39
  const useCheckToolsVisibility_1 = require("../hooks/useCheckToolsVisibility");
40
40
  const useDatumWithSpectraStatistics_1 = __importDefault(require("../hooks/useDatumWithSpectraStatistics"));
41
41
  const useToolsFunctions_1 = __importDefault(require("../hooks/useToolsFunctions"));
42
+ const Reducer_1 = require("../reducer/Reducer");
42
43
  const Types_1 = require("../reducer/types/Types");
43
44
  const ToolTypes_1 = require("./ToolTypes");
44
45
  function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCounter, }) {
@@ -75,7 +76,8 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, ftCou
75
76
  }
76
77
  const MemoizedFunctionToolBar = (0, react_1.memo)(FunctionToolBarInner);
77
78
  function FunctionToolBar({ defaultValue = ToolTypes_1.options.zoom.id, }) {
78
- const { activeSpectrum, displayerMode, activeTab } = (0, ChartContext_1.useChartData)();
79
+ const { displayerMode, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
80
+ const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
79
81
  const data = (0, useDatumWithSpectraStatistics_1.default)();
80
82
  return ((0, jsx_runtime_1.jsx)(MemoizedFunctionToolBar, { ...{
81
83
  ...data,
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assert = void 0;
4
+ function assert(value, message) {
5
+ if (!value) {
6
+ throw new Error(`unreachable${message ? `: ${message}` : ''}`);
7
+ }
8
+ }
9
+ exports.assert = assert;
@@ -13,6 +13,12 @@ exports.exercise = {
13
13
  integralsPanel: { display: true },
14
14
  },
15
15
  toolBarButtons: {
16
+ peakPicking: true,
17
+ apodization: true,
18
+ zeroFilling: true,
19
+ fastFourierTransform: true,
20
+ phaseCorrection: true,
21
+ baselineCorrection: true,
16
22
  integral: true,
17
23
  spectraCenterAlignments: true,
18
24
  spectraStackAlignments: true,