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
@@ -13,7 +13,7 @@ import useSpectrum from '../../hooks/useSpectrum';
13
13
  import { zoneStateInit } from '../../reducer/Reducer';
14
14
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
15
15
  import NoTableData from '../extra/placeholder/NoTableData';
16
- import DefaultPanelHeader from '../header/DefaultPanelHeader';
16
+ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
17
17
  import PreferencesHeader from '../header/PreferencesHeader';
18
18
  import ZonesPreferences from './ZonesPreferences';
19
19
  import ZonesTable from './ZonesTable';
@@ -131,6 +131,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
131
131
  const handleSetShowPeaks = () => {
132
132
  dispatch({ type: 'SHOW_ZONES_PEAKS', payload: { id } });
133
133
  };
134
+ const counter = zones?.values?.length || 0;
134
135
  return (_jsxs("div", { css: [
135
136
  tablePanelStyle,
136
137
  style,
@@ -140,7 +141,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, experiment, showZ
140
141
  position: relative;
141
142
  }
142
143
  `,
143
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: zones.values ? zones.values.length : 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', filterIsActive: filterIsActive, counterFiltered: tableData?.length, showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: `Remove all assignments`, popupPlacement: "right", children: _jsx("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: _jsx(FaUnlink, {}) }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide zones", popupPlacement: "right", value: showZones, onClick: handleSetShowZones, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide signals", popupPlacement: "right", value: showSignals, onClick: handleSetShowSignals, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide peaks", popupPlacement: "right", value: showPeaks, onClick: handleSetShowPeaks, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: tableData && tableData.length > 0 ? (_jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
144
+ ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && tableData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: `Remove all assignments`, popupPlacement: "right", children: _jsx("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: _jsx(FaUnlink, {}) }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide zones", popupPlacement: "right", value: showZones, onClick: handleSetShowZones, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide signals", popupPlacement: "right", value: showSignals, onClick: handleSetShowSignals, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide peaks", popupPlacement: "right", value: showPeaks, onClick: handleSetShowPeaks, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: tableData && tableData.length > 0 ? (_jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nuclei: activeTab && activeTab.split(',').length === 2
144
145
  ? activeTab.split(',')
145
146
  : ['?', '?'], experiment: experiment })) : (_jsx(NoTableData, {})) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
146
147
  }
@@ -23,7 +23,7 @@ function ZonesPreferences(props, ref) {
23
23
  const nuclei = useMemo(() => getUniqueNuclei(nucleus), [nucleus]);
24
24
  const zonesPreferences = usePanelPreferencesByNuclei('zones', nuclei);
25
25
  useEffect(() => {
26
- formRef.current?.setValues(zonesPreferences);
26
+ void formRef.current?.setValues(zonesPreferences);
27
27
  }, [zonesPreferences]);
28
28
  const saveHandler = useCallback((values) => {
29
29
  preferences.dispatch({
@@ -1,21 +1,20 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  interface DefaultPanelHeaderProps {
3
3
  counter?: number;
4
- counterFiltered?: number;
4
+ counterLabel?: string;
5
5
  deleteToolTip?: string;
6
6
  filterToolTip?: string;
7
7
  onDelete?: () => void;
8
8
  onFilter?: () => void;
9
9
  onSettingClick?: () => void;
10
- filterIsActive?: boolean;
11
10
  canDelete?: boolean;
12
11
  disableDelete?: boolean;
13
12
  showSettingButton?: boolean;
14
- showCounter?: boolean;
15
13
  children?: ReactNode;
16
14
  style?: CSSProperties;
17
15
  className?: string;
18
16
  renderRightButtons?: () => ReactNode;
19
17
  }
20
- declare function DefaultPanelHeader({ counter, onDelete, deleteToolTip, onFilter, filterToolTip, filterIsActive, counterFiltered, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function createFilterLabel(total: number, counter: number | false): string;
19
+ declare function DefaultPanelHeader({ counter, counterLabel, onDelete, deleteToolTip, onFilter, filterToolTip, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
21
20
  export default DefaultPanelHeader;
@@ -14,13 +14,17 @@ const styles = {
14
14
  margin: 0,
15
15
  textAlign: 'right',
16
16
  lineHeight: '22px',
17
- padding: '0 10px',
17
+ padding: '0 5px',
18
18
  whiteSpace: 'nowrap',
19
19
  },
20
20
  };
21
- function DefaultPanelHeader({ counter, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', filterIsActive = false, counterFiltered = 0, children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
22
- return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, defaultValue: filterIsActive, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counter !== undefined && (_jsxs("p", { style: styles.counterLabel, children: ["[", ' ', filterIsActive && counterFiltered !== undefined
23
- ? `${counterFiltered}/${counter}`
24
- : counter, ' ', "]"] })), showSettingButton && (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
21
+ export function createFilterLabel(total, counter) {
22
+ if (typeof counter === 'boolean') {
23
+ return `[ ${total || 0} ]`;
24
+ }
25
+ return `[ ${counter}/${total} ]`;
26
+ }
27
+ function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
28
+ return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && _jsx("p", { style: styles.counterLabel, children: counterLabel }), showSettingButton && (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
25
29
  }
26
30
  export default DefaultPanelHeader;
@@ -72,7 +72,7 @@ export default function PredictionPanel() {
72
72
  }
73
73
  const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
74
74
  try {
75
- const data = await predictSpectra(molfile);
75
+ const data = await predictSpectra(molfile, predictionPreferences.spectra);
76
76
  dispatch({
77
77
  type: 'PREDICT_SPECTRA',
78
78
  payload: {
@@ -37,7 +37,6 @@ function PredictionSimpleOptions() {
37
37
  display: 'flex',
38
38
  justifyContent: 'flex-end',
39
39
  flex: '1',
40
- padding: '0 10px',
41
40
  height: '100%',
42
41
  }, children: [_jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "1d.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] }), _jsx(FormikOnChange, { enableValidation: true, onChange: optionsChangeHandler })] }) }));
43
42
  }
@@ -64,7 +64,7 @@ export default function SpectrumSimulation() {
64
64
  }
65
65
  function saveSettingsHandler(values) {
66
66
  simulateHandler(values);
67
- formRef.current?.setValues(values);
67
+ void formRef.current?.setValues(values);
68
68
  }
69
69
  return (_jsx(Formik, { initialValues: { ...defaultSimulationOptions, data }, enableReinitialize: true,
70
70
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -20,6 +20,5 @@ export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, sp
20
20
  display: 'flex',
21
21
  justifyContent: 'flex-end',
22
22
  flex: '1',
23
- padding: '0 10px',
24
- }, children: [_jsx(Label, { title: "Spin system", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
23
+ }, children: [_jsx(Label, { title: "", style: labelStyle, children: _jsx(Select, { items: SPIN_SYSTEMS, style: selectStyles, onChange: onSpinSystemChange, value: spinSystem }) }), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikNumberInput, { name: "options.lineWidth", type: "number", style: { margin: 0, width: '40px' } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
25
24
  }
@@ -19,7 +19,6 @@ const ignoreActions = new Set([
19
19
  'CHANGE_SPECTRUM_VISIBILITY',
20
20
  'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS',
21
21
  'CHANGE_ACTIVE_SPECTRUM',
22
- 'SET_MOUSE_OVER_DISPLAYER',
23
22
  'CHANGE_FLOAT_MOLECULE_POSITION',
24
23
  'ALIGN_SPECTRA',
25
24
  'TOGGLE_REAL_IMAGINARY_VISIBILITY',
@@ -162,12 +162,6 @@ export interface State {
162
162
  zoom: {
163
163
  history: ZoomHistory;
164
164
  };
165
- /**
166
- * boolean indicator to check if the mouse over the displayer or not
167
- * value change to true once the mouse come over the displayer and vice versa true once the mouse out of the displayer
168
- * @default false
169
- */
170
- overDisplayer: boolean;
171
165
  /**
172
166
  * Basic options for the tools
173
167
  */
@@ -193,6 +187,7 @@ export interface State {
193
187
  baselineCorrection: {
194
188
  zones: BaselineCorrectionZone[];
195
189
  options: any;
190
+ livePreview: boolean;
196
191
  };
197
192
  apodizationOptions: ApodizationOptions;
198
193
  /**
@@ -1,5 +1,5 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
- import { produce } from 'immer';
2
+ import { produce, original } from 'immer';
3
3
  import { buildCorrelationData } from 'nmr-correlation';
4
4
  import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants';
5
5
  import * as AssignmentsActions from './actions/AssignmentsActions';
@@ -8,7 +8,6 @@ import * as DatabaseActions from './actions/DatabaseActions';
8
8
  import * as DimensionsActions from './actions/DimensionsActions';
9
9
  import * as DomainActions from './actions/DomainActions';
10
10
  import * as FiltersActions from './actions/FiltersActions';
11
- import * as GlobalActions from './actions/GlobalActions';
12
11
  import * as IntegralsActions from './actions/IntegralsActions';
13
12
  import * as LoadActions from './actions/LoadActions';
14
13
  import * as MoleculeActions from './actions/MoleculeActions';
@@ -92,7 +91,6 @@ export const getInitialState = () => ({
92
91
  zoom: {
93
92
  history: {},
94
93
  },
95
- overDisplayer: false,
96
94
  toolOptions: {
97
95
  selectedTool: 'zoom',
98
96
  selectedOptionPanel: null,
@@ -100,6 +98,7 @@ export const getInitialState = () => ({
100
98
  baselineCorrection: {
101
99
  options: {},
102
100
  zones: [],
101
+ livePreview: true,
103
102
  },
104
103
  apodizationOptions: {},
105
104
  pivot: { value: 0, index: 0 },
@@ -149,6 +148,8 @@ function innerSpectrumReducer(draft, action) {
149
148
  return PeaksActions.handleChangePeakShape(draft, action);
150
149
  case 'TOGGLE_PEAKS_VIEW_PROPERTY':
151
150
  return PeaksActions.handleTogglePeaksViewProperty(draft, action);
151
+ case 'TOGGLE_PEAKS_DISPLAYING_MODE':
152
+ return PeaksActions.handleChangePeaksDisplayingMode(draft);
152
153
  case 'ADD_INTEGRAL':
153
154
  return IntegralsActions.handleAddIntegral(draft, action);
154
155
  case 'DELETE_INTEGRAL':
@@ -162,6 +163,8 @@ function innerSpectrumReducer(draft, action) {
162
163
  return IntegralsActions.handleChangeIntegralsSumFlag(draft);
163
164
  case 'CHANGE_INTEGRAL_RELATIVE':
164
165
  return IntegralsActions.handleChangeIntegralsRelativeValue(draft, action);
166
+ case 'CUT_INTEGRAL':
167
+ return IntegralsActions.handleCutIntegral(draft, action);
165
168
  case 'SET_X_DOMAIN':
166
169
  return DomainActions.handleSetXDomain(draft, action);
167
170
  case 'SET_Y_DOMAIN':
@@ -182,6 +185,10 @@ function innerSpectrumReducer(draft, action) {
182
185
  return FiltersActions.handleCalculateZeroFillingFilter(draft, action);
183
186
  case 'APPLY_FFT_FILTER':
184
187
  return FiltersActions.handleApplyFFTFilter(draft);
188
+ case 'APPLY_FFT_DIMENSION_1_FILTER':
189
+ return FiltersActions.handleApplyFFtDimension1Filter(draft);
190
+ case 'APPLY_FFT_DIMENSION_2_FILTER':
191
+ return FiltersActions.handleApplyFFtDimension2Filter(draft);
185
192
  case 'APPLY_MANUAL_PHASE_CORRECTION_FILTER':
186
193
  return FiltersActions.handleApplyManualPhaseCorrectionFilter(draft, action);
187
194
  case 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER':
@@ -328,6 +335,8 @@ function innerSpectrumReducer(draft, action) {
328
335
  return RangesActions.handleAutoSpectraRangesDetection(draft);
329
336
  case 'SHOW_J_GRAPH':
330
337
  return RangesActions.handleShowJGraph(draft, action);
338
+ case 'CUT_RANGE':
339
+ return RangesActions.handleCutRange(draft, action);
331
340
  case 'SET_KEY_PREFERENCES':
332
341
  return PreferencesActions.handleSetKeyPreferences(draft, action);
333
342
  case 'APPLY_KEY_PREFERENCES':
@@ -370,15 +379,30 @@ function innerSpectrumReducer(draft, action) {
370
379
  return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
371
380
  case 'SET_AUTOMATIC_ASSIGNMENTS':
372
381
  return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
373
- case 'SET_MOUSE_OVER_DISPLAYER':
374
- return GlobalActions.handleSetIsOverDisplayer(draft, action);
375
382
  default:
376
383
  }
377
384
  }
378
385
  catch (error) {
379
386
  draft.errorAction = error;
380
- error.data = { action };
387
+ error.data = { action, state: getDebugState(draft) };
381
388
  reportError(error);
382
389
  }
383
390
  }
384
391
  export const spectrumReducer = produce(innerSpectrumReducer);
392
+ function getDebugState(draft) {
393
+ const state = original(draft);
394
+ const string = JSON.stringify(state, (key, value) => {
395
+ if (ArrayBuffer.isView(value)) {
396
+ return Array.from(value).slice(0, 20);
397
+ }
398
+ if (Array.isArray(value) && typeof value[0] === 'number') {
399
+ return value.slice(0, 20);
400
+ }
401
+ return value;
402
+ });
403
+ if (string.length > 800000) {
404
+ // fallback, better to have something as a string t han nothing
405
+ return string.slice(0, 800000);
406
+ }
407
+ return JSON.parse(string);
408
+ }
@@ -7,18 +7,37 @@ import { ActionType } from '../types/ActionType';
7
7
  type ShiftSpectrumAlongXAxisAction = ActionType<'SHIFT_SPECTRUM', {
8
8
  shift: number;
9
9
  }>;
10
- type ApodizationFilterAction = ActionType<'APPLY_APODIZATION_FILTER' | 'CALCULATE_APODIZATION_FILTER', ApodizationOptions>;
11
- type ZeroFillingFilterAction = ActionType<'APPLY_ZERO_FILLING_FILTER' | 'CALCULATE_ZERO_FILLING_FILTER', {
12
- nbPoints: number;
10
+ type ApodizationFilterAction = ActionType<'APPLY_APODIZATION_FILTER', {
11
+ options: ApodizationOptions;
12
+ }>;
13
+ type ApodizationFilterLiveAction = ActionType<'CALCULATE_APODIZATION_FILTER', {
14
+ options: ApodizationOptions;
15
+ livePreview: boolean;
16
+ }>;
17
+ type ZeroFillingFilterAction = ActionType<'APPLY_ZERO_FILLING_FILTER', {
18
+ options: {
19
+ nbPoints: number;
20
+ };
21
+ }>;
22
+ type ZeroFillingFilterLiveAction = ActionType<'CALCULATE_ZERO_FILLING_FILTER', {
23
+ options: {
24
+ nbPoints: number;
25
+ };
26
+ livePreview: boolean;
13
27
  }>;
14
28
  type ManualPhaseCorrectionFilterAction = ActionType<'APPLY_MANUAL_PHASE_CORRECTION_FILTER' | 'CALCULATE_MANUAL_PHASE_CORRECTION_FILTER', {
15
29
  ph0: number;
16
30
  ph1: number;
17
31
  }>;
18
- type BaselineCorrectionFilterProps = Omit<BaselineCorrectionOptions, 'zones'> & {
32
+ type BaselineCorrectionFilterOptions = Omit<BaselineCorrectionOptions, 'zones'>;
33
+ interface BaselineCorrectionFilterProps {
34
+ options: BaselineCorrectionFilterOptions;
19
35
  livePreview: boolean;
20
- };
21
- type BaselineCorrectionFilterAction = ActionType<'APPLY_BASE_LINE_CORRECTION_FILTER' | 'CALCULATE_BASE_LINE_CORRECTION_FILTER', BaselineCorrectionFilterProps>;
36
+ }
37
+ type BaselineCorrectionFilterAction = ActionType<'APPLY_BASE_LINE_CORRECTION_FILTER', {
38
+ options: BaselineCorrectionFilterOptions;
39
+ }>;
40
+ type BaselineCorrectionFilterLiveAction = ActionType<'CALCULATE_BASE_LINE_CORRECTION_FILTER', BaselineCorrectionFilterProps>;
22
41
  type EnableFilterAction = ActionType<'ENABLE_FILTER', {
23
42
  id: string;
24
43
  enabled: boolean;
@@ -44,7 +63,7 @@ type DeleteExclusionZoneAction = ActionType<'DELETE_EXCLUSION_ZONE', {
44
63
  type ApplySignalProcessingAction = ActionType<'APPLY_SIGNAL_PROCESSING_FILTER', {
45
64
  options: MatrixOptions;
46
65
  }>;
47
- export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ZeroFillingFilterAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
66
+ export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ApodizationFilterLiveAction | ZeroFillingFilterAction | ZeroFillingFilterLiveAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | BaselineCorrectionFilterLiveAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_FFT_DIMENSION_1_FILTER' | 'APPLY_FFT_DIMENSION_2_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
48
67
  interface RollbackSpectrumByFilterOptions {
49
68
  applyFilter?: boolean;
50
69
  reset?: boolean;
@@ -62,17 +81,19 @@ interface RollbackSpectrumOptions {
62
81
  declare function rollbackSpectrum(draft: Draft<State>, options: RollbackSpectrumOptions): void;
63
82
  declare function handleShiftSpectrumAlongXAxis(draft: Draft<State>, action: ShiftSpectrumAlongXAxisAction): void;
64
83
  declare function handleApplyZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterAction): void;
65
- declare function handleCalculateZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterAction): void;
66
- declare function handleCalculateApodizationFilter(draft: Draft<State>, action: ApodizationFilterAction): void;
84
+ declare function handleCalculateZeroFillingFilter(draft: Draft<State>, action: ZeroFillingFilterLiveAction): void;
85
+ declare function handleCalculateApodizationFilter(draft: Draft<State>, action: ApodizationFilterLiveAction): void;
67
86
  declare function handleApplyApodizationFilter(draft: Draft<State>, action: ApodizationFilterAction): void;
68
87
  declare function handleApplyFFTFilter(draft: Draft<State>): void;
88
+ declare function handleApplyFFtDimension1Filter(draft: Draft<State>): void;
89
+ declare function handleApplyFFtDimension2Filter(draft: Draft<State>): void;
69
90
  declare function handleApplyManualPhaseCorrectionFilter(draft: Draft<State>, action: ManualPhaseCorrectionFilterAction): void;
70
91
  declare function handleCalculateManualPhaseCorrection(draft: Draft<State>, action: ManualPhaseCorrectionFilterAction): void;
71
92
  declare function handleApplyAbsoluteFilter(draft: Draft<State>): void;
72
93
  declare function handleApplyAutoPhaseCorrectionFilter(draft: Draft<State>): void;
73
94
  declare function handleBaseLineCorrectionFilter(draft: Draft<State>, action: BaselineCorrectionFilterAction): void;
74
95
  declare function calculateBaseLineCorrection(draft: Draft<State>, baseLineOptions?: BaselineCorrectionFilterProps): void;
75
- declare function handleCalculateBaseLineCorrection(draft: Draft<State>, action: BaselineCorrectionFilterAction): void;
96
+ declare function handleCalculateBaseLineCorrection(draft: Draft<State>, action: BaselineCorrectionFilterLiveAction): void;
76
97
  declare function handleEnableFilter(draft: Draft<State>, action: EnableFilterAction): void;
77
98
  declare function handleDeleteFilter(draft: Draft<State>, action: DeleteFilterAction): void;
78
99
  declare function handleDeleteSpectraFilter(draft: Draft<State>, action: DeleteSpectraFilterAction): void;
@@ -80,4 +101,4 @@ declare function handleSetFilterSnapshotHandler(draft: Draft<State>, action: Set
80
101
  declare function handleSignalProcessingFilter(draft: Draft<State>, action: ApplySignalProcessingAction): void;
81
102
  declare function handleAddExclusionZone(draft: Draft<State>, action: AddExclusionZoneAction): void;
82
103
  declare function handleDeleteExclusionZone(draft: Draft<State>, action: DeleteExclusionZoneAction): void;
83
- export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
104
+ export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
@@ -13,7 +13,7 @@ import { getStrongestPeak } from '../helper/getStrongestPeak';
13
13
  import { setDomain, setMode } from './DomainActions';
14
14
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
15
15
  import { activateTool, resetSelectedTool } from './ToolsActions';
16
- const { fft, apodization, baselineCorrection, phaseCorrection, zeroFilling, shiftX, shift2DX, shift2DY, exclusionZones, signalProcessing, } = Filters;
16
+ const { fft, fftDimension1, fftDimension2, apodization, baselineCorrection, phaseCorrection, zeroFilling, shiftX, shift2DX, shift2DY, exclusionZones, signalProcessing, } = Filters;
17
17
  function getFilterUpdateDomainRules(filterName) {
18
18
  return (Filters[filterName]?.DOMAIN_UPDATE_RULES || {
19
19
  updateXDomain: false,
@@ -158,6 +158,25 @@ function updateView(draft, filterUpdateDomainRules) {
158
158
  setMode(draft);
159
159
  changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
160
160
  }
161
+ function disableLivePreview(draft, id) {
162
+ const activeSpectrum = getActiveSpectrum(draft);
163
+ if (activeSpectrum) {
164
+ const index = activeSpectrum.index;
165
+ const { data } = draft.tempData[index];
166
+ draft.data[index].data = data;
167
+ setDomain(draft);
168
+ // reset default options
169
+ switch (id) {
170
+ case apodization.name: {
171
+ draft.toolOptions.data.apodizationOptions = defaultApodizationOptions;
172
+ break;
173
+ }
174
+ default: {
175
+ return null;
176
+ }
177
+ }
178
+ }
179
+ }
161
180
  //action
162
181
  function handleShiftSpectrumAlongXAxis(draft, action) {
163
182
  //apply filter into the spectrum
@@ -190,7 +209,7 @@ function handleApplyZeroFillingFilter(draft, action) {
190
209
  const filters = [
191
210
  {
192
211
  name: zeroFilling.id,
193
- value: action.payload,
212
+ value: action.payload.options,
194
213
  },
195
214
  ];
196
215
  FiltersManager.applyFilter(draft.data[index], filters, {
@@ -212,16 +231,22 @@ function handleApplyZeroFillingFilter(draft, action) {
212
231
  function handleCalculateZeroFillingFilter(draft, action) {
213
232
  const activeSpectrum = getActiveSpectrum(draft);
214
233
  if (activeSpectrum) {
215
- const index = activeSpectrum.index;
216
- const { data: { x, re, im }, filters, info, } = draft.tempData[index];
217
- const _data = { data: { x, re, im }, filters, info };
218
- zeroFilling.apply(_data, action.payload);
219
- const { im: newIm, re: newRe, x: newX } = _data.data;
220
- const datum = draft.data[index];
221
- datum.data.x = newX;
222
- datum.data.im = newIm;
223
- datum.data.re = newRe;
224
- draft.xDomain = [newX[0], newX.at(-1)];
234
+ const { options, livePreview } = action.payload;
235
+ if (livePreview) {
236
+ const index = activeSpectrum.index;
237
+ const { data: { x, re, im }, filters, info, } = draft.tempData[index];
238
+ const _data = { data: { x, re, im }, filters, info };
239
+ zeroFilling.apply(_data, options);
240
+ const { im: newIm, re: newRe, x: newX } = _data.data;
241
+ const datum = draft.data[index];
242
+ datum.data.x = newX;
243
+ datum.data.im = newIm;
244
+ datum.data.re = newRe;
245
+ draft.xDomain = [newX[0], newX.at(-1)];
246
+ }
247
+ else {
248
+ disableLivePreview(draft, zeroFilling.name);
249
+ }
225
250
  }
226
251
  }
227
252
  //action
@@ -229,15 +254,20 @@ function handleCalculateApodizationFilter(draft, action) {
229
254
  const activeSpectrum = getActiveSpectrum(draft);
230
255
  if (activeSpectrum) {
231
256
  const index = activeSpectrum.index;
232
- const options = action.payload;
233
- const { data: { x, re, im }, info, } = draft.tempData[index];
234
- const _data = { data: { x, re, im }, info };
235
- draft.toolOptions.data.apodizationOptions = options;
236
- apodization.apply(_data, options);
237
- const { im: newIm, re: newRe } = _data.data;
238
- const datum = draft.data[index];
239
- datum.data.im = newIm;
240
- datum.data.re = newRe;
257
+ const { livePreview, options } = action.payload;
258
+ if (livePreview) {
259
+ const { data: { x, re, im }, info, } = draft.tempData[index];
260
+ const _data = { data: { x, re, im }, info };
261
+ draft.toolOptions.data.apodizationOptions = options;
262
+ apodization.apply(_data, options);
263
+ const { im: newIm, re: newRe } = _data.data;
264
+ const datum = draft.data[index];
265
+ datum.data.im = newIm;
266
+ datum.data.re = newRe;
267
+ }
268
+ else {
269
+ disableLivePreview(draft, apodization.name);
270
+ }
241
271
  }
242
272
  }
243
273
  //action
@@ -249,7 +279,7 @@ function handleApplyApodizationFilter(draft, action) {
249
279
  FiltersManager.applyFilter(draft.data[index], [
250
280
  {
251
281
  name: apodization.id,
252
- value: action.payload,
282
+ value: action.payload.options,
253
283
  },
254
284
  ], { filterIndex: activeFilterIndex });
255
285
  if (activeFilterIndex !== -1) {
@@ -283,6 +313,42 @@ function handleApplyFFTFilter(draft) {
283
313
  }
284
314
  }
285
315
  }
316
+ function handleApplyFFtDimension1Filter(draft) {
317
+ const activeSpectrum = getActiveSpectrum(draft);
318
+ if (activeSpectrum) {
319
+ const { index } = activeSpectrum;
320
+ const activeFilterIndex = getActiveFilterIndex(draft);
321
+ //apply filter into the spectrum
322
+ FiltersManager.applyFilter(draft.data[index], [{ name: fftDimension1.id, value: {} }], { filterIndex: activeFilterIndex });
323
+ if (activeFilterIndex !== -1) {
324
+ rollbackSpectrumByFilter(draft, {
325
+ searchBy: 'name',
326
+ key: fftDimension1.id,
327
+ });
328
+ }
329
+ else {
330
+ updateView(draft, fftDimension1.DOMAIN_UPDATE_RULES);
331
+ }
332
+ }
333
+ }
334
+ function handleApplyFFtDimension2Filter(draft) {
335
+ const activeSpectrum = getActiveSpectrum(draft);
336
+ if (activeSpectrum) {
337
+ const { index } = activeSpectrum;
338
+ const activeFilterIndex = getActiveFilterIndex(draft);
339
+ //apply filter into the spectrum
340
+ FiltersManager.applyFilter(draft.data[index], [{ name: fftDimension2.id, value: {} }], { filterIndex: activeFilterIndex });
341
+ if (activeFilterIndex !== -1) {
342
+ rollbackSpectrumByFilter(draft, {
343
+ searchBy: 'name',
344
+ key: fftDimension2.id,
345
+ });
346
+ }
347
+ else {
348
+ updateView(draft, fftDimension2.DOMAIN_UPDATE_RULES);
349
+ }
350
+ }
351
+ }
286
352
  //action
287
353
  function handleApplyManualPhaseCorrectionFilter(draft, action) {
288
354
  const activeSpectrum = getActiveSpectrum(draft);
@@ -377,7 +443,7 @@ function handleBaseLineCorrectionFilter(draft, action) {
377
443
  const activeSpectrum = getActiveSpectrum(draft);
378
444
  if (activeSpectrum) {
379
445
  const { zones } = draft.toolOptions.data.baselineCorrection;
380
- const { livePreview, ...options } = action.payload;
446
+ const { options } = action.payload;
381
447
  const activeFilterIndex = getActiveFilterIndex(draft);
382
448
  FiltersManager.applyFilter(draft.data[activeSpectrum.index], [
383
449
  {
@@ -408,21 +474,23 @@ function calculateBaseLineCorrection(draft, baseLineOptions) {
408
474
  // save the baseline options temporary
409
475
  draft.toolOptions.data.baselineCorrection = {
410
476
  ...draft.toolOptions.data.baselineCorrection,
411
- ...(baseLineOptions ? { options: baseLineOptions } : {}),
477
+ ...(baseLineOptions && baseLineOptions),
412
478
  };
413
- const { zones, options } = draft.toolOptions.data.baselineCorrection;
414
- const { livePreview, ...filterOptions } = options;
479
+ const { zones, options, livePreview } = draft.toolOptions.data.baselineCorrection;
415
480
  if (livePreview) {
416
481
  const _data = { data: { x, re, im }, info };
417
482
  baselineCorrection.apply(_data, {
418
483
  zones,
419
- ...filterOptions,
484
+ ...options,
420
485
  });
421
486
  const { im: newIm, re: newRe } = _data.data;
422
487
  const datum = draft.data[index];
423
488
  datum.data.im = newIm;
424
489
  datum.data.re = newRe;
425
490
  }
491
+ else {
492
+ disableLivePreview(draft, baselineCorrection.id);
493
+ }
426
494
  }
427
495
  }
428
496
  //action
@@ -567,4 +635,4 @@ function handleDeleteExclusionZone(draft, action) {
567
635
  }
568
636
  }
569
637
  }
570
- export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
638
+ export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, };
@@ -20,11 +20,15 @@ type ChangeIntegralRelativeValueAction = ActionType<'CHANGE_INTEGRAL_RELATIVE',
20
20
  id: string;
21
21
  value: number;
22
22
  }>;
23
- export type IntegralsActions = ChangeIntegralSumAction | AddIntegralAction | DeleteIntegralAction | ChangeIntegralAction | ChangeIntegralRelativeValueAction | ActionType<'CHANGE_INTEGRALS_SUM_FLAG'>;
23
+ type CutIntegralAction = ActionType<'CUT_INTEGRAL', {
24
+ cutValue: number;
25
+ }>;
26
+ export type IntegralsActions = ChangeIntegralSumAction | AddIntegralAction | DeleteIntegralAction | ChangeIntegralAction | ChangeIntegralRelativeValueAction | CutIntegralAction | ActionType<'CHANGE_INTEGRALS_SUM_FLAG'>;
24
27
  declare function handleChangeIntegralSum(draft: Draft<State>, action: ChangeIntegralSumAction): void;
25
28
  declare function handleAddIntegral(draft: Draft<State>, action: AddIntegralAction): void;
26
29
  declare function handleDeleteIntegral(draft: Draft<State>, action: DeleteIntegralAction): void;
27
30
  declare function handleChangeIntegral(draft: Draft<State>, action: ChangeIntegralAction): void;
28
31
  declare function handleChangeIntegralsRelativeValue(draft: Draft<State>, action: ChangeIntegralRelativeValueAction): void;
29
32
  declare function handleChangeIntegralsSumFlag(draft: any): void;
30
- export { handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
33
+ declare function handleCutIntegral(draft: Draft<State>, action: CutIntegralAction): void;
34
+ export { handleCutIntegral, handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };