nmrium 2.3.0 → 2.4.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/peaks/PeakEditionManager.d.ts +1 -1
- package/lib/component/1d-2d/tools/BrushXY.js +6 -6
- package/lib/component/1d-2d/tools/BrushXY.js.map +1 -1
- package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
- package/lib/component/2d/1d-tracer/Left1DChart.js +6 -2
- package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/Ranges1D.d.ts +9 -0
- package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -0
- package/lib/component/2d/1d-tracer/Ranges1D.js +76 -0
- package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -0
- package/lib/component/2d/1d-tracer/Signals1D.d.ts +11 -0
- package/lib/component/2d/1d-tracer/Signals1D.d.ts.map +1 -0
- package/lib/component/2d/1d-tracer/Signals1D.js +90 -0
- package/lib/component/2d/1d-tracer/Signals1D.js.map +1 -0
- package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
- package/lib/component/2d/1d-tracer/Top1DChart.js +6 -2
- package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
- package/lib/component/2d/ft/FTContainer.d.ts.map +1 -1
- package/lib/component/2d/ft/FTContainer.js.map +1 -1
- package/lib/component/AnchorSVG.d.ts +37 -0
- package/lib/component/AnchorSVG.d.ts.map +1 -0
- package/lib/component/AnchorSVG.js +137 -0
- package/lib/component/AnchorSVG.js.map +1 -0
- package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
- package/lib/component/EventsTrackers/BrushTracker.js +4 -0
- package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
- package/lib/component/context/KeyModifierContext.d.ts +1 -0
- package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
- package/lib/component/context/KeyModifierContext.js +4 -0
- package/lib/component/context/KeyModifierContext.js.map +1 -1
- package/lib/component/elements/DraggableDialog.d.ts.map +1 -1
- package/lib/component/elements/DraggableDialog.js +1 -2
- package/lib/component/elements/DraggableDialog.js.map +1 -1
- package/lib/component/elements/Sections.d.ts +3 -3
- package/lib/component/elements/Sections.d.ts.map +1 -1
- package/lib/component/elements/Sections.js +1 -1
- package/lib/component/elements/Sections.js.map +1 -1
- package/lib/component/elements/export/ExportOptionsModal.js +2 -5
- package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
- package/lib/component/header/Header.d.ts.map +1 -1
- package/lib/component/header/Header.js +2 -4
- package/lib/component/header/Header.js.map +1 -1
- package/lib/component/hooks/useSaveSettings.d.ts.map +1 -1
- package/lib/component/hooks/useSaveSettings.js +3 -6
- package/lib/component/hooks/useSaveSettings.js.map +1 -1
- package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
- package/lib/component/modal/PublicationStringModal.js +2 -6
- package/lib/component/modal/PublicationStringModal.js.map +1 -1
- package/lib/component/modal/SaveAsModal.js +3 -6
- package/lib/component/modal/SaveAsModal.js.map +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js +2 -4
- package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts.map +1 -1
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +38 -36
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +9 -12
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +4 -4
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +24 -24
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +24 -24
- package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -9
- package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +9 -9
- package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +7 -0
- package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.js +5 -2
- package/lib/component/panels/filtersPanel/FilterPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
- package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts +2 -0
- package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -0
- package/lib/component/panels/filtersPanel/processings_sections_panel.js +144 -0
- package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -0
- package/lib/component/reducer/Reducer.d.ts.map +1 -1
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/Reducer.js.map +1 -1
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +9 -0
- package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +11 -2
- package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.js +23 -5
- package/lib/component/reducer/actions/RangesActions.js.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +5 -17
- package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
- package/lib/component/reducer/helper/getTraceSpectrumID.d.ts +5 -0
- package/lib/component/reducer/helper/getTraceSpectrumID.d.ts.map +1 -0
- package/lib/component/reducer/helper/getTraceSpectrumID.js +14 -0
- package/lib/component/reducer/helper/getTraceSpectrumID.js.map +1 -0
- package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
- package/lib/component/toolbar/nmr_toolbar.js +3 -1
- package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
- package/lib/component/utility/CoreSlot.d.ts +27 -0
- package/lib/component/utility/CoreSlot.d.ts.map +1 -0
- package/lib/component/utility/CoreSlot.js +56 -0
- package/lib/component/utility/CoreSlot.js.map +1 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +35 -30
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +25 -24
- package/src/component/1d-2d/tools/BrushXY.tsx +8 -8
- package/src/component/2d/1d-tracer/Left1DChart.tsx +24 -1
- package/src/component/2d/1d-tracer/Ranges1D.tsx +134 -0
- package/src/component/2d/1d-tracer/Signals1D.tsx +145 -0
- package/src/component/2d/1d-tracer/Top1DChart.tsx +29 -2
- package/src/component/2d/ft/FTContainer.tsx +1 -0
- package/src/component/AnchorSVG.tsx +370 -0
- package/src/component/EventsTrackers/BrushTracker.tsx +6 -0
- package/src/component/context/KeyModifierContext.tsx +5 -0
- package/src/component/elements/DraggableDialog.tsx +1 -2
- package/src/component/elements/Sections.tsx +4 -4
- package/src/component/elements/export/ExportOptionsModal.tsx +22 -31
- package/src/component/header/Header.tsx +2 -4
- package/src/component/hooks/useSaveSettings.tsx +4 -15
- package/src/component/modal/PublicationStringModal.tsx +5 -11
- package/src/component/modal/SaveAsModal.tsx +41 -50
- package/src/component/modal/aboutUs/AboutUsModal.tsx +5 -4
- package/src/component/modal/editRange/forms/components/NewSignalTab.tsx +57 -57
- package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +23 -29
- package/src/component/panels/PeaksPanel/PeaksPanel.tsx +1 -8
- package/src/component/panels/PeaksPanel/PeaksPreferences.tsx +1 -1
- package/src/component/panels/PeaksPanel/PeaksTable.tsx +11 -9
- package/src/component/panels/SummaryPanel/SummaryPanel.tsx +13 -11
- package/src/component/panels/filtersPanel/FilterPanel.tsx +10 -0
- package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
- package/src/component/panels/filtersPanel/processings_sections_panel.tsx +324 -0
- package/src/component/reducer/Reducer.ts +2 -0
- package/src/component/reducer/actions/CorrelationsActions.ts +1 -1
- package/src/component/reducer/actions/RangesActions.ts +39 -5
- package/src/component/reducer/actions/ToolsActions.ts +5 -21
- package/src/component/reducer/helper/getTraceSpectrumID.tsx +25 -0
- package/src/component/toolbar/nmr_toolbar.tsx +3 -2
- package/src/component/utility/CoreSlot.tsx +126 -0
- package/src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts +1 -0
- package/src/data/data1d/Spectrum1D/peaks/optimizePeaks.ts +35 -30
- package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +1 -0
- package/src/versionInfo.ts +1 -1
- package/lib/component/utility/renderCoreSlot.d.ts +0 -11
- package/lib/component/utility/renderCoreSlot.d.ts.map +0 -1
- package/lib/component/utility/renderCoreSlot.js +0 -13
- package/lib/component/utility/renderCoreSlot.js.map +0 -1
- package/src/component/utility/renderCoreSlot.tsx +0 -21
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { Classes, Switch } from '@blueprintjs/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import type {
|
|
4
|
+
ProcessingOperatorId,
|
|
5
|
+
Spectrum,
|
|
6
|
+
SpectrumProcessingOperation,
|
|
7
|
+
} from '@zakodium/nmrium-core';
|
|
8
|
+
import { cast } from '@zakodium/utils';
|
|
9
|
+
import type { Filter1D, Filter2D } from 'nmr-processing';
|
|
10
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
11
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import { ObjectInspector } from 'react-inspector';
|
|
13
|
+
import { Button } from 'react-science/ui';
|
|
14
|
+
|
|
15
|
+
import { useChartData } from '../../context/ChartContext.tsx';
|
|
16
|
+
import { useCore } from '../../context/CoreContext.tsx';
|
|
17
|
+
import type { AlertButton } from '../../elements/Alert.tsx';
|
|
18
|
+
import { useAlert } from '../../elements/Alert.tsx';
|
|
19
|
+
import { EmptyText } from '../../elements/EmptyText.tsx';
|
|
20
|
+
import { Sections } from '../../elements/Sections.tsx';
|
|
21
|
+
import useSpectrum from '../../hooks/useSpectrum.ts';
|
|
22
|
+
import type { Tool } from '../../toolbar/ToolTypes.ts';
|
|
23
|
+
import {
|
|
24
|
+
CoreOperatorExpanded,
|
|
25
|
+
CoreOperatorName,
|
|
26
|
+
} from '../../utility/CoreSlot.tsx';
|
|
27
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader.tsx';
|
|
28
|
+
|
|
29
|
+
const mapToolsToProcessing: Partial<Record<Tool, ProcessingOperatorId>> = {
|
|
30
|
+
apodization: '@zakodium/nmrium-core-plugins#apodization1D',
|
|
31
|
+
zeroFilling: '@zakodium/nmrium-core-plugins#zeroFilling1D',
|
|
32
|
+
fft: '@zakodium/nmrium-core-plugins#fft1D',
|
|
33
|
+
phaseCorrection: '@zakodium/nmrium-core-plugins#phaseCorrection1D',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type FilterName = Filter1D['name'] | Filter2D['name'];
|
|
37
|
+
const mapFiltersToProcessings: Partial<
|
|
38
|
+
Record<FilterName, ProcessingOperatorId>
|
|
39
|
+
> = {
|
|
40
|
+
apodization: '@zakodium/nmrium-core-plugins#apodization1D',
|
|
41
|
+
digitalFilter: '@zakodium/nmrium-core-plugins#digitalFilter1D',
|
|
42
|
+
fft: '@zakodium/nmrium-core-plugins#fft1D',
|
|
43
|
+
phaseCorrection: '@zakodium/nmrium-core-plugins#phaseCorrection1D',
|
|
44
|
+
shiftX: '@zakodium/nmrium-core-plugins#shiftX1D',
|
|
45
|
+
zeroFilling: '@zakodium/nmrium-core-plugins#zeroFilling1D',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const unremoveableProcessings = new Set<ProcessingOperatorId>([
|
|
49
|
+
'@zakodium/nmrium-core-plugins#digitalFilter1D',
|
|
50
|
+
'@zakodium/nmrium-core-plugins#digitalFilter2D',
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
export function ProcessingsSectionsPanel() {
|
|
54
|
+
const core = useCore();
|
|
55
|
+
const { showAlert } = useAlert();
|
|
56
|
+
const spectrum: Spectrum | undefined = useSpectrum();
|
|
57
|
+
const { toolOptions } = useChartData();
|
|
58
|
+
|
|
59
|
+
cast<FilterName>(toolOptions.data.activeFilterID);
|
|
60
|
+
const selectedToolProcessing = mapToolsToProcessing[toolOptions.selectedTool];
|
|
61
|
+
const activeProcessing =
|
|
62
|
+
mapFiltersToProcessings[toolOptions.data.activeFilterID];
|
|
63
|
+
const [openedOperation, setOpenedOperation] = useState<string>();
|
|
64
|
+
|
|
65
|
+
const [processings, setProcessings] = useState(
|
|
66
|
+
() => spectrum?.processings ?? [],
|
|
67
|
+
);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setProcessings(spectrum?.processings ?? []);
|
|
70
|
+
}, [spectrum?.processings]);
|
|
71
|
+
|
|
72
|
+
const selectedProcessing = useMemo<{
|
|
73
|
+
operatorId?: ProcessingOperatorId;
|
|
74
|
+
operationId?: string;
|
|
75
|
+
}>(() => {
|
|
76
|
+
if (selectedToolProcessing) return { operatorId: selectedToolProcessing };
|
|
77
|
+
if (
|
|
78
|
+
activeProcessing &&
|
|
79
|
+
spectrum?.processings?.some((p) => p.operatorId === activeProcessing)
|
|
80
|
+
) {
|
|
81
|
+
return { operatorId: activeProcessing };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return { operationId: openedOperation };
|
|
85
|
+
}, [
|
|
86
|
+
activeProcessing,
|
|
87
|
+
openedOperation,
|
|
88
|
+
selectedToolProcessing,
|
|
89
|
+
spectrum?.processings,
|
|
90
|
+
]);
|
|
91
|
+
|
|
92
|
+
function handleDeleteFilter() {
|
|
93
|
+
const buttons: AlertButton[] = [
|
|
94
|
+
{
|
|
95
|
+
text: 'Yes',
|
|
96
|
+
intent: 'danger',
|
|
97
|
+
onClick: () => setProcessings([]),
|
|
98
|
+
},
|
|
99
|
+
{ text: 'No' },
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
showAlert({
|
|
103
|
+
message:
|
|
104
|
+
'You are about to delete all processing steps, Are you sure?. Experimental, not implemented yet',
|
|
105
|
+
buttons,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function toggleSection(operationId: string) {
|
|
110
|
+
setOpenedOperation(
|
|
111
|
+
openedOperation === operationId ? undefined : operationId,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function onReorder(sourceIndex: number, targetIndex: number) {
|
|
116
|
+
const newProcessings = [...processings];
|
|
117
|
+
[newProcessings[sourceIndex], newProcessings[targetIndex]] = [
|
|
118
|
+
newProcessings[targetIndex],
|
|
119
|
+
newProcessings[sourceIndex],
|
|
120
|
+
];
|
|
121
|
+
setProcessings(newProcessings);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!spectrum) return null;
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<DefaultPanelHeader
|
|
129
|
+
deleteTooltip="Delete all filters"
|
|
130
|
+
onDelete={handleDeleteFilter}
|
|
131
|
+
total={processings?.length}
|
|
132
|
+
hideCounter
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
{processings.length === 0 && <EmptyText text="No Processings" />}
|
|
136
|
+
{processings.length > 0 && (
|
|
137
|
+
<Sections isOverflow renderActiveSectionContentOnly>
|
|
138
|
+
{processings?.map((operation, index) => {
|
|
139
|
+
const operatorUI = core.slotOperator(operation.operatorId);
|
|
140
|
+
const isOpen =
|
|
141
|
+
selectedProcessing.operatorId === operation.operatorId ||
|
|
142
|
+
selectedProcessing.operationId === operation.uid;
|
|
143
|
+
const isEditable = operatorUI?.isEditable;
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<Sections.Item
|
|
147
|
+
key={operation.uid}
|
|
148
|
+
id={operation.uid}
|
|
149
|
+
title={
|
|
150
|
+
<CoreOperatorName
|
|
151
|
+
id={operation.operatorId}
|
|
152
|
+
fallback={operation.operatorId.split('#', 2).at(-1)}
|
|
153
|
+
/>
|
|
154
|
+
}
|
|
155
|
+
isOpen={isOpen}
|
|
156
|
+
index={index}
|
|
157
|
+
serial={index + 1}
|
|
158
|
+
sticky
|
|
159
|
+
onReorder={onReorder}
|
|
160
|
+
onClick={() => toggleSection(operation.uid)}
|
|
161
|
+
rightElement={
|
|
162
|
+
<ProcessingItemExtra
|
|
163
|
+
isOpen={isOpen}
|
|
164
|
+
isEditable={isEditable}
|
|
165
|
+
setOpenedOperation={setOpenedOperation}
|
|
166
|
+
setProcessings={setProcessings}
|
|
167
|
+
operation={operation}
|
|
168
|
+
/>
|
|
169
|
+
}
|
|
170
|
+
>
|
|
171
|
+
<Sections.Body style={{ paddingBottom: '120px' }}>
|
|
172
|
+
<CoreOperatorExpanded
|
|
173
|
+
id={operation.operatorId}
|
|
174
|
+
fallback={<OperationFallback operation={operation} />}
|
|
175
|
+
operation={operation}
|
|
176
|
+
core={core}
|
|
177
|
+
onChange={(operation) => {
|
|
178
|
+
const newProcessings = processings.map((p) =>
|
|
179
|
+
p.uid === operation.uid
|
|
180
|
+
? { ...operation, options: undefined }
|
|
181
|
+
: p,
|
|
182
|
+
);
|
|
183
|
+
setProcessings(newProcessings);
|
|
184
|
+
setOpenedOperation(undefined);
|
|
185
|
+
}}
|
|
186
|
+
>
|
|
187
|
+
{(children) => (
|
|
188
|
+
<LiveEditBanner>
|
|
189
|
+
<Switch
|
|
190
|
+
label="Live preview"
|
|
191
|
+
innerLabelChecked="On"
|
|
192
|
+
innerLabel="Off"
|
|
193
|
+
checked
|
|
194
|
+
/>
|
|
195
|
+
<Switch
|
|
196
|
+
label="Processed"
|
|
197
|
+
innerLabelChecked="On"
|
|
198
|
+
innerLabel="Off"
|
|
199
|
+
checked
|
|
200
|
+
/>
|
|
201
|
+
<Spacer />
|
|
202
|
+
{children}
|
|
203
|
+
<Button
|
|
204
|
+
variant="minimal"
|
|
205
|
+
intent="danger"
|
|
206
|
+
onClick={() => setOpenedOperation(undefined)}
|
|
207
|
+
size="small"
|
|
208
|
+
>
|
|
209
|
+
Cancel
|
|
210
|
+
</Button>
|
|
211
|
+
</LiveEditBanner>
|
|
212
|
+
)}
|
|
213
|
+
</CoreOperatorExpanded>
|
|
214
|
+
</Sections.Body>
|
|
215
|
+
</Sections.Item>
|
|
216
|
+
);
|
|
217
|
+
})}
|
|
218
|
+
</Sections>
|
|
219
|
+
)}
|
|
220
|
+
</>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
interface ProcessingItemExtraProps {
|
|
225
|
+
operation: SpectrumProcessingOperation<unknown, unknown>;
|
|
226
|
+
isOpen: boolean;
|
|
227
|
+
isEditable: boolean | undefined;
|
|
228
|
+
setOpenedOperation: Dispatch<SetStateAction<string | undefined>>;
|
|
229
|
+
setProcessings: Dispatch<
|
|
230
|
+
SetStateAction<Array<SpectrumProcessingOperation<unknown, unknown>>>
|
|
231
|
+
>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function ProcessingItemExtra(props: ProcessingItemExtraProps) {
|
|
235
|
+
const { operation, isOpen, isEditable, setOpenedOperation, setProcessings } =
|
|
236
|
+
props;
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<CompactControls>
|
|
240
|
+
{isEditable && (
|
|
241
|
+
<Button
|
|
242
|
+
intent="success"
|
|
243
|
+
tooltipProps={{ content: 'Edit filter' }}
|
|
244
|
+
variant="minimal"
|
|
245
|
+
onClick={() => setOpenedOperation(operation.uid)}
|
|
246
|
+
icon="annotation"
|
|
247
|
+
disabled={isOpen}
|
|
248
|
+
/>
|
|
249
|
+
)}
|
|
250
|
+
|
|
251
|
+
<Button
|
|
252
|
+
intent="danger"
|
|
253
|
+
tooltipProps={{ content: 'Delete filter' }}
|
|
254
|
+
variant="minimal"
|
|
255
|
+
onClick={() =>
|
|
256
|
+
setProcessings((processings) =>
|
|
257
|
+
processings.filter((p) => p.uid !== operation.uid),
|
|
258
|
+
)
|
|
259
|
+
}
|
|
260
|
+
disabled={unremoveableProcessings.has(operation.operatorId)}
|
|
261
|
+
icon="trash"
|
|
262
|
+
/>
|
|
263
|
+
|
|
264
|
+
<Switch
|
|
265
|
+
innerLabelChecked="On"
|
|
266
|
+
innerLabel="Off"
|
|
267
|
+
checked={operation.enabled || false}
|
|
268
|
+
onChange={() => {
|
|
269
|
+
setProcessings((processings) =>
|
|
270
|
+
processings.map((p) =>
|
|
271
|
+
p.uid === operation.uid
|
|
272
|
+
? { ...operation, enabled: !operation.enabled }
|
|
273
|
+
: p,
|
|
274
|
+
),
|
|
275
|
+
);
|
|
276
|
+
}}
|
|
277
|
+
/>
|
|
278
|
+
</CompactControls>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
interface OperationFallbackProps {
|
|
283
|
+
operation: SpectrumProcessingOperation<unknown, unknown>;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function OperationFallback(props: OperationFallbackProps) {
|
|
287
|
+
const { operation } = props;
|
|
288
|
+
const { settings, options } = operation;
|
|
289
|
+
|
|
290
|
+
if (settings === null) {
|
|
291
|
+
return <EmptyText text=" No options available" />;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return <ObjectInspector data={{ settings, options }} />;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const CompactControls = styled.div`
|
|
298
|
+
display: flex;
|
|
299
|
+
align-items: center;
|
|
300
|
+
|
|
301
|
+
.${Classes.CONTROL} {
|
|
302
|
+
margin-bottom: 0;
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
|
|
306
|
+
const LiveEditBanner = styled.div`
|
|
307
|
+
background-color: white;
|
|
308
|
+
box-shadow: rgb(0 0 0 / 16%) 0 1px 4px;
|
|
309
|
+
margin-left: -10px;
|
|
310
|
+
margin-right: -10px;
|
|
311
|
+
transform: translateY(-10px);
|
|
312
|
+
padding: 5px;
|
|
313
|
+
display: flex;
|
|
314
|
+
align-items: center;
|
|
315
|
+
gap: 5px;
|
|
316
|
+
|
|
317
|
+
.${Classes.CONTROL} {
|
|
318
|
+
margin-bottom: 0;
|
|
319
|
+
}
|
|
320
|
+
`;
|
|
321
|
+
|
|
322
|
+
const Spacer = styled.span`
|
|
323
|
+
flex: 1;
|
|
324
|
+
`;
|
|
@@ -741,6 +741,8 @@ function innerSpectrumReducer(draft: Draft<State>, action: Action) {
|
|
|
741
741
|
draft,
|
|
742
742
|
action,
|
|
743
743
|
);
|
|
744
|
+
case 'CHANGE_SIGNAL_DELTA':
|
|
745
|
+
return RangesActions.handleChangeSignalDelta(draft, action);
|
|
744
746
|
|
|
745
747
|
case 'SET_KEY_PREFERENCES':
|
|
746
748
|
return PreferencesActions.handleSetKeyPreferences(draft, action);
|
|
@@ -58,7 +58,7 @@ export type CorrelationsActions =
|
|
|
58
58
|
| DeleteCorrelationAction;
|
|
59
59
|
|
|
60
60
|
function handleUpdateCorrelations(draft: Draft<State>) {
|
|
61
|
-
const { data: spectra, correlations } = draft;
|
|
61
|
+
const { data: spectra, correlations } = original(draft);
|
|
62
62
|
draft.correlations = buildCorrelationData(spectra as Spectrum, {
|
|
63
63
|
...correlations.options,
|
|
64
64
|
values: lodashCloneDeep(correlations.values),
|
|
@@ -122,6 +122,7 @@ type ChangeRangeSumAction = ActionType<
|
|
|
122
122
|
type AddRangeAction = ActionType<
|
|
123
123
|
'ADD_RANGE',
|
|
124
124
|
{
|
|
125
|
+
spectrumId?: string;
|
|
125
126
|
range: Range;
|
|
126
127
|
}
|
|
127
128
|
>;
|
|
@@ -133,7 +134,14 @@ type ChangeRangeSignalValueAction = ActionType<
|
|
|
133
134
|
'CHANGE_RANGE_SIGNAL_VALUE',
|
|
134
135
|
{ rangeId: string; signalId: string; value: number }
|
|
135
136
|
>;
|
|
136
|
-
type
|
|
137
|
+
type ChangeSignalDeltaAction = ActionType<
|
|
138
|
+
'CHANGE_SIGNAL_DELTA',
|
|
139
|
+
{ spectrumId: string; rangeId: string; signalId: string; value: number }
|
|
140
|
+
>;
|
|
141
|
+
type UpdateRangAction = ActionType<
|
|
142
|
+
'UPDATE_RANGE',
|
|
143
|
+
{ range: Range; spectrumId?: string }
|
|
144
|
+
>;
|
|
137
145
|
type CutRangAction = ActionType<
|
|
138
146
|
'CUT_RANGE',
|
|
139
147
|
{ ranges: Record<string, Range[]> }
|
|
@@ -189,6 +197,7 @@ export type RangesActions =
|
|
|
189
197
|
| Change1DSignalAssignmentLabelAction
|
|
190
198
|
| ChangeRangesViewFloatingBoxBoundingAction
|
|
191
199
|
| ChangeRangesAssignmentsLabelsByDiaIdsAction
|
|
200
|
+
| ChangeSignalDeltaAction
|
|
192
201
|
| ActionType<
|
|
193
202
|
| 'AUTO_RANGES_SPECTRA_PICKING'
|
|
194
203
|
| 'CHANGE_RANGES_SUM_FLAG'
|
|
@@ -234,6 +243,7 @@ function handleAutoRangesDetection(
|
|
|
234
243
|
broadWidth: 0.05,
|
|
235
244
|
thresholdFactor: 8,
|
|
236
245
|
minMaxRatio,
|
|
246
|
+
maxAbsoluteRatio: minMaxRatio,
|
|
237
247
|
direction: lookNegative ? 'both' : 'positive',
|
|
238
248
|
},
|
|
239
249
|
};
|
|
@@ -321,6 +331,29 @@ function handleChangeRangeSignalKind(
|
|
|
321
331
|
handleUpdateCorrelations(draft);
|
|
322
332
|
}
|
|
323
333
|
}
|
|
334
|
+
//action
|
|
335
|
+
function handleChangeSignalDelta(
|
|
336
|
+
draft: Draft<State>,
|
|
337
|
+
action: ChangeSignalDeltaAction,
|
|
338
|
+
) {
|
|
339
|
+
const { spectrumId, rangeId, signalId, value } = action.payload;
|
|
340
|
+
|
|
341
|
+
const spectrum = getSpectrum(draft, spectrumId);
|
|
342
|
+
if (!isSpectrum1D(spectrum)) return;
|
|
343
|
+
|
|
344
|
+
const rangeIndex = getRangeIndex(spectrum, rangeId);
|
|
345
|
+
const range = spectrum.ranges.values[rangeIndex];
|
|
346
|
+
if (range.signals) {
|
|
347
|
+
const signalIndex = range.signals.findIndex(
|
|
348
|
+
(_signal) => _signal.id === signalId,
|
|
349
|
+
);
|
|
350
|
+
if (signalIndex !== -1) {
|
|
351
|
+
range.signals[signalIndex].delta = value;
|
|
352
|
+
}
|
|
353
|
+
updateRangesRelativeValues(spectrum);
|
|
354
|
+
handleUpdateCorrelations(draft);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
324
357
|
|
|
325
358
|
//action
|
|
326
359
|
function handleSaveEditedRange(
|
|
@@ -517,9 +550,9 @@ function initiateRangeSumOptions(datum: Spectrum1D, options: SumParams) {
|
|
|
517
550
|
|
|
518
551
|
//action
|
|
519
552
|
function handleAddRange(draft: Draft<State>, action: AddRangeAction) {
|
|
520
|
-
const { range } = action.payload;
|
|
553
|
+
const { range, spectrumId } = action.payload;
|
|
521
554
|
|
|
522
|
-
const spectrum = getSpectrum(draft);
|
|
555
|
+
const spectrum = getSpectrum(draft, spectrumId);
|
|
523
556
|
if (!isSpectrum1D(spectrum)) return;
|
|
524
557
|
|
|
525
558
|
const { molecules } = draft;
|
|
@@ -583,9 +616,9 @@ function handleChangeRangesSumFlag(draft: Draft<State>) {
|
|
|
583
616
|
|
|
584
617
|
//action
|
|
585
618
|
function handleUpdateRange(draft: Draft<State>, action: UpdateRangAction) {
|
|
586
|
-
const { range } = action.payload;
|
|
619
|
+
const { range, spectrumId } = action.payload;
|
|
587
620
|
|
|
588
|
-
const spectrum = getSpectrum(draft);
|
|
621
|
+
const spectrum = getSpectrum(draft, spectrumId);
|
|
589
622
|
if (!isSpectrum1D(spectrum)) return;
|
|
590
623
|
|
|
591
624
|
const index = spectrum.ranges.values.findIndex(
|
|
@@ -720,6 +753,7 @@ export {
|
|
|
720
753
|
handleChangeRangesAssignmentLabelsByDiaIds,
|
|
721
754
|
handleChangeRangesSumFlag,
|
|
722
755
|
handleChangeRangesViewFloatingBoxBounding,
|
|
756
|
+
handleChangeSignalDelta,
|
|
723
757
|
handleCutRange,
|
|
724
758
|
handleDeleteRange,
|
|
725
759
|
handleDeleteRangePeak,
|
|
@@ -6,7 +6,6 @@ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/index.js';
|
|
|
6
6
|
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours.js';
|
|
7
7
|
import { getXScale } from '../../1d/utilities/scale.js';
|
|
8
8
|
import type { Layout } from '../../2d/utilities/DimensionLayout.js';
|
|
9
|
-
import { LAYOUT } from '../../2d/utilities/DimensionLayout.js';
|
|
10
9
|
import { get2DXScale, get2DYScale } from '../../2d/utilities/scale.js';
|
|
11
10
|
import type {
|
|
12
11
|
BrushAxis,
|
|
@@ -25,6 +24,7 @@ import zoomHistoryManager, {
|
|
|
25
24
|
} from '../helper/ZoomHistoryManager.js';
|
|
26
25
|
import { getActiveSpectra } from '../helper/getActiveSpectra.js';
|
|
27
26
|
import { getSpectrum } from '../helper/getSpectrum.js';
|
|
27
|
+
import { getTraceSpectrumID } from '../helper/getTraceSpectrumID.tsx';
|
|
28
28
|
import { getTwoDimensionPhaseCorrectionOptions } from '../helper/getTwoDimensionPhaseCorrectionOptions.js';
|
|
29
29
|
import { getVerticalAlign } from '../helper/getVerticalAlign.js';
|
|
30
30
|
import { setIntegralsViewProperty } from '../helper/setIntegralsViewProperty.js';
|
|
@@ -173,18 +173,6 @@ function setSelectedTool(draft: Draft<State>, action: SetSelectedToolAction) {
|
|
|
173
173
|
const { selectedTool } = action.payload;
|
|
174
174
|
activateTool(draft, { toolId: selectedTool });
|
|
175
175
|
}
|
|
176
|
-
//utility
|
|
177
|
-
function getSpectrumID(draft: Draft<State>, index: any): string | null {
|
|
178
|
-
const { activeSpectra, activeTab } = draft.view.spectra;
|
|
179
|
-
|
|
180
|
-
const spectra = activeSpectra[activeTab.split(',')[index]];
|
|
181
|
-
|
|
182
|
-
if (spectra?.length === 1) {
|
|
183
|
-
return spectra[0].id;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
176
|
|
|
189
177
|
function setSpectraVerticalAlign(draft: Draft<State>) {
|
|
190
178
|
const currentVerticalAlign = getVerticalAlign(draft);
|
|
@@ -314,14 +302,10 @@ function handleZoom(draft: Draft<State>, action: ZoomAction) {
|
|
|
314
302
|
}
|
|
315
303
|
} else {
|
|
316
304
|
// change the vertical scale of 1D traces
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (id) {
|
|
322
|
-
const domain = yDomains[id];
|
|
323
|
-
yDomains[id] = wheelZoom(options, domain);
|
|
324
|
-
}
|
|
305
|
+
const id = getTraceSpectrumID(draft, trackID);
|
|
306
|
+
if (id) {
|
|
307
|
+
const domain = yDomains[id];
|
|
308
|
+
yDomains[id] = wheelZoom(options, domain);
|
|
325
309
|
}
|
|
326
310
|
}
|
|
327
311
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Draft } from 'immer';
|
|
2
|
+
|
|
3
|
+
import type { Layout } from '../../2d/utilities/DimensionLayout.ts';
|
|
4
|
+
import { LAYOUT } from '../../2d/utilities/DimensionLayout.ts';
|
|
5
|
+
import type { State } from '../Reducer.ts';
|
|
6
|
+
|
|
7
|
+
//utility
|
|
8
|
+
export function getTraceSpectrumID(
|
|
9
|
+
draft: Draft<State>,
|
|
10
|
+
trackID: Layout | undefined,
|
|
11
|
+
): string | null {
|
|
12
|
+
const index = trackID === LAYOUT.top ? 0 : trackID === LAYOUT.left ? 1 : null;
|
|
13
|
+
|
|
14
|
+
if (index === null) return null;
|
|
15
|
+
|
|
16
|
+
const { activeSpectra, activeTab } = draft.view.spectra;
|
|
17
|
+
|
|
18
|
+
const spectra = activeSpectra[activeTab.split(',')[index]];
|
|
19
|
+
|
|
20
|
+
if (spectra?.length === 1) {
|
|
21
|
+
return spectra[0].id;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
@@ -30,6 +30,7 @@ import { Toolbar, TooltipHelpContent } from 'react-science/ui';
|
|
|
30
30
|
import { isQuadrants2DSpectrum } from '../../data/data2d/Spectrum2D/isSpectrum2D.js';
|
|
31
31
|
import { useChartData } from '../context/ChartContext.js';
|
|
32
32
|
import { useDispatch } from '../context/DispatchContext.js';
|
|
33
|
+
import { useIsPrimaryKeyActivated } from '../context/KeyModifierContext.tsx';
|
|
33
34
|
import { useLoader } from '../context/LoaderContext.js';
|
|
34
35
|
import { usePreferences } from '../context/PreferencesContext.js';
|
|
35
36
|
import type { ToolbarPopoverMenuItem } from '../elements/ToolbarPopoverItem.js';
|
|
@@ -99,6 +100,7 @@ export default function NMRToolbar() {
|
|
|
99
100
|
const isButtonVisible = useCheckToolsVisibility();
|
|
100
101
|
const dispatch = useDispatch();
|
|
101
102
|
const spectrum = useSpectrum();
|
|
103
|
+
const isPrimaryKeyActivated = useIsPrimaryKeyActivated();
|
|
102
104
|
|
|
103
105
|
const {
|
|
104
106
|
isRealSpectrumShown,
|
|
@@ -234,8 +236,7 @@ export default function NMRToolbar() {
|
|
|
234
236
|
{ title: 'Horizontal', shortcuts: ['f'] },
|
|
235
237
|
{ title: 'Horizontal and Vertical', shortcuts: ['f', 'f'] },
|
|
236
238
|
],
|
|
237
|
-
description:
|
|
238
|
-
'Zoom out by double-clicking the left mouse button, and fully zoom out horizontally by pressing the key "f". Alternatively, press the key "ff" to fit the spectra horizontally and vertically.',
|
|
239
|
+
description: `Zoom out by ${isPrimaryKeyActivated ? 'Shift + ' : ''}double-clicking the left mouse button, and fully zoom out horizontally by pressing the key "f". Alternatively, press the key "ff" to fit the spectra horizontally and vertically.`,
|
|
239
240
|
link: 'https://docs.nmrium.org/help/zoom-and-scale',
|
|
240
241
|
},
|
|
241
242
|
onClick: handleFullZoomOut,
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import type {
|
|
3
|
+
PluginUIComponentProps,
|
|
4
|
+
ProcessingOperatorId,
|
|
5
|
+
ProcessingOperatorUIExpandedProps,
|
|
6
|
+
SupportedUISlot,
|
|
7
|
+
} from '@zakodium/nmrium-core';
|
|
8
|
+
import { castSlotProps } from '@zakodium/nmrium-core';
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
10
|
+
import type { FallbackProps } from 'react-error-boundary';
|
|
11
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
12
|
+
|
|
13
|
+
import { useCore } from '../context/CoreContext.tsx';
|
|
14
|
+
|
|
15
|
+
type SlotProps<Slot extends SupportedUISlot> =
|
|
16
|
+
Omit<Extract<PluginUIComponentProps, { slot: Slot }>, 'slot'> extends Record<
|
|
17
|
+
string,
|
|
18
|
+
never
|
|
19
|
+
>
|
|
20
|
+
? object
|
|
21
|
+
: Omit<Extract<PluginUIComponentProps, { slot: Slot }>, 'slot'>;
|
|
22
|
+
|
|
23
|
+
interface CoreSlotProps<Slot extends SupportedUISlot> {
|
|
24
|
+
slot: Slot;
|
|
25
|
+
fallback?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Render all components registered in the given slot.
|
|
30
|
+
*/
|
|
31
|
+
export function CoreSlot<Slot extends SupportedUISlot>(
|
|
32
|
+
props: CoreSlotProps<Slot> & SlotProps<Slot>,
|
|
33
|
+
) {
|
|
34
|
+
const { slot, fallback, ...slotProps } = props;
|
|
35
|
+
castSlotProps(slotProps, slot);
|
|
36
|
+
|
|
37
|
+
const core = useCore();
|
|
38
|
+
|
|
39
|
+
const jsx = Array.from(core.slot(slot), ([key, Component]) => (
|
|
40
|
+
<Component key={key} {...slotProps} slot={slot} />
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
return jsx.length > 0 ? jsx : fallback;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface CoreOperatorNameProps<Id extends ProcessingOperatorId> {
|
|
47
|
+
id: Id;
|
|
48
|
+
fallback?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function CoreOperatorName<Id extends ProcessingOperatorId>(
|
|
52
|
+
props: CoreOperatorNameProps<Id>,
|
|
53
|
+
) {
|
|
54
|
+
const { id, fallback } = props;
|
|
55
|
+
const core = useCore();
|
|
56
|
+
|
|
57
|
+
const operator = core.slotOperator(id);
|
|
58
|
+
if (!operator) return fallback;
|
|
59
|
+
|
|
60
|
+
return operator.name;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface CoreOperatorExtendedProps<Id extends ProcessingOperatorId> {
|
|
64
|
+
id: Id;
|
|
65
|
+
fallback?: ReactNode;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function CoreOperatorExpanded<Id extends ProcessingOperatorId>(
|
|
69
|
+
props: CoreOperatorExtendedProps<Id> & ProcessingOperatorUIExpandedProps<Id>,
|
|
70
|
+
) {
|
|
71
|
+
const { id, fallback, ...operatorProps } = props;
|
|
72
|
+
const core = useCore();
|
|
73
|
+
|
|
74
|
+
const operator = core.slotOperator(id);
|
|
75
|
+
const Expanded = operator?.Expanded;
|
|
76
|
+
if (!Expanded) return fallback;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<ErrorBoundary
|
|
80
|
+
fallbackRender={(props) => (
|
|
81
|
+
<>
|
|
82
|
+
<ErrorOverlay {...props} />
|
|
83
|
+
{fallback}
|
|
84
|
+
</>
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
<Expanded {...operatorProps} />
|
|
88
|
+
</ErrorBoundary>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function ErrorOverlay(props: FallbackProps) {
|
|
93
|
+
const error = props.error;
|
|
94
|
+
const message =
|
|
95
|
+
error && typeof error === 'object' && 'message' in error
|
|
96
|
+
? error.message
|
|
97
|
+
: null;
|
|
98
|
+
const stack =
|
|
99
|
+
error && typeof error === 'object' && 'stack' in error ? error.stack : null;
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<ErrorOverlayStyled>
|
|
103
|
+
<p>Something went wrong.</p>
|
|
104
|
+
<details>
|
|
105
|
+
<summary>{message as ReactNode}</summary>
|
|
106
|
+
{stack as ReactNode}
|
|
107
|
+
</details>
|
|
108
|
+
</ErrorOverlayStyled>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const ErrorOverlayStyled = styled.div`
|
|
113
|
+
background: white;
|
|
114
|
+
padding-block: 10px;
|
|
115
|
+
|
|
116
|
+
> p {
|
|
117
|
+
margin: 0;
|
|
118
|
+
text-align: center;
|
|
119
|
+
font-size: 20px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
details {
|
|
123
|
+
color: red;
|
|
124
|
+
white-space: pre-wrap;
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
@@ -48,6 +48,7 @@ export function autoPeakPicking(
|
|
|
48
48
|
sensitivity: 100,
|
|
49
49
|
shape: defaultPeakShape,
|
|
50
50
|
noiseLevel: noise * noiseFactor,
|
|
51
|
+
maxAbsoluteRatio: minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
|
|
51
52
|
minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
|
|
52
53
|
realTopDetection: true,
|
|
53
54
|
smoothY: false,
|