nmrium 0.42.0 → 0.43.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 (217) hide show
  1. package/lib/component/1d/ApodizationLine.js +1 -1
  2. package/lib/component/1d/Chart1D.js +3 -2
  3. package/lib/component/1d/Line.js +1 -1
  4. package/lib/component/1d/Viewer1D.js +15 -3
  5. package/lib/component/1d/integral/IntegralResizable.js +4 -3
  6. package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  7. package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
  8. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
  9. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
  10. package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
  11. package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
  12. package/lib/component/1d/peaks/Peaks.d.ts +1 -0
  13. package/lib/component/1d/peaks/Peaks.js +22 -0
  14. package/lib/component/1d/ranges/Range.js +3 -1
  15. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  16. package/lib/component/1d/tool/BaseLineZones.js +11 -31
  17. package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
  18. package/lib/component/1d/utilities/intersectionResolver.js +71 -0
  19. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
  20. package/lib/component/2d/SlicingView.js +1 -1
  21. package/lib/component/2d/ft/Contours.js +1 -1
  22. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
  24. package/lib/component/assignment/index.d.ts +6 -1
  25. package/lib/component/assignment/index.js +5 -1
  26. package/lib/component/context/DispatchContext.d.ts +1 -2
  27. package/lib/component/context/KeyModifierContext.d.ts +13 -0
  28. package/lib/component/context/KeyModifierContext.js +39 -0
  29. package/lib/component/context/PreferencesContext.d.ts +39 -39
  30. package/lib/component/elements/Button.js +2 -0
  31. package/lib/component/elements/NumberInput.d.ts +1 -0
  32. package/lib/component/elements/NumberInput.js +10 -3
  33. package/lib/component/elements/formik/FormikOnChange.js +1 -1
  34. package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  35. package/lib/component/header/ApodizationOptionsPanel.js +23 -14
  36. package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
  37. package/lib/component/header/Header.d.ts +10 -3
  38. package/lib/component/header/Header.js +5 -5
  39. package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
  40. package/lib/component/highlight/index.d.ts +1 -0
  41. package/lib/component/highlight/index.js +1 -0
  42. package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  43. package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
  44. package/lib/component/hooks/useResizerStatus.d.ts +2 -0
  45. package/lib/component/hooks/useResizerStatus.js +7 -0
  46. package/lib/component/hooks/useSpectrum.js +1 -1
  47. package/lib/component/main/ErrorOverlay.js +20 -0
  48. package/lib/component/main/InnerNMRium.d.ts +7 -0
  49. package/lib/component/main/InnerNMRium.js +52 -0
  50. package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
  51. package/lib/component/main/InnerNMRiumContents.js +89 -0
  52. package/lib/component/main/NMRium.d.ts +23 -0
  53. package/lib/component/main/NMRium.js +13 -0
  54. package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
  55. package/lib/component/main/NMRiumStateProvider.js +74 -0
  56. package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  57. package/lib/component/main/StateError.d.ts +4 -0
  58. package/lib/component/main/StateError.js +16 -0
  59. package/lib/component/main/index.d.ts +3 -0
  60. package/lib/component/main/index.js +3 -0
  61. package/lib/component/main/types.d.ts +18 -0
  62. package/lib/component/main/types.js +2 -0
  63. package/lib/component/modal/PredictSpectraModal.js +1 -1
  64. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
  65. package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
  66. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
  67. package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
  68. package/lib/component/modal/setting/GeneralSettings.js +2 -2
  69. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  70. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
  71. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  72. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
  73. package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
  74. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
  75. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
  76. package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
  77. package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
  78. package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  79. package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
  80. package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
  81. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  82. package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
  83. package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
  84. package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
  85. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  86. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  87. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  88. package/lib/component/reducer/IgnoreActions.js +0 -1
  89. package/lib/component/reducer/Reducer.d.ts +1 -6
  90. package/lib/component/reducer/Reducer.js +30 -6
  91. package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
  92. package/lib/component/reducer/actions/FiltersActions.js +96 -28
  93. package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
  94. package/lib/component/reducer/actions/IntegralsActions.js +44 -20
  95. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  96. package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
  97. package/lib/component/reducer/actions/PeaksActions.js +19 -1
  98. package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
  99. package/lib/component/reducer/actions/RangesActions.js +31 -3
  100. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  101. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
  102. package/lib/component/toolbar/FunctionToolBar.js +13 -3
  103. package/lib/component/toolbar/ToolTypes.d.ts +1 -0
  104. package/lib/component/toolbar/ToolTypes.js +36 -0
  105. package/lib/component/utility/export.js +7 -4
  106. package/lib/component/utility/filterType.d.ts +3 -0
  107. package/lib/component/utility/filterType.js +1 -0
  108. package/lib/component/workspaces/basic.js +2 -0
  109. package/lib/component/workspaces/embedded.js +2 -0
  110. package/lib/component/workspaces/exercise.js +2 -0
  111. package/lib/component/workspaces/prediction.js +9 -0
  112. package/lib/component/workspaces/process1D.js +2 -0
  113. package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
  114. package/lib/data/PredictionManager.d.ts +3 -3
  115. package/lib/data/PredictionManager.js +10 -10
  116. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
  117. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
  118. package/lib/data/molecules/Molecule.js +2 -2
  119. package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
  120. package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
  121. package/lib/versionInfo.js +1 -1
  122. package/lib-cjs/component/1d/ApodizationLine.js +1 -1
  123. package/lib-cjs/component/1d/Chart1D.js +3 -2
  124. package/lib-cjs/component/1d/Line.js +1 -1
  125. package/lib-cjs/component/1d/Viewer1D.js +15 -3
  126. package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
  127. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
  128. package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
  129. package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
  130. package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
  131. package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
  132. package/lib-cjs/component/1d/ranges/Range.js +3 -1
  133. package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
  134. package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
  135. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
  136. package/lib-cjs/component/2d/SlicingView.js +1 -1
  137. package/lib-cjs/component/2d/ft/Contours.js +1 -1
  138. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
  139. package/lib-cjs/component/assignment/index.js +5 -1
  140. package/lib-cjs/component/context/KeyModifierContext.js +44 -0
  141. package/lib-cjs/component/elements/Button.js +2 -0
  142. package/lib-cjs/component/elements/NumberInput.js +12 -2
  143. package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
  144. package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
  145. package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
  146. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
  147. package/lib-cjs/component/header/Header.js +5 -5
  148. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
  149. package/lib-cjs/component/highlight/index.js +1 -0
  150. package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
  151. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
  152. package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
  153. package/lib-cjs/component/hooks/useSpectrum.js +1 -1
  154. package/lib-cjs/component/main/ErrorOverlay.js +26 -0
  155. package/lib-cjs/component/main/InnerNMRium.js +82 -0
  156. package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
  157. package/lib-cjs/component/main/NMRium.js +19 -0
  158. package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
  159. package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
  160. package/lib-cjs/component/main/StateError.js +20 -0
  161. package/lib-cjs/component/main/index.js +21 -0
  162. package/lib-cjs/component/main/types.js +3 -0
  163. package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
  164. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
  165. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
  166. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
  167. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
  168. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  169. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
  170. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
  171. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
  172. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
  173. package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
  174. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
  175. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
  176. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
  177. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
  178. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
  179. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
  180. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
  181. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
  182. package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
  183. package/lib-cjs/component/reducer/Reducer.js +29 -5
  184. package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
  185. package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
  186. package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
  187. package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
  188. package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
  189. package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
  190. package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
  191. package/lib-cjs/component/utility/export.js +7 -4
  192. package/lib-cjs/component/utility/filterType.js +2 -0
  193. package/lib-cjs/component/workspaces/basic.js +2 -0
  194. package/lib-cjs/component/workspaces/embedded.js +2 -0
  195. package/lib-cjs/component/workspaces/exercise.js +2 -0
  196. package/lib-cjs/component/workspaces/prediction.js +9 -0
  197. package/lib-cjs/component/workspaces/process1D.js +2 -0
  198. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
  199. package/lib-cjs/data/PredictionManager.js +9 -9
  200. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
  201. package/lib-cjs/data/molecules/Molecule.js +2 -2
  202. package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
  203. package/lib-cjs/versionInfo.js +1 -1
  204. package/package.json +26 -25
  205. package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
  206. package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
  207. package/lib/component/ErrorOverlay.js +0 -27
  208. package/lib/component/NMRium.d.ts +0 -42
  209. package/lib/component/NMRium.js +0 -237
  210. package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
  211. package/lib/component/reducer/actions/GlobalActions.js +0 -4
  212. package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
  213. package/lib-cjs/component/ErrorOverlay.js +0 -30
  214. package/lib-cjs/component/NMRium.js +0 -267
  215. package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
  216. /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
  217. /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
