@zakodium/nmrium-core-plugins-ui 0.1.32 → 0.1.34
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_topbar.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.js +1 -24
- package/lib/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.d.ts +148 -110
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.js +50 -3
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.js +2 -15
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.js +11 -4
- package/lib/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.d.ts.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.js +2 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling.js.map +1 -1
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.d.ts +3 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.d.ts.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.js +10 -0
- package/lib/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.js.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.d.ts +34 -0
- package/lib/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.d.ts.map +1 -0
- package/lib/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.js +25 -0
- package/lib/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.js.map +1 -0
- package/package.json +6 -5
- package/src/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.tsx +3 -26
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts +73 -4
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_expanded.tsx +4 -24
- package/src/plugins/spectrum_1d_processings_ui/operators/phase_correction_tool.tsx +21 -4
- package/src/plugins/spectrum_1d_processings_ui/operators/zero_filling.tsx +2 -0
- package/src/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.tsx +28 -0
- package/src/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.tsx +25 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_topbar.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apodization_topbar.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAMnF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC,+BAiC5F"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { AppForm } from 'react-science/ui';
|
|
2
|
+
import { HorizontalAppForm } from "../utils/horizontal_app_form.js";
|
|
5
3
|
import { useApodizationForm } from "./apodization.hook.js";
|
|
6
4
|
export function ApodizationTopBar(props) {
|
|
7
5
|
const { children } = props;
|
|
@@ -9,25 +7,4 @@ export function ApodizationTopBar(props) {
|
|
|
9
7
|
const { AppField, SubmitButton, Subscribe } = form;
|
|
10
8
|
return (_jsxs(HorizontalAppForm, { form: form, layout: "inline", children: [_jsx(Subscribe, { selector: (state) => state.values.exponential?.apply ?? false, children: (apply) => (_jsx(AppField, { name: "exponential.options.lineBroadening", children: ({ NumericInput }) => (_jsx(NumericInput, { readOnly: !apply, disabled: !apply, label: "Line broadening", minorStepSize: 0.01, step: 0.1, majorStepSize: 1 })) })) }), children(_jsx(SubmitButton, { variant: "outlined", size: "small", intent: "success", children: "Apply" }))] }));
|
|
11
9
|
}
|
|
12
|
-
const HorizontalAppForm = styled(AppForm) `
|
|
13
|
-
display: contents;
|
|
14
|
-
|
|
15
|
-
.${Classes.FORM_GROUP} {
|
|
16
|
-
min-height: unset;
|
|
17
|
-
width: unset;
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: row;
|
|
20
|
-
align-items: center;
|
|
21
|
-
gap: 5px;
|
|
22
|
-
|
|
23
|
-
> :not(.${Classes.LABEL}) {
|
|
24
|
-
min-width: unset;
|
|
25
|
-
width: unset;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.${Classes.INPUT} {
|
|
29
|
-
width: 5em;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
10
|
//# sourceMappingURL=apodization_topbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apodization_topbar.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"apodization_topbar.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/apodization_topbar.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAkC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,UAAU,iBAAiB,CAC/B,KAA2F;IAE3F,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3B,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAEnD,OAAO,CACL,MAAC,iBAAiB,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,QAAQ,aAC5C,KAAC,SAAS,IAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,IAAI,KAAK,YACrE,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,KAAC,QAAQ,IAAC,IAAI,EAAC,oCAAoC,YAChD,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CACrB,KAAC,YAAY,IACX,QAAQ,EAAE,CAAC,KAAK,EAChB,QAAQ,EAAE,CAAC,KAAK,EAChB,KAAK,EAAC,iBAAiB,EACvB,aAAa,EAAE,IAAI,EACnB,IAAI,EAAE,GAAG,EACT,aAAa,EAAE,CAAC,GAChB,CACH,GACQ,CACZ,GACS,EAEX,QAAQ,CACP,KAAC,YAAY,IAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,sBAE/C,CAChB,IACiB,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,112 +1,150 @@
|
|
|
1
1
|
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
2
|
-
export declare function usePhaseCorrectionForm(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>):
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
2
|
+
export declare function usePhaseCorrectionForm(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>): {
|
|
3
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<{
|
|
4
|
+
mode: "absolute";
|
|
5
|
+
} | {
|
|
6
|
+
mode: "manual";
|
|
7
|
+
ph0: number;
|
|
8
|
+
ph1: number;
|
|
9
|
+
} | {
|
|
10
|
+
mode: "automatic-compute";
|
|
11
|
+
} | {
|
|
12
|
+
mode: "automatic-info";
|
|
13
|
+
}, import("@tanstack/react-form").FormValidateOrFn<{
|
|
14
|
+
mode: "absolute";
|
|
15
|
+
} | {
|
|
16
|
+
mode: "manual";
|
|
17
|
+
ph0: number;
|
|
18
|
+
ph1: number;
|
|
19
|
+
} | {
|
|
20
|
+
mode: "automatic-compute";
|
|
21
|
+
} | {
|
|
22
|
+
mode: "automatic-info";
|
|
23
|
+
}> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
|
|
24
|
+
mode: "absolute";
|
|
25
|
+
} | {
|
|
26
|
+
mode: "manual";
|
|
27
|
+
ph0: number;
|
|
28
|
+
ph1: number;
|
|
29
|
+
} | {
|
|
30
|
+
mode: "automatic-compute";
|
|
31
|
+
} | {
|
|
32
|
+
mode: "automatic-info";
|
|
33
|
+
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
34
|
+
mode: "absolute";
|
|
35
|
+
} | {
|
|
36
|
+
mode: "manual";
|
|
37
|
+
ph0: number;
|
|
38
|
+
ph1: number;
|
|
39
|
+
} | {
|
|
40
|
+
mode: "automatic-compute";
|
|
41
|
+
} | {
|
|
42
|
+
mode: "automatic-info";
|
|
43
|
+
}> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
|
|
44
|
+
mode: "absolute";
|
|
45
|
+
} | {
|
|
46
|
+
mode: "manual";
|
|
47
|
+
ph0: number;
|
|
48
|
+
ph1: number;
|
|
49
|
+
} | {
|
|
50
|
+
mode: "automatic-compute";
|
|
51
|
+
} | {
|
|
52
|
+
mode: "automatic-info";
|
|
53
|
+
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
54
|
+
mode: "absolute";
|
|
55
|
+
} | {
|
|
56
|
+
mode: "manual";
|
|
57
|
+
ph0: number;
|
|
58
|
+
ph1: number;
|
|
59
|
+
} | {
|
|
60
|
+
mode: "automatic-compute";
|
|
61
|
+
} | {
|
|
62
|
+
mode: "automatic-info";
|
|
63
|
+
}> | undefined, import("@tanstack/react-form").FormValidateOrFn<{
|
|
64
|
+
mode: "absolute";
|
|
65
|
+
} | {
|
|
66
|
+
mode: "manual";
|
|
67
|
+
ph0: number;
|
|
68
|
+
ph1: number;
|
|
69
|
+
} | {
|
|
70
|
+
mode: "automatic-compute";
|
|
71
|
+
} | {
|
|
72
|
+
mode: "automatic-info";
|
|
73
|
+
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
74
|
+
mode: "absolute";
|
|
75
|
+
} | {
|
|
76
|
+
mode: "manual";
|
|
77
|
+
ph0: number;
|
|
78
|
+
ph1: number;
|
|
79
|
+
} | {
|
|
80
|
+
mode: "automatic-compute";
|
|
81
|
+
} | {
|
|
82
|
+
mode: "automatic-info";
|
|
83
|
+
}> | undefined, import("zod").ZodType<{
|
|
84
|
+
mode: "absolute";
|
|
85
|
+
} | {
|
|
86
|
+
mode: "manual";
|
|
87
|
+
ph0: number;
|
|
88
|
+
ph1: number;
|
|
89
|
+
} | {
|
|
90
|
+
mode: "automatic-compute";
|
|
91
|
+
} | {
|
|
92
|
+
mode: "automatic-info";
|
|
93
|
+
}, any, import("zod/v4/core").$ZodTypeInternals<{
|
|
94
|
+
mode: "absolute";
|
|
95
|
+
} | {
|
|
96
|
+
mode: "manual";
|
|
97
|
+
ph0: number;
|
|
98
|
+
ph1: number;
|
|
99
|
+
} | {
|
|
100
|
+
mode: "automatic-compute";
|
|
101
|
+
} | {
|
|
102
|
+
mode: "automatic-info";
|
|
103
|
+
}, any>>, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
104
|
+
mode: "absolute";
|
|
105
|
+
} | {
|
|
106
|
+
mode: "manual";
|
|
107
|
+
ph0: number;
|
|
108
|
+
ph1: number;
|
|
109
|
+
} | {
|
|
110
|
+
mode: "automatic-compute";
|
|
111
|
+
} | {
|
|
112
|
+
mode: "automatic-info";
|
|
113
|
+
}> | undefined, import("@tanstack/react-form").FormAsyncValidateOrFn<{
|
|
114
|
+
mode: "absolute";
|
|
115
|
+
} | {
|
|
116
|
+
mode: "manual";
|
|
117
|
+
ph0: number;
|
|
118
|
+
ph1: number;
|
|
119
|
+
} | {
|
|
120
|
+
mode: "automatic-compute";
|
|
121
|
+
} | {
|
|
122
|
+
mode: "automatic-info";
|
|
123
|
+
}> | undefined, unknown, {
|
|
124
|
+
readonly Input: typeof import("react-science/ui")._Input;
|
|
125
|
+
readonly NumericInput: typeof import("react-science/ui")._NumericInput;
|
|
126
|
+
readonly Checkbox: typeof import("react-science/ui")._Checkbox;
|
|
127
|
+
readonly Select: typeof import("react-science/ui")._Select;
|
|
128
|
+
readonly Switch: typeof import("react-science/ui")._Switch;
|
|
129
|
+
readonly ColorPicker: typeof import("react-science/ui")._ColorPicker;
|
|
130
|
+
readonly RadioGroup: typeof import("react-science/ui")._RadioGroup;
|
|
131
|
+
readonly DraggableNumericInput: typeof import("react-science/ui")._DraggableNumericInput;
|
|
132
|
+
}, {
|
|
133
|
+
readonly SubmitButton: typeof import("react-science/ui")._SubmitButton;
|
|
134
|
+
readonly ResetButton: typeof import("react-science/ui")._ResetButton;
|
|
135
|
+
readonly Section: typeof import("react-science/ui")._Section;
|
|
136
|
+
}>;
|
|
137
|
+
selectModeProps: Pick<import("react-science/ui").SelectProps, "itemDisabled" | "items">;
|
|
138
|
+
appFieldModeListeners: import("@tanstack/react-form").FieldListeners<{
|
|
139
|
+
mode: "absolute";
|
|
140
|
+
} | {
|
|
141
|
+
mode: "manual";
|
|
142
|
+
ph0: number;
|
|
143
|
+
ph1: number;
|
|
144
|
+
} | {
|
|
145
|
+
mode: "automatic-compute";
|
|
146
|
+
} | {
|
|
147
|
+
mode: "automatic-info";
|
|
148
|
+
}, "mode" | "ph0" | "ph1", number | "absolute" | "manual" | "automatic-compute" | "automatic-info">;
|
|
149
|
+
};
|
|
112
150
|
//# sourceMappingURL=phase_correction.hook.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACV,qCAAqC,EAEtC,MAAM,uBAAuB,CAAC;AA6B/B,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,qCAAqC,CAAC,iDAAiD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkFhG"}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
|
-
import {
|
|
2
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
+
import { cast } from '@zakodium/utils';
|
|
4
|
+
import { autoPhaseCorrection } from 'nmr-processing';
|
|
5
|
+
import { useEffect, useMemo } from 'react';
|
|
3
6
|
import { useForm } from 'react-science/ui';
|
|
7
|
+
const items = [
|
|
8
|
+
{
|
|
9
|
+
value: 'automatic-compute',
|
|
10
|
+
label: 'Automatic from data computation',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: 'automatic-info',
|
|
14
|
+
label: 'Automatic from spectrum informations',
|
|
15
|
+
},
|
|
16
|
+
{ value: 'manual', label: 'Manual' },
|
|
17
|
+
{ value: 'absolute', label: 'Absolute' },
|
|
18
|
+
];
|
|
4
19
|
export function usePhaseCorrectionForm(props) {
|
|
5
|
-
const { operation, core, onSubmit, onChange } = props;
|
|
20
|
+
const { spectrum, operation, core, onSubmit, onChange } = props;
|
|
21
|
+
castSpectrum1D(spectrum);
|
|
6
22
|
const { settings } = operation;
|
|
7
23
|
const operator = core.getOperationOperator('@zakodium/nmrium-core-plugins#phaseCorrection1D', operation);
|
|
8
24
|
const { schemaSettings } = operator;
|
|
@@ -32,6 +48,37 @@ export function usePhaseCorrectionForm(props) {
|
|
|
32
48
|
useEffect(() => {
|
|
33
49
|
form.reset(settings, { keepDefaultValues: true });
|
|
34
50
|
}, [form, settings]);
|
|
35
|
-
|
|
51
|
+
const shouldDisableAutoInfoMode = useMemo(() => {
|
|
52
|
+
const { phc0 = 0, phc1 = 0 } = spectrum.info;
|
|
53
|
+
return phc0 === 0 && phc1 === 0;
|
|
54
|
+
}, [spectrum]);
|
|
55
|
+
const selectModeProps = {
|
|
56
|
+
items,
|
|
57
|
+
itemDisabled: (item) => {
|
|
58
|
+
cast(item);
|
|
59
|
+
return item.value === 'automatic-info' && shouldDisableAutoInfoMode;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const appFieldModeListeners = {
|
|
63
|
+
onChange: ({ value, fieldApi }) => {
|
|
64
|
+
// It is not strictly typed to `<AppField name="mode">`,
|
|
65
|
+
// so little safety check if the listener is attached to the right field.
|
|
66
|
+
// NB: `Extract<AppFieldProps, {name: 'mode'}>` returns `never`.
|
|
67
|
+
if (fieldApi.name !== 'mode')
|
|
68
|
+
return;
|
|
69
|
+
if (value !== 'manual')
|
|
70
|
+
return;
|
|
71
|
+
// When we switch to manual mode, we should set ph0 and ph1 from `autoPhaseCorrection`.
|
|
72
|
+
// cf: `packages/nmr/nmr-processing/src/datum/data1d/filter1d/phaseCorrection.ts`
|
|
73
|
+
// when ph0 and ph1 are not available.
|
|
74
|
+
let phases = autoPhaseCorrection(spectrum);
|
|
75
|
+
if (phases.ph0 === 0 && phases.ph1 === 0) {
|
|
76
|
+
phases = autoPhaseCorrection(spectrum, { magnitudeMode: true });
|
|
77
|
+
}
|
|
78
|
+
form.setFieldValue('ph0', phases.ph0);
|
|
79
|
+
form.setFieldValue('ph1', phases.ph1);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return { form, selectModeProps, appFieldModeListeners };
|
|
36
83
|
}
|
|
37
84
|
//# sourceMappingURL=phase_correction.hook.js.map
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"phase_correction.hook.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/phase_correction.hook.ts"],"names":[],"mappings":"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"}
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;
|
|
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;AAMnF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qCAAqC,CAAC,iDAAiD,CAAC,+BAgDhG"}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
-
import { autoPhaseCorrection } from 'nmr-processing';
|
|
4
3
|
import { AppForm } from 'react-science/ui';
|
|
5
4
|
import { usePhaseCorrectionForm } from "./phase_correction.hook.js";
|
|
6
5
|
export function PhaseCorrectionExpanded(props) {
|
|
7
|
-
const form = usePhaseCorrectionForm(props);
|
|
6
|
+
const { form, selectModeProps, appFieldModeListeners } = usePhaseCorrectionForm(props);
|
|
8
7
|
const { spectrum, children } = props;
|
|
9
8
|
castSpectrum1D(spectrum);
|
|
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: {
|
|
11
|
-
onChange: ({ value, fieldApi }) => {
|
|
12
|
-
if (value === 'manual') {
|
|
13
|
-
const { ph0, ph1 } = autoPhaseCorrection(spectrum);
|
|
14
|
-
fieldApi.form.setFieldValue('ph0', ph0);
|
|
15
|
-
fieldApi.form.setFieldValue('ph1', ph1);
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
}, children: (field) => (_jsxs(_Fragment, { children: [_jsx(field.Select, { label: "Mode", layout: "inline", items: [
|
|
19
|
-
{ value: 'automatic', label: 'Automatic' },
|
|
20
|
-
{ value: 'manual', label: 'Manual' },
|
|
21
|
-
{ value: 'absolute', label: 'Absolute' },
|
|
22
|
-
] }), field.state.value === 'manual' && (_jsxs(_Fragment, { children: [_jsx(form.AppField, { name: "ph0", children: (field) => (_jsx(field.DraggableNumericInput, { label: "PH0", draggableLabel: "Change PH0 (click and drag)", draggableIntent: "success" })) }), _jsx(form.AppField, { name: "ph1", children: (field) => (_jsx(field.DraggableNumericInput, { label: "PH1", draggableLabel: "Change PH1 (click and drag)", draggableIntent: "success" })) })] }))] })) })] }));
|
|
9
|
+
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: appFieldModeListeners, children: (field) => (_jsxs(_Fragment, { children: [_jsx(field.Select, { label: "Mode", layout: "inline", ...selectModeProps }), field.state.value === 'manual' && (_jsxs(_Fragment, { children: [_jsx(form.AppField, { name: "ph0", children: (field) => (_jsx(field.DraggableNumericInput, { label: "PH0", draggableLabel: "Change PH0 (click and drag)", draggableIntent: "success" })) }), _jsx(form.AppField, { name: "ph1", children: (field) => (_jsx(field.DraggableNumericInput, { label: "PH1", draggableLabel: "Change PH1 (click and drag)", draggableIntent: "success" })) })] }))] })) })] }));
|
|
23
10
|
}
|
|
24
11
|
//# sourceMappingURL=phase_correction_expanded.js.map
|
|
@@ -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":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,
|
|
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,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,UAAU,uBAAuB,CACrC,KAA+F;IAE/F,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,qBAAqB,EAAE,GACpD,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAChC,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,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAE,qBAAqB,YACxD,CAAC,KAAK,EAAE,EAAE,CAAC,CACV,8BACE,KAAC,KAAK,CAAC,MAAM,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,QAAQ,KAAK,eAAe,GAAI,EAEjE,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,
|
|
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,EAG9B,MAAM,uBAAuB,CAAC;AAkC/B,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,6BAA6B,CAAC,iDAAiD,CAAC,sCAoDxF"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useHotkeys } from '@blueprintjs/core';
|
|
3
|
-
import { generateID, isSpectrum1DFt } from '@zakodium/nmrium-core';
|
|
3
|
+
import { castSpectrum1D, generateID, isSpectrum1DFt, } from '@zakodium/nmrium-core';
|
|
4
4
|
import { SvgNmrPhaseCorrection } from 'cheminfo-font';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { Toolbar, TooltipHelpContent } from 'react-science/ui';
|
|
7
7
|
import { useEventCallback } from 'usehooks-ts';
|
|
8
|
-
function
|
|
8
|
+
function getPhaseCorrection1DSettings(spectrum) {
|
|
9
|
+
const { phc0 = 0, phc1 = 0 } = spectrum.info;
|
|
10
|
+
if (phc0 === 0 && phc1 === 0)
|
|
11
|
+
return { mode: 'automatic-compute' };
|
|
12
|
+
return { mode: 'automatic-info' };
|
|
13
|
+
}
|
|
14
|
+
function defaultPhaseCorrectionOperation(spectrum) {
|
|
9
15
|
return {
|
|
10
16
|
operatorId: '@zakodium/nmrium-core-plugins#phaseCorrection1D',
|
|
11
|
-
settings:
|
|
17
|
+
settings: getPhaseCorrection1DSettings(spectrum),
|
|
12
18
|
options: undefined,
|
|
13
19
|
error: undefined,
|
|
14
20
|
uid: generateID(),
|
|
@@ -17,6 +23,7 @@ function defaultPhaseCorrectionOperation() {
|
|
|
17
23
|
}
|
|
18
24
|
export function PhaseCorrectionTool(props) {
|
|
19
25
|
const { spectrum, activeOperatorId, onTriggerOperation } = props;
|
|
26
|
+
castSpectrum1D(spectrum);
|
|
20
27
|
const isActive = activeOperatorId === '@zakodium/nmrium-core-plugins#phaseCorrection1D';
|
|
21
28
|
const isVisible = isSpectrum1DFt(spectrum) && spectrum.info.isComplex;
|
|
22
29
|
const triggerOperation = useEventCallback((event) => {
|
|
@@ -25,7 +32,7 @@ export function PhaseCorrectionTool(props) {
|
|
|
25
32
|
// nmrium keyboard listener is also on document
|
|
26
33
|
event.stopImmediatePropagation();
|
|
27
34
|
}
|
|
28
|
-
onTriggerOperation(defaultPhaseCorrectionOperation());
|
|
35
|
+
onTriggerOperation(defaultPhaseCorrectionOperation(spectrum));
|
|
29
36
|
});
|
|
30
37
|
const hotkeys = useMemo(() => {
|
|
31
38
|
return [
|
|
@@ -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;
|
|
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;AAM/C,OAAO,EACL,cAAc,EACd,UAAU,EACV,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,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,4BAA4B,CACnC,QAAoB;IAEpB,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;IAE7C,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;IACnE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,+BAA+B,CACtC,QAAoB;IAEpB,OAAO;QACL,UAAU,EAAE,iDAAiD;QAC7D,QAAQ,EAAE,4BAA4B,CAAC,QAAQ,CAAC;QAChD,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;IACjE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,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,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChE,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zero_filling.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zero_filling.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,qGASxB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
2
2
|
import { ZeroFillingExpand } from "./zero_filling_expand.js";
|
|
3
3
|
import { ZeroFillingTool } from "./zero_filling_tool.js";
|
|
4
|
+
import { ZeroFillingTopBar } from "./zero_filling_topbar.js";
|
|
4
5
|
export const zeroFilling1D = defineProcessingOperatorUI({
|
|
5
6
|
id: '@zakodium/nmrium-core-plugins#zeroFilling1D',
|
|
6
7
|
name: 'Zero filling',
|
|
@@ -9,5 +10,6 @@ export const zeroFilling1D = defineProcessingOperatorUI({
|
|
|
9
10
|
defaultShouldProcessAll: false,
|
|
10
11
|
Expanded: ZeroFillingExpand,
|
|
11
12
|
Tool: ZeroFillingTool,
|
|
13
|
+
TopBar: ZeroFillingTopBar,
|
|
12
14
|
});
|
|
13
15
|
//# sourceMappingURL=zero_filling.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zero_filling.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"zero_filling.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA2B,CAAC;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,0BAA0B,CAAC;IACtD,EAAE,EAAE,6CAA6C;IACjD,IAAI,EAAE,cAAc;IACpB,UAAU,EAAE,IAAI;IAChB,cAAc,EAAE,IAAI;IACpB,uBAAuB,EAAE,KAAK;IAC9B,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,iBAAiB;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
2
|
+
export declare function ZeroFillingTopBar(props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#zeroFilling1D'>): import("react").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=zero_filling_topbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zero_filling_topbar.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,uBAAuB,CAAC;AAMnF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,qCAAqC,CAAC,6CAA6C,CAAC,+BAoB5F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HorizontalAppForm } from "../utils/horizontal_app_form.js";
|
|
3
|
+
import { useZeroFillingForm } from "./zero_filling.hook.js";
|
|
4
|
+
export function ZeroFillingTopBar(props) {
|
|
5
|
+
const { children } = props;
|
|
6
|
+
const { form, options } = useZeroFillingForm(props);
|
|
7
|
+
const { AppField, SubmitButton } = form;
|
|
8
|
+
return (_jsxs(HorizontalAppForm, { form: form, layout: "inline", children: [_jsx(AppField, { name: "size", children: ({ Select }) => _jsx(Select, { label: "Size", items: options }) }), children(_jsx(SubmitButton, { variant: "outlined", size: "small", intent: "success", children: "Apply" }))] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=zero_filling_topbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zero_filling_topbar.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/operators/zero_filling_topbar.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAkC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,UAAU,iBAAiB,CAC/B,KAA2F;IAE3F,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAExC,OAAO,CACL,MAAC,iBAAiB,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,QAAQ,aAC5C,KAAC,QAAQ,IAAC,IAAI,EAAC,MAAM,YAClB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAC,MAAM,IAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAE,OAAO,GAAI,GAC/C,EAEV,QAAQ,CACP,KAAC,YAAY,IAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,sBAE/C,CAChB,IACiB,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const HorizontalAppForm: import("@emotion/styled").StyledComponent<Omit<import("react").PropsWithChildren<NoInfer<import("react-science/ui").AppFormProps> & {
|
|
2
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<any, any, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, {
|
|
3
|
+
readonly Input: typeof import("react-science/ui").Input;
|
|
4
|
+
readonly NumericInput: typeof import("react-science/ui").NumericInput;
|
|
5
|
+
readonly Checkbox: typeof import("react-science/ui").Checkbox;
|
|
6
|
+
readonly Select: typeof import("react-science/ui").Select;
|
|
7
|
+
readonly Switch: typeof import("react-science/ui").Switch;
|
|
8
|
+
readonly ColorPicker: typeof import("react-science/ui").ColorPicker;
|
|
9
|
+
readonly RadioGroup: typeof import("react-science/ui").RadioGroup;
|
|
10
|
+
readonly DraggableNumericInput: typeof import("react-science/ui").DraggableNumericInput;
|
|
11
|
+
}, {
|
|
12
|
+
readonly SubmitButton: typeof import("react-science/ui").SubmitButton;
|
|
13
|
+
readonly ResetButton: typeof import("react-science/ui").ResetButton;
|
|
14
|
+
readonly Section: typeof import("react-science/ui").Section;
|
|
15
|
+
}>;
|
|
16
|
+
}>, "form"> & {
|
|
17
|
+
form: Omit<import("@tanstack/react-form").AppFieldExtendedReactFormApi<any, any, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, import("@tanstack/form-core").FormAsyncValidateOrFn<any> | undefined, any, {
|
|
18
|
+
readonly Input: typeof import("react-science/ui").Input;
|
|
19
|
+
readonly NumericInput: typeof import("react-science/ui").NumericInput;
|
|
20
|
+
readonly Checkbox: typeof import("react-science/ui").Checkbox;
|
|
21
|
+
readonly Select: typeof import("react-science/ui").Select;
|
|
22
|
+
readonly Switch: typeof import("react-science/ui").Switch;
|
|
23
|
+
readonly ColorPicker: typeof import("react-science/ui").ColorPicker;
|
|
24
|
+
readonly RadioGroup: typeof import("react-science/ui").RadioGroup;
|
|
25
|
+
readonly DraggableNumericInput: typeof import("react-science/ui").DraggableNumericInput;
|
|
26
|
+
}, {
|
|
27
|
+
readonly SubmitButton: typeof import("react-science/ui").SubmitButton;
|
|
28
|
+
readonly ResetButton: typeof import("react-science/ui").ResetButton;
|
|
29
|
+
readonly Section: typeof import("react-science/ui").Section;
|
|
30
|
+
}>, "pushFieldValue" | "insertFieldValue" | "replaceFieldValue">;
|
|
31
|
+
} & {
|
|
32
|
+
theme?: import("@emotion/react").Theme;
|
|
33
|
+
}, {}, {}>;
|
|
34
|
+
//# sourceMappingURL=horizontal_app_form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal_app_form.d.ts","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoB7B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Classes } from '@blueprintjs/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { AppForm } from 'react-science/ui';
|
|
4
|
+
export const HorizontalAppForm = styled(AppForm) `
|
|
5
|
+
display: contents;
|
|
6
|
+
|
|
7
|
+
.${Classes.FORM_GROUP} {
|
|
8
|
+
min-height: unset;
|
|
9
|
+
width: unset;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 5px;
|
|
14
|
+
|
|
15
|
+
> :not(.${Classes.LABEL}) {
|
|
16
|
+
min-width: unset;
|
|
17
|
+
width: unset;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.${Classes.INPUT} {
|
|
21
|
+
width: 5em;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
//# sourceMappingURL=horizontal_app_form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"horizontal_app_form.js","sourceRoot":"","sources":["../../../../src/plugins/spectrum_1d_processings_ui/utils/horizontal_app_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;;;KAG3C,OAAO,CAAC,UAAU;;;;;;;;cAQT,OAAO,CAAC,KAAK;;;;;OAKpB,OAAO,CAAC,KAAK;;;;CAInB,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.34",
|
|
4
4
|
"license": "CC-BY-NC-SA-4.0",
|
|
5
5
|
"description": "UI related plugins needed for cheminfo/nmrium",
|
|
6
6
|
"keywords": [],
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"@blueprintjs/select": "^6.3.3",
|
|
29
29
|
"@emotion/styled": "^11.14.1",
|
|
30
30
|
"@tanstack/react-form": "^1.33.2",
|
|
31
|
-
"@zakodium/nmrium-core": "^0.7.
|
|
32
|
-
"@zakodium/nmrium-core-plugins": "^0.7.
|
|
31
|
+
"@zakodium/nmrium-core": "^0.7.53",
|
|
32
|
+
"@zakodium/nmrium-core-plugins": "^0.7.71",
|
|
33
|
+
"@zakodium/utils": "^0.5.0",
|
|
33
34
|
"fifo-logger": "^2.0.1",
|
|
34
35
|
"react": "^18.3.1",
|
|
35
36
|
"react-dom": "^18.3.1",
|
|
36
|
-
"react-science": "^20.
|
|
37
|
+
"react-science": "^20.7.0",
|
|
37
38
|
"usehooks-ts": "^3.1.1",
|
|
38
39
|
"zod": "^4.4.3"
|
|
39
40
|
},
|
|
@@ -44,5 +45,5 @@
|
|
|
44
45
|
"typescript": "~6.0.3",
|
|
45
46
|
"vitest": "^4.1.10"
|
|
46
47
|
},
|
|
47
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "699ffe8485c79fa4cc9a6e1f8c54282fa14f8506"
|
|
48
49
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Classes } from '@blueprintjs/core';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
1
|
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
import { HorizontalAppForm } from '../utils/horizontal_app_form.tsx';
|
|
5
4
|
|
|
6
5
|
import { useApodizationForm } from './apodization.hook.ts';
|
|
7
6
|
|
|
@@ -9,8 +8,8 @@ export function ApodizationTopBar(
|
|
|
9
8
|
props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#apodization1D'>,
|
|
10
9
|
) {
|
|
11
10
|
const { children } = props;
|
|
12
|
-
const form = useApodizationForm(props);
|
|
13
11
|
|
|
12
|
+
const form = useApodizationForm(props);
|
|
14
13
|
const { AppField, SubmitButton, Subscribe } = form;
|
|
15
14
|
|
|
16
15
|
return (
|
|
@@ -40,25 +39,3 @@ export function ApodizationTopBar(
|
|
|
40
39
|
</HorizontalAppForm>
|
|
41
40
|
);
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
const HorizontalAppForm = styled(AppForm)`
|
|
45
|
-
display: contents;
|
|
46
|
-
|
|
47
|
-
.${Classes.FORM_GROUP} {
|
|
48
|
-
min-height: unset;
|
|
49
|
-
width: unset;
|
|
50
|
-
display: flex;
|
|
51
|
-
flex-direction: row;
|
|
52
|
-
align-items: center;
|
|
53
|
-
gap: 5px;
|
|
54
|
-
|
|
55
|
-
> :not(.${Classes.LABEL}) {
|
|
56
|
-
min-width: unset;
|
|
57
|
-
width: unset;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.${Classes.INPUT} {
|
|
61
|
-
width: 5em;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import { revalidateLogic } from '@tanstack/react-form';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
ProcessingOperatorUISettingsFormProps,
|
|
4
|
+
Spectrum1DProcessingTypeRegistry,
|
|
5
|
+
} from '@zakodium/nmrium-core';
|
|
6
|
+
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
7
|
+
import { cast } from '@zakodium/utils';
|
|
8
|
+
import { autoPhaseCorrection } from 'nmr-processing';
|
|
9
|
+
import type { ComponentProps } from 'react';
|
|
10
|
+
import { useEffect, useMemo } from 'react';
|
|
4
11
|
import { useForm } from 'react-science/ui';
|
|
5
12
|
|
|
13
|
+
type Mode =
|
|
14
|
+
Spectrum1DProcessingTypeRegistry['@zakodium/nmrium-core-plugins#phaseCorrection1D']['settings']['mode'];
|
|
15
|
+
|
|
16
|
+
interface Item {
|
|
17
|
+
value: Mode;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const items: Item[] = [
|
|
22
|
+
{
|
|
23
|
+
value: 'automatic-compute',
|
|
24
|
+
label: 'Automatic from data computation',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: 'automatic-info',
|
|
28
|
+
label: 'Automatic from spectrum informations',
|
|
29
|
+
},
|
|
30
|
+
{ value: 'manual', label: 'Manual' },
|
|
31
|
+
{ value: 'absolute', label: 'Absolute' },
|
|
32
|
+
];
|
|
33
|
+
|
|
6
34
|
export function usePhaseCorrectionForm(
|
|
7
35
|
props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>,
|
|
8
36
|
) {
|
|
9
|
-
const { operation, core, onSubmit, onChange } = props;
|
|
37
|
+
const { spectrum, operation, core, onSubmit, onChange } = props;
|
|
38
|
+
castSpectrum1D(spectrum);
|
|
10
39
|
|
|
11
40
|
const { settings } = operation;
|
|
12
41
|
const operator = core.getOperationOperator(
|
|
@@ -44,5 +73,45 @@ export function usePhaseCorrectionForm(
|
|
|
44
73
|
form.reset(settings, { keepDefaultValues: true });
|
|
45
74
|
}, [form, settings]);
|
|
46
75
|
|
|
47
|
-
|
|
76
|
+
const shouldDisableAutoInfoMode = useMemo(() => {
|
|
77
|
+
const { phc0 = 0, phc1 = 0 } = spectrum.info;
|
|
78
|
+
|
|
79
|
+
return phc0 === 0 && phc1 === 0;
|
|
80
|
+
}, [spectrum]);
|
|
81
|
+
|
|
82
|
+
type AppFieldProps = ComponentProps<typeof form.AppField>;
|
|
83
|
+
type AppFieldApi = Parameters<AppFieldProps['children']>[0];
|
|
84
|
+
type SelectProps = ComponentProps<AppFieldApi['Select']>;
|
|
85
|
+
|
|
86
|
+
const selectModeProps: Pick<SelectProps, 'items' | 'itemDisabled'> = {
|
|
87
|
+
items,
|
|
88
|
+
itemDisabled: (item) => {
|
|
89
|
+
cast<Item>(item);
|
|
90
|
+
|
|
91
|
+
return item.value === 'automatic-info' && shouldDisableAutoInfoMode;
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const appFieldModeListeners: AppFieldProps['listeners'] = {
|
|
96
|
+
onChange: ({ value, fieldApi }) => {
|
|
97
|
+
// It is not strictly typed to `<AppField name="mode">`,
|
|
98
|
+
// so little safety check if the listener is attached to the right field.
|
|
99
|
+
// NB: `Extract<AppFieldProps, {name: 'mode'}>` returns `never`.
|
|
100
|
+
if (fieldApi.name !== 'mode') return;
|
|
101
|
+
if (value !== 'manual') return;
|
|
102
|
+
|
|
103
|
+
// When we switch to manual mode, we should set ph0 and ph1 from `autoPhaseCorrection`.
|
|
104
|
+
// cf: `packages/nmr/nmr-processing/src/datum/data1d/filter1d/phaseCorrection.ts`
|
|
105
|
+
// when ph0 and ph1 are not available.
|
|
106
|
+
let phases = autoPhaseCorrection(spectrum);
|
|
107
|
+
if (phases.ph0 === 0 && phases.ph1 === 0) {
|
|
108
|
+
phases = autoPhaseCorrection(spectrum, { magnitudeMode: true });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
form.setFieldValue('ph0', phases.ph0);
|
|
112
|
+
form.setFieldValue('ph1', phases.ph1);
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return { form, selectModeProps, appFieldModeListeners };
|
|
48
117
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
2
2
|
import { castSpectrum1D } from '@zakodium/nmrium-core';
|
|
3
|
-
import { autoPhaseCorrection } from 'nmr-processing';
|
|
4
3
|
import { AppForm } from 'react-science/ui';
|
|
5
4
|
|
|
6
5
|
import { usePhaseCorrectionForm } from './phase_correction.hook.ts';
|
|
@@ -8,7 +7,8 @@ import { usePhaseCorrectionForm } from './phase_correction.hook.ts';
|
|
|
8
7
|
export function PhaseCorrectionExpanded(
|
|
9
8
|
props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>,
|
|
10
9
|
) {
|
|
11
|
-
const form =
|
|
10
|
+
const { form, selectModeProps, appFieldModeListeners } =
|
|
11
|
+
usePhaseCorrectionForm(props);
|
|
12
12
|
const { spectrum, children } = props;
|
|
13
13
|
castSpectrum1D(spectrum);
|
|
14
14
|
|
|
@@ -20,30 +20,10 @@ export function PhaseCorrectionExpanded(
|
|
|
20
20
|
</form.SubmitButton>,
|
|
21
21
|
)}
|
|
22
22
|
|
|
23
|
-
<form.AppField
|
|
24
|
-
name="mode"
|
|
25
|
-
listeners={{
|
|
26
|
-
onChange: ({ value, fieldApi }) => {
|
|
27
|
-
if (value === 'manual') {
|
|
28
|
-
const { ph0, ph1 } = autoPhaseCorrection(spectrum);
|
|
29
|
-
|
|
30
|
-
fieldApi.form.setFieldValue('ph0', ph0);
|
|
31
|
-
fieldApi.form.setFieldValue('ph1', ph1);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
23
|
+
<form.AppField name="mode" listeners={appFieldModeListeners}>
|
|
36
24
|
{(field) => (
|
|
37
25
|
<>
|
|
38
|
-
<field.Select
|
|
39
|
-
label="Mode"
|
|
40
|
-
layout="inline"
|
|
41
|
-
items={[
|
|
42
|
-
{ value: 'automatic', label: 'Automatic' },
|
|
43
|
-
{ value: 'manual', label: 'Manual' },
|
|
44
|
-
{ value: 'absolute', label: 'Absolute' },
|
|
45
|
-
]}
|
|
46
|
-
/>
|
|
26
|
+
<field.Select label="Mode" layout="inline" {...selectModeProps} />
|
|
47
27
|
|
|
48
28
|
{field.state.value === 'manual' && (
|
|
49
29
|
<>
|
|
@@ -2,19 +2,35 @@ import type { HotkeyConfig } from '@blueprintjs/core';
|
|
|
2
2
|
import { useHotkeys } from '@blueprintjs/core';
|
|
3
3
|
import type {
|
|
4
4
|
ProcessingOperatorUIToolProps,
|
|
5
|
+
Spectrum1D,
|
|
5
6
|
Spectrum1DProcessingTypeRegistry,
|
|
6
7
|
} from '@zakodium/nmrium-core';
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
castSpectrum1D,
|
|
10
|
+
generateID,
|
|
11
|
+
isSpectrum1DFt,
|
|
12
|
+
} from '@zakodium/nmrium-core';
|
|
8
13
|
import { SvgNmrPhaseCorrection } from 'cheminfo-font';
|
|
9
14
|
import type { MouseEvent } from 'react';
|
|
10
15
|
import { useMemo } from 'react';
|
|
11
16
|
import { Toolbar, TooltipHelpContent } from 'react-science/ui';
|
|
12
17
|
import { useEventCallback } from 'usehooks-ts';
|
|
13
18
|
|
|
14
|
-
function
|
|
19
|
+
function getPhaseCorrection1DSettings(
|
|
20
|
+
spectrum: Spectrum1D,
|
|
21
|
+
): Spectrum1DProcessingTypeRegistry['@zakodium/nmrium-core-plugins#phaseCorrection1D']['settings'] {
|
|
22
|
+
const { phc0 = 0, phc1 = 0 } = spectrum.info;
|
|
23
|
+
|
|
24
|
+
if (phc0 === 0 && phc1 === 0) return { mode: 'automatic-compute' };
|
|
25
|
+
return { mode: 'automatic-info' };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function defaultPhaseCorrectionOperation(
|
|
29
|
+
spectrum: Spectrum1D,
|
|
30
|
+
): Spectrum1DProcessingTypeRegistry['@zakodium/nmrium-core-plugins#phaseCorrection1D'] {
|
|
15
31
|
return {
|
|
16
32
|
operatorId: '@zakodium/nmrium-core-plugins#phaseCorrection1D',
|
|
17
|
-
settings:
|
|
33
|
+
settings: getPhaseCorrection1DSettings(spectrum),
|
|
18
34
|
options: undefined,
|
|
19
35
|
error: undefined,
|
|
20
36
|
uid: generateID(),
|
|
@@ -26,6 +42,7 @@ export function PhaseCorrectionTool(
|
|
|
26
42
|
props: ProcessingOperatorUIToolProps<'@zakodium/nmrium-core-plugins#phaseCorrection1D'>,
|
|
27
43
|
) {
|
|
28
44
|
const { spectrum, activeOperatorId, onTriggerOperation } = props;
|
|
45
|
+
castSpectrum1D(spectrum);
|
|
29
46
|
|
|
30
47
|
const isActive =
|
|
31
48
|
activeOperatorId === '@zakodium/nmrium-core-plugins#phaseCorrection1D';
|
|
@@ -40,7 +57,7 @@ export function PhaseCorrectionTool(
|
|
|
40
57
|
event.stopImmediatePropagation();
|
|
41
58
|
}
|
|
42
59
|
|
|
43
|
-
onTriggerOperation(defaultPhaseCorrectionOperation());
|
|
60
|
+
onTriggerOperation(defaultPhaseCorrectionOperation(spectrum));
|
|
44
61
|
},
|
|
45
62
|
);
|
|
46
63
|
|
|
@@ -2,6 +2,7 @@ import { defineProcessingOperatorUI } from '@zakodium/nmrium-core';
|
|
|
2
2
|
|
|
3
3
|
import { ZeroFillingExpand } from './zero_filling_expand.tsx';
|
|
4
4
|
import { ZeroFillingTool } from './zero_filling_tool.tsx';
|
|
5
|
+
import { ZeroFillingTopBar } from './zero_filling_topbar.tsx';
|
|
5
6
|
|
|
6
7
|
export const zeroFilling1D = defineProcessingOperatorUI({
|
|
7
8
|
id: '@zakodium/nmrium-core-plugins#zeroFilling1D',
|
|
@@ -11,4 +12,5 @@ export const zeroFilling1D = defineProcessingOperatorUI({
|
|
|
11
12
|
defaultShouldProcessAll: false,
|
|
12
13
|
Expanded: ZeroFillingExpand,
|
|
13
14
|
Tool: ZeroFillingTool,
|
|
15
|
+
TopBar: ZeroFillingTopBar,
|
|
14
16
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ProcessingOperatorUISettingsFormProps } from '@zakodium/nmrium-core';
|
|
2
|
+
|
|
3
|
+
import { HorizontalAppForm } from '../utils/horizontal_app_form.tsx';
|
|
4
|
+
|
|
5
|
+
import { useZeroFillingForm } from './zero_filling.hook.ts';
|
|
6
|
+
|
|
7
|
+
export function ZeroFillingTopBar(
|
|
8
|
+
props: ProcessingOperatorUISettingsFormProps<'@zakodium/nmrium-core-plugins#zeroFilling1D'>,
|
|
9
|
+
) {
|
|
10
|
+
const { children } = props;
|
|
11
|
+
|
|
12
|
+
const { form, options } = useZeroFillingForm(props);
|
|
13
|
+
const { AppField, SubmitButton } = form;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<HorizontalAppForm form={form} layout="inline">
|
|
17
|
+
<AppField name="size">
|
|
18
|
+
{({ Select }) => <Select label="Size" items={options} />}
|
|
19
|
+
</AppField>
|
|
20
|
+
|
|
21
|
+
{children(
|
|
22
|
+
<SubmitButton variant="outlined" size="small" intent="success">
|
|
23
|
+
Apply
|
|
24
|
+
</SubmitButton>,
|
|
25
|
+
)}
|
|
26
|
+
</HorizontalAppForm>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Classes } from '@blueprintjs/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { AppForm } from 'react-science/ui';
|
|
4
|
+
|
|
5
|
+
export const HorizontalAppForm = styled(AppForm)`
|
|
6
|
+
display: contents;
|
|
7
|
+
|
|
8
|
+
.${Classes.FORM_GROUP} {
|
|
9
|
+
min-height: unset;
|
|
10
|
+
width: unset;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 5px;
|
|
15
|
+
|
|
16
|
+
> :not(.${Classes.LABEL}) {
|
|
17
|
+
min-width: unset;
|
|
18
|
+
width: unset;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.${Classes.INPUT} {
|
|
22
|
+
width: 5em;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|