@zakodium/nmrium-core-plugins-ui 0.1.27 → 0.1.29

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 (62) hide show
  1. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.d.ts.map +1 -1
  2. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.d.ts +400 -0
  3. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.d.ts.map +1 -0
  4. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.js +34 -0
  5. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.hook.js.map +1 -0
  6. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.js +2 -0
  7. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization.js.map +1 -1
  8. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.d.ts +2 -2
  9. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.d.ts.map +1 -1
  10. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.js +4 -26
  11. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.js.map +1 -1
  12. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_tool.d.ts.map +1 -1
  13. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_tool.js +2 -3
  14. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_tool.js.map +1 -1
  15. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.d.ts +3 -0
  16. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.d.ts.map +1 -0
  17. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.js +33 -0
  18. package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.js.map +1 -0
  19. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.d.ts +112 -0
  20. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.d.ts.map +1 -0
  21. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.js +37 -0
  22. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.js.map +1 -0
  23. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.d.ts +2 -2
  24. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.d.ts.map +1 -1
  25. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.js +4 -30
  26. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.js.map +1 -1
  27. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.d.ts.map +1 -1
  28. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.js +2 -3
  29. package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.js.map +1 -1
  30. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.d.ts +39 -0
  31. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.d.ts.map +1 -0
  32. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.js +38 -0
  33. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.js.map +1 -0
  34. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.d.ts +2 -2
  35. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.d.ts.map +1 -1
  36. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.js +4 -43
  37. package/lib/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.js.map +1 -1
  38. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.d.ts +45 -0
  39. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.d.ts.map +1 -0
  40. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.js +58 -0
  41. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.js.map +1 -0
  42. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.d.ts +2 -2
  43. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.d.ts.map +1 -1
  44. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.js +5 -51
  45. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.js.map +1 -1
  46. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_tool.d.ts.map +1 -1
  47. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_tool.js +2 -3
  48. package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_tool.js.map +1 -1
  49. package/package.json +5 -4
  50. package/src/plugins/spectrum_1d_processings_ui/operators/apodization.hook.ts +43 -0
  51. package/src/plugins/spectrum_1d_processings_ui/operators/apodization.ts +2 -0
  52. package/src/plugins/spectrum_1d_processings_ui/operators/apodization_expanded.tsx +7 -32
  53. package/src/plugins/spectrum_1d_processings_ui/operators/apodization_tool.tsx +2 -3
  54. package/src/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.tsx +64 -0
  55. package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts +48 -0
  56. package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.tsx +7 -47
  57. package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.tsx +2 -3
  58. package/src/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.ts +53 -0
  59. package/src/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.tsx +7 -53
  60. package/src/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.ts +76 -0
  61. package/src/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.tsx +7 -67
  62. package/src/plugins/spectrum_1d_processings_ui/operators/zero_filling_tool.tsx +2 -3
