nmrium 1.1.0 → 1.2.1

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 (251) hide show
  1. package/lib/component/1d/ExclusionZoneAnnotation.js +1 -1
  2. package/lib/component/1d/FloatPublicationString.js +2 -2
  3. package/lib/component/1d/FloatingRanges.js +3 -3
  4. package/lib/component/1d/FloatingRanges.js.map +1 -1
  5. package/lib/component/1d/FooterBanner.js +1 -1
  6. package/lib/component/1d/LinesSeries.js +1 -1
  7. package/lib/component/1d/PredictionErrorsNotations.js +2 -2
  8. package/lib/component/1d/inset/DraggableInset.js +2 -2
  9. package/lib/component/1d/multiAnalysis/AnalysisRange.js +1 -1
  10. package/lib/component/1d/multiAnalysis/AnalysisRange.js.map +1 -1
  11. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.d.ts +1 -1
  12. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.d.ts.map +1 -1
  13. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +3 -1
  14. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js.map +1 -1
  15. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +1 -1
  16. package/lib/component/1d/multiplicityTree/MultiplicityTree.js.map +1 -1
  17. package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
  18. package/lib/component/1d/peaks/Peaks.js +1 -1
  19. package/lib/component/1d/peaks/Peaks.js.map +1 -1
  20. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -3
  21. package/lib/component/1d-2d/tools/BrushXY.js +2 -2
  22. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +1 -1
  23. package/lib/component/2d/SignalDeltaLine.js +1 -1
  24. package/lib/component/2d/zones/Signal.d.ts.map +1 -1
  25. package/lib/component/2d/zones/Signal.js +1 -1
  26. package/lib/component/2d/zones/Signal.js.map +1 -1
  27. package/lib/component/2d/zones/SignalsGuideLines.js +2 -2
  28. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  29. package/lib/component/2d/zones/Zone.d.ts.map +1 -1
  30. package/lib/component/2d/zones/Zone.js +3 -1
  31. package/lib/component/2d/zones/Zone.js.map +1 -1
  32. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +1 -1
  33. package/lib/component/elements/ActionsButtonsPopover.js +4 -4
  34. package/lib/component/elements/Alert.js +2 -2
  35. package/lib/component/elements/AssignmentsCell.js +1 -1
  36. package/lib/component/elements/Button.js +10 -10
  37. package/lib/component/elements/Button.js.map +1 -1
  38. package/lib/component/elements/DraggableDialog.js +3 -3
  39. package/lib/component/elements/EditableColumn.js +3 -3
  40. package/lib/component/elements/EmptyText.js +2 -2
  41. package/lib/component/elements/Footer.js +9 -9
  42. package/lib/component/elements/Footer.js.map +1 -1
  43. package/lib/component/elements/MoleculeSelection.js +19 -19
  44. package/lib/component/elements/MoleculeSelection.js.map +1 -1
  45. package/lib/component/elements/NextPrev.js +15 -15
  46. package/lib/component/elements/NextPrev.js.map +1 -1
  47. package/lib/component/elements/ReactTable/BaseReactTable.js +6 -6
  48. package/lib/component/elements/ReadOnly.js +8 -8
  49. package/lib/component/elements/ReadOnly.js.map +1 -1
  50. package/lib/component/elements/Sections.js +29 -29
  51. package/lib/component/elements/Sections.js.map +1 -1
  52. package/lib/component/elements/Select.js +10 -10
  53. package/lib/component/elements/Select.js.map +1 -1
  54. package/lib/component/elements/StyledDialogBody.js +1 -1
  55. package/lib/component/elements/StyledDialogBody.js.map +1 -1
  56. package/lib/component/elements/Tab/DeleteButton.js +5 -5
  57. package/lib/component/elements/Tab/Tabs.js +5 -5
  58. package/lib/component/elements/dropDownButton/DropDownList.js +6 -6
  59. package/lib/component/elements/export/ExportManager.d.ts.map +1 -1
  60. package/lib/component/elements/export/ExportManager.js +12 -1
  61. package/lib/component/elements/export/ExportManager.js.map +1 -1
  62. package/lib/component/elements/resizer/SVGResizer.js +1 -1
  63. package/lib/component/header/Header.js +1 -1
  64. package/lib/component/hooks/useExport.d.ts.map +1 -1
  65. package/lib/component/hooks/useExport.js +25 -10
  66. package/lib/component/hooks/useExport.js.map +1 -1
  67. package/lib/component/hooks/useFilter.d.ts.map +1 -1
  68. package/lib/component/hooks/useFilter.js +4 -5
  69. package/lib/component/hooks/useFilter.js.map +1 -1
  70. package/lib/component/hooks/useSaveSettings.js +2 -2
  71. package/lib/component/loader/DefaultSpinnerComponent.js +9 -9
  72. package/lib/component/loader/DropZone.js +8 -8
  73. package/lib/component/main/ErrorOverlay.js +4 -4
  74. package/lib/component/main/InnerNMRiumContents.js +3 -3
  75. package/lib/component/main/NMRiumViewer.d.ts.map +1 -1
  76. package/lib/component/main/NMRiumViewer.js +13 -2
  77. package/lib/component/main/NMRiumViewer.js.map +1 -1
  78. package/lib/component/modal/AboutPredictionModal.js +2 -2
  79. package/lib/component/modal/AboutSpectrumSimulationModal.js +2 -2
  80. package/lib/component/modal/MultipletAnalysisModal.js +12 -12
  81. package/lib/component/modal/PredictSpectraModal.js +4 -4
  82. package/lib/component/modal/PublicationStringModal.js +2 -2
  83. package/lib/component/modal/aboutUs/AboutUsModal.js +3 -3
  84. package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  85. package/lib/component/modal/changeSum/SelectMolecule.js +5 -5
  86. package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
  87. package/lib/component/modal/setting/GeneralSettings.js +5 -5
  88. package/lib/component/panels/Panels.js +2 -2
  89. package/lib/component/panels/PanelsBar.js +3 -3
  90. package/lib/component/panels/PanelsBar.js.map +1 -1
  91. package/lib/component/panels/RangesPanel/RangesTable.js +6 -6
  92. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  93. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +9 -9
  94. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.js +5 -5
  95. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +11 -11
  96. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +7 -7
  97. package/lib/component/panels/SummaryPanel/Overview.js +1 -1
  98. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
  99. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -5
  100. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  101. package/lib/component/panels/ZonesPanel/ZonesTable.js +6 -6
  102. package/lib/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.d.ts.map +1 -1
  103. package/lib/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.js +1 -1
  104. package/lib/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.js.map +1 -1
  105. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
  106. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +32 -5
  107. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
  108. package/lib/component/panels/filtersPanel/Filters/InnerFilterHeader.js +1 -1
  109. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.d.ts.map +1 -1
  110. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
  111. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
  112. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +4 -4
  113. package/lib/component/panels/predictionPanel/PredictionPanel.js +6 -6
  114. package/lib/component/panels/predictionPanel/PredictionPanel.js.map +1 -1
  115. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  116. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  117. package/lib/component/reducer/actions/FiltersActions.js +69 -38
  118. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  119. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  120. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  121. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  122. package/lib/component/workspaces/assignment.d.ts.map +1 -1
  123. package/lib/component/workspaces/assignment.js +1 -0
  124. package/lib/component/workspaces/assignment.js.map +1 -1
  125. package/lib/component/workspaces/basic.d.ts.map +1 -1
  126. package/lib/component/workspaces/basic.js +1 -0
  127. package/lib/component/workspaces/basic.js.map +1 -1
  128. package/lib/component/workspaces/embedded.d.ts.map +1 -1
  129. package/lib/component/workspaces/embedded.js +1 -0
  130. package/lib/component/workspaces/embedded.js.map +1 -1
  131. package/lib/component/workspaces/exercise.d.ts.map +1 -1
  132. package/lib/component/workspaces/exercise.js +1 -0
  133. package/lib/component/workspaces/exercise.js.map +1 -1
  134. package/lib/component/workspaces/prediction.d.ts.map +1 -1
  135. package/lib/component/workspaces/prediction.js +1 -0
  136. package/lib/component/workspaces/prediction.js.map +1 -1
  137. package/lib/component/workspaces/process1D.d.ts.map +1 -1
  138. package/lib/component/workspaces/process1D.js +1 -0
  139. package/lib/component/workspaces/process1D.js.map +1 -1
  140. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  141. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  142. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  143. package/lib/data/PredictionManager.d.ts.map +1 -1
  144. package/lib/data/PredictionManager.js +7 -21
  145. package/lib/data/PredictionManager.js.map +1 -1
  146. package/lib/data/SpectraManager.js +1 -1
  147. package/lib/data/SpectraManager.js.map +1 -1
  148. package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js +1 -1
  149. package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js.map +1 -1
  150. package/lib/data/data2d/Spectrum2D/getMissingProjection.d.ts +1 -1
  151. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  152. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  153. package/lib/data/utilities/generateColor.d.ts.map +1 -1
  154. package/lib/data/utilities/generateColor.js +1 -1
  155. package/lib/data/utilities/generateColor.js.map +1 -1
  156. package/lib/data/utilities/isNumber.js +1 -1
  157. package/lib/data/utilities/isNumber.js.map +1 -1
  158. package/lib/utils/clipboard/clipboardComponents.js +1 -1
  159. package/lib/versionInfo.js +1 -1
  160. package/package.json +41 -36
  161. package/src/component/1d/ExclusionZoneAnnotation.tsx +1 -1
  162. package/src/component/1d/FloatPublicationString.tsx +2 -2
  163. package/src/component/1d/FloatingRanges.tsx +3 -3
  164. package/src/component/1d/FooterBanner.tsx +1 -1
  165. package/src/component/1d/LinesSeries.tsx +1 -1
  166. package/src/component/1d/PredictionErrorsNotations.tsx +2 -2
  167. package/src/component/1d/inset/DraggableInset.tsx +2 -2
  168. package/src/component/1d/multiAnalysis/AnalysisRange.tsx +1 -1
  169. package/src/component/1d/multiAnalysis/MultiAnalysisRanges.tsx +3 -1
  170. package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +1 -1
  171. package/src/component/1d/peaks/Peaks.tsx +2 -6
  172. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +3 -3
  173. package/src/component/1d-2d/tools/BrushXY.tsx +2 -2
  174. package/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx +1 -1
  175. package/src/component/2d/SignalDeltaLine.tsx +1 -1
  176. package/src/component/2d/zones/Signal.tsx +2 -1
  177. package/src/component/2d/zones/SignalsGuideLines.tsx +2 -2
  178. package/src/component/2d/zones/Zone.tsx +2 -1
  179. package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +1 -1
  180. package/src/component/elements/ActionsButtonsPopover.tsx +4 -4
  181. package/src/component/elements/Alert.tsx +2 -2
  182. package/src/component/elements/AssignmentsCell.tsx +1 -1
  183. package/src/component/elements/Button.tsx +10 -10
  184. package/src/component/elements/DraggableDialog.tsx +3 -3
  185. package/src/component/elements/EditableColumn.tsx +3 -3
  186. package/src/component/elements/EmptyText.tsx +2 -2
  187. package/src/component/elements/Footer.tsx +9 -9
  188. package/src/component/elements/MoleculeSelection.tsx +19 -19
  189. package/src/component/elements/NextPrev.tsx +15 -15
  190. package/src/component/elements/ReactTable/BaseReactTable.tsx +6 -6
  191. package/src/component/elements/ReadOnly.tsx +8 -8
  192. package/src/component/elements/Sections.tsx +29 -29
  193. package/src/component/elements/Select.tsx +10 -10
  194. package/src/component/elements/StyledDialogBody.tsx +1 -1
  195. package/src/component/elements/Tab/DeleteButton.tsx +5 -5
  196. package/src/component/elements/Tab/Tabs.tsx +5 -5
  197. package/src/component/elements/dropDownButton/DropDownList.tsx +6 -6
  198. package/src/component/elements/export/ExportManager.tsx +13 -3
  199. package/src/component/elements/resizer/SVGResizer.tsx +1 -1
  200. package/src/component/header/Header.tsx +1 -1
  201. package/src/component/hooks/useExport.tsx +21 -10
  202. package/src/component/hooks/useFilter.ts +4 -6
  203. package/src/component/hooks/useSaveSettings.tsx +2 -2
  204. package/src/component/loader/DefaultSpinnerComponent.tsx +9 -9
  205. package/src/component/loader/DropZone.tsx +8 -8
  206. package/src/component/main/ErrorOverlay.tsx +4 -4
  207. package/src/component/main/InnerNMRiumContents.tsx +3 -3
  208. package/src/component/main/NMRiumViewer.tsx +16 -2
  209. package/src/component/modal/AboutPredictionModal.tsx +2 -2
  210. package/src/component/modal/AboutSpectrumSimulationModal.tsx +2 -2
  211. package/src/component/modal/MultipletAnalysisModal.tsx +12 -12
  212. package/src/component/modal/PredictSpectraModal.tsx +4 -4
  213. package/src/component/modal/PublicationStringModal.tsx +2 -2
  214. package/src/component/modal/aboutUs/AboutUsModal.tsx +3 -3
  215. package/src/component/modal/changeSum/ChangeSumModalContents.tsx +1 -1
  216. package/src/component/modal/changeSum/SelectMolecule.tsx +5 -5
  217. package/src/component/modal/setting/GeneralSettings.tsx +5 -5
  218. package/src/component/panels/Panels.tsx +2 -2
  219. package/src/component/panels/PanelsBar.tsx +3 -3
  220. package/src/component/panels/RangesPanel/RangesTable.tsx +6 -6
  221. package/src/component/panels/RangesPanel/TableColumns/ActionsColumn.tsx +1 -1
  222. package/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx +9 -9
  223. package/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx +5 -5
  224. package/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx +11 -11
  225. package/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx +7 -7
  226. package/src/component/panels/SummaryPanel/Overview.tsx +1 -1
  227. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +6 -5
  228. package/src/component/panels/ZonesPanel/ZonesTable.tsx +6 -6
  229. package/src/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.tsx +1 -0
  230. package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +37 -5
  231. package/src/component/panels/filtersPanel/Filters/InnerFilterHeader.tsx +1 -1
  232. package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
  233. package/src/component/panels/multipleAnalysisPanel/AlignSpectra.tsx +4 -4
  234. package/src/component/panels/predictionPanel/PredictionPanel.tsx +6 -6
  235. package/src/component/panels/predictionPanel/PredictionSimpleOptions.tsx +1 -1
  236. package/src/component/reducer/actions/FiltersActions.ts +197 -91
  237. package/src/component/reducer/actions/ToolsActions.ts +5 -4
  238. package/src/component/workspaces/assignment.ts +1 -0
  239. package/src/component/workspaces/basic.ts +1 -0
  240. package/src/component/workspaces/embedded.ts +1 -0
  241. package/src/component/workspaces/exercise.ts +1 -0
  242. package/src/component/workspaces/prediction.ts +1 -0
  243. package/src/component/workspaces/process1D.ts +1 -0
  244. package/src/component/workspaces/workspaceDefaultProperties.ts +1 -0
  245. package/src/data/PredictionManager.ts +8 -23
  246. package/src/data/SpectraManager.ts +1 -1
  247. package/src/data/data1d/Spectrum1D/ranges/resurrectSpectrum.ts +1 -1
  248. package/src/data/utilities/generateColor.ts +5 -3
  249. package/src/data/utilities/isNumber.ts +1 -1
  250. package/src/utils/clipboard/clipboardComponents.tsx +1 -1
  251. package/src/versionInfo.ts +1 -1
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ AirplsOptions,
2
3
  Apodization1DOptions,
