@zakodium/nmrium-core-plugins-ui 0.1.24 → 0.1.25
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/index.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.js +4 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.d.ts +3 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.d.ts.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.js +48 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.js.map +1 -0
- package/package.json +3 -3
- package/src/plugins/spectrum_1d_processings_ui/operators/index.ts +1 -1
- package/src/plugins/spectrum_1d_processings_ui/operators/{shift_x.tsx → shift_x.ts} +5 -0
- package/src/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.tsx +71 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAqC;IAC3D,eAAe;IACf,aAAa;IACb,aAAa;IACb,KAAK;IACL,QAAQ;IACR,iBAAiB;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift_x.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.
|
|
1
|
+
{"version":3,"file":"shift_x.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,gGAMnB,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
2
|
+
import { ShiftXExpanded } from "./shift_x_expanded.js";
|
|
2
3
|
export const shiftX1D = defineProcessingOperatorUI({
|
|
3
4
|
id: '@zakodium/nmrium-core-plugins#shiftX1D',
|
|
4
5
|
name: 'Shift x',
|
|
6
|
+
Expanded: ShiftXExpanded,
|
|
7
|
+
isEditable: true,
|
|
8
|
+
isLiveEditable: true,
|
|
5
9
|
});
|
|
6
10
|
//# sourceMappingURL=shift_x.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift_x.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.
|
|
1
|
+
{"version":3,"file":"shift_x.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAwB,CAAC;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,0BAA0B,CAAC;IACjD,EAAE,EAAE,wCAAwC;IAC5C,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProcessingOperatorUIExpandedProps } from '@zakodium/nmrium-core';
|
|
2
|
+
export declare function ShiftXExpanded(props: ProcessingOperatorUIExpandedProps<'@zakodium/nmrium-core-plugins#shiftX1D'>): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=shift_x_expanded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shift_x_expanded.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAK/E,wBAAgB,cAAc,CAC5B,KAAK,EAAE,iCAAiC,CAAC,wCAAwC,CAAC,+BA+DnF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { revalidateLogic } from '@tanstack/react-form';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { AppForm, useForm } from 'react-science/ui';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export function ShiftXExpanded(props) {
|
|
7
|
+
const { operation, core, children, onChange, onLiveChange, onMount } = props;
|
|
8
|
+
const { settings } = operation;
|
|
9
|
+
const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#shiftX1D', operation);
|
|
10
|
+
const defaultValues = useMemo(() => {
|
|
11
|
+
return {
|
|
12
|
+
shift: settings,
|
|
13
|
+
};
|
|
14
|
+
}, [settings]);
|
|
15
|
+
const { schemaSettings } = operator;
|
|
16
|
+
const validation = useMemo(() => {
|
|
17
|
+
return z.object({
|
|
18
|
+
shift: schemaSettings,
|
|
19
|
+
});
|
|
20
|
+
}, [schemaSettings]);
|
|
21
|
+
const form = useForm({
|
|
22
|
+
defaultValues,
|
|
23
|
+
validators: { onDynamic: validation },
|
|
24
|
+
validationLogic: revalidateLogic(),
|
|
25
|
+
onSubmit: ({ value }) => {
|
|
26
|
+
if (!onChange)
|
|
27
|
+
return;
|
|
28
|
+
const { shift } = validation.parse(value);
|
|
29
|
+
const newOperation = {
|
|
30
|
+
...operation,
|
|
31
|
+
settings: shift,
|
|
32
|
+
};
|
|
33
|
+
onChange(newOperation);
|
|
34
|
+
},
|
|
35
|
+
listeners: {
|
|
36
|
+
onMount: () => onMount(),
|
|
37
|
+
onChange: ({ formApi }) => {
|
|
38
|
+
const result = validation.safeParse(formApi.state.values);
|
|
39
|
+
if (!result.success)
|
|
40
|
+
return;
|
|
41
|
+
const liveOperation = { ...operation, settings: result.data.shift };
|
|
42
|
+
onLiveChange(liveOperation);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
return (_jsxs(AppForm, { form: form, layout: "inline", children: [children?.(_jsx(form.SubmitButton, { variant: "outlined", size: "small", intent: "success", children: "Apply" })), _jsx(form.AppField, { name: "shift", children: (field) => _jsx(field.NumericInput, { label: "Shift" }) })] }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=shift_x_expanded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shift_x_expanded.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAA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AQ,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;gBACxB,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC1D,IAAI,CAAC,MAAM,CAAC,OAAO;oBAAE,OAAO;gBAE5B,MAAM,aAAa,GAAG,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACpE,YAAY,CAAC,aAAa,CAAC,CAAC;YAC9B,CAAC;SACF;KACF,CAAC,CAAC;IAEH,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,QAAQ,aACjC,QAAQ,EAAE,CACT,KAAC,IAAI,CAAC,YAAY,IAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,sBAE/C,CACrB,EAED,KAAC,IAAI,CAAC,QAAQ,IAAC,IAAI,EAAC,OAAO,YACxB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,KAAK,CAAC,YAAY,IAAC,KAAK,EAAC,OAAO,GAAG,GAClC,IACR,CACX,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.25",
|
|
4
4
|
"license": "CC-BY-NC-SA-4.0",
|
|
5
5
|
"description": "UI related plugins needed for cheminfo/nmrium",
|
|
6
6
|
"keywords": [],
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@blueprintjs/select": "^6.3.3",
|
|
29
29
|
"@tanstack/react-form": "^1.33.2",
|
|
30
30
|
"@zakodium/nmrium-core": "^0.7.50",
|
|
31
|
-
"@zakodium/nmrium-core-plugins": "^0.7.
|
|
31
|
+
"@zakodium/nmrium-core-plugins": "^0.7.67",
|
|
32
32
|
"fifo-logger": "^2.0.1",
|
|
33
33
|
"react": "^18.3.1",
|
|
34
34
|
"react-dom": "^18.3.1",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"typescript": "~6.0.3",
|
|
44
44
|
"vitest": "^4.1.10"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "80667e0063863c55c90ac6cd4f8e3159a2aeaa04"
|
|
47
47
|
}
|
|
@@ -4,7 +4,7 @@ import { apodization1D } from './apodization.ts';
|
|
|
4
4
|
import { digitalFilter1D } from './digital_filter.tsx';
|
|
5
5
|
import { fft1D } from './fft.tsx';
|
|
6
6
|
import { phaseCorrection1D } from './phase_correction.ts';
|
|
7
|
-
import { shiftX1D } from './shift_x.
|
|
7
|
+
import { shiftX1D } from './shift_x.ts';
|
|
8
8
|
import { zeroFilling1D } from './zero_filling.tsx';
|
|
9
9
|
|
|
10
10
|
export const operatorsUI: Array<ProcessingOperatorUI<any>> = [
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
2
2
|
|
|
3
|
+
import { ShiftXExpanded } from './shift_x_expanded.tsx';
|
|
4
|
+
|
|
3
5
|
export const shiftX1D = defineProcessingOperatorUI({
|
|
4
6
|
id: '@zakodium/nmrium-core-plugins#shiftX1D',
|
|
5
7
|
name: 'Shift x',
|
|
8
|
+
Expanded: ShiftXExpanded,
|
|
9
|
+
isEditable: true,
|
|
10
|
+
isLiveEditable: true,
|
|
6
11
|
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
|
+
import type { ProcessingOperatorUIExpandedProps } from '@zakodium/nmrium-core';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { AppForm, useForm } from 'react-science/ui';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export function ShiftXExpanded(
|
|
8
|
+
props: ProcessingOperatorUIExpandedProps<'@zakodium/nmrium-core-plugins#shiftX1D'>,
|
|
9
|
+
) {
|
|
10
|
+
const { operation, core, children, onChange, onLiveChange, onMount } = props;
|
|
11
|
+
|
|
12
|
+
const { settings } = operation;
|
|
13
|
+
const operator = core.getOperationOperator(
|
|
14
|
+
'@zakodium/nmrium-core-plugins#shiftX1D',
|
|
15
|
+
operation,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const defaultValues = useMemo(() => {
|
|
19
|
+
return {
|
|
20
|
+
shift: settings,
|
|
21
|
+
};
|
|
22
|
+
}, [settings]);
|
|
23
|
+
|
|
24
|
+
const { schemaSettings } = operator;
|
|
25
|
+
const validation = useMemo(() => {
|
|
26
|
+
return z.object({
|
|
27
|
+
shift: schemaSettings,
|
|
28
|
+
});
|
|
29
|
+
}, [schemaSettings]);
|
|
30
|
+
|
|
31
|
+
const form = useForm({
|
|
32
|
+
defaultValues,
|
|
33
|
+
validators: { onDynamic: validation },
|
|
34
|
+
validationLogic: revalidateLogic(),
|
|
35
|
+
onSubmit: ({ value }) => {
|
|
36
|
+
if (!onChange) return;
|
|
37
|
+
|
|
38
|
+
const { shift } = validation.parse(value);
|
|
39
|
+
const newOperation = {
|
|
40
|
+
...operation,
|
|
41
|
+
settings: shift,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
onChange(newOperation);
|
|
45
|
+
},
|
|
46
|
+
listeners: {
|
|
47
|
+
onMount: () => onMount(),
|
|
48
|
+
onChange: ({ formApi }) => {
|
|
49
|
+
const result = validation.safeParse(formApi.state.values);
|
|
50
|
+
if (!result.success) return;
|
|
51
|
+
|
|
52
|
+
const liveOperation = { ...operation, settings: result.data.shift };
|
|
53
|
+
onLiveChange(liveOperation);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<AppForm form={form} layout="inline">
|
|
60
|
+
{children?.(
|
|
61
|
+
<form.SubmitButton variant="outlined" size="small" intent="success">
|
|
62
|
+
Apply
|
|
63
|
+
</form.SubmitButton>,
|
|
64
|
+
)}
|
|
65
|
+
|
|
66
|
+
<form.AppField name="shift">
|
|
67
|
+
{(field) => <field.NumericInput label="Shift" />}
|
|
68
|
+
</form.AppField>
|
|
69
|
+
</AppForm>
|
|
70
|
+
);
|
|
71
|
+
}
|