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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
2
2
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { AppForm, Button, useForm } from 'react-science/ui';
|
|
5
5
|
import { z } from 'zod/v4';
|
|
6
6
|
|
|
7
7
|
import { DataExportOptions } from '../../data/SpectraManager.js';
|
|
@@ -52,7 +52,7 @@ function InnerSaveAsModal(props: InnerSaveAsModalProps) {
|
|
|
52
52
|
const { saveHandler } = useExport();
|
|
53
53
|
|
|
54
54
|
const form = useForm({
|
|
55
|
-
defaultValues: { ...INITIAL_VALUE, name: data[0]?.info?.name },
|
|
55
|
+
defaultValues: { ...INITIAL_VALUE, name: data[0]?.info?.name ?? '' },
|
|
56
56
|
validators: { onDynamic: formSchema },
|
|
57
57
|
validationLogic: revalidateLogic({ modeAfterSubmission: 'change' }),
|
|
58
58
|
onSubmit: ({ value }) => {
|
|
@@ -86,54 +86,45 @@ function InnerSaveAsModal(props: InnerSaveAsModalProps) {
|
|
|
86
86
|
onClose={onCloseDialog}
|
|
87
87
|
style={{ width: 600 }}
|
|
88
88
|
>
|
|
89
|
-
<form
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</form.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
>
|
|
129
|
-
Cancel
|
|
130
|
-
</Button>
|
|
131
|
-
<form.SubmitButton intent="success">Save</form.SubmitButton>
|
|
132
|
-
</>
|
|
133
|
-
}
|
|
134
|
-
/>
|
|
135
|
-
</Form>
|
|
136
|
-
</form.AppForm>
|
|
89
|
+
<AppForm form={form} layout="inline">
|
|
90
|
+
<DialogBody style={{ backgroundColor: 'white' }}>
|
|
91
|
+
<form.Section title="General information">
|
|
92
|
+
<form.AppField name="name">
|
|
93
|
+
{(field) => <field.Input label="Name" required autoFocus />}
|
|
94
|
+
</form.AppField>
|
|
95
|
+
</form.Section>
|
|
96
|
+
<form.Section title="Include">
|
|
97
|
+
<form.AppField name="include.view">
|
|
98
|
+
{(field) => <field.Checkbox label="View" />}
|
|
99
|
+
</form.AppField>
|
|
100
|
+
|
|
101
|
+
<form.AppField name="include.settings">
|
|
102
|
+
{(field) => <field.Checkbox label="Workspace" />}
|
|
103
|
+
</form.AppField>
|
|
104
|
+
|
|
105
|
+
<form.AppField name="include.dataType">
|
|
106
|
+
{(field) => (
|
|
107
|
+
<field.RadioGroup inline label="Data" options={options} />
|
|
108
|
+
)}
|
|
109
|
+
</form.AppField>
|
|
110
|
+
</form.Section>
|
|
111
|
+
</DialogBody>
|
|
112
|
+
|
|
113
|
+
<DialogFooter
|
|
114
|
+
actions={
|
|
115
|
+
<>
|
|
116
|
+
<Button
|
|
117
|
+
variant="outlined"
|
|
118
|
+
intent="danger"
|
|
119
|
+
onClick={() => onCloseDialog?.()}
|
|
120
|
+
>
|
|
121
|
+
Cancel
|
|
122
|
+
</Button>
|
|
123
|
+
<form.SubmitButton intent="success">Save</form.SubmitButton>
|
|
124
|
+
</>
|
|
125
|
+
}
|
|
126
|
+
/>
|
|
127
|
+
</AppForm>
|
|
137
128
|
</StandardDialog>
|
|
138
129
|
);
|
|
139
130
|
}
|
|
@@ -3,11 +3,10 @@ import { SvgLogoNmrium } from 'cheminfo-font';
|
|
|
3
3
|
import { Toolbar, useOnOff } from 'react-science/ui';
|
|
4
4
|
|
|
5
5
|
import versionInfo from '../../../versionInfo.js';
|
|
6
|
-
import { useCore } from '../../context/CoreContext.js';
|
|
7
6
|
import Logo from '../../elements/Logo.js';
|
|
8
7
|
import { StandardDialog } from '../../elements/StandardDialog.tsx';
|
|
9
8
|
import { StyledDialogBody } from '../../elements/StyledDialogBody.js';
|
|
10
|
-
import {
|
|
9
|
+
import { CoreSlot } from '../../utility/CoreSlot.tsx';
|
|
11
10
|
|
|
12
11
|
import AboutUsZakodium from './AboutUsZakodium.js';
|
|
13
12
|
|
|
@@ -116,7 +115,6 @@ const modalContentFallback = (
|
|
|
116
115
|
|
|
117
116
|
function AboutUsModal() {
|
|
118
117
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
119
|
-
const core = useCore();
|
|
120
118
|
|
|
121
119
|
return (
|
|
122
120
|
<>
|
|
@@ -137,7 +135,10 @@ function AboutUsModal() {
|
|
|
137
135
|
title="About NMRium"
|
|
138
136
|
>
|
|
139
137
|
<StyledDialogBody>
|
|
140
|
-
|
|
138
|
+
<CoreSlot
|
|
139
|
+
slot="topbar.about_us.modal"
|
|
140
|
+
fallback={modalContentFallback}
|
|
141
|
+
/>
|
|
141
142
|
</StyledDialogBody>
|
|
142
143
|
</StandardDialog>
|
|
143
144
|
</>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { yupResolver } from '@hookform/resolvers/yup';
|
|
1
|
+
import { revalidateLogic } from '@tanstack/react-form';
|
|
3
2
|
import type { Range } from '@zakodium/nmr-types';
|
|
4
3
|
import type { CSSProperties } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useFormContext, useWatch } from 'react-hook-form';
|
|
6
|
+
import { AppForm, useForm } from 'react-science/ui';
|
|
7
|
+
import { z } from 'zod/v4';
|
|
8
|
+
import type { CheckParams } from 'zod/v4/core';
|
|
8
9
|
|
|
9
|
-
import { NumberInput2Controller } from '../../../../elements/NumberInput2Controller.js';
|
|
10
10
|
import { useTabsController } from '../../../../elements/TabsProvider.js';
|
|
11
11
|
import { useActiveNucleusTab } from '../../../../hooks/useActiveNucleusTab.js';
|
|
12
12
|
import { usePanelPreferences } from '../../../../hooks/usePanelPreferences.js';
|
|
@@ -44,29 +44,41 @@ export function NewSignalTab(props: NewSignalTabProps) {
|
|
|
44
44
|
const activeTab = useActiveNucleusTab();
|
|
45
45
|
const { tablePreferences } = usePanelPreferences('ranges', activeTab);
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const schemaFormValidation = useMemo(() => {
|
|
48
|
+
return getSignalValidationSchema(range);
|
|
49
|
+
}, [range]);
|
|
50
|
+
|
|
51
|
+
function saveHandler({ delta }: z.infer<typeof schemaFormValidation>) {
|
|
48
52
|
const newSignal = {
|
|
49
53
|
multiplicity: 'm',
|
|
50
54
|
kind: 'signal',
|
|
51
|
-
delta
|
|
55
|
+
delta,
|
|
52
56
|
js: [{ multiplicity: 'm', coupling: '' }],
|
|
53
57
|
};
|
|
54
|
-
const _signals = signals.slice().concat(newSignal);
|
|
55
58
|
|
|
59
|
+
const _signals = [...signals, newSignal];
|
|
56
60
|
setValue('signals', _signals);
|
|
57
61
|
selectTab(_signals.length - 1);
|
|
58
62
|
}
|
|
59
|
-
|
|
63
|
+
|
|
64
|
+
const form = useForm({
|
|
60
65
|
defaultValues: {
|
|
61
|
-
delta: (range.from + range.to) / 2,
|
|
66
|
+
delta: String((range.from + range.to) / 2),
|
|
67
|
+
},
|
|
68
|
+
onSubmit: ({ value }) => {
|
|
69
|
+
const parsedValues = schemaFormValidation.parse(value);
|
|
70
|
+
saveHandler(parsedValues);
|
|
71
|
+
},
|
|
72
|
+
validationLogic: revalidateLogic({ modeAfterSubmission: 'change' }),
|
|
73
|
+
validators: {
|
|
74
|
+
onDynamic: schemaFormValidation,
|
|
62
75
|
},
|
|
63
|
-
resolver: yupResolver(getSignalValidationSchema(range)),
|
|
64
76
|
});
|
|
65
77
|
|
|
66
78
|
useEvent({
|
|
67
79
|
onClick: ({ xPPM, shiftKey }) => {
|
|
68
80
|
if (signalIndex === -1 && shiftKey) {
|
|
69
|
-
reset({ delta: xPPM });
|
|
81
|
+
form.reset({ delta: String(xPPM) });
|
|
70
82
|
}
|
|
71
83
|
},
|
|
72
84
|
onBrushEnd: (options) => {
|
|
@@ -75,65 +87,53 @@ export function NewSignalTab(props: NewSignalTabProps) {
|
|
|
75
87
|
shiftKey,
|
|
76
88
|
} = options;
|
|
77
89
|
if (signalIndex === -1 && shiftKey) {
|
|
78
|
-
reset({ delta: (to - from) / 2 + from });
|
|
90
|
+
form.reset({ delta: String((to - from) / 2 + from) });
|
|
79
91
|
}
|
|
80
92
|
},
|
|
81
93
|
});
|
|
82
94
|
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
requestAnimationFrame(() => {
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
setFocus('delta', { shouldSelect: true });
|
|
87
|
-
}, 0);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
95
|
return (
|
|
92
96
|
<div style={styles.container}>
|
|
93
97
|
<div style={styles.innerContainer}>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
tablePreferences.from.format,
|
|
99
|
-
)} ppm - ${formatNumber(range.to, tablePreferences.to.format)} ppm`}
|
|
100
|
-
]:
|
|
101
|
-
</p>
|
|
102
|
-
<NumberInput2Controller
|
|
103
|
-
control={control}
|
|
104
|
-
name="delta"
|
|
105
|
-
placeholder={`𝛅(ppm)`}
|
|
106
|
-
autoSelect
|
|
107
|
-
fill
|
|
108
|
-
/>
|
|
109
|
-
<Button
|
|
110
|
-
intent="success"
|
|
111
|
-
style={{
|
|
112
|
-
marginTop: '20px',
|
|
98
|
+
<AppForm
|
|
99
|
+
form={form}
|
|
100
|
+
onSubmitMeta={(event) => {
|
|
101
|
+
event.stopPropagation();
|
|
113
102
|
}}
|
|
114
|
-
onClick={() => handleSubmit(saveHandler)()}
|
|
115
103
|
>
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
<form.AppField name="delta">
|
|
105
|
+
{(field) => (
|
|
106
|
+
<field.NumericInput
|
|
107
|
+
autoFocus
|
|
108
|
+
placeholder="𝛅(ppm)"
|
|
109
|
+
label="Edit or select a delta value of new signal"
|
|
110
|
+
helpText={`Value should be in range [${formatNumber(
|
|
111
|
+
range.from,
|
|
112
|
+
tablePreferences.from.format,
|
|
113
|
+
)} ppm - ${formatNumber(range.to, tablePreferences.to.format)} ppm]`}
|
|
114
|
+
/>
|
|
115
|
+
)}
|
|
116
|
+
</form.AppField>
|
|
117
|
+
|
|
118
|
+
<form.SubmitButton intent="success">Add a signal</form.SubmitButton>
|
|
119
|
+
</AppForm>
|
|
118
120
|
</div>
|
|
119
121
|
</div>
|
|
120
122
|
);
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
function getSignalValidationSchema(range: Range) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
126
|
+
const params: CheckParams = {
|
|
127
|
+
error: (ctx) => {
|
|
128
|
+
const input = Number(ctx.input);
|
|
129
|
+
return `${input.toFixed(5)} ppm out of the range`;
|
|
130
|
+
},
|
|
131
|
+
};
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
.required(),
|
|
133
|
+
return z.object({
|
|
134
|
+
delta: z.coerce
|
|
135
|
+
.number<string>()
|
|
136
|
+
.min(range.from, params)
|
|
137
|
+
.max(range.to, params),
|
|
138
138
|
});
|
|
139
139
|
}
|
|
@@ -3,8 +3,9 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
4
4
|
import type { Workspace } from '@zakodium/nmrium-core';
|
|
5
5
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
|
-
import {
|
|
6
|
+
import { AppForm, useForm } from 'react-science/ui';
|
|
7
7
|
import { match } from 'ts-pattern';
|
|
8
|
+
import { z } from 'zod';
|
|
8
9
|
|
|
9
10
|
import { usePreferences } from '../../../context/PreferencesContext.js';
|
|
10
11
|
import ErrorOverlay from '../../../main/ErrorOverlay.tsx';
|
|
@@ -60,7 +61,9 @@ interface GeneralSettingsProps extends Omit<
|
|
|
60
61
|
onSave: (values?: Partial<Workspace>) => void;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
const metaSchema = z.enum(['apply', 'save']);
|
|
65
|
+
type FormMeta = z.input<typeof metaSchema>;
|
|
66
|
+
const onSubmitMeta: FormMeta = 'apply';
|
|
64
67
|
|
|
65
68
|
function GeneralSettings(props: GeneralSettingsProps) {
|
|
66
69
|
const { close, height, onSave } = props;
|
|
@@ -74,10 +77,12 @@ function GeneralSettings(props: GeneralSettingsProps) {
|
|
|
74
77
|
},
|
|
75
78
|
validationLogic: revalidateLogic({ mode: 'change' }),
|
|
76
79
|
defaultValues,
|
|
77
|
-
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
79
|
-
onSubmitMeta: 'apply' as FormMeta,
|
|
80
|
+
onSubmitMeta,
|
|
80
81
|
onSubmit: ({ value, meta }) => {
|
|
82
|
+
meta = metaSchema.parse(meta, {
|
|
83
|
+
error: () =>
|
|
84
|
+
'Submit event must be attached to a submitter with "data-action" attribute with "apply" or "save" value',
|
|
85
|
+
});
|
|
81
86
|
const mergedValues = formValueToWorkspace(value, currentWorkspace);
|
|
82
87
|
|
|
83
88
|
match(meta)
|
|
@@ -97,30 +102,19 @@ function GeneralSettings(props: GeneralSettingsProps) {
|
|
|
97
102
|
});
|
|
98
103
|
|
|
99
104
|
return (
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
<PreventImplicitSubmit />
|
|
116
|
-
|
|
117
|
-
<GeneralSettingsErrorsOpenProvider form={form}>
|
|
118
|
-
<GeneralSettingsDialogHeader form={form} />
|
|
119
|
-
<GeneralSettingsDialogBody form={form} height={height} />
|
|
120
|
-
<GeneralSettingsDialogFooter form={form} onCancel={close} />
|
|
121
|
-
</GeneralSettingsErrorsOpenProvider>
|
|
122
|
-
</Form>
|
|
123
|
-
</form.AppForm>
|
|
105
|
+
<AppForm
|
|
106
|
+
form={form}
|
|
107
|
+
layout="inline"
|
|
108
|
+
onSubmitMeta={(event) => event.nativeEvent.submitter?.dataset.action}
|
|
109
|
+
>
|
|
110
|
+
<PreventImplicitSubmit />
|
|
111
|
+
|
|
112
|
+
<GeneralSettingsErrorsOpenProvider form={form}>
|
|
113
|
+
<GeneralSettingsDialogHeader form={form} />
|
|
114
|
+
<GeneralSettingsDialogBody form={form} height={height} />
|
|
115
|
+
<GeneralSettingsDialogFooter form={form} onCancel={close} />
|
|
116
|
+
</GeneralSettingsErrorsOpenProvider>
|
|
117
|
+
</AppForm>
|
|
124
118
|
);
|
|
125
119
|
}
|
|
126
120
|
|
|
@@ -111,14 +111,7 @@ function PeaksPanelInner(props: PeaksPanelInnerProps) {
|
|
|
111
111
|
const filterPeaks = peaks.values.filter((peak) =>
|
|
112
112
|
isInRange(peak.x, { from, to }),
|
|
113
113
|
);
|
|
114
|
-
|
|
115
|
-
dispatch({ type: 'OPTIMIZE_PEAKS', payload: { peaks: filterPeaks } });
|
|
116
|
-
} else {
|
|
117
|
-
toaster.show({
|
|
118
|
-
message: 'optimization can be done on no more than 15 peaks',
|
|
119
|
-
intent: 'danger',
|
|
120
|
-
});
|
|
121
|
-
}
|
|
114
|
+
dispatch({ type: 'OPTIMIZE_PEAKS', payload: { peaks: filterPeaks } });
|
|
122
115
|
};
|
|
123
116
|
|
|
124
117
|
function toggleViewProperty(key: keyof FilterType<PeaksViewState, boolean>) {
|
|
@@ -110,10 +110,10 @@ export function usePeaksTableColumns(activeTab: string) {
|
|
|
110
110
|
accessor: (row) => row?.shape?.fwhm || '',
|
|
111
111
|
Cell: ({ row }: CellProps<PeakRecord>) => {
|
|
112
112
|
const fwhm = row.original?.shape?.fwhm;
|
|
113
|
-
if (fwhm) {
|
|
114
|
-
return
|
|
113
|
+
if (typeof fwhm !== 'number') {
|
|
114
|
+
return '';
|
|
115
115
|
}
|
|
116
|
-
return
|
|
116
|
+
return formatNumber(fwhm, tablePreferences.fwhm.format);
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -126,10 +126,10 @@ export function usePeaksTableColumns(activeTab: string) {
|
|
|
126
126
|
const mu =
|
|
127
127
|
row.original?.shape?.kind === 'pseudoVoigt' &&
|
|
128
128
|
row.original?.shape?.mu;
|
|
129
|
-
if (mu) {
|
|
130
|
-
return
|
|
129
|
+
if (typeof mu !== 'number') {
|
|
130
|
+
return '';
|
|
131
131
|
}
|
|
132
|
-
return
|
|
132
|
+
return formatNumber(mu, tablePreferences.mu.format);
|
|
133
133
|
},
|
|
134
134
|
},
|
|
135
135
|
{
|
|
@@ -143,10 +143,12 @@ export function usePeaksTableColumns(activeTab: string) {
|
|
|
143
143
|
const gamma =
|
|
144
144
|
row.original?.shape?.kind === 'generalizedLorentzian' &&
|
|
145
145
|
row.original?.shape?.gamma;
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
|
|
147
|
+
if (typeof gamma !== 'number') {
|
|
148
|
+
return '';
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
+
|
|
151
|
+
return formatNumber(gamma, tablePreferences.gamma.format);
|
|
150
152
|
},
|
|
151
153
|
},
|
|
152
154
|
{
|
|
@@ -10,6 +10,7 @@ import { getLinkDelta, getLinkDim } from 'nmr-correlation';
|
|
|
10
10
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
11
11
|
import { FaFlask, FaSlidersH } from 'react-icons/fa';
|
|
12
12
|
|
|
13
|
+
import { isSpectrum2D } from '../../../data/data2d/Spectrum2D/isSpectrum2D.ts';
|
|
13
14
|
import {
|
|
14
15
|
findRange,
|
|
15
16
|
findSignal1D,
|
|
@@ -148,11 +149,10 @@ function SummaryPanel() {
|
|
|
148
149
|
// try to find a link which contains the belonging 2D signal in the spectra in view
|
|
149
150
|
if (
|
|
150
151
|
correlation.link.some((link: Link) => {
|
|
151
|
-
const spectrum = findSpectrum(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
) as Spectrum2D;
|
|
152
|
+
const spectrum = findSpectrum(spectraData, link.experimentID, true);
|
|
153
|
+
|
|
154
|
+
if (!isSpectrum2D(spectrum)) return false;
|
|
155
|
+
|
|
156
156
|
return findSignalMatch1D(
|
|
157
157
|
spectrum,
|
|
158
158
|
link,
|
|
@@ -178,8 +178,11 @@ function SummaryPanel() {
|
|
|
178
178
|
spectraData,
|
|
179
179
|
firstLink2D.experimentID,
|
|
180
180
|
true,
|
|
181
|
-
)
|
|
181
|
+
);
|
|
182
182
|
// correlation is represented by a 2D signal
|
|
183
|
+
|
|
184
|
+
if (!isSpectrum2D(spectrum)) return false;
|
|
185
|
+
|
|
183
186
|
if (
|
|
184
187
|
findSignalMatch2D(
|
|
185
188
|
spectrum,
|
|
@@ -196,11 +199,10 @@ function SummaryPanel() {
|
|
|
196
199
|
// try to find a link which contains the belonging 2D signal in the spectra in view
|
|
197
200
|
else if (
|
|
198
201
|
correlation.link.some((link: any) => {
|
|
199
|
-
const spectrum = findSpectrum(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
) as Spectrum2D;
|
|
202
|
+
const spectrum = findSpectrum(spectraData, link.experimentID, true);
|
|
203
|
+
|
|
204
|
+
if (!isSpectrum2D(spectrum)) return false;
|
|
205
|
+
|
|
204
206
|
return findSignalMatch2D(
|
|
205
207
|
spectrum,
|
|
206
208
|
link,
|
|
@@ -2,17 +2,20 @@ import { useDispatch } from '../../context/DispatchContext.js';
|
|
|
2
2
|
import { useToaster } from '../../context/ToasterContext.js';
|
|
3
3
|
import type { AlertButton } from '../../elements/Alert.js';
|
|
4
4
|
import { useAlert } from '../../elements/Alert.js';
|
|
5
|
+
import useCheckExperimentalFeature from '../../hooks/useCheckExperimentalFeature.ts';
|
|
5
6
|
import useSpectrum from '../../hooks/useSpectrum.js';
|
|
6
7
|
import { TablePanel } from '../extra/BasicPanelStyle.js';
|
|
7
8
|
import DefaultPanelHeader from '../header/DefaultPanelHeader.js';
|
|
8
9
|
|
|
9
10
|
import { FiltersSectionsPanel } from './Filters/FiltersSectionsPanel.js';
|
|
11
|
+
import { ProcessingsSectionsPanel } from './processings_sections_panel.tsx';
|
|
10
12
|
|
|
11
13
|
export default function FiltersPanel() {
|
|
12
14
|
const dispatch = useDispatch();
|
|
13
15
|
const toaster = useToaster();
|
|
14
16
|
const { showAlert } = useAlert();
|
|
15
17
|
const { filters } = useSpectrum({ filters: [] });
|
|
18
|
+
const isExperimental = useCheckExperimentalFeature();
|
|
16
19
|
|
|
17
20
|
function handleDeleteFilter() {
|
|
18
21
|
const buttons: AlertButton[] = [
|
|
@@ -46,6 +49,13 @@ export default function FiltersPanel() {
|
|
|
46
49
|
/>
|
|
47
50
|
<div className="inner-container">
|
|
48
51
|
<FiltersSectionsPanel />
|
|
52
|
+
|
|
53
|
+
{isExperimental && (
|
|
54
|
+
<>
|
|
55
|
+
<hr />
|
|
56
|
+
<ProcessingsSectionsPanel />
|
|
57
|
+
</>
|
|
58
|
+
)}
|
|
49
59
|
</div>
|
|
50
60
|
</TablePanel>
|
|
51
61
|
);
|