3
4
  BaselineCorrectionOptions,
4
5
  Filter1DEntry,
@@ -6,6 +7,7 @@ import type {
6
7
  Filter2DEntry,
7
8
  Filter2DOptions,
8
9
  MatrixOptions,
10
+ PolynomialOptions,
9
11
  } from '@zakodium/nmr-types';
10
12
  import type { Spectrum1D, Spectrum2D, Spectrum } from '@zakodium/nmrium-core';
11
13
  import type { NmrData1D, NmrData2DFt } from 'cheminfo-types';
@@ -444,10 +446,20 @@ function rollbackSpectrumByFilter(
444
446
  const filterIndex = spectrum.filters.findIndex((f) => f[searchBy] === key);
445
447
  if (filterIndex === -1 || reset) {
446
448
  if (draft.tempData) {
447
- reapplyFilters(spectrum);
449
+ const activeFilterIndex =
450
+ !reset && toolData.activeFilterID
451
+ ? spectrum.filters.findIndex(
452
+ (f) => f.id === toolData.activeFilterID,
453
+ )
454
+ : spectrum.filters.length;
455
+
456
+ const filters = spectrum.filters.slice(0, activeFilterIndex);
457
+ reapplyFilters(spectrum, filters);
448
458
  }
459
+
449
460
  //if the filter is not exists, create a clone of the current data
450
461
  draft.tempData = structuredClone(current(draft).data);
462
+
451
463
  draft.tempData[index] = spectrum;
452
464
  spectrum = structuredClone(spectrum);
453
465
 
@@ -576,6 +588,12 @@ function rollbackSpectrum(
576
588
  afterRollback(draft, filterKey);
577
589
  }
578
590
 
591
+ function hasBaselineZones(
592
+ filterOptions,
593
+ ): filterOptions is PolynomialOptions | AirplsOptions {
594
+ return 'zones' in filterOptions;
595
+ }
596
+
579
597
  function getTwoDimensionFilterOptions(
580
598
  draft: Draft<State>,
581
599
  ): TwoDimensionPhaseCorrection['traces'] | null {
@@ -692,17 +710,20 @@ function beforeRollback(draft: Draft<State>, filterKey) {
692
710
  const baselineCorrectionFilter = datum.filters.find(
693
711
  (filter) => filter.name === Filters1D.baselineCorrection.name,
694
712
  );
713
+
714
+ const filterOptions = baselineCorrectionFilter?.value;
715
+
695
716
  if (
696
- !baselineCorrectionFilter ||
697
- (baselineCorrectionFilter &&
698
- baselineCorrectionFilter.value.zones?.length === 0)
717
+ filterOptions &&
718
+ hasBaselineZones(filterOptions) &&
719
+ filterOptions.zones.length > 0
699
720
  ) {
700
- draft.toolOptions.data.baselineCorrection.zones =
701
- getBaselineZonesByDietrich(datum.data as NmrData1D);
702
- } else {
703
- draft.toolOptions.data.baselineCorrection.zones =
704
- baselineCorrectionFilter.value.zones;
721
+ draft.toolOptions.data.baselineCorrection.zones = filterOptions.zones;
722
+ return;
705
723
  }
724
+
725
+ draft.toolOptions.data.baselineCorrection.zones =
726
+ getBaselineZonesByDietrich(datum.data as NmrData1D);
706
727
  }
707
728
  break;
708
729
  }
@@ -776,6 +797,8 @@ function handleShiftSpectrumAlongXAxis(
776
797
  return;
777
798
  }
778
799
 
800
+ const activeFilterIndex = getActiveFilterIndex(draft);
801
+
779
802
  //apply filter into the spectrum
780
803
  const options = action.payload;
781
804
 
@@ -791,9 +814,14 @@ function handleShiftSpectrumAlongXAxis(
791
814
  applyFilter: false,
792
815
  });
793
816
 
794
- Filters1DManager.applyFilters(draft.data[index] as Spectrum1D, [
795
- { name: 'shiftX', value: { shift } },
796
- ]);
817
+ Filters1DManager.applyFilters(
818
+ draft.data[index] as Spectrum1D,
819
+ [{ name: 'shiftX', value: { shift } }],
820
+ {
821
+ filterIndex: activeFilterIndex,
822
+ forceReapply: activeFilterIndex !== -1,
823
+ },
824
+ );
797
825
 
798
826
  updateView(draft, shiftX.domainUpdateRules);
799
827
  }