@@ -34,7 +34,6 @@ const DatabaseActions = __importStar(require("./actions/DatabaseActions"));
34
34
  const DimensionsActions = __importStar(require("./actions/DimensionsActions"));
35
35
  const DomainActions = __importStar(require("./actions/DomainActions"));
36
36
  const FiltersActions = __importStar(require("./actions/FiltersActions"));
37
- const GlobalActions = __importStar(require("./actions/GlobalActions"));
38
37
  const IntegralsActions = __importStar(require("./actions/IntegralsActions"));
39
38
  const LoadActions = __importStar(require("./actions/LoadActions"));
40
39
  const MoleculeActions = __importStar(require("./actions/MoleculeActions"));
@@ -119,7 +118,6 @@ const getInitialState = () => ({
119
118
  zoom: {
120
119
  history: {},
121
120
  },
122
- overDisplayer: false,
123
121
  toolOptions: {
124
122
  selectedTool: 'zoom',
125
123
  selectedOptionPanel: null,
@@ -127,6 +125,7 @@ const getInitialState = () => ({
127
125
  baselineCorrection: {
128
126
  options: {},
129
127
  zones: [],
128
+ livePreview: true,
130
129
  },
131
130
  apodizationOptions: {},
132
131
  pivot: { value: 0, index: 0 },
@@ -178,6 +177,8 @@ function innerSpectrumReducer(draft, action) {
178
177
  return PeaksActions.handleChangePeakShape(draft, action);
179
178
  case 'TOGGLE_PEAKS_VIEW_PROPERTY':
180
179
  return PeaksActions.handleTogglePeaksViewProperty(draft, action);
180
+ case 'TOGGLE_PEAKS_DISPLAYING_MODE':
181
+ return PeaksActions.handleChangePeaksDisplayingMode(draft);
181
182
  case 'ADD_INTEGRAL':
182
183
  return IntegralsActions.handleAddIntegral(draft, action);
183
184
  case 'DELETE_INTEGRAL':
@@ -191,6 +192,8 @@ function innerSpectrumReducer(draft, action) {
191
192
  return IntegralsActions.handleChangeIntegralsSumFlag(draft);
192
193
  case 'CHANGE_INTEGRAL_RELATIVE':
193
194
  return IntegralsActions.handleChangeIntegralsRelativeValue(draft, action);
195
+ case 'CUT_INTEGRAL':
196
+ return IntegralsActions.handleCutIntegral(draft, action);
194
197
  case 'SET_X_DOMAIN':
195
198
  return DomainActions.handleSetXDomain(draft, action);
196
199
  case 'SET_Y_DOMAIN':
@@ -211,6 +214,10 @@ function innerSpectrumReducer(draft, action) {
211
214
  return FiltersActions.handleCalculateZeroFillingFilter(draft, action);
212
215
  case 'APPLY_FFT_FILTER':
213
216
  return FiltersActions.handleApplyFFTFilter(draft);
217
+ case 'APPLY_FFT_DIMENSION_1_FILTER':
218
+ return FiltersActions.handleApplyFFtDimension1Filter(draft);
219
+ case 'APPLY_FFT_DIMENSION_2_FILTER':
220
+ return FiltersActions.handleApplyFFtDimension2Filter(draft);
214
221
  case 'APPLY_MANUAL_PHASE_CORRECTION_FILTER':
215
222
  return FiltersActions.handleApplyManualPhaseCorrectionFilter(draft, action);
216
223
  case 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER':
@@ -357,6 +364,8 @@ function innerSpectrumReducer(draft, action) {
357
364
  return RangesActions.handleAutoSpectraRangesDetection(draft);
358
365
  case 'SHOW_J_GRAPH':
359
366
  return RangesActions.handleShowJGraph(draft, action);
367
+ case 'CUT_RANGE':
368
+ return RangesActions.handleCutRange(draft, action);
360
369
  case 'SET_KEY_PREFERENCES':
361
370
  return PreferencesActions.handleSetKeyPreferences(draft, action);
362
371
  case 'APPLY_KEY_PREFERENCES':
@@ -399,15 +408,30 @@ function innerSpectrumReducer(draft, action) {
399
408
  return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
400
409
  case 'SET_AUTOMATIC_ASSIGNMENTS':
401
410
  return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
402
- case 'SET_MOUSE_OVER_DISPLAYER':
403
- return GlobalActions.handleSetIsOverDisplayer(draft, action);
404
411
  default:
405
412
  }
406
413
  }
407
414
  catch (error) {
408
415
  draft.errorAction = error;
409
- error.data = { action };
416
+ error.data = { action, state: getDebugState(draft) };
410
417
  reportError(error);
411
418
  }
412
419
  }
413
420
  exports.spectrumReducer = (0, immer_1.produce)(innerSpectrumReducer);
421
+ function getDebugState(draft) {
422
+ const state = (0, immer_1.original)(draft);
423
+ const string = JSON.stringify(state, (key, value) => {
424
+ if (ArrayBuffer.isView(value)) {
425
+ return Array.from(value).slice(0, 20);
426
+ }
427
+ if (Array.isArray(value) && typeof value[0] === 'number') {
428
+ return value.slice(0, 20);
429
+ }
430
+ return value;
431
+ });
432
+ if (string.length > 800000) {
433
+ // fallback, better to have something as a string t han nothing
434
+ return string.slice(0, 800000);
435
+ }
436
+ return JSON.parse(string);
437
+ }
@@ -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.rollbackSpectrumByFilter = exports.rollbackSpectrum = exports.handleSignalProcessingFilter = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.handleSetFilterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.handleDeleteSpectraFilter = exports.handleDeleteFilter = exports.handleEnableFilter = exports.handleCalculateZeroFillingFilter = exports.handleCalculateApodizationFilter = exports.handleCalculateBaseLineCorrection = exports.calculateBaseLineCorrection = exports.handleCalculateManualPhaseCorrection = exports.handleApplyAbsoluteFilter = exports.handleApplyAutoPhaseCorrectionFilter = exports.handleApplyManualPhaseCorrectionFilter = exports.handleApplyFFTFilter = exports.handleApplyApodizationFilter = exports.handleApplyZeroFillingFilter = exports.handleShiftSpectrumAlongXAxis = void 0;
6
+ exports.rollbackSpectrumByFilter = exports.rollbackSpectrum = exports.handleSignalProcessingFilter = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.handleSetFilterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.handleDeleteSpectraFilter = exports.handleDeleteFilter = exports.handleEnableFilter = exports.handleCalculateZeroFillingFilter = exports.handleCalculateApodizationFilter = exports.handleCalculateBaseLineCorrection = exports.calculateBaseLineCorrection = exports.handleCalculateManualPhaseCorrection = exports.handleApplyAbsoluteFilter = exports.handleApplyAutoPhaseCorrectionFilter = exports.handleApplyManualPhaseCorrectionFilter = exports.handleApplyFFtDimension2Filter = exports.handleApplyFFtDimension1Filter = exports.handleApplyFFTFilter = exports.handleApplyApodizationFilter = exports.handleApplyZeroFillingFilter = exports.handleShiftSpectrumAlongXAxis = void 0;
7
7
  const uuid_1 = require("@lukeed/uuid");
8
8
  const immer_1 = require("immer");
9
9
  const nmr_processing_1 = require("nmr-processing");
@@ -19,7 +19,7 @@ const getStrongestPeak_1 = require("../helper/getStrongestPeak");
19
19
  const DomainActions_1 = require("./DomainActions");
20
20
  const PreferencesActions_1 = require("./PreferencesActions");
21
21
  const ToolsActions_1 = require("./ToolsActions");
22
- const { fft, apodization, baselineCorrection, phaseCorrection, zeroFilling, shiftX, shift2DX, shift2DY, exclusionZones, signalProcessing, } = nmr_processing_1.Filters;
22
+ const { fft, fftDimension1, fftDimension2, apodization, baselineCorrection, phaseCorrection, zeroFilling, shiftX, shift2DX, shift2DY, exclusionZones, signalProcessing, } = nmr_processing_1.Filters;
23
23
  function getFilterUpdateDomainRules(filterName) {
24
24
  return (nmr_processing_1.Filters[filterName]?.DOMAIN_UPDATE_RULES || {
25
25
  updateXDomain: false,
@@ -166,6 +166,25 @@ function updateView(draft, filterUpdateDomainRules) {
166
166
  (0, DomainActions_1.setMode)(draft);
167
167
  (0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { verticalAlign: 'auto-check' });
168
168
  }
169
+ function disableLivePreview(draft, id) {
170
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
171
+ if (activeSpectrum) {
172
+ const index = activeSpectrum.index;
173
+ const { data } = draft.tempData[index];
174
+ draft.data[index].data = data;
175
+ (0, DomainActions_1.setDomain)(draft);
176
+ // reset default options
177
+ switch (id) {
178
+ case apodization.name: {
179
+ draft.toolOptions.data.apodizationOptions = DefaultApodizationOptions_1.defaultApodizationOptions;
180
+ break;
181
+ }
182
+ default: {
183
+ return null;
184
+ }
185
+ }
186
+ }
187
+ }
169
188
  //action
170
189
  function handleShiftSpectrumAlongXAxis(draft, action) {
171
190
  //apply filter into the spectrum
@@ -199,7 +218,7 @@ function handleApplyZeroFillingFilter(draft, action) {
199
218
  const filters = [
200
219
  {
201
220
  name: zeroFilling.id,
202
- value: action.payload,
221
+ value: action.payload.options,
203
222
  },
204
223
  ];
205
224
  nmr_processing_1.FiltersManager.applyFilter(draft.data[index], filters, {
@@ -222,16 +241,22 @@ exports.handleApplyZeroFillingFilter = handleApplyZeroFillingFilter;
222
241
  function handleCalculateZeroFillingFilter(draft, action) {
223
242
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
224
243
  if (activeSpectrum) {
225
- const index = activeSpectrum.index;
226
- const { data: { x, re, im }, filters, info, } = draft.tempData[index];
227
- const _data = { data: { x, re, im }, filters, info };
228
- zeroFilling.apply(_data, action.payload);
229
- const { im: newIm, re: newRe, x: newX } = _data.data;
230
- const datum = draft.data[index];
231
- datum.data.x = newX;
232
- datum.data.im = newIm;
233
- datum.data.re = newRe;
234
- draft.xDomain = [newX[0], newX.at(-1)];
244
+ const { options, livePreview } = action.payload;
245
+ if (livePreview) {
246
+ const index = activeSpectrum.index;
247
+ const { data: { x, re, im }, filters, info, } = draft.tempData[index];
248
+ const _data = { data: { x, re, im }, filters, info };
249
+ zeroFilling.apply(_data, options);
250
+ const { im: newIm, re: newRe, x: newX } = _data.data;
251
+ const datum = draft.data[index];
252
+ datum.data.x = newX;
253
+ datum.data.im = newIm;
254
+ datum.data.re = newRe;
255
+ draft.xDomain = [newX[0], newX.at(-1)];
256
+ }
257
+ else {
258
+ disableLivePreview(draft, zeroFilling.name);
259
+ }
235
260
  }
236
261
  }
237
262
  exports.handleCalculateZeroFillingFilter = handleCalculateZeroFillingFilter;
@@ -240,15 +265,20 @@ function handleCalculateApodizationFilter(draft, action) {
240
265
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
241
266
  if (activeSpectrum) {
242
267
  const index = activeSpectrum.index;
243
- const options = action.payload;
244
- const { data: { x, re, im }, info, } = draft.tempData[index];
245
- const _data = { data: { x, re, im }, info };
246
- draft.toolOptions.data.apodizationOptions = options;
247
- apodization.apply(_data, options);
248
- const { im: newIm, re: newRe } = _data.data;
249
- const datum = draft.data[index];
250
- datum.data.im = newIm;
251
- datum.data.re = newRe;
268
+ const { livePreview, options } = action.payload;
269
+ if (livePreview) {
270
+ const { data: { x, re, im }, info, } = draft.tempData[index];
271
+ const _data = { data: { x, re, im }, info };
272
+ draft.toolOptions.data.apodizationOptions = options;
273
+ apodization.apply(_data, options);
274
+ const { im: newIm, re: newRe } = _data.data;
275
+ const datum = draft.data[index];
276
+ datum.data.im = newIm;
277
+ datum.data.re = newRe;
278
+ }
279
+ else {
280
+ disableLivePreview(draft, apodization.name);
281
+ }
252
282
  }
253
283
  }
254
284
  exports.handleCalculateApodizationFilter = handleCalculateApodizationFilter;
@@ -261,7 +291,7 @@ function handleApplyApodizationFilter(draft, action) {
261
291
  nmr_processing_1.FiltersManager.applyFilter(draft.data[index], [
262
292
  {
263
293
  name: apodization.id,
264
- value: action.payload,
294
+ value: action.payload.options,
265
295
  },
266
296
  ], { filterIndex: activeFilterIndex });
267
297
  if (activeFilterIndex !== -1) {
@@ -297,6 +327,44 @@ function handleApplyFFTFilter(draft) {
297
327
  }
298
328
  }
299
329
  exports.handleApplyFFTFilter = handleApplyFFTFilter;
330
+ function handleApplyFFtDimension1Filter(draft) {
331
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
332
+ if (activeSpectrum) {
333
+ const { index } = activeSpectrum;
334
+ const activeFilterIndex = getActiveFilterIndex(draft);
335
+ //apply filter into the spectrum
336
+ nmr_processing_1.FiltersManager.applyFilter(draft.data[index], [{ name: fftDimension1.id, value: {} }], { filterIndex: activeFilterIndex });
337
+ if (activeFilterIndex !== -1) {
338
+ rollbackSpectrumByFilter(draft, {
339
+ searchBy: 'name',
340
+ key: fftDimension1.id,
341
+ });
342
+ }
343
+ else {
344
+ updateView(draft, fftDimension1.DOMAIN_UPDATE_RULES);
345
+ }
346
+ }
347
+ }
348
+ exports.handleApplyFFtDimension1Filter = handleApplyFFtDimension1Filter;
349
+ function handleApplyFFtDimension2Filter(draft) {
350
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
351
+ if (activeSpectrum) {
352
+ const { index } = activeSpectrum;
353
+ const activeFilterIndex = getActiveFilterIndex(draft);
354
+ //apply filter into the spectrum
355
+ nmr_processing_1.FiltersManager.applyFilter(draft.data[index], [{ name: fftDimension2.id, value: {} }], { filterIndex: activeFilterIndex });
356
+ if (activeFilterIndex !== -1) {
357
+ rollbackSpectrumByFilter(draft, {
358
+ searchBy: 'name',
359
+ key: fftDimension2.id,
360
+ });
361
+ }
362
+ else {
363
+ updateView(draft, fftDimension2.DOMAIN_UPDATE_RULES);
364
+ }
365
+ }
366
+ }
367
+ exports.handleApplyFFtDimension2Filter = handleApplyFFtDimension2Filter;
300
368
  //action
301
369
  function handleApplyManualPhaseCorrectionFilter(draft, action) {
302
370
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
@@ -395,7 +463,7 @@ function handleBaseLineCorrectionFilter(draft, action) {
395
463
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
396
464
  if (activeSpectrum) {
397
465
  const { zones } = draft.toolOptions.data.baselineCorrection;
398
- const { livePreview, ...options } = action.payload;
466
+ const { options } = action.payload;
399
467
  const activeFilterIndex = getActiveFilterIndex(draft);
400
468
  nmr_processing_1.FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
401
469
  {
@@ -427,21 +495,23 @@ function calculateBaseLineCorrection(draft, baseLineOptions) {
427
495
  // save the baseline options temporary
428
496
  draft.toolOptions.data.baselineCorrection = {
429
497
  ...draft.toolOptions.data.baselineCorrection,
430
- ...(baseLineOptions ? { options: baseLineOptions } : {}),
498
+ ...(baseLineOptions && baseLineOptions),
431
499
  };
432
- const { zones, options } = draft.toolOptions.data.baselineCorrection;
433
- const { livePreview, ...filterOptions } = options;
500
+ const { zones, options, livePreview } = draft.toolOptions.data.baselineCorrection;
434
501
  if (livePreview) {
435
502
  const _data = { data: { x, re, im }, info };
436
503
  baselineCorrection.apply(_data, {
437
504
  zones,
438
- ...filterOptions,
505
+ ...options,
439
506
  });
440
507
  const { im: newIm, re: newRe } = _data.data;
441
508
  const datum = draft.data[index];
442
509
  datum.data.im = newIm;
443
510
  datum.data.re = newRe;
444
511
  }
512
+ else {
513
+ disableLivePreview(draft, baselineCorrection.id);
514
+ }
445
515
  }
446
516
  }
447
517
  exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
@@ -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.handleChangeIntegralsSumFlag = exports.handleChangeIntegralsRelativeValue = exports.handleChangeIntegral = exports.handleDeleteIntegral = exports.handleAddIntegral = exports.handleChangeIntegralSum = void 0;
6
+ exports.handleChangeIntegralsSumFlag = exports.handleChangeIntegralsRelativeValue = exports.handleChangeIntegral = exports.handleDeleteIntegral = exports.handleAddIntegral = exports.handleChangeIntegralSum = exports.handleCutIntegral = void 0;
7
7
  const uuid_1 = require("@lukeed/uuid");
8
8
  const immer_1 = require("immer");
9
9
  const ml_spectra_processing_1 = require("ml-spectra-processing");
@@ -11,6 +11,7 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
11
11
  const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
12
12
  const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
13
13
  const getRange_1 = __importDefault(require("../helper/getRange"));
14
+ const getSpectrum_1 = require("../helper/getSpectrum");
14
15
  const DomainActions_1 = require("./DomainActions");
15
16
  function handleChangeIntegralSum(draft, action) {
16
17
  const { options } = action.payload;
@@ -24,31 +25,39 @@ function handleChangeIntegralSum(draft, action) {
24
25
  }
25
26
  }
26
27
  exports.handleChangeIntegralSum = handleChangeIntegralSum;
28
+ function initiateIntergalSumOptions(datum, options) {
29
+ const { molecules, nucleus } = options;
30
+ datum.integrals.options = (0, SumManager_1.initSumOptions)(datum.integrals.options, {
31
+ molecules,
32
+ nucleus,
33
+ });
34
+ }
35
+ function addIntegral(datum, options) {
36
+ const { from, to } = options;
37
+ const { x, re } = datum.data;
38
+ const shiftX = (0, Spectrum1D_1.getShiftX)(datum);
39
+ const integration = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
40
+ const integral = {
41
+ id: (0, uuid_1.v4)(),
42
+ originFrom: from - shiftX,
43
+ originTo: to - shiftX,
44
+ from,
45
+ to,
46
+ integral: integration,
47
+ absolute: integration,
48
+ kind: 'signal',
49
+ };
50
+ datum.integrals.values.push(integral);
51
+ }
27
52
  function handleAddIntegral(draft, action) {
28
53
  const { startX, endX } = action.payload;
29
54
  const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
30
55
  const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
31
- const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
32
56
  if (activeSpectrum?.id) {
57
+ const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
33
58
  const datum = data[activeSpectrum.index];
34
- const { x, re } = datum.data;
35
- const shiftX = (0, Spectrum1D_1.getShiftX)(datum);
36
- const integration = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
37
- const integral = {
38
- id: (0, uuid_1.v4)(),
39
- originFrom: from - shiftX,
40
- originTo: to - shiftX,
41
- from,
42
- to,
43
- integral: integration,
44
- absolute: integration,
45
- kind: 'signal',
46
- };
47
- datum.integrals.values.push(integral);
48
- datum.integrals.options = (0, SumManager_1.initSumOptions)(datum.integrals.options, {
49
- molecules,
50
- nucleus,
51
- });
59
+ addIntegral(datum, { from, to });
60
+ initiateIntergalSumOptions(datum, { molecules, nucleus });
52
61
  (0, Spectrum1D_1.updateIntegralsRelativeValues)(datum);
53
62
  (0, DomainActions_1.setIntegralsYDomain)(draft, datum);
54
63
  }
@@ -112,3 +121,19 @@ function handleChangeIntegralsSumFlag(draft) {
112
121
  }
113
122
  }
114
123
  exports.handleChangeIntegralsSumFlag = handleChangeIntegralsSumFlag;
124
+ function handleCutIntegral(draft, action) {
125
+ const { cutValue } = action.payload;
126
+ const spectrum = (0, getSpectrum_1.getSpectrum)(draft);
127
+ const integrals = spectrum.integrals.values;
128
+ for (let i = 0; i < integrals.length; i++) {
129
+ const { to, from } = integrals[i];
130
+ if (cutValue > from && cutValue < to) {
131
+ integrals.splice(i, 1);
132
+ addIntegral(spectrum, { from, to: cutValue });
133
+ addIntegral(spectrum, { from: cutValue, to });
134
+ }
135
+ }
136
+ (0, Spectrum1D_1.updateIntegralsRelativeValues)(spectrum);
137
+ (0, DomainActions_1.setIntegralsYDomain)(draft, spectrum);
138
+ }
139
+ exports.handleCutIntegral = handleCutIntegral;
@@ -147,7 +147,7 @@ function checkPredictions(predictedSpectra, inputOptions, molfile, logger) {
147
147
  const { spectra } = inputOptions;
148
148
  const missing2DPrediction = [];
149
149
  const molecule = full_1.default.Molecule.fromMolfile(molfile);
150
- molecule.addImplicitHydrogens();
150
+ //@ts-expect-error Will be fixed once OCL-utils is typed correctly
151
151
  const { atoms } = (0, openchemlib_utils_1.getAtoms)(molecule);
152
152
  for (const [experiment, required] of Object.entries(spectra)) {
153
153
  if (!required || predictedSpectra[experiment])
@@ -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.handleTogglePeaksViewProperty = exports.handleChangePeakShape = exports.handleOptimizePeaks = exports.handleAutoPeakPicking = exports.handleDeletePeak = exports.handleAddPeaks = exports.handleAddPeak = void 0;
6
+ exports.handleChangePeaksDisplayingMode = exports.handleTogglePeaksViewProperty = exports.handleChangePeakShape = exports.handleOptimizePeaks = exports.handleAutoPeakPicking = exports.handleDeletePeak = exports.handleAddPeaks = exports.handleAddPeak = void 0;
7
7
  const uuid_1 = require("@lukeed/uuid");
8
8
  const immer_1 = require("immer");
9
9
  const ml_spectra_processing_1 = require("ml-spectra-processing");
@@ -158,3 +158,22 @@ function togglePeaksViewProperty(draft, key) {
158
158
  }
159
159
  }
160
160
  }
161
+ function handleChangePeaksDisplayingMode(draft) {
162
+ const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
163
+ if (activeSpectrum?.id) {
164
+ const peaksView = draft.view.peaks;
165
+ if (peaksView[activeSpectrum.id]) {
166
+ peaksView[activeSpectrum.id].displayingMode =
167
+ peaksView[activeSpectrum.id].displayingMode === 'single'
168
+ ? 'spread'
169
+ : 'single';
170
+ }
171
+ else {
172
+ const defaultPeaksView = { ...useActiveSpectrumPeaksViewState_1.defaultPeaksViewState };
173
+ defaultPeaksView.displayingMode =
174
+ defaultPeaksView.displayingMode === 'single' ? 'spread' : 'single';
175
+ peaksView[activeSpectrum.id] = defaultPeaksView;
176
+ }
177
+ }
178
+ }
179
+ exports.handleChangePeaksDisplayingMode = handleChangePeaksDisplayingMode;
@@ -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.handleShowJGraph = exports.handleAutoSpectraRangesDetection = exports.handleShowRangesIntegrals = exports.handleShowMultiplicityTrees = exports.handleUpdateRange = exports.handleChangeRangesSumFlag = exports.handleSetDiaIDRange = exports.unlinkRange = exports.handleUnlinkRange = exports.handleSaveEditedRange = exports.handleChangeRangeSignalKind = exports.handleChangeRangeSignalValue = exports.handleChangeRangeRelativeValue = exports.handleResizeRange = exports.handleAddRange = exports.handleChangeRangeSum = exports.handleDeleteSignal = exports.deleteSignal1D = exports.handleDeleteRange = exports.handleAutoRangesDetection = void 0;
6
+ exports.handleShowJGraph = exports.handleAutoSpectraRangesDetection = exports.handleShowRangesIntegrals = exports.handleShowMultiplicityTrees = exports.handleUpdateRange = exports.handleChangeRangesSumFlag = exports.handleSetDiaIDRange = exports.unlinkRange = exports.handleUnlinkRange = exports.handleSaveEditedRange = exports.handleChangeRangeSignalKind = exports.handleChangeRangeSignalValue = exports.handleChangeRangeRelativeValue = exports.handleResizeRange = exports.handleAddRange = exports.handleChangeRangeSum = exports.handleDeleteSignal = exports.deleteSignal1D = exports.handleDeleteRange = exports.handleAutoRangesDetection = exports.handleCutRange = void 0;
7
7
  const uuid_1 = require("@lukeed/uuid");
8
8
  const immer_1 = require("immer");
9
9
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
@@ -16,6 +16,7 @@ const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
16
16
  const Reducer_1 = require("../Reducer");
17
17
  const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
18
18
  const getRange_1 = __importDefault(require("../helper/getRange"));
19
+ const getSpectrum_1 = require("../helper/getSpectrum");
19
20
  const CorrelationsActions_1 = require("./CorrelationsActions");
20
21
  const DomainActions_1 = require("./DomainActions");
21
22
  const ToolsActions_1 = require("./ToolsActions");
@@ -266,6 +267,13 @@ function handleChangeRangeSum(draft, action) {
266
267
  }
267
268
  }
268
269
  exports.handleChangeRangeSum = handleChangeRangeSum;
270
+ function initiateRangeSumOptions(datum, options) {
271
+ const { nucleus, molecules } = options;
272
+ datum.ranges.options = (0, SumManager_1.initSumOptions)(datum.ranges.options, {
273
+ molecules,
274
+ nucleus,
275
+ });
276
+ }
269
277
  //action
270
278
  function handleAddRange(draft, action) {
271
279
  const { startX, endX } = action.payload;
@@ -275,12 +283,16 @@ function handleAddRange(draft, action) {
275
283
  if (activeSpectrum?.id) {
276
284
  const { index } = activeSpectrum;
277
285
  const [from, to] = range;
278
- (0, Spectrum1D_1.addRange)(data[index], {
286
+ const datum = data[index];
287
+ (0, Spectrum1D_1.addRange)(datum, {
279
288
  from,
280
289
  to,
290
+ });
291
+ initiateRangeSumOptions(datum, {
281
292
  nucleus,
282
293
  molecules,
283
294
  });
295
+ (0, Spectrum1D_1.updateRangesRelativeValues)(datum);
284
296
  (0, CorrelationsActions_1.handleUpdateCorrelations)(draft);
285
297
  (0, DomainActions_1.setIntegralsYDomain)(draft, data[index]);
286
298
  }
@@ -384,3 +396,20 @@ function handleShowJGraph(draft, action) {
384
396
  }
385
397
  }
386
398
  exports.handleShowJGraph = handleShowJGraph;
399
+ function handleCutRange(draft, action) {
400
+ const { cutValue } = action.payload;
401
+ const spectrum = (0, getSpectrum_1.getSpectrum)(draft);
402
+ const ranges = spectrum.ranges.values;
403
+ for (let i = 0; i < ranges.length; i++) {
404
+ const { to, from } = ranges[i];
405
+ if (cutValue > from && cutValue < to) {
406
+ ranges.splice(i, 1);
407
+ (0, Spectrum1D_1.addRange)(spectrum, { from, to: cutValue });
408
+ (0, Spectrum1D_1.addRange)(spectrum, { from: cutValue, to });
409
+ }
410
+ }
411
+ (0, Spectrum1D_1.updateRangesRelativeValues)(spectrum);
412
+ (0, DomainActions_1.setIntegralsYDomain)(draft, spectrum);
413
+ (0, CorrelationsActions_1.handleUpdateCorrelations)(draft);
414
+ }
415
+ exports.handleCutRange = handleCutRange;
@@ -33,11 +33,21 @@ function FunctionToolBarInner({ defaultValue, ftCounter, }) {
33
33
  type: 'APPLY_FFT_FILTER',
34
34
  });
35
35
  }, [dispatch]);
36
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('zoom') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: ToolTypes_1.options.zoom.id, title: `${ToolTypes_1.options.zoom.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}) }, ToolTypes_1.options.zoom.id)), isButtonVisible('zoomOut') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}) })), isButtonVisible('peakPicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, id: ToolTypes_1.options.peakPicking.id, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}) }, ToolTypes_1.options.peakPicking.id)), isButtonVisible('integral') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, id: ToolTypes_1.options.integral.id, title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}) }, ToolTypes_1.options.integral.id)), isButtonVisible('zonePicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zonePicking.id, id: ToolTypes_1.options.zonePicking.id, title: `${ToolTypes_1.options.zonePicking.label} ( Press r )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaDiceFour, {}) }, ToolTypes_1.options.zonePicking.id)), isButtonVisible('slicing') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.slicing.id, id: ToolTypes_1.options.slicing.id, title: `${ToolTypes_1.options.slicing.label}`, children: (0, jsx_runtime_1.jsx)("p", { children: "Slic" }) }, ToolTypes_1.options.slicing.id)), isButtonVisible('rangePicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.rangePicking.id, title: `${ToolTypes_1.options.rangePicking.label} ( Press r )`, id: ToolTypes_1.options.rangePicking.id, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}) }, ToolTypes_1.options.rangePicking.id)), isButtonVisible('multipleSpectraAnalysis', {
36
+ const handleFFtDimension1Filter = (0, react_1.useCallback)(() => {
37
+ dispatch({
38
+ type: 'APPLY_FFT_DIMENSION_1_FILTER',
39
+ });
40
+ }, [dispatch]);
41
+ const handleFFtDimension2Filter = (0, react_1.useCallback)(() => {
42
+ dispatch({
43
+ type: 'APPLY_FFT_DIMENSION_2_FILTER',
44
+ });
45
+ }, [dispatch]);
46
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('zoom') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: ToolTypes_1.options.zoom.id, title: `${ToolTypes_1.options.zoom.label}`, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}) }, ToolTypes_1.options.zoom.id)), isButtonVisible('zoomOut') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}) })), isButtonVisible('peakPicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, id: ToolTypes_1.options.peakPicking.id, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}) }, ToolTypes_1.options.peakPicking.id)), isButtonVisible('integral') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, id: ToolTypes_1.options.integral.id, title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}) }, ToolTypes_1.options.integral.id)), isButtonVisible('zonePicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zonePicking.id, id: ToolTypes_1.options.zonePicking.id, title: `${ToolTypes_1.options.zonePicking.label} ( Press r )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaDiceFour, {}) }, ToolTypes_1.options.zonePicking.id)), isButtonVisible('slicing') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.slicing.id, id: ToolTypes_1.options.slicing.id, title: `${ToolTypes_1.options.slicing.label}`, children: (0, jsx_runtime_1.jsx)("p", { children: "Slic" }) }, ToolTypes_1.options.slicing.id)), isButtonVisible('rangePicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.rangePicking.id, title: `${ToolTypes_1.options.rangePicking.label} ( Press r )`, id: ToolTypes_1.options.rangePicking.id, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}) }, ToolTypes_1.options.rangePicking.id)), isButtonVisible('multipleSpectraAnalysis', {
37
47
  checkSpectrumType: false,
38
48
  }) &&
39
- ftCounter > 1 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.multipleSpectraAnalysis.id, id: ToolTypes_1.options.multipleSpectraAnalysis.id, title: ToolTypes_1.options.multipleSpectraAnalysis.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }, ToolTypes_1.options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.apodization.id, id: ToolTypes_1.options.apodization.id, title: `${ToolTypes_1.options.apodization.label} (Press a)`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrApodization, {}) }, ToolTypes_1.options.apodization.id)), isButtonVisible('zeroFilling') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zeroFilling.id, id: ToolTypes_1.options.zeroFilling.id, title: ToolTypes_1.options.zeroFilling.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrZeroFilling, {}) }, ToolTypes_1.options.zeroFilling.id)), isButtonVisible('phaseCorrection') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: ToolTypes_1.options.phaseCorrection.id, title: `${ToolTypes_1.options.phaseCorrection.label} ( Press a )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPhaseCorrection, {}) }, ToolTypes_1.options.phaseCorrection.id)), isButtonVisible('baselineCorrection') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baselineCorrection.id, id: ToolTypes_1.options.baselineCorrection.id, title: `${ToolTypes_1.options.baselineCorrection.label} ( Press b )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}) }, ToolTypes_1.options.baselineCorrection.id)), isButtonVisible('exclusionZones', { checkSpectrumType: false }) &&
40
- ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: ToolTypes_1.options.exclusionZones.id, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }) }, ToolTypes_1.options.exclusionZones.id))] }), isButtonVisible('fft') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fft.id, className: "cheminfo", title: ToolTypes_1.options.fft.label, onClick: handleOnFFTFilter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) }))] }));
49
+ ftCounter > 1 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.multipleSpectraAnalysis.id, id: ToolTypes_1.options.multipleSpectraAnalysis.id, title: ToolTypes_1.options.multipleSpectraAnalysis.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }, ToolTypes_1.options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.apodization.id, id: ToolTypes_1.options.apodization.id, title: `${ToolTypes_1.options.apodization.label} (Press a)`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrApodization, {}) }, ToolTypes_1.options.apodization.id)), isButtonVisible('zeroFilling') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zeroFilling.id, id: ToolTypes_1.options.zeroFilling.id, title: `${ToolTypes_1.options.zeroFilling.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrZeroFilling, {}) }, ToolTypes_1.options.zeroFilling.id)), isButtonVisible('phaseCorrection') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: ToolTypes_1.options.phaseCorrection.id, title: `${ToolTypes_1.options.phaseCorrection.label} ( Press a )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPhaseCorrection, {}) }, ToolTypes_1.options.phaseCorrection.id)), isButtonVisible('baselineCorrection') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baselineCorrection.id, id: ToolTypes_1.options.baselineCorrection.id, title: `${ToolTypes_1.options.baselineCorrection.label} ( Press b )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}) }, ToolTypes_1.options.baselineCorrection.id)), isButtonVisible('exclusionZones', { checkSpectrumType: false }) &&
50
+ ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: ToolTypes_1.options.exclusionZones.id, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }) }, ToolTypes_1.options.exclusionZones.id))] }), isButtonVisible('fft') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fft.id, className: "cheminfo", title: `${ToolTypes_1.options.fft.label} ( Press t )`, onClick: handleOnFFTFilter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension1') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fftDimension1.id, className: "cheminfo", title: ToolTypes_1.options.fftDimension1.label, onClick: handleFFtDimension1Filter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension2') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fftDimension2.id, className: "cheminfo", title: ToolTypes_1.options.fftDimension2.label, onClick: handleFFtDimension2Filter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) }))] }));
41
51
  }
