@zakodium/nmrium-core-plugins-ui 0.1.46 → 0.1.48
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/plugins/spectrum_1d_processings_ui/operators/apodization.hook.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.js +17 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.js +39 -12
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_tool.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_tool.js +3 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_tool.js.map +1 -1
- package/package.json +4 -4
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts +17 -1
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.tsx +53 -12
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization_tool.tsx +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apodization.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAkBnF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqC5F"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useForm } from 'react-science/ui';
|
|
4
|
+
function canonizeShapes(shapes) {
|
|
5
|
+
if ('exponential' in shapes && !shapes.exponential?.apply) {
|
|
6
|
+
delete shapes.exponential;
|
|
7
|
+
}
|
|
8
|
+
if ('gaussian' in shapes && !shapes.gaussian?.apply)
|
|
9
|
+
delete shapes.gaussian;
|
|
10
|
+
if ('sineBell' in shapes && !shapes.sineBell?.apply)
|
|
11
|
+
delete shapes.sineBell;
|
|
12
|
+
if ('sineSquare' in shapes && !shapes.sineSquare?.apply) {
|
|
13
|
+
delete shapes.sineSquare;
|
|
14
|
+
}
|
|
15
|
+
if ('traf' in shapes && !shapes.traf?.apply)
|
|
16
|
+
delete shapes.sineSquare;
|
|
17
|
+
return shapes;
|
|
18
|
+
}
|
|
4
19
|
export function useApodizationForm(props) {
|
|
5
20
|
const { operation, onSubmit, onChange, core } = props;
|
|
6
21
|
const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#apodization1D', operation);
|
|
@@ -13,7 +28,8 @@ export function useApodizationForm(props) {
|
|
|
13
28
|
onSubmit: ({ value }) => {
|
|
14
29
|
if (!onSubmit)
|
|
15
30
|
return;
|
|
16
|
-
const
|
|
31
|
+
const settings = validator.parse(value);
|
|
32
|
+
const newOperation = { ...operation, settings: canonizeShapes(settings) };
|
|
17
33
|
onSubmit(newOperation);
|
|
18
34
|
},
|
|
19
35
|
listeners: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"apodization.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,SAAS,cAAc,CAAC,MAAc;IACpC,IAAI,aAAa,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;QAC1D,OAAO,MAAM,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD,IAAI,UAAU,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC;IAC5E,IAAI,UAAU,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC;IAC5E,IAAI,YAAY,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,IAAI,MAAM,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK;QAAE,OAAO,MAAM,CAAC,UAAU,CAAC;IAEtE,OAAO,MAAM,CAAC;AACh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I,EAAE,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IAE1B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_expanded.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apodization_expanded.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAuCnF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC,+BAgN5F"}
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AppForm } from 'react-science/ui';
|
|
3
3
|
import { useApodizationForm } from "./apodization.hook.js";
|
|
4
|
+
const defaults = {
|
|
5
|
+
exponential: {
|
|
6
|
+
apply: true,
|
|
7
|
+
options: {
|
|
8
|
+
lineBroadening: 0.3,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
sineBell: {
|
|
12
|
+
apply: false,
|
|
13
|
+
options: {
|
|
14
|
+
offset: 0,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
sineSquare: {
|
|
18
|
+
apply: false,
|
|
19
|
+
options: {
|
|
20
|
+
offset: 0,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
traf: {
|
|
24
|
+
apply: false,
|
|
25
|
+
options: {
|
|
26
|
+
lineBroadening: 0.3,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
gaussian: {
|
|
30
|
+
apply: false,
|
|
31
|
+
options: {
|
|
32
|
+
lineBroadening: -0.4,
|
|
33
|
+
lineBroadeningCenter: 0.5,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
4
37
|
export function ApodizationExpanded(props) {
|
|
5
38
|
const { children } = props;
|
|
6
39
|
const form = useApodizationForm(props);
|
|
@@ -13,7 +46,7 @@ export function ApodizationExpanded(props) {
|
|
|
13
46
|
const lineBroadening = exponential?.options?.lineBroadening;
|
|
14
47
|
if (typeof lineBroadening === 'number')
|
|
15
48
|
return;
|
|
16
|
-
fieldApi.form.setFieldValue('exponential.options.lineBroadening',
|
|
49
|
+
fieldApi.form.setFieldValue('exponential.options.lineBroadening', defaults.exponential?.options.lineBroadening, { dontRunListeners: true });
|
|
17
50
|
},
|
|
18
51
|
}, children: ({ Checkbox, state }) => (_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "Exponential" }), state.value && (_jsx(AppField, { name: "exponential.options.lineBroadening", children: ({ NumericInput }) => (_jsx(NumericInput, { label: "Line broadening", minorStepSize: 0.01, step: 0.1, majorStepSize: 1 })) }))] })) }), _jsx(AppField, { name: "gaussian.apply", listeners: {
|
|
19
52
|
onChange: ({ value, fieldApi }) => {
|
|
@@ -23,10 +56,10 @@ export function ApodizationExpanded(props) {
|
|
|
23
56
|
const lineBroadening = gaussian?.options?.lineBroadening;
|
|
24
57
|
const lineBroadeningCenter = gaussian?.options?.lineBroadeningCenter;
|
|
25
58
|
if (typeof lineBroadening !== 'number') {
|
|
26
|
-
fieldApi.form.setFieldValue('gaussian.options.lineBroadening',
|
|
59
|
+
fieldApi.form.setFieldValue('gaussian.options.lineBroadening', defaults.gaussian?.options.lineBroadening, { dontRunListeners: true });
|
|
27
60
|
}
|
|
28
61
|
if (typeof lineBroadeningCenter !== 'number') {
|
|
29
|
-
fieldApi.form.setFieldValue('gaussian.options.lineBroadeningCenter',
|
|
62
|
+
fieldApi.form.setFieldValue('gaussian.options.lineBroadeningCenter', defaults.gaussian?.options.lineBroadeningCenter, { dontRunListeners: true });
|
|
30
63
|
}
|
|
31
64
|
},
|
|
32
65
|
}, children: ({ Checkbox, state }) => (_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "Gaussian" }), state.value && (_jsxs(_Fragment, { children: [_jsx(AppField, { name: "gaussian.options.lineBroadening", children: ({ NumericInput }) => (_jsx(NumericInput, { label: "Line broadening", minorStepSize: 0.01, step: 0.1, majorStepSize: 1 })) }), _jsx(AppField, { name: "gaussian.options.lineBroadeningCenter", children: ({ NumericInput }) => (_jsx(NumericInput, { label: "Center", helpText: "keep it in [0 - 1] range", min: 0, max: 1, minorStepSize: 0.001, step: 0.01, majorStepSize: 0.1 })) })] }))] })) }), _jsx(AppField, { name: "sineBell.apply", listeners: {
|
|
@@ -37,9 +70,7 @@ export function ApodizationExpanded(props) {
|
|
|
37
70
|
const offset = sineBell?.options?.offset;
|
|
38
71
|
if (typeof offset === 'number')
|
|
39
72
|
return;
|
|
40
|
-
fieldApi.form.setFieldValue('sineBell.options.offset',
|
|
41
|
-
dontRunListeners: true,
|
|
42
|
-
});
|
|
73
|
+
fieldApi.form.setFieldValue('sineBell.options.offset', defaults.sineBell?.options.offset, { dontRunListeners: true });
|
|
43
74
|
},
|
|
44
75
|
}, children: ({ Checkbox, state }) => (_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "Sine Bell" }), state.value && (_jsx(AppField, { name: "sineBell.options.offset", children: ({ NumericInput }) => _jsx(NumericInput, { label: "Offset" }) }))] })) }), _jsx(AppField, { name: "sineSquare.apply", listeners: {
|
|
45
76
|
onChange: ({ value, fieldApi }) => {
|
|
@@ -49,9 +80,7 @@ export function ApodizationExpanded(props) {
|
|
|
49
80
|
const offset = sineSquare?.options?.offset;
|
|
50
81
|
if (typeof offset === 'number')
|
|
51
82
|
return;
|
|
52
|
-
fieldApi.form.setFieldValue('sineSquare.options.offset',
|
|
53
|
-
dontRunListeners: true,
|
|
54
|
-
});
|
|
83
|
+
fieldApi.form.setFieldValue('sineSquare.options.offset', defaults.sineSquare?.options.offset, { dontRunListeners: true });
|
|
55
84
|
},
|
|
56
85
|
}, children: ({ Checkbox, state }) => (_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "Sine Square" }), state.value && (_jsx(AppField, { name: "sineSquare.options.offset", children: ({ NumericInput }) => _jsx(NumericInput, { label: "Offset" }) }))] })) }), _jsx(AppField, { name: "traf.apply", listeners: {
|
|
57
86
|
onChange: ({ value, fieldApi }) => {
|
|
@@ -61,9 +90,7 @@ export function ApodizationExpanded(props) {
|
|
|
61
90
|
const lineBroadening = traf?.options?.lineBroadening;
|
|
62
91
|
if (typeof lineBroadening === 'number')
|
|
63
92
|
return;
|
|
64
|
-
fieldApi.form.setFieldValue('traf.options.lineBroadening',
|
|
65
|
-
dontRunListeners: true,
|
|
66
|
-
});
|
|
93
|
+
fieldApi.form.setFieldValue('traf.options.lineBroadening', defaults.traf?.options.lineBroadening, { dontRunListeners: true });
|
|
67
94
|
},
|
|
68
95
|
}, children: ({ Checkbox, state }) => (_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "Traf" }), state.value && (_jsx(AppField, { name: "traf.options.lineBroadening", children: ({ NumericInput }) => (_jsx(NumericInput, { label: "Line broadening", minorStepSize: 0.01, step: 0.1, majorStepSize: 1 })) }))] })) })] }));
|
|
69
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_expanded.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"apodization_expanded.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,QAAQ,GAAW;IACvB,WAAW,EAAE;QACX,KAAK,EAAE,IAAI;QACX,OAAO,EAAE;YACP,cAAc,EAAE,GAA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CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,KAAC,YAAY,IAAC,KAAK,EAAC,QAAQ,GAAG,GAC7C,CACZ,IACA,CACJ,GACQ,EAEX,KAAC,QAAQ,IACP,IAAI,EAAC,YAAY,EACjB,SAAS,EAAE;oBACT,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;wBAChC,IAAI,CAAC,KAAK;4BAAE,OAAO;wBACnB,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;wBAC5C,MAAM,cAAc,GAAG,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC;wBACrD,IAAI,OAAO,cAAc,KAAK,QAAQ;4BAAE,OAAO;wBAE/C,QAAQ,CAAC,IAAI,CAAC,aAAa,CACzB,6BAA6B,EAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,EACrC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC;oBACJ,CAAC;iBACF,YAEA,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACxB,8BACE,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,GAAG,EACxB,KAAK,CAAC,KAAK,IAAI,CACd,KAAC,QAAQ,IAAC,IAAI,EAAC,6BAA6B,YACzC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,YAAY,IACX,KAAK,EAAC,iBAAiB,EACvB,aAAa,EAAE,IAAI,EACnB,IAAI,EAAE,GAAG,EACT,aAAa,EAAE,CAAC,GAChB,CACH,GACQ,CACZ,IACA,CACJ,GACQ,IACH,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_tool.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_tool.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"apodization_tool.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_tool.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAuB3E,wBAAgB,eAAe,CAC7B,KAAK,EAAE,6BAA6B,CAAC,6CAA6C,CAAC,sCAoDpF"}
|
|
@@ -8,7 +8,9 @@ import { useEventCallback } from 'usehooks-ts';
|
|
|
8
8
|
function defaultApodization1DOperation() {
|
|
9
9
|
return {
|
|
10
10
|
operatorId: '@zakodium/nmrium-core-plugins#apodization1D',
|
|
11
|
-
settings: {
|
|
11
|
+
settings: {
|
|
12
|
+
exponential: { apply: true, options: { lineBroadening: 0.3 } },
|
|
13
|
+
},
|
|
12
14
|
options: undefined,
|
|
13
15
|
error: undefined,
|
|
14
16
|
uid: generateID(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_tool.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_tool.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,SAAS,6BAA6B;IACpC,OAAO;QACL,UAAU,EAAE,6CAA6C;QACzD,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"apodization_tool.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/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AM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CAAC;QACJ;YACE,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,gBAAgB;SAC5B;KACF,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IACF,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IAE/C,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,OAAO,CACL,KAAC,OAAO,CAAC,IAAI,IACX,EAAE,EAAC,6CAA6C,EAChD,IAAI,EAAE,KAAC,iBAAiB,KAAG,EAC3B,OAAO,EACL,KAAC,kBAAkB,IACjB,KAAK,EAAC,sBAAsB,EAC5B,SAAS,EAAE,CAAC,GAAG,CAAC,EAChB,WAAW,EAAC,qFAAqF,EACjG,IAAI,EAAC,0CAA0C,GAC/C,EAEJ,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,gBAAgB,GACzB,CACH,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakodium/nmrium-core-plugins-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"license": "CC-BY-NC-SA-4.0",
|
|
5
5
|
"description": "UI related plugins needed for cheminfo/nmrium",
|
|
6
6
|
"keywords": [],
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@emotion/react": "^11.14.0",
|
|
30
30
|
"@emotion/styled": "^11.14.1",
|
|
31
31
|
"@tanstack/react-form": "^1.33.4",
|
|
32
|
-
"@zakodium/nmrium-core": "^0.7.
|
|
33
|
-
"@zakodium/nmrium-core-plugins": "^0.7.
|
|
32
|
+
"@zakodium/nmrium-core": "^0.7.62",
|
|
33
|
+
"@zakodium/nmrium-core-plugins": "^0.7.84",
|
|
34
34
|
"@zakodium/utils": "^0.5.1",
|
|
35
35
|
"cheminfo-font": "^1.27.0",
|
|
36
36
|
"fifo-logger": "^2.0.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"volta": {
|
|
52
52
|
"extends": "../../../package.json"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9e840db68f21ac4a956b7496bd2fb85df1ee3608"
|
|
55
55
|
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
|
+
import type { Shapes } from '@zakodium/nmr-types';
|
|
2
3
|
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
3
4
|
import { useEffect } from 'react';
|
|
4
5
|
import { useForm } from 'react-science/ui';
|
|
5
6
|
|
|
7
|
+
function canonizeShapes(shapes: Shapes): Shapes {
|
|
8
|
+
if ('exponential' in shapes && !shapes.exponential?.apply) {
|
|
9
|
+
delete shapes.exponential;
|
|
10
|
+
}
|
|
11
|
+
if ('gaussian' in shapes && !shapes.gaussian?.apply) delete shapes.gaussian;
|
|
12
|
+
if ('sineBell' in shapes && !shapes.sineBell?.apply) delete shapes.sineBell;
|
|
13
|
+
if ('sineSquare' in shapes && !shapes.sineSquare?.apply) {
|
|
14
|
+
delete shapes.sineSquare;
|
|
15
|
+
}
|
|
16
|
+
if ('traf' in shapes && !shapes.traf?.apply) delete shapes.sineSquare;
|
|
17
|
+
|
|
18
|
+
return shapes;
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
export function useApodizationForm(
|
|
7
22
|
props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#apodization1D'>,
|
|
8
23
|
) {
|
|
@@ -21,7 +36,8 @@ export function useApodizationForm(
|
|
|
21
36
|
onSubmit: ({ value }) => {
|
|
22
37
|
if (!onSubmit) return;
|
|
23
38
|
|
|
24
|
-
const
|
|
39
|
+
const settings = validator.parse(value);
|
|
40
|
+
const newOperation = { ...operation, settings: canonizeShapes(settings) };
|
|
25
41
|
onSubmit(newOperation);
|
|
26
42
|
},
|
|
27
43
|
listeners: {
|
|
@@ -1,8 +1,43 @@
|
|
|
1
|
+
import type { Shapes } from '@zakodium/nmr-types';
|
|
1
2
|
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
2
3
|
import { AppForm } from 'react-science/ui';
|
|
3
4
|
|
|
4
5
|
import { useApodizationForm } from './apodization.hook.ts';
|
|
5
6
|
|
|
7
|
+
const defaults: Shapes = {
|
|
8
|
+
exponential: {
|
|
9
|
+
apply: true,
|
|
10
|
+
options: {
|
|
11
|
+
lineBroadening: 0.3,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
sineBell: {
|
|
15
|
+
apply: false,
|
|
16
|
+
options: {
|
|
17
|
+
offset: 0,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
sineSquare: {
|
|
21
|
+
apply: false,
|
|
22
|
+
options: {
|
|
23
|
+
offset: 0,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
traf: {
|
|
27
|
+
apply: false,
|
|
28
|
+
options: {
|
|
29
|
+
lineBroadening: 0.3,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
gaussian: {
|
|
33
|
+
apply: false,
|
|
34
|
+
options: {
|
|
35
|
+
lineBroadening: -0.4,
|
|
36
|
+
lineBroadeningCenter: 0.5,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
6
41
|
export function ApodizationExpanded(
|
|
7
42
|
props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#apodization1D'>,
|
|
8
43
|
) {
|
|
@@ -30,7 +65,7 @@ export function ApodizationExpanded(
|
|
|
30
65
|
|
|
31
66
|
fieldApi.form.setFieldValue(
|
|
32
67
|
'exponential.options.lineBroadening',
|
|
33
|
-
|
|
68
|
+
defaults.exponential?.options.lineBroadening,
|
|
34
69
|
{ dontRunListeners: true },
|
|
35
70
|
);
|
|
36
71
|
},
|
|
@@ -68,7 +103,7 @@ export function ApodizationExpanded(
|
|
|
68
103
|
if (typeof lineBroadening !== 'number') {
|
|
69
104
|
fieldApi.form.setFieldValue(
|
|
70
105
|
'gaussian.options.lineBroadening',
|
|
71
|
-
|
|
106
|
+
defaults.gaussian?.options.lineBroadening,
|
|
72
107
|
{ dontRunListeners: true },
|
|
73
108
|
);
|
|
74
109
|
}
|
|
@@ -76,7 +111,7 @@ export function ApodizationExpanded(
|
|
|
76
111
|
if (typeof lineBroadeningCenter !== 'number') {
|
|
77
112
|
fieldApi.form.setFieldValue(
|
|
78
113
|
'gaussian.options.lineBroadeningCenter',
|
|
79
|
-
|
|
114
|
+
defaults.gaussian?.options.lineBroadeningCenter,
|
|
80
115
|
{ dontRunListeners: true },
|
|
81
116
|
);
|
|
82
117
|
}
|
|
@@ -126,9 +161,11 @@ export function ApodizationExpanded(
|
|
|
126
161
|
const offset = sineBell?.options?.offset;
|
|
127
162
|
if (typeof offset === 'number') return;
|
|
128
163
|
|
|
129
|
-
fieldApi.form.setFieldValue(
|
|
130
|
-
|
|
131
|
-
|
|
164
|
+
fieldApi.form.setFieldValue(
|
|
165
|
+
'sineBell.options.offset',
|
|
166
|
+
defaults.sineBell?.options.offset,
|
|
167
|
+
{ dontRunListeners: true },
|
|
168
|
+
);
|
|
132
169
|
},
|
|
133
170
|
}}
|
|
134
171
|
>
|
|
@@ -153,9 +190,11 @@ export function ApodizationExpanded(
|
|
|
153
190
|
const offset = sineSquare?.options?.offset;
|
|
154
191
|
if (typeof offset === 'number') return;
|
|
155
192
|
|
|
156
|
-
fieldApi.form.setFieldValue(
|
|
157
|
-
|
|
158
|
-
|
|
193
|
+
fieldApi.form.setFieldValue(
|
|
194
|
+
'sineSquare.options.offset',
|
|
195
|
+
defaults.sineSquare?.options.offset,
|
|
196
|
+
{ dontRunListeners: true },
|
|
197
|
+
);
|
|
159
198
|
},
|
|
160
199
|
}}
|
|
161
200
|
>
|
|
@@ -180,9 +219,11 @@ export function ApodizationExpanded(
|
|
|
180
219
|
const lineBroadening = traf?.options?.lineBroadening;
|
|
181
220
|
if (typeof lineBroadening === 'number') return;
|
|
182
221
|
|
|
183
|
-
fieldApi.form.setFieldValue(
|
|
184
|
-
|
|
185
|
-
|
|
222
|
+
fieldApi.form.setFieldValue(
|
|
223
|
+
'traf.options.lineBroadening',
|
|
224
|
+
defaults.traf?.options.lineBroadening,
|
|
225
|
+
{ dontRunListeners: true },
|
|
226
|
+
);
|
|
186
227
|
},
|
|
187
228
|
}}
|
|
188
229
|
>
|
|
@@ -12,7 +12,9 @@ import { useEventCallback } from 'usehooks-ts';
|
|
|
12
12
|
function defaultApodization1DOperation(): Spectrum1DProcessingTypeRegistry['@zakodium/nmrium-core-plugins#apodization1D'] {
|
|
13
13
|
return {
|
|
14
14
|
operatorId: '@zakodium/nmrium-core-plugins#apodization1D',
|
|
15
|
-
settings: {
|
|
15
|
+
settings: {
|
|
16
|
+
exponential: { apply: true, options: { lineBroadening: 0.3 } },
|
|
17
|
+
},
|
|
16
18
|
options: undefined,
|
|
17
19
|
error: undefined,
|
|
18
20
|
uid: generateID(),
|