@@ -0,0 +1,112 @@
1
+ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
2
+ export declare function usePhaseCorrectionForm(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): import("@tanstack/react-form").AppFieldExtendedReactFormApi<{
3
+ mode: "absolute";
4
+ } | {
5
+ mode: "manual";
6
+ ph0: number;
7
+ ph1: number;
8
+ } | {
9
+ mode: "automatic";
10
+ }, import("@tanstack/react-form").FormValidateOrFn<{
11
+ mode: "absolute";
12
+ } | {
13
+ mode: "manual";
14
+ ph0: number;
15
+ ph1: number;
16
+ } | {
17
+ mode: "automatic";
18
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
19
+ mode: "absolute";
20
+ } | {
21
+ mode: "manual";
22
+ ph0: number;
23
+ ph1: number;
24
+ } | {
25
+ mode: "automatic";
26
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
27
+ mode: "absolute";
28
+ } | {
29
+ mode: "manual";
30
+ ph0: number;
31
+ ph1: number;
32
+ } | {
33
+ mode: "automatic";
34
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
35
+ mode: "absolute";
36
+ } | {
37
+ mode: "manual";
38
+ ph0: number;
39
+ ph1: number;
40
+ } | {
41
+ mode: "automatic";
42
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
43
+ mode: "absolute";
44
+ } | {
45
+ mode: "manual";
46
+ ph0: number;
47
+ ph1: number;
48
+ } | {
49
+ mode: "automatic";
50
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
51
+ mode: "absolute";
52
+ } | {
53
+ mode: "manual";
54
+ ph0: number;
55
+ ph1: number;
56
+ } | {
57
+ mode: "automatic";
58
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
59
+ mode: "absolute";
60
+ } | {
61
+ mode: "manual";
62
+ ph0: number;
63
+ ph1: number;
64
+ } | {
65
+ mode: "automatic";
66
+ }> | undefined, import("zod").ZodType<{
67
+ mode: "absolute";
68
+ } | {
69
+ mode: "manual";
70
+ ph0: number;
71
+ ph1: number;
72
+ } | {
73
+ mode: "automatic";
74
+ }, any, import("zod/v4/core").$ZodTypeInternals<{
75
+ mode: "absolute";
76
+ } | {
77
+ mode: "manual";
78
+ ph0: number;
79
+ ph1: number;
80
+ } | {
81
+ mode: "automatic";
82
+ }, any>>, import("@tanstack/react-form").FormAsyncValidateOrFn<{
83
+ mode: "absolute";
84
+ } | {
85
+ mode: "manual";
86
+ ph0: number;
87
+ ph1: number;
88
+ } | {
89
+ mode: "automatic";
90
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
91
+ mode: "absolute";
92
+ } | {
93
+ mode: "manual";
94
+ ph0: number;
95
+ ph1: number;
96
+ } | {
97
+ mode: "automatic";
98
+ }> | undefined, unknown, {
99
+ readonly Input: typeof import("react-science/ui")._Input;
100
+ readonly NumericInput: typeof import("react-science/ui")._NumericInput;
101
+ readonly Checkbox: typeof import("react-science/ui")._Checkbox;
102
+ readonly Select: typeof import("react-science/ui")._Select;
103
+ readonly Switch: typeof import("react-science/ui")._Switch;
104
+ readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
105
+ readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
106
+ readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
107
+ }, {
108
+ readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
109
+ readonly ResetButton: typeof import("react-science/ui")._ResetButton;
110
+ readonly Section: typeof import("react-science/ui")._Section;
111
+ }>;
112
+ //# sourceMappingURL=phase_correction.hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase_correction.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAInF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,qCAAqC,CAAC,iDAAiD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyChG"}
@@ -0,0 +1,37 @@
1
+ import { revalidateLogic } from '@tanstack/react-form';
2
+ import { useEffect } from 'react';
3
+ import { useForm } from 'react-science/ui';
4
+ export function usePhaseCorrectionForm(props) {
5
+ const { operation, core, onSubmit, onChange } = props;
6
+ const { settings } = operation;
7
+ const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#phaseCorrection1D', operation);
8
+ const { schemaSettings } = operator;
9
+ const form = useForm({
10
+ defaultValues: settings,
11
+ validators: { onDynamic: schemaSettings },
12
+ validationLogic: revalidateLogic(),
13
+ onSubmit: ({ value }) => {
14
+ if (!onSubmit)
15
+ return;
16
+ const newOperation = {
17
+ ...operation,
18
+ settings: schemaSettings.parse(value),
19
+ };
20
+ onSubmit(newOperation);
21
+ },
22
+ listeners: {
23
+ onChange: ({ formApi }) => {
24
+ const result = schemaSettings.safeParse(formApi.state.values);
25
+ if (!result.success)
26
+ return;
27
+ const liveOperation = { ...operation, settings: result.data };
28
+ onChange(liveOperation);
29
+ },
30
+ },
31
+ });
32
+ useEffect(() => {
33
+ form.reset(settings, { keepDefaultValues: true });
34
+ }, [form, settings]);
35
+ return form;
36
+ }
37
+ //# sourceMappingURL=phase_correction.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase_correction.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,UAAU,sBAAsB,CACpC,KAA+F;IAE/F,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEtD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAA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peratorUIExpandedProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): import("react").JSX.Element;
1
+ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
2
+ export declare function PhaseCorrectionExpanded(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): import("react").JSX.Element;
3
3
  //# sourceMappingURL=phase_correction_expanded.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"phase_correction_expanded.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAK/E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,iCAAiC,CAAC,iDAAiD,CAAC,+BA4G5F"}
1
+ {"version":3,"file":"phase_correction_expanded.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAOnF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qCAAqC,CAAC,iDAAiD,CAAC,+BAmEhG"}
@@ -1,38 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { revalidateLogic } from '@tanstack/react-form';
3
2
  import { castSpectrum1D } from '@zakodium/nmrium-core';
4
3
  import { autoPhaseCorrection } from 'nmr-processing';
5
- import { AppForm, useForm } from 'react-science/ui';
4
+ import { AppForm } from 'react-science/ui';
5
+ import { usePhaseCorrectionForm } from "./phase_correction.hook.js";
6
6
  export function PhaseCorrectionExpanded(props) {
7
- const { operation, core, children, onChange, onLiveChange, onMount, spectrum, } = props;
7
+ const form = usePhaseCorrectionForm(props);
8
+ const { spectrum, children } = props;
8
9
  castSpectrum1D(spectrum);
9
- const { settings } = operation;
10
- const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#phaseCorrection1D', operation);
11
- const { schemaSettings } = operator;
12
- const form = useForm({
13
- defaultValues: settings,
14
- validators: { onDynamic: schemaSettings },
15
- validationLogic: revalidateLogic(),
16
- onSubmit: ({ value }) => {
17
- if (!onChange)
18
- return;
19
- const newOperation = {
20
- ...operation,
21
- settings: schemaSettings.parse(value),
22
- };
23
- onChange(newOperation);
24
- },
25
- listeners: {
26
- onMount: () => onMount(),
27
- onChange: ({ formApi }) => {
28
- const result = schemaSettings.safeParse(formApi.state.values);
29
- if (!result.success)
30
- return;
31
- const liveOperation = { ...operation, settings: result.data };
32
- onLiveChange(liveOperation);
33
- },
34
- },
35
- });
36
10
  return (_jsxs(AppForm, { form: form, layout: "stacked", children: [children?.(_jsx(form.SubmitButton, { variant: "outlined", size: "small", intent: "success", children: "Apply" })), _jsx(form.AppField, { name: "mode", listeners: {
37
11
  onChange: ({ value, fieldApi }) => {
38
12
  if (value === 'manual') {
@@ -1 +1 @@
1
- {"version":3,"file":"phase_correction_expanded.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,uBAAuB,CACrC,KAA2F;IAE3F,MAAM,EACJ,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,QAAQ,GACT,GAAG,KAAK,CAAC;IAEV,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAA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AAC"}
1
+ {"version":3,"file":"phase_correction_expanded.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,UAAU,uBAAuB,CACrC,KAA+F;IAE/F,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACrC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,SAAS,aAClC,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,IACZ,IAAI,EAAC,MAAM,EACX,SAAS,EAAE;oBACT,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;wBAChC,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;4BACvB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;4BAEnD,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;4BACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;wBAC1C,CAAC;oBACH,CAAC;iBACF,YAEA,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,8BACE,KAAC,KAAK,CAAC,MAAM,IACX,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,QAAQ,EACf,KAAK,EAAE;gCACL,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;gCAC1C,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;gCACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;6BACzC,GACD,EAED,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,CACjC,8BACE,KAAC,IAAI,CAAC,QAAQ,IAAC,IAAI,EAAC,KAAK,YACtB,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,KAAC,KAAK,CAAC,qBAAqB,IAC1B,KAAK,EAAC,KAAK,EACX,cAAc,EAAC,6BAA6B,EAC5C,eAAe,EAAC,SAAS,GACzB,CACH,GACa,EAEhB,KAAC,IAAI,CAAC,QAAQ,IAAC,IAAI,EAAC,KAAK,YACtB,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,KAAC,KAAK,CAAC,qBAAqB,IAC1B,KAAK,EAAC,KAAK,EACX,cAAc,EAAC,6BAA6B,EAC5C,eAAe,EAAC,SAAS,GACzB,CACH,GACa,IACf,CACJ,IACA,CACJ,GACa,IACR,CACX,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"phase_correction_tool.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,uBAAuB,CAAC;AAmB/B,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,6BAA6B,CAAC,iDAAiD,CAAC,sCAoDxF"}
1
+ {"version":3,"file":"phase_correction_tool.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,uBAAuB,CAAC;AAmB/B,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,6BAA6B,CAAC,iDAAiD,CAAC,sCAmDxF"}
@@ -16,9 +16,8 @@ function defaultPhaseCorrectionOperation() {
16
16
  };
17
17
  }
18
18
  export function PhaseCorrectionTool(props) {
19
- const { spectrum, liveSpectrum, onTriggerOperation } = props;
20
- const firstLiveProcessing = liveSpectrum?.processings?.[0]?.operatorId;
21
- const isActive = firstLiveProcessing === '@zakodium/nmrium-core-plugins#phaseCorrection1D';
19
+ const { spectrum, activeOperatorId, onTriggerOperation } = props;
20
+ const isActive = activeOperatorId === '@zakodium/nmrium-core-plugins#phaseCorrection1D';
22
21
  const isVisible = isSpectrum1DFt(spectrum) && spectrum.info.isComplex;
23
22
  const triggerOperation = useEventCallback((event) => {
24
23
  if ('stopImmediatePropagation' in event) {
@@ -1 +1 @@
1
- {"version":3,"file":"phase_correction_tool.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,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,+BAA+B;IACtC,OAAO;QACL,UAAU,EAAE,iDAAiD;QAC7D,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;QAC/B,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,UAAU,EAAE;QACjB,OAAO,EAAE,IAAI;KACd,CAAC;A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AAI,EAAC,qCAAqC,GAC1C,EAEJ,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,gBAAgB,GACzB,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"phase_correction_tool.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,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,+BAA+B;IACtC,OAAO;QACL,UAAU,EAAE,iDAAiD;QAC7D,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;QAC/B,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,UAAU,EAAE;QACjB,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAuF;IAEvF,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAEjE,MAAM,QAAQ,GACZ,gBAAgB,KAAK,iDAAiD,CAAC;IAEzE,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;IAEtE,MAAM,gBAAgB,GAAG,gBAAgB,CACvC,CAAC,KAAiC,EAAE,EAAE;QACpC,IAAI,0BAA0B,IAAI,KAAK,EAAE,CAAC;YACxC,wCAAwC;YACxC,+CAA+C;YAC/C,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACnC,CAAC;QAED,kBAAkB,CAAC,+BAA+B,EAAE,CAAC,CAAC;IACxD,CAAC,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CAAiB,GAAG,EAAE;QAC3C,OAAO;YACL;gBACE,KAAK,EAAE,GAAG;gBACV,KAAK,EAAE,kBAAkB;gBACzB,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,gBAAgB;aAC5B;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,OAAO,CACL,KAAC,OAAO,CAAC,IAAI,IACX,EAAE,EAAC,iDAAiD,EACpD,IAAI,EAAE,KAAC,qBAAqB,KAAG,EAC/B,OAAO,EACL,KAAC,kBAAkB,IACjB,KAAK,EAAC,kBAAkB,EACxB,SAAS,EAAE,CAAC,GAAG,CAAC,EAChB,WAAW,EAAC,gLAAgL,EAC5L,IAAI,EAAC,qCAAqC,GAC1C,EAEJ,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,gBAAgB,GACzB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
2
+ import { z } from 'zod';
3
+ export declare function useShiftXForm(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#shiftX1D'>): import("@tanstack/react-form").AppFieldExtendedReactFormApi<{
4
+ shift: number;
5
+ }, import("@tanstack/react-form").FormValidateOrFn<{
6
+ shift: number;
7
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
8
+ shift: number;
9
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
10
+ shift: number;
11
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
12
+ shift: number;
13
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
14
+ shift: number;
15
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
16
+ shift: number;
17
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
18
+ shift: number;
19
+ }> | undefined, z.ZodObject<{
20
+ shift: z.ZodType<number, any, z.core.$ZodTypeInternals<number, any>>;
21
+ }, z.core.$strip>, import("@tanstack/react-form").FormAsyncValidateOrFn<{
22
+ shift: number;
23
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
24
+ shift: number;
25
+ }> | undefined, unknown, {
26
+ readonly Input: typeof import("react-science/ui")._Input;
27
+ readonly NumericInput: typeof import("react-science/ui")._NumericInput;
28
+ readonly Checkbox: typeof import("react-science/ui")._Checkbox;
29
+ readonly Select: typeof import("react-science/ui")._Select;
30
+ readonly Switch: typeof import("react-science/ui")._Switch;
31
+ readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
32
+ readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
33
+ readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
34
+ }, {
35
+ readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
36
+ readonly ResetButton: typeof import("react-science/ui")._ResetButton;
37
+ readonly Section: typeof import("react-science/ui")._Section;
38
+ }>;
39
+ //# sourceMappingURL=shift_x.hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shift_x.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,aAAa,CAC3B,KAAK,EAAE,qCAAqC,CAAC,wCAAwC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CvF"}
@@ -0,0 +1,38 @@
1
+ import { revalidateLogic } from '@tanstack/react-form';
2
+ import { useEffect, useMemo } from 'react';
3
+ import { useForm } from 'react-science/ui';
4
+ import { z } from 'zod';
5
+ export function useShiftXForm(props) {
6
+ const { operation, core, onChange, onSubmit } = props;
7
+ const { settings } = operation;
8
+ const defaultValues = useMemo(() => ({ shift: settings }), [settings]);
9
+ const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#shiftX1D', operation);
10
+ const { schemaSettings } = operator;
11
+ const validation = useMemo(() => z.object({ shift: schemaSettings }), [schemaSettings]);
12
+ const form = useForm({
13
+ defaultValues,
14
+ validators: { onDynamic: validation },
15
+ validationLogic: revalidateLogic(),
16
+ onSubmit: ({ value }) => {
17
+ if (!onChange)
18
+ return;
19
+ const { shift } = validation.parse(value);
20
+ const newOperation = { ...operation, settings: shift };
21
+ onSubmit(newOperation);
22
+ },
23
+ listeners: {
24
+ onChange: ({ formApi }) => {
25
+ const result = validation.safeParse(formApi.state.values);
26
+ if (!result.success)
27
+ return;
28
+ const liveOperation = { ...operation, settings: result.data.shift };
29
+ onChange(liveOperation);
30
+ },
31
+ },
32
+ });
33
+ useEffect(() => {
34
+ form.reset(defaultValues, { keepDefaultValues: true });
35
+ }, [form, defaultValues]);
36
+ return form;
37
+ }
38
+ //# sourceMappingURL=shift_x.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shift_x.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,aAAa,CAC3B,KAAsF;IAEtF,MAAM,EAAE,SAAS,EAAE,IAAI,E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CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACpE,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC1B,CAAC;SACF;KACF,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IAE1B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,3 +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;
1
+ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
2
+ export declare function ShiftXExpanded(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#shiftX1D'>): import("react").JSX.Element;
3
3
  //# sourceMappingURL=shift_x_expanded.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"shift_x_expanded.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAKnF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,qCAAqC,CAAC,wCAAwC,CAAC,+BAkBvF"}
@@ -1,48 +1,9 @@
1
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';
2
+ import { AppForm } from 'react-science/ui';
3
+ import { useShiftXForm } from "./shift_x.hook.js";
6
4
  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
- });
5
+ const form = useShiftXForm(props);
6
+ const { children } = props;
46
7
  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
8
  }
48
9
  //# sourceMappingURL=shift_x_expanded.js.map
@@ -1 +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,C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AC;QACzB,CAAC;QACD,SAAS,EAAE;YACT,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;YACxB,QAAQ,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"}
1
+ {"version":3,"file":"shift_x_expanded.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/shift_x_expanded.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,UAAU,cAAc,CAC5B,KAAsF;IAEtF,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3B,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"}
@@ -0,0 +1,45 @@
1
+ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
2
+ import { z } from 'zod';
3
+ export declare function useZeroFillingForm(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#zeroFilling1D'>): {
4
+ form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<{
5
+ size: number;
6
+ }, import("@tanstack/react-form").FormValidateOrFn<{
7
+ size: number;
8
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
9
+ size: number;
10
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
11
+ size: number;
12
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
13
+ size: number;
14
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
15
+ size: number;
16
+ }> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
17
+ size: number;
18
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
19
+ size: number;
20
+ }> | undefined, z.ZodObject<{
21
+ size: z.ZodType<number, any, z.core.$ZodTypeInternals<number, any>>;
22
+ }, z.core.$strip>, import("@tanstack/react-form").FormAsyncValidateOrFn<{
23
+ size: number;
24
+ }> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
25
+ size: number;
26
+ }> | undefined, unknown, {
27
+ readonly Input: typeof import("react-science/ui")._Input;
28
+ readonly NumericInput: typeof import("react-science/ui")._NumericInput;
29
+ readonly Checkbox: typeof import("react-science/ui")._Checkbox;
30
+ readonly Select: typeof import("react-science/ui")._Select;
31
+ readonly Switch: typeof import("react-science/ui")._Switch;
32
+ readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
33
+ readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
34
+ readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
35
+ }, {
36
+ readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
37
+ readonly ResetButton: typeof import("react-science/ui")._ResetButton;
38
+ readonly Section: typeof import("react-science/ui")._Section;
39
+ }>;
40
+ options: {
41
+ label: string;
42
+ value: number;
43
+ }[];
44
+ };
45
+ //# sourceMappingURL=zero_filling.hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero_filling.hook.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD5F"}
@@ -0,0 +1,58 @@
1
+ import { revalidateLogic } from '@tanstack/react-form';
2
+ import { useEffect, useMemo } from 'react';
3
+ import { useForm } from 'react-science/ui';
4
+ import { z } from 'zod';
5
+ const DEFAULT_OPTIONS = [
6
+ { label: '256', value: 2 ** 8 },
7
+ { label: '512', value: 2 ** 9 },
8
+ { label: '1K', value: 2 ** 10 },
9
+ { label: '2K', value: 2 ** 11 },
10
+ { label: '4K', value: 2 ** 12 },
11
+ { label: '8K', value: 2 ** 13 },
12
+ { label: '16K', value: 2 ** 14 },
13
+ { label: '32K', value: 2 ** 15 },
14
+ { label: '64K', value: 2 ** 16 },
15
+ { label: '128K', value: 2 ** 17 },
16
+ { label: '256K', value: 2 ** 18 },
17
+ { label: '512K', value: 2 ** 19 },
18
+ { label: '1M', value: 2 ** 20 },
19
+ { label: '2M', value: 2 ** 21 },
20
+ ];
21
+ export function useZeroFillingForm(props) {
22
+ const { operation, onSubmit, onChange, core } = props;
23
+ const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#zeroFilling1D', operation);
24
+ const validator = useMemo(() => z.object({ size: operator.schemaSettings }), [operator]);
25
+ const defaultValues = useMemo(() => ({ size: operation.settings }), [operation.settings]);
26
+ const form = useForm({
27
+ defaultValues,
28
+ validators: { onDynamic: validator },
29
+ validationLogic: revalidateLogic(),
30
+ onSubmit: ({ value }) => {
31
+ const { size: settings } = validator.parse(value);
32
+ onSubmit({ ...operation, settings });
33
+ },
34
+ listeners: {
35
+ onChange: ({ formApi }) => {
36
+ const result = validator.safeParse(formApi.state.values);
37
+ if (!result.success)
38
+ return;
39
+ onChange({ ...operation, settings: result.data.size });
40
+ },
41
+ },
42
+ });
43
+ useEffect(() => {
44
+ form.reset(defaultValues, { keepDefaultValues: true });
45
+ }, [form, defaultValues]);
46
+ const options = useMemo(() => {
47
+ const settings = operation.settings;
48
+ if (DEFAULT_OPTIONS.some((o) => o.value === settings)) {
49
+ return DEFAULT_OPTIONS;
50
+ }
51
+ return [
52
+ ...DEFAULT_OPTIONS,
53
+ { label: String(settings), value: settings },
54
+ ].toSorted((a, b) => a.value - b.value);
55
+ }, [operation.settings]);
56
+ return { form, options };
57
+ }
58
+ //# sourceMappingURL=zero_filling.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero_filling.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C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E,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IAE1B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3B,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QACpC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,EAAE,CAAC;YACtD,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,OAAO;YACL,GAAG,eAAe;YAClB,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;SAC7C,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEzB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { ProcessingOperatorUIExpandedProps } from '@zakodium/nmrium-core';
2
- export declare function ZeroFillingExpand(props: ProcessingOperatorUIExpandedProps<'@zakodium/nmrium-core-plugins#zeroFilling1D'>): import("react").JSX.Element;
1
+ import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
2
+ export declare function ZeroFillingExpand(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#zeroFilling1D'>): import("react").JSX.Element;
3
3
  //# sourceMappingURL=zero_filling_expand.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zero_filling_expand.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAsB/E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iCAAiC,CAAC,6CAA6C,CAAC,+BA8DxF"}
1
+ {"version":3,"file":"zero_filling_expand.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling_expand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAKnF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC,+BAoB5F"}
@@ -1,56 +1,10 @@
1
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
- const options = [
7
- { label: '256', value: 2 ** 8 },
8
- { label: '512', value: 2 ** 9 },
9
- { label: '1K', value: 2 ** 10 },
10
- { label: '2K', value: 2 ** 11 },
11
- { label: '4K', value: 2 ** 12 },
12
- { label: '8K', value: 2 ** 13 },
13
- { label: '16K', value: 2 ** 14 },
14
- { label: '32K', value: 2 ** 15 },
15
- { label: '64K', value: 2 ** 16 },
16
- { label: '128K', value: 2 ** 17 },
17
- { label: '256K', value: 2 ** 18 },
18
- { label: '512K', value: 2 ** 19 },
19
- { label: '1M', value: 2 ** 20 },
20
- { label: '2M', value: 2 ** 21 },
21
- ];
2
+ import { AppForm } from 'react-science/ui';
3
+ import { useZeroFillingForm } from "./zero_filling.hook.js";
22
4
  export function ZeroFillingExpand(props) {
23
- const { operation, onChange, onLiveChange, onMount, core, children } = props;
24
- const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#zeroFilling1D', operation);
25
- const validator = useMemo(() => z.object({
26
- size: operator.schemaSettings,
27
- }), [operator]);
28
- const defaultValues = useMemo(() => ({ size: operation.settings }), [operation.settings]);
29
- const form = useForm({
30
- defaultValues,
31
- validators: { onDynamic: validator },
32
- validationLogic: revalidateLogic(),
33
- onSubmit: ({ value }) => {
34
- const { size: settings } = validator.parse(value);
35
- onChange({ ...operation, settings });
36
- },
37
- listeners: {
38
- onMount: () => onMount(),
39
- onChange: ({ formApi }) => {
40
- const result = validator.safeParse(formApi.state.values);
41
- if (!result.success)
42
- return;
43
- onLiveChange({ ...operation, settings: result.data.size });
44
- },
45
- },
46
- });
47
- const allOptions = useMemo(() => {
48
- const settings = operation.settings;
49
- if (options.some((o) => o.value === settings))
50
- return options;
51
- return [...options, { label: String(settings), value: settings }].toSorted((a, b) => a.value - b.value);
52
- }, [operation.settings]);
5
+ const { children } = props;
6
+ const { form, options } = useZeroFillingForm(props);
53
7
  const { AppField, SubmitButton } = form;
54
- return (_jsxs(AppForm, { form: form, layout: "inline", children: [children(_jsx(SubmitButton, { variant: "outlined", size: "small", intent: "success", children: "Apply" })), _jsx(AppField, { name: "size", children: ({ Select }) => _jsx(Select, { label: "Size", items: allOptions }) })] }));
8
+ return (_jsxs(AppForm, { form: form, layout: "inline", children: [children(_jsx(SubmitButton, { variant: "outlined", size: "small", intent: "success", children: "Apply" })), _jsx(AppField, { name: "size", children: ({ Select }) => _jsx(Select, { label: "Size", items: options }) })] }));
55
9
  }
56
10
  //# sourceMappingURL=zero_filling_expand.js.map