42
52
  const MemoizedFunctionToolBar = (0, react_1.memo)(FunctionToolBarInner);
43
53
  function FunctionToolBar({ defaultValue = ToolTypes_1.options.zoom.id, }) {
@@ -291,6 +291,42 @@ exports.options = {
291
291
  ],
292
292
  isToggle: false,
293
293
  },
294
+ fftDimension1: {
295
+ id: 'fftDimension1',
296
+ label: 'Fourier transform dimension 1',
297
+ hasOptionPanel: false,
298
+ isFilter: true,
299
+ mode: Constants_1.DISPLAYER_MODE.DM_2D,
300
+ spectraOptions: [
301
+ {
302
+ info: [
303
+ { key: 'isFid', value: true },
304
+ { key: 'isComplex', value: true },
305
+ ],
306
+ active: true,
307
+ },
308
+ ],
309
+ isToggle: false,
310
+ isExperimental: true,
311
+ },
312
+ fftDimension2: {
313
+ id: 'fftDimension2',
314
+ label: 'Fourier transform dimension 2',
315
+ hasOptionPanel: false,
316
+ isFilter: true,
317
+ mode: Constants_1.DISPLAYER_MODE.DM_2D,
318
+ spectraOptions: [
319
+ {
320
+ info: [
321
+ { key: 'isFid', value: true },
322
+ { key: 'isComplex', value: true },
323
+ ],
324
+ active: true,
325
+ },
326
+ ],
327
+ isToggle: false,
328
+ isExperimental: true,
329
+ },
294
330
  import: {
295
331
  id: 'import',
296
332
  label: 'Import',
@@ -201,14 +201,17 @@ function getBlob(rootRef, elementID) {
201
201
  return { blob, width, height };
202
202
  }
203
203
  exports.getBlob = getBlob;
204
+ function getMatrix(element) {
205
+ const transform = window
206
+ .getComputedStyle(element)
207
+ .getPropertyValue('transform');
208
+ return new DOMMatrix(transform);
209
+ }
204
210
  function getMoleculesElement(rootRef) {
205
211
  const nmriumViewer = rootRef.getRootNode().querySelector(`#nmrium-viewer`);
206
212
  const floatingMoleculesGroup = document.createElement('g');
207
213
  for (const element of nmriumViewer.querySelectorAll('.draggable-molecule')) {
208
- const transform = window
209
- .getComputedStyle(element)
210
- .getPropertyValue('transform');
211
- const matrix = new DOMMatrix(transform);
214
+ const matrix = getMatrix(element);
212
215
  const actionHeaderElement = element.querySelector('.float-molecule-actions');
213
216
  const molElement = element
214
217
  .cloneNode(true)
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -35,6 +35,8 @@ exports.basic = {
35
35
  phaseCorrection: true,
36
36
  baselineCorrection: true,
37
37
  autoRangeAndZonePicking: true,
38
+ fftDimension1: true,
39
+ fftDimension2: true,
38
40
  },
39
41
  },
40
42
  };
@@ -39,6 +39,8 @@ exports.embedded = {
39
39
  zoomOut: true,
40
40
  zoom: true,
41
41
  autoRangeAndZonePicking: true,
42
+ fftDimension1: true,
43
+ fftDimension2: true,
42
44
  },
43
45
  },
44
46
  };
@@ -25,6 +25,8 @@ exports.exercise = {
25
25
  integral: true,
26
26
  spectraCenterAlignments: true,
27
27
  spectraStackAlignments: true,
28
+ fftDimension1: true,
29
+ fftDimension2: true,
28
30
  },
29
31
  },
30
32
  general: {