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.
Files changed (176) hide show
  1. package/lib/component/1d/peaks/PeakEditionManager.d.ts +1 -1
  2. package/lib/component/1d-2d/tools/BrushXY.js +6 -6
  3. package/lib/component/1d-2d/tools/BrushXY.js.map +1 -1
  4. package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
  5. package/lib/component/2d/1d-tracer/Left1DChart.js +6 -2
  6. package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
  7. package/lib/component/2d/1d-tracer/Ranges1D.d.ts +9 -0
  8. package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -0
  9. package/lib/component/2d/1d-tracer/Ranges1D.js +76 -0
  10. package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -0
  11. package/lib/component/2d/1d-tracer/Signals1D.d.ts +11 -0
  12. package/lib/component/2d/1d-tracer/Signals1D.d.ts.map +1 -0
  13. package/lib/component/2d/1d-tracer/Signals1D.js +90 -0
  14. package/lib/component/2d/1d-tracer/Signals1D.js.map +1 -0
  15. package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
  16. package/lib/component/2d/1d-tracer/Top1DChart.js +6 -2
  17. package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
  18. package/lib/component/2d/ft/FTContainer.d.ts.map +1 -1
  19. package/lib/component/2d/ft/FTContainer.js.map +1 -1
  20. package/lib/component/AnchorSVG.d.ts +37 -0
  21. package/lib/component/AnchorSVG.d.ts.map +1 -0
  22. package/lib/component/AnchorSVG.js +137 -0
  23. package/lib/component/AnchorSVG.js.map +1 -0
  24. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  25. package/lib/component/EventsTrackers/BrushTracker.js +4 -0
  26. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  27. package/lib/component/context/KeyModifierContext.d.ts +1 -0
  28. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  29. package/lib/component/context/KeyModifierContext.js +4 -0
  30. package/lib/component/context/KeyModifierContext.js.map +1 -1
  31. package/lib/component/elements/DraggableDialog.d.ts.map +1 -1
  32. package/lib/component/elements/DraggableDialog.js +1 -2
  33. package/lib/component/elements/DraggableDialog.js.map +1 -1
  34. package/lib/component/elements/Sections.d.ts +3 -3
  35. package/lib/component/elements/Sections.d.ts.map +1 -1
  36. package/lib/component/elements/Sections.js +1 -1
  37. package/lib/component/elements/Sections.js.map +1 -1
  38. package/lib/component/elements/export/ExportOptionsModal.js +2 -5
  39. package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
  40. package/lib/component/header/Header.d.ts.map +1 -1
  41. package/lib/component/header/Header.js +2 -4
  42. package/lib/component/header/Header.js.map +1 -1
  43. package/lib/component/hooks/useSaveSettings.d.ts.map +1 -1
  44. package/lib/component/hooks/useSaveSettings.js +3 -6
  45. package/lib/component/hooks/useSaveSettings.js.map +1 -1
  46. package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
  47. package/lib/component/modal/PublicationStringModal.js +2 -6
  48. package/lib/component/modal/PublicationStringModal.js.map +1 -1
  49. package/lib/component/modal/SaveAsModal.js +3 -6
  50. package/lib/component/modal/SaveAsModal.js.map +1 -1
  51. package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
  52. package/lib/component/modal/aboutUs/AboutUsModal.js +2 -4
  53. package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
  54. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts.map +1 -1
  55. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +38 -36
  56. package/lib/component/modal/editRange/forms/components/NewSignalTab.js.map +1 -1
  57. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +24 -24
  58. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +24 -24
  59. package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
  60. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +9 -12
  61. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
  62. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +24 -24
  63. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +24 -24
  64. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +24 -24
  65. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +4 -4
  66. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +24 -24
  67. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +24 -24
  68. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +24 -24
  69. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +24 -24
  70. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +24 -24
  71. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +24 -24
  72. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +24 -24
  73. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +24 -24
  74. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +24 -24
  75. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +24 -24
  76. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +24 -24
  77. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +24 -24
  78. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +24 -24
  79. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
  80. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -9
  81. package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
  82. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +1 -1
  83. package/lib/component/panels/PeaksPanel/PeaksPreferences.js.map +1 -1
  84. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
  85. package/lib/component/panels/PeaksPanel/PeaksTable.js +9 -9
  86. package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
  87. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
  88. package/lib/component/panels/SummaryPanel/SummaryPanel.js +7 -0
  89. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  90. package/lib/component/panels/filtersPanel/FilterPanel.d.ts.map +1 -1
  91. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -2
  92. package/lib/component/panels/filtersPanel/FilterPanel.js.map +1 -1
  93. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
  94. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
  95. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts +2 -0
  96. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -0
  97. package/lib/component/panels/filtersPanel/processings_sections_panel.js +144 -0
  98. package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -0
  99. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  100. package/lib/component/reducer/Reducer.js +2 -0
  101. package/lib/component/reducer/Reducer.js.map +1 -1
  102. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  103. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  104. package/lib/component/reducer/actions/MoleculeActions.d.ts +9 -0
  105. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  106. package/lib/component/reducer/actions/RangesActions.d.ts +11 -2
  107. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  108. package/lib/component/reducer/actions/RangesActions.js +23 -5
  109. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  110. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  111. package/lib/component/reducer/actions/ToolsActions.js +5 -17
  112. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  113. package/lib/component/reducer/helper/getTraceSpectrumID.d.ts +5 -0
  114. package/lib/component/reducer/helper/getTraceSpectrumID.d.ts.map +1 -0
  115. package/lib/component/reducer/helper/getTraceSpectrumID.js +14 -0
  116. package/lib/component/reducer/helper/getTraceSpectrumID.js.map +1 -0
  117. package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
  118. package/lib/component/toolbar/nmr_toolbar.js +3 -1
  119. package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
  120. package/lib/component/utility/CoreSlot.d.ts +27 -0
  121. package/lib/component/utility/CoreSlot.d.ts.map +1 -0
  122. package/lib/component/utility/CoreSlot.js +56 -0
  123. package/lib/component/utility/CoreSlot.js.map +1 -0
  124. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts.map +1 -1
  125. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  126. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js.map +1 -1
  127. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts.map +1 -1
  128. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +35 -30
  129. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js.map +1 -1
  130. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
  131. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +1 -0
  132. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
  133. package/lib/versionInfo.js +1 -1
  134. package/package.json +25 -24
  135. package/src/component/1d-2d/tools/BrushXY.tsx +8 -8
  136. package/src/component/2d/1d-tracer/Left1DChart.tsx +24 -1
  137. package/src/component/2d/1d-tracer/Ranges1D.tsx +134 -0
  138. package/src/component/2d/1d-tracer/Signals1D.tsx +145 -0
  139. package/src/component/2d/1d-tracer/Top1DChart.tsx +29 -2
  140. package/src/component/2d/ft/FTContainer.tsx +1 -0
  141. package/src/component/AnchorSVG.tsx +370 -0
  142. package/src/component/EventsTrackers/BrushTracker.tsx +6 -0
  143. package/src/component/context/KeyModifierContext.tsx +5 -0
  144. package/src/component/elements/DraggableDialog.tsx +1 -2
  145. package/src/component/elements/Sections.tsx +4 -4
  146. package/src/component/elements/export/ExportOptionsModal.tsx +22 -31
  147. package/src/component/header/Header.tsx +2 -4
  148. package/src/component/hooks/useSaveSettings.tsx +4 -15
  149. package/src/component/modal/PublicationStringModal.tsx +5 -11
  150. package/src/component/modal/SaveAsModal.tsx +41 -50
  151. package/src/component/modal/aboutUs/AboutUsModal.tsx +5 -4
  152. package/src/component/modal/editRange/forms/components/NewSignalTab.tsx +57 -57
  153. package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +23 -29
  154. package/src/component/panels/PeaksPanel/PeaksPanel.tsx +1 -8
  155. package/src/component/panels/PeaksPanel/PeaksPreferences.tsx +1 -1
  156. package/src/component/panels/PeaksPanel/PeaksTable.tsx +11 -9
  157. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +13 -11
  158. package/src/component/panels/filtersPanel/FilterPanel.tsx +10 -0
  159. package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
  160. package/src/component/panels/filtersPanel/processings_sections_panel.tsx +324 -0
  161. package/src/component/reducer/Reducer.ts +2 -0
  162. package/src/component/reducer/actions/CorrelationsActions.ts +1 -1
  163. package/src/component/reducer/actions/RangesActions.ts +39 -5
  164. package/src/component/reducer/actions/ToolsActions.ts +5 -21
  165. package/src/component/reducer/helper/getTraceSpectrumID.tsx +25 -0
  166. package/src/component/toolbar/nmr_toolbar.tsx +3 -2
  167. package/src/component/utility/CoreSlot.tsx +126 -0
  168. package/src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts +1 -0
  169. package/src/data/data1d/Spectrum1D/peaks/optimizePeaks.ts +35 -30
  170. package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +1 -0
  171. package/src/versionInfo.ts +1 -1
  172. package/lib/component/utility/renderCoreSlot.d.ts +0 -11
  173. package/lib/component/utility/renderCoreSlot.d.ts.map +0 -1
  174. package/lib/component/utility/renderCoreSlot.js +0 -13
  175. package/lib/component/utility/renderCoreSlot.js.map +0 -1
  176. 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 { Button, Form, useForm } from 'react-science/ui';
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.AppForm>
90
- <Form
91
- layout="inline"
92
- noValidate
93
- onSubmit={(event) => {
94
- event.preventDefault();
95
- void form.handleSubmit();
96
- }}
97
- >
98
- <DialogBody style={{ backgroundColor: 'white' }}>
99
- <form.Section title="General information">
100
- <form.AppField name="name">
101
- {(field) => <field.Input label="Name" required autoFocus />}
102
- </form.AppField>
103
- </form.Section>
104
- <form.Section title="Include">
105
- <form.AppField name="include.view">
106
- {(field) => <field.Checkbox label="View" />}
107
- </form.AppField>
108
-
109
- <form.AppField name="include.settings">
110
- {(field) => <field.Checkbox label="Workspace" />}
111
- </form.AppField>
112
-
113
- <form.AppField name="include.dataType">
114
- {(field) => (
115
- <field.RadioGroup inline label="Data" options={options} />
116
- )}
117
- </form.AppField>
118
- </form.Section>
119
- </DialogBody>
120
-
121
- <DialogFooter
122
- actions={
123
- <>
124
- <Button
125
- variant="outlined"
126
- intent="danger"
127
- onClick={() => onCloseDialog?.()}
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 { renderCoreSlot } from '../../utility/renderCoreSlot.js';
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
- {renderCoreSlot(core, 'topbar.about_us.modal', modalContentFallback)}
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 { Button } from '@blueprintjs/core';
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 { useEffect } from 'react';
6
- import { useForm, useFormContext, useWatch } from 'react-hook-form';
7
- import * as Yup from 'yup';
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
- function saveHandler(val: any) {
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: val.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
- const { handleSubmit, reset, control, setFocus } = useForm({
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
- <p style={styles.infoText}>
95
- Edit or select a delta value of new signal in range [
96
- {`${formatNumber(
97
- range.from,
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
- Add a signal
117
- </Button>
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
- return Yup.object().shape({
125
- delta: Yup.number()
126
- .test(`test-range`, '', function testNewSignalDelta(value, context) {
127
- const { path, createError } = context;
128
- if (value && value >= range.from && value <= range.to) {
129
- return true;
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
- const errorMessage = ` ${
133
- value ? value.toFixed(5) : 0
134
- } ppm out of the range`;
135
- return createError({ path, message: errorMessage });
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 { Form, assert, useForm } from 'react-science/ui';
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
- type FormMeta = 'apply' | 'save';
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
- // We don't want onSubmitMeta to be inferred as sting.
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
- <form.AppForm>
101
- <Form
102
- layout="inline"
103
- noValidate
104
- onSubmit={(event) => {
105
- event.preventDefault();
106
-
107
- const nativeEvent = event.nativeEvent as SubmitEvent;
108
- const submitter = nativeEvent.submitter as HTMLButtonElement | null;
109
- assert(submitter, 'form event should have a submitter');
110
- const action = submitter.dataset.action;
111
-
112
- void form.handleSubmit(action as FormMeta);
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
- if (filterPeaks.length <= 15) {
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>) {
@@ -51,7 +51,7 @@ const formatFields: NucleusPreferenceField[] = [
51
51
  {
52
52
  id: 6,
53
53
  label: 'kind :',
54
- checkFieldName: 'tablePreferences.fwhm.show',
54
+ checkFieldName: 'tablePreferences.showKind',
55
55
  },
56
56
  {
57
57
  id: 7,
@@ -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 formatNumber(fwhm, tablePreferences.fwhm.format);
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 formatNumber(mu, tablePreferences.mu.format);
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
- if (gamma) {
147
- return formatNumber(gamma, tablePreferences.gamma.format);
146
+
147
+ if (typeof gamma !== 'number') {
148
+ return '';
148
149
  }
149
- return '';
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
- spectraData,
153
- link.experimentID,
154
- true,
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
- ) as Spectrum2D;
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
- spectraData,
201
- link.experimentID,
202
- true,
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
  );
@@ -330,6 +330,7 @@ function OptionsSection(options: OptionsSectionProps) {
330
330
 
331
331
  return (
332
332
  <Sections.Item
333
+ id={algorithm}
333
334
  title={algorithmTitle}
334
335
  arrowProps={{ hide: true }}
335
336
  isOpen={isApplyChecked}