@@ -807,9 +835,14 @@ function handleShiftSpectrumAlongXAxis(
807
835
  searchBy: 'name',
808
836
  applyFilter: false,
809
837
  });
810
- Filters2DManager.applyFilters(draft.data[index] as Spectrum2D, [
811
- { name: 'shift2DX', value: { shift: shiftX } },
812
- ]);
838
+ Filters2DManager.applyFilters(
839
+ draft.data[index] as Spectrum2D,
840
+ [{ name: 'shift2DX', value: { shift: shiftX } }],
841
+ {
842
+ filterIndex: activeFilterIndex,
843
+ forceReapply: activeFilterIndex !== -1,
844
+ },
845
+ );
813
846
  updateView(draft, shift2DX.domainUpdateRules);
814
847
  }
815
848
 
@@ -819,9 +852,14 @@ function handleShiftSpectrumAlongXAxis(
819
852
  searchBy: 'name',
820
853
  applyFilter: false,
821
854
  });
822
- Filters2DManager.applyFilters(draft.data[index] as Spectrum2D, [
823
- { name: 'shift2DY', value: { shift: shiftY } },
824
- ]);
855
+ Filters2DManager.applyFilters(
856
+ draft.data[index] as Spectrum2D,
857
+ [{ name: 'shift2DY', value: { shift: shiftY } }],
858
+ {
859
+ filterIndex: activeFilterIndex,
860
+ forceReapply: activeFilterIndex !== -1,
861
+ },
862
+ );
825
863
 
