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.
- package/lib/component/1d/ApodizationLine.js +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +1 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +5 -5
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +89 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
- package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -6
- package/lib/component/reducer/Reducer.js +30 -6
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +1 -0
- package/lib/component/toolbar/ToolTypes.js +36 -0
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +5 -5
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
- package/lib-cjs/component/reducer/Reducer.js +29 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /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:
|
|
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
|
-
|
|
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
|
|
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
|
|
17
|
+
padding: '0 5px',
|
|
18
18
|
whiteSpace: 'nowrap',
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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'
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
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'
|
|
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:
|
|
66
|
-
declare function handleCalculateApodizationFilter(draft: Draft<State>, action:
|
|
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:
|
|
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
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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 {
|
|
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
|
|
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
|
-
...
|
|
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
|
-
|
|
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
|
-
|
|
33
|
+
declare function handleCutIntegral(draft: Draft<State>, action: CutIntegralAction): void;
|
|
34
|
+
export { handleCutIntegral, handleChangeIntegralSum, handleAddIntegral, handleDeleteIntegral, handleChangeIntegral, handleChangeIntegralsRelativeValue, handleChangeIntegralsSumFlag, };
|