826
864
  updateView(draft, shift2DY.domainUpdateRules);
827
865
  }
@@ -833,6 +871,7 @@ function handleApplyZeroFillingFilter(
833
871
  draft: Draft<State>,
834
872
  action: ZeroFillingFilterAction,
835
873
  ) {
874
+ const activeFilterIndex = getActiveFilterIndex(draft);
836
875
  const activeSpectrum = getActiveSpectrum(draft);
837
876
 
838
877
  if (!activeSpectrum || !draft.tempData) {
@@ -847,9 +886,12 @@ function handleApplyZeroFillingFilter(
847
886
  enabled: true,
848
887
  },
849
888
  ];
850
- Filters1DManager.applyFilters(draft.tempData[index], filters);
851
- draft.data[index] = draft.tempData[index];
852
889
 
890
+ Filters1DManager.applyFilters(draft.tempData[index], filters, {
891
+ filterIndex: activeFilterIndex,
892
+ forceReapply: activeFilterIndex !== -1,
893
+ });
894
+ draft.data[index] = draft.tempData[index];
853
895
  updateView(draft, zeroFilling.domainUpdateRules);
854
896
  }
855
897
  //action
@@ -857,6 +899,7 @@ function handleApplyZeroFillingDimensionOneFilter(
857
899
  draft: Draft<State>,
858
900
  action: ZeroFillingDimensionOneFilterAction,
859
901
  ) {
902
+ const activeFilterIndex = getActiveFilterIndex(draft);
860
903
  const activeSpectrum = getActiveSpectrum(draft);
861
904
 
862
905
  if (!activeSpectrum || !draft.tempData) {
@@ -871,7 +914,10 @@ function handleApplyZeroFillingDimensionOneFilter(
871
914
  enabled: true,
872
915
  },
873
916
  ];
874
- Filters2DManager.applyFilters(draft.tempData[index], filters);
917
+ Filters2DManager.applyFilters(draft.tempData[index], filters, {
918
+ filterIndex: activeFilterIndex,
919
+ forceReapply: activeFilterIndex !== -1,
920
+ });
875
921
  draft.data[index] = draft.tempData[index];
876
922
 
877
923
  updateView(draft, Filters2D.zeroFillingDimension1.domainUpdateRules);
@@ -881,6 +927,7 @@ function handleApplyZeroFillingDimensionTwoFilter(
881
927
  draft: Draft<State>,
882
928
  action: ZeroFillingDimensionTwoFilterAction,
883
929
  ) {
930
+ const activeFilterIndex = getActiveFilterIndex(draft);
884
931
  const activeSpectrum = getActiveSpectrum(draft);
885
932
 
886
933
  if (!activeSpectrum || !draft.tempData) {
@@ -895,7 +942,10 @@ function handleApplyZeroFillingDimensionTwoFilter(
895
942
  enabled: true,
896
943
  },
897
944
  ];
898
- Filters2DManager.applyFilters(draft.tempData[index], filters);
945
+ Filters2DManager.applyFilters(draft.tempData[index], filters, {
946
+ filterIndex: activeFilterIndex,
947
+ forceReapply: activeFilterIndex !== -1,
948
+ });
899
949
  draft.data[index] = draft.tempData[index];
900
950
 
901
951
  updateView(draft, Filters2D.zeroFillingDimension2.domainUpdateRules);
@@ -1050,7 +1100,11 @@ function handleCalculateApodizationFilter(
1050
1100
  if (!tempRollback) {
1051
1101
  apodization.apply(spectrum, options);
1052
1102
  } else {
1053
- for (const filter of datum.filters) {
1103
+ const index = datum.filters.findIndex(
1104
+ (filter) => filter.name === 'apodization',
1105
+ );
1106
+
1107
+ for (const filter of datum.filters.slice(index)) {
1054
1108
  const { name, value } = filter;
1055
1109
 
1056
1110
  delete filter.error;
@@ -1148,6 +1202,7 @@ function handleApplyApodizationFilter(
1148
1202
  draft: Draft<State>,
1149
1203
  action: ApodizationFilterAction,
1150
1204
  ) {
1205
+ const activeFilterIndex = getActiveFilterIndex(draft);
1151
1206
  const activeSpectrum = getActiveSpectrum(draft);
1152
1207
 
1153
1208
  if (!activeSpectrum || !draft.tempData) {
@@ -1156,12 +1211,16 @@ function handleApplyApodizationFilter(
1156
1211
 
1157
1212
  const index = activeSpectrum.index;
1158
1213
 
1159
- Filters1DManager.applyFilters(draft.tempData[index], [
1160
- {
1161
- name: 'apodization',
1162
- value: action.payload.options,
1163
- },
1164
- ]);
1214
+ Filters1DManager.applyFilters(
1215
+ draft.tempData[index],
1216
+ [
1217
+ {
1218
+ name: 'apodization',
1219
+ value: action.payload.options,
1220
+ },
1221
+ ],
1222
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1223
+ );
1165
1224
  draft.data[index] = draft.tempData[index];
1166
1225
 
1167
1226
  updateView(draft, apodization.domainUpdateRules);
@@ -1171,6 +1230,7 @@ function handleApplyApodizationDimensionOneFilter(
1171
1230
  draft: Draft<State>,
1172
1231
  action: ApodizationDimensionOneFilterAction,
1173
1232
  ) {
1233
+ const activeFilterIndex = getActiveFilterIndex(draft);
1174
1234
  const activeSpectrum = getActiveSpectrum(draft);
1175
1235
 
1176
1236
  if (!activeSpectrum || !draft.tempData) {
@@ -1179,12 +1239,16 @@ function handleApplyApodizationDimensionOneFilter(
1179
1239
 
1180
1240
  const index = activeSpectrum.index;
1181
1241
 
1182
- Filters2DManager.applyFilters(draft.tempData[index], [
1183
- {
1184
- name: 'apodizationDimension1',
1185
- value: action.payload.options,
1186
- },
1187
- ]);
1242
+ Filters2DManager.applyFilters(
1243
+ draft.tempData[index],
1244
+ [
1245
+ {
1246
+ name: 'apodizationDimension1',
1247
+ value: action.payload.options,
1248
+ },
1249
+ ],
1250
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1251
+ );
1188
1252
  draft.data[index] = draft.tempData[index];
1189
1253
 
1190
1254
  updateView(draft, apodization.domainUpdateRules);
@@ -1194,6 +1258,7 @@ function handleApplyApodizationDimensionTwoFilter(
1194
1258
  draft: Draft<State>,
1195
1259
  action: ApodizationDimensionTwoFilterAction,
1196
1260
  ) {
1261
+ const activeFilterIndex = getActiveFilterIndex(draft);
1197
1262
  const activeSpectrum = getActiveSpectrum(draft);
1198
1263
 
1199
1264
  if (!activeSpectrum || !draft.tempData) {
@@ -1202,12 +1267,16 @@ function handleApplyApodizationDimensionTwoFilter(
1202
1267
 
1203
1268
  const index = activeSpectrum.index;
1204
1269
 
1205
- Filters2DManager.applyFilters(draft.tempData[index], [
1206
- {
1207
- name: 'apodizationDimension2',
1208
- value: action.payload.options,
1209
- },
1210
- ]);
1270
+ Filters2DManager.applyFilters(
1271
+ draft.tempData[index],
1272
+ [
1273
+ {
1274
+ name: 'apodizationDimension2',
1275
+ value: action.payload.options,
1276
+ },
1277
+ ],
1278
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1279
+ );
1211
1280
  draft.data[index] = draft.tempData[index];
1212
1281
 
1213
1282
  updateView(draft, apodization.domainUpdateRules);
@@ -1215,6 +1284,7 @@ function handleApplyApodizationDimensionTwoFilter(
1215
1284
 
1216
1285
  //action
1217
1286
  function handleApplyFFTFilter(draft: Draft<State>) {
1287
+ const activeFilterIndex = getActiveFilterIndex(draft);
1218
1288
  const activeSpectrum = getActiveSpectrum(draft);
1219
1289
 
1220
1290
  if (!activeSpectrum) {
@@ -1222,12 +1292,12 @@ function handleApplyFFTFilter(draft: Draft<State>) {
1222
1292
  }
1223
1293
 
1224
1294
  const { index } = activeSpectrum;
1225
- const activeFilterIndex = getActiveFilterIndex(draft);
1226
1295
 
1227
1296
  //apply filter into the spectrum
1228
1297
  Filters1DManager.applyFilters(
1229
1298
  activeFilterIndex !== -1 ? draft.tempData[index] : draft.data[index],
1230
1299
  [{ name: 'fft', value: {} }],
1300
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1231
1301
  );
1232
1302
 
1233
1303
  if (activeFilterIndex !== -1) {
@@ -1265,9 +1335,11 @@ function applyFFTTwoDimensionFilter(
1265
1335
  const targetSpectrum =
1266
1336
  activeFilterIndex !== -1 ? draft.tempData[index] : draft.data[index];
1267
1337
 
1268
- Filters2DManager.applyFilters(targetSpectrum, [
1269
- { name: filterName, value: {} },
1270
- ]);
1338
+ Filters2DManager.applyFilters(
1339
+ targetSpectrum,
1340
+ [{ name: filterName, value: {} }],
1341
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1342
+ );
1271
1343
 
1272
1344
  if (activeFilterIndex !== -1) {
1273
1345
  draft.data[index] = draft.tempData[index];
@@ -1312,17 +1384,22 @@ function handleApplyManualPhaseCorrectionFilter(
1312
1384
  if (!activeSpectrum || !draft.tempData) {
1313
1385
  return;
1314
1386
  }
1387
+ const activeFilterIndex = getActiveFilterIndex(draft);
1315
1388
 
1316
1389
  const { index } = activeSpectrum;
1317
1390
  const { ph0, ph1 } = action.payload;
1318
1391
  draft.data = draft.tempData;
1319
1392
 
1320
- Filters1DManager.applyFilters(draft.tempData[index], [
1321
- {
1322
- name: 'phaseCorrection',
1323
- value: { ph0, ph1 },
1324
- },
1325
- ]);
1393
+ Filters1DManager.applyFilters(
1394
+ draft.tempData[index],
1395
+ [
1396
+ {
1397
+ name: 'phaseCorrection',
1398
+ value: { ph0, ph1 },
1399
+ },
1400
+ ],
1401
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1402
+ );
1326
1403
  draft.data[index] = draft.tempData[index];
1327
1404
 
1328
1405
  updateView(draft, phaseCorrection.domainUpdateRules);
@@ -1457,15 +1534,20 @@ function handleApplyAbsoluteFilter(draft: Draft<State>) {
1457
1534
  if (!activeSpectrum || !draft.tempData) {
1458
1535
  return;
1459
1536
  }
1537
+ const activeFilterIndex = getActiveFilterIndex(draft);
1460
1538
 
1461
1539
  const { index } = activeSpectrum;
1462
1540
 
1463
- Filters1DManager.applyFilters(draft.tempData[index], [
1464
- {
1465
- name: 'phaseCorrection',
1466
- value: { absolute: true },
1467
- },
1468
- ]);
1541
+ Filters1DManager.applyFilters(
1542
+ draft.tempData[index],
1543
+ [
1544
+ {
1545
+ name: 'phaseCorrection',
1546
+ value: { absolute: true },
1547
+ },
1548
+ ],
1549
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1550
+ );
1469
1551
  draft.data[index] = draft.tempData[index];
1470
1552
 
1471
1553
  updateView(draft, phaseCorrection.domainUpdateRules);
@@ -1478,15 +1560,19 @@ function handleApplyAutoPhaseCorrectionFilter(draft: Draft<State>) {
1478
1560
  if (!activeSpectrum || !draft.tempData) {
1479
1561
  return;
1480
1562
  }
1481
-
1563
+ const activeFilterIndex = getActiveFilterIndex(draft);
1482
1564
  const { index } = activeSpectrum;
1483
1565
 
1484
- Filters1DManager.applyFilters(draft.tempData[index], [
1485
- {
1486
- name: 'phaseCorrection',
1487
- value: {},
1488
- },
1489
- ]);
1566
+ Filters1DManager.applyFilters(
1567
+ draft.tempData[index],
1568
+ [
1569
+ {
1570
+ name: 'phaseCorrection',
1571
+ value: {},
1572
+ },
1573
+ ],
1574
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1575
+ );
1490
1576
 
1491
1577
  draft.data[index] = draft.tempData[index];
1492
1578
 
@@ -1503,19 +1589,24 @@ function handleBaseLineCorrectionFilter(
1503
1589
  if (!activeSpectrum || !draft.tempData) {
1504
1590
  return;
1505
1591
  }
1592
+ const activeFilterIndex = getActiveFilterIndex(draft);
1506
1593
 
1507
1594
  const { index } = activeSpectrum;
1508
1595
  const { zones } = draft.toolOptions.data.baselineCorrection;
1509
1596
  const { options } = action.payload;
1510
- Filters1DManager.applyFilters(draft.tempData[index], [
1511
- {
1512
- name: 'baselineCorrection',
1513
- value: {
1514
- ...options,
1515
- zones,
1516
- },
1517
- } as Extract<Filter1D, { name: 'baseLineCorrection' }>,
1518
- ]);
1597
+ Filters1DManager.applyFilters(
1598
+ draft.tempData[index],
1599
+ [
1600
+ {
1601
+ name: 'baselineCorrection',
1602
+ value: {
1603
+ ...options,
1604
+ zones,
1605
+ },
1606
+ } as Extract<Filter1D, { name: 'baseLineCorrection' }>,
1607
+ ],
1608
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1609
+ );
1519
1610
  draft.data[index] = draft.tempData[index];
1520
1611
 
1521
1612
  updateView(draft, baselineCorrection.domainUpdateRules);
@@ -1753,13 +1844,18 @@ function handleApplyExclusionZone(
1753
1844
  if (!isSpectrum1D(datum)) {
1754
1845
  return;
1755
1846
  }
1847
+ const activeFilterIndex = getActiveFilterIndex(draft);
1756
1848
 
1757
- Filters1DManager.applyFilters(datum, [
1758
- {
1759
- name: 'exclusionZones',
1760
- value: zones,
1761
- },
1762
- ]);
1849
+ Filters1DManager.applyFilters(
1850
+ datum,
1851
+ [
1852
+ {
1853
+ name: 'exclusionZones',
1854
+ value: zones,
1855
+ },
1856
+ ],
1857
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
1858
+ );
1763
1859
 
1764
1860
  const { updateXDomain, updateYDomain } = exclusionZones.domainUpdateRules;
1765
1861
 
@@ -1978,17 +2074,22 @@ function handleApplyManualTowDimensionsPhaseCorrectionFilter(
1978
2074
  if (!activeSpectrum || !draft.tempData) {
1979
2075
  return;
1980
2076
  }
2077
+ const activeFilterIndex = getActiveFilterIndex(draft);
1981
2078
 
1982
2079
  const { index } = activeSpectrum;
1983
2080
  draft.data = draft.tempData;
1984
2081
  const filterOptions = getTwoDimensionsPhaseCorrectionOptions(draft);
1985
2082
 
1986
- Filters2DManager.applyFilters(draft.tempData[index], [
1987
- {
1988
- name: 'phaseCorrectionTwoDimensions',
1989
- value: filterOptions,
1990
- },
1991
- ]);
2083
+ Filters2DManager.applyFilters(
2084
+ draft.tempData[index],
2085
+ [
2086
+ {
2087
+ name: 'phaseCorrectionTwoDimensions',
2088
+ value: filterOptions,
2089
+ },
2090
+ ],
2091
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
2092
+ );
1992
2093
  draft.data[index] = draft.tempData[index];
1993
2094
 
1994
2095
  updateView(draft, phaseCorrectionTwoDimensions.domainUpdateRules);
@@ -2003,15 +2104,20 @@ function handleApplyAutoPhaseCorrectionTwoDimensionsFilter(
2003
2104
  if (!activeSpectrum || !draft.tempData) {
2004
2105
  return;
2005
2106
  }
2107
+ const activeFilterIndex = getActiveFilterIndex(draft);
2006
2108
 
2007
2109
  const { index } = activeSpectrum;
2008
2110
 
2009
- Filters2DManager.applyFilters(draft.tempData[index], [
2010
- {
2011
- name: 'phaseCorrectionTwoDimensions',
2012
- value: {},
2013
- },
2014
- ]);
2111
+ Filters2DManager.applyFilters(
2112
+ draft.tempData[index],
2113
+ [
2114
+ {
2115
+ name: 'phaseCorrectionTwoDimensions',
2116
+ value: {},
2117
+ },
2118
+ ],
2119
+ { filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
2120
+ );
2015
2121
 
2016
2122
  draft.data[index] = draft.tempData[index];
2017
2123
 
@@ -148,10 +148,11 @@ function handleResetSelectedTool(draft: Draft<State>) {
148
148
  resetSelectedTool(draft);
149
149
  }
150
150
  function resetSelectedTool(draft: Draft<State>) {
151
- if (
152
- draft.toolOptions.selectedTool &&
153
- Tools[draft.toolOptions.selectedTool].isFilter
154
- ) {
151
+ const {
152
+ selectedTool,
153
+ data: { activeFilterID },
154
+ } = draft.toolOptions;
155
+ if ((selectedTool && Tools[selectedTool].isFilter) || activeFilterID) {
155
156
  resetTool(draft, { reset: true, toolId: draft.toolOptions.selectedTool });
156
157
  }
157
158
  }
@@ -29,6 +29,7 @@ export const assignment: InnerWorkspace = {
29
29
  phaseCorrection: true,
30
30
  baselineCorrection: true,
31
31
  autoRangeAndZonePicking: true,
32
+ inset: true,
32
33
  },
33
34
  },
34
35
  };
@@ -35,6 +35,7 @@ export const basic: InnerWorkspace = {
35
35
  autoRangeAndZonePicking: true,
36
36
  fftDimension1: true,
37
37
  fftDimension2: true,
38
+ inset: true,
38
39
  },
39
40
  },
40
41
  };
@@ -46,6 +46,7 @@ export const embedded: InnerWorkspace = {
46
46
  autoRangeAndZonePicking: true,
47
47
  fftDimension1: true,
48
48
  fftDimension2: true,
49
+ inset: true,
49
50
  },
50
51
  },
51
52
  };
@@ -26,6 +26,7 @@ export const exercise: InnerWorkspace = {
26
26
  spectraStackAlignments: true,
27
27
  fftDimension1: true,
28
28
  fftDimension2: true,
29
+ inset: true,
29
30
  },
30
31
  },
31
32
  general: {
@@ -46,6 +46,7 @@ export const prediction: InnerWorkspace = {
46
46
  autoRangeAndZonePicking: true,
47
47
  fftDimension1: true,
48
48
  fftDimension2: true,
49
+ inset: true,
49
50
  },
50
51
  },
51
52
  nuclei: [],
@@ -32,6 +32,7 @@ export const process1D: InnerWorkspace = {
32
32
  autoRangeAndZonePicking: true,
33
33
  fftDimension1: true,
34
34
  fftDimension2: true,
35
+ inset: true,
35
36
  },
36
37
  },
37
38
  };
@@ -59,6 +59,7 @@ export const workspaceDefaultProperties: Required<WorkspacePreferences> = {
59
59
  autoRangeAndZonePicking: false,
60
60
  fftDimension1: false,
61
61
  fftDimension2: false,
62
+ inset: false,
62
63
  },
63
64
  },
64
65
 
@@ -10,7 +10,8 @@ import type {
10
10
  PredictionBase2D,
11
11
  } from 'nmr-processing';
12
12
  import {
13
- getFrequency,
13
+ calculateRelativeFrequency,
14
+ getRelativeFrequency,
14
15
  predict,
15
16
  signals2DToZ,
16
17
  signalsToRanges,
@@ -254,7 +255,10 @@ function generated1DSpectrum(params: {
254
255
  frequency: freq,
255
256
  } = options;
256
257
  const SpectrumName = generateName(name, { frequency: freq, experiment });
257
- const frequency = calculateFrequency(nucleus, freq);
258
+ const frequency = getRelativeFrequency(nucleus, {
259
+ frequency: freq,
260
+ nucleus,
261
+ });
258
262
  const { x, y } = signalsToXY(signals, {
259
263
  ...options['1d'][nucleus],
260
264
  frequency,
@@ -294,7 +298,7 @@ function generated1DSpectrum(params: {
294
298
  {},
295
299
  );
296
300
  datum.ranges.values = mapRanges(
297
- signalsToRanges(joinedSignals, { frequency: frequency as number }),
301
+ signalsToRanges(joinedSignals, { frequency }),
298
302
  datum,
299
303
  );
300
304
  updateIntegralsRelativeValues(datum);
@@ -335,7 +339,7 @@ function generated2DSpectrum(params: {
335
339
  const yOption = options['1d'][nuclei[1]];
336
340
 
337
341
  const width = get2DWidth(nuclei);
338
- const frequency = calculateFrequency(nuclei, options.frequency);
342
+ const frequency = calculateRelativeFrequency(nuclei, options.frequency);
339
343
 
340
344
  const minMaxContent = signals2DToZ(signals, {
341
345
  from: { x: xOption.from, y: yOption.from },
@@ -399,22 +403,3 @@ function getSpectralWidth(experiment: string, options: PredictionOptions) {
399
403
  return [];
400
404
  }
401
405
  }
402
-
403
- function calculateFrequency(
404
- nucleus: string | string[],
405
- frequency: number,
406
- ): number | number[] {
407
- if (typeof nucleus === 'string') {
408
- return getFrequency(nucleus, { nucleus: '1H', frequency });
409
- } else if (nucleus[0] === nucleus[1]) {
410
- return [frequency, frequency];
411
- } else {
412
- return [
413
- frequency,
414
- getFrequency(nucleus[1], {
415
- nucleus: nucleus[0],
416
- frequency,
417
- }),
418
- ];
419
- }
420
- }
@@ -214,5 +214,5 @@ export async function exportForCT(options: ExportForCTOptions) {
214
214
  await zip.add(`${molFileName}.mol`, new TextReader(molecule.toMolfile()));
215
215
 
216
216
  const blob = await zip.close();
217
- fileSaver.saveAs(blob, name);
217
+ fileSaver.saveAs(blob, `${name}.zip`);
218
218
  }