nmrium 0.55.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +3 -1
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +0 -1
- package/lib/component/1d/Viewer1D.js +36 -11
- package/lib/component/1d/database/DatabaseSpectrum.js +14 -19
- package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +0 -1
- package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
- package/lib/component/1d/matrix/Boxplot.js +97 -0
- package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
- package/lib/component/1d/matrix/Stocsy.js +101 -0
- package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
- package/lib/component/1d/matrix/useMatrix.js +93 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +0 -1
- package/lib/component/1d/peaks/PeakEditionManager.js +16 -10
- package/lib/component/1d/utilities/getDecimalsCount.js +1 -1
- package/lib/component/1d/utilities/intersectionResolver.js +1 -1
- package/lib/component/1d/utilities/scale.d.ts +2 -1
- package/lib/component/1d/utilities/scale.js +6 -1
- package/lib/component/1d-2d/FieldEdition.d.ts +3 -1
- package/lib/component/1d-2d/FieldEdition.js +26 -10
- package/lib/component/2d/1d-tracer/Left1DChart.d.ts +0 -1
- package/lib/component/2d/1d-tracer/Top1DChart.d.ts +0 -1
- package/lib/component/2d/XAxis.d.ts +0 -1
- package/lib/component/2d/YAxis.d.ts +0 -1
- package/lib/component/2d/ft/Contours.js +7 -7
- package/lib/component/assignment/AssignmentsContext.d.ts +0 -1
- package/lib/component/context/ChartContext.d.ts +0 -1
- package/lib/component/context/DispatchContext.d.ts +0 -1
- package/lib/component/context/GlobalContext.d.ts +0 -1
- package/lib/component/context/KeyModifierContext.js +1 -1
- package/lib/component/context/LoaderContext.d.ts +0 -1
- package/lib/component/context/PreferencesContext.d.ts +0 -1
- package/lib/component/context/PrepareExportContext.d.ts +21 -0
- package/lib/component/context/PrepareExportContext.js +124 -0
- package/lib/component/context/ScaleContext.d.ts +0 -1
- package/lib/component/elements/ActionButtons.d.ts +1 -0
- package/lib/component/elements/ActionButtons.js +4 -4
- package/lib/component/elements/ColorInput.d.ts +0 -1
- package/lib/component/elements/ColorPickerDropdownController.d.ts +2 -0
- package/lib/component/elements/ColorPickerDropdownController.js +8 -0
- package/lib/component/elements/ColumnWrapper.d.ts +0 -1
- package/lib/component/elements/ContextMenu.d.ts +0 -1
- package/lib/component/elements/Input.d.ts +1 -0
- package/lib/component/elements/Input.js +2 -1
- package/lib/component/elements/Input2.d.ts +13 -0
- package/lib/component/elements/Input2.js +118 -0
- package/lib/component/elements/Input2Controller.d.ts +12 -0
- package/lib/component/elements/Input2Controller.js +22 -0
- package/lib/component/elements/MoleculeSelection.js +1 -1
- package/lib/component/elements/NumberInput.js +1 -1
- package/lib/component/elements/NumberInput2.d.ts +12 -0
- package/lib/component/elements/NumberInput2.js +65 -0
- package/lib/component/elements/NumberInput2Controller.d.ts +8 -0
- package/lib/component/elements/NumberInput2Controller.js +15 -0
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +3 -3
- package/lib/component/elements/ReactTable/Style.d.ts +3 -1
- package/lib/component/elements/ReactTable/Style.js +11 -1
- package/lib/component/elements/ReactTable/utility/ReactTableContext.d.ts +0 -1
- package/lib/component/elements/Select2.d.ts +26 -0
- package/lib/component/elements/Select2.js +25 -0
- package/lib/component/elements/Select2Controller.d.ts +7 -0
- package/lib/component/elements/Select2Controller.js +12 -0
- package/lib/component/elements/draggable/useDraggable.d.ts +0 -1
- package/lib/component/elements/dropDownButton/DropDownButton.d.ts +2 -4
- package/lib/component/elements/dropDownButton/DropDownButton.js +11 -37
- package/lib/component/elements/dropDownButton/DropDownList.js +3 -32
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColumnFormatField.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput2.d.ts +11 -0
- package/lib/component/elements/formik/FormikInput2.js +26 -0
- package/lib/component/elements/formik/FormikOnChange.d.ts +0 -1
- package/lib/component/elements/popup/Modal/Context.d.ts +0 -1
- package/lib/component/elements/popup/Modal/ModalContent.d.ts +0 -1
- package/lib/component/elements/resizer/SVGResizer.d.ts +0 -1
- package/lib/component/elements/useFormValidateField.d.ts +1 -0
- package/lib/component/elements/useFormValidateField.js +9 -0
- package/lib/component/header/ApodizationOptionsPanel.js +26 -11
- package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +1 -4
- package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -16
- package/lib/component/header/BaseLineCorrectionPanel.js +49 -27
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/PhaseCorrectionPanel.js +12 -24
- package/lib/component/header/RangesPickingOptionPanel.js +12 -12
- package/lib/component/header/ZeroFillingOptionsPanel.js +18 -7
- package/lib/component/header/Zones2DOptionPanel.js +19 -18
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useExport.js +4 -4
- package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
- package/lib/component/hooks/usePanelPreferences.js +3 -1
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
- package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
- package/lib/component/hooks/useWorkspaceAction.d.ts +1 -1
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +0 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +5 -1
- package/lib/component/modal/setting/GeneralSettings.js +107 -111
- package/lib/component/modal/setting/WorkspaceItem.js +4 -9
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +95 -59
- package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +33 -25
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +15 -4
- package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +56 -39
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +36 -36
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +44 -36
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +16 -11
- package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +47 -40
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +50 -40
- package/lib/component/modal/setting/settingsValidation.js +8 -34
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +0 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +0 -1
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +0 -1
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
- package/lib/component/panels/Panels.js +32 -9
- package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +0 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +0 -1
- package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
- package/lib/component/panels/SpectraPanel/SpectraPreferences.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/SpectraPreferences.js +32 -24
- package/lib/component/panels/SpectraPanel/SpectraTable.js +17 -2
- package/lib/component/panels/SpectraPanel/SpectrumListPanel.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/ColorIndicator.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.d.ts +3 -3
- package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.js +25 -16
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DHistogram.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +15 -5
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.d.ts +0 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +44 -6
- package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.d.ts +0 -1
- package/lib/component/panels/SummaryPanel/Overview.d.ts +0 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts +0 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +0 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +17 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.d.ts +0 -1
- package/lib/component/panels/databasePanel/DatabaseTable.d.ts +11 -4
- package/lib/component/panels/databasePanel/DatabaseTable.js +22 -7
- package/lib/component/panels/informationPanel/InformationEditionModal.d.ts +6 -0
- package/lib/component/panels/informationPanel/InformationEditionModal.js +105 -0
- package/lib/component/panels/informationPanel/InformationPanel.d.ts +1 -0
- package/lib/component/panels/{InformationPanel.js → informationPanel/InformationPanel.js} +2 -2
- package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts +0 -1
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.d.ts +0 -1
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +0 -1
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +0 -1
- package/lib/component/reducer/Reducer.d.ts +7 -1
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/DatabaseActions.js +22 -5
- package/lib/component/reducer/actions/DomainActions.d.ts +5 -2
- package/lib/component/reducer/actions/DomainActions.js +6 -4
- package/lib/component/reducer/actions/FiltersActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +5 -2
- package/lib/component/reducer/actions/SpectraActions.d.ts +9 -2
- package/lib/component/reducer/actions/SpectraActions.js +65 -23
- package/lib/component/reducer/actions/ToolsActions.js +3 -4
- package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +62 -25
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +11 -8
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +19 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -26
- package/lib/component/reducer/preferences/preferencesReducer.js +7 -1
- package/lib/component/toolbar/ToolBar.js +6 -7
- package/lib/component/utility/PathBuilder.d.ts +1 -0
- package/lib/component/utility/PathBuilder.js +8 -1
- package/lib/component/utility/checkUniqueByKey.d.ts +2 -0
- package/lib/component/utility/checkUniqueByKey.js +40 -0
- package/lib/component/utility/colorToHexWithAlpha.d.ts +9 -0
- package/lib/component/utility/colorToHexWithAlpha.js +4 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/process1D.js +0 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib/data/PredictionManager.js +3 -5
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +13 -13
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +9 -9
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -13
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +13 -13
- package/lib/data/data1d/database.d.ts +1 -0
- package/lib/data/data1d/database.js +4 -2
- package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -22
- package/lib/data/data2d/Spectrum2D/contours.js +88 -67
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +4 -2
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +20 -20
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +20 -20
- package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
- package/lib/data/initiateFilters.d.ts +1 -1
- package/lib/data/matrixGeneration.js +1 -2
- package/lib/data/types/common/DeepPartial.d.ts +3 -0
- package/lib/data/types/common/DeepPartial.js +1 -0
- package/lib/data/types/common/Keys.d.ts +3 -0
- package/lib/data/types/common/Keys.js +1 -0
- package/lib/data/utilities/generateNumbersPowerOfX.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/package.json +39 -38
- package/lib/component/elements/CustomToolTip.d.ts +0 -8
- package/lib/component/elements/CustomToolTip.js +0 -107
- package/lib/component/elements/formik/FormikSlider.d.ts +0 -6
- package/lib/component/elements/formik/FormikSlider.js +0 -15
- package/lib/component/panels/InformationPanel.d.ts +0 -1
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from '@blueprintjs/core';
|
|
3
|
+
import { Select } from '@blueprintjs/select';
|
|
4
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
3
5
|
import { Filters } from 'nmr-processing';
|
|
4
|
-
import {
|
|
6
|
+
import { memo, useRef } from 'react';
|
|
7
|
+
import { useForm } from 'react-hook-form';
|
|
8
|
+
import { Button, useSelect } from 'react-science/ui';
|
|
5
9
|
import * as Yup from 'yup';
|
|
6
10
|
import { useDispatch } from '../context/DispatchContext';
|
|
7
11
|
import ActionButtons from '../elements/ActionButtons';
|
|
8
12
|
import Label from '../elements/Label';
|
|
9
|
-
import
|
|
10
|
-
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
11
|
-
import FormikInput from '../elements/formik/FormikInput';
|
|
12
|
-
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
13
|
+
import { NumberInput2Controller } from '../elements/NumberInput2Controller';
|
|
13
14
|
import { useFilter } from '../hooks/useFilter';
|
|
14
15
|
import { headerLabelStyle } from './Header';
|
|
15
16
|
import { HeaderContainer } from './HeaderContainer';
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
const inputStyle = {
|
|
23
|
-
input: { width: '50px', textAlign: 'center' },
|
|
24
|
-
inputWrapper: { height: '100%' },
|
|
25
|
-
};
|
|
26
|
-
const formData = (algorithm, filterValues) => {
|
|
17
|
+
const algorithmsList = ['airPLS', 'Polynomial'].map((val) => ({
|
|
18
|
+
label: val,
|
|
19
|
+
value: val.toLowerCase(),
|
|
20
|
+
}));
|
|
21
|
+
const getData = (algorithm, filterValues) => {
|
|
27
22
|
const { zones, algorithm: baseAlgorithm, ...other } = filterValues;
|
|
28
23
|
switch (algorithm) {
|
|
29
24
|
case 'airpls': {
|
|
30
25
|
const validation = Yup.object().shape({
|
|
26
|
+
algorithm: Yup.string().required(),
|
|
27
|
+
livePreview: Yup.boolean().required(),
|
|
31
28
|
maxIterations: Yup.number().integer().min(1).required(),
|
|
32
29
|
tolerance: Yup.number().moreThan(0).required(),
|
|
33
30
|
});
|
|
34
31
|
return {
|
|
35
|
-
validation,
|
|
32
|
+
resolver: yupResolver(validation),
|
|
36
33
|
values: {
|
|
37
34
|
algorithm,
|
|
38
35
|
livePreview: true,
|
|
@@ -45,10 +42,12 @@ const formData = (algorithm, filterValues) => {
|
|
|
45
42
|
case 'autoPolynomial':
|
|
46
43
|
case 'polynomial': {
|
|
47
44
|
const validation = Yup.object().shape({
|
|
45
|
+
algorithm: Yup.string().required(),
|
|
46
|
+
livePreview: Yup.boolean().required(),
|
|
48
47
|
degree: Yup.number().integer().min(1).max(6).required(),
|
|
49
48
|
});
|
|
50
49
|
return {
|
|
51
|
-
validation,
|
|
50
|
+
resolver: yupResolver(validation),
|
|
52
51
|
values: {
|
|
53
52
|
algorithm,
|
|
54
53
|
livePreview: true,
|
|
@@ -59,7 +58,9 @@ const formData = (algorithm, filterValues) => {
|
|
|
59
58
|
}
|
|
60
59
|
default:
|
|
61
60
|
return {
|
|
62
|
-
|
|
61
|
+
resolver: yupResolver(Yup.object({
|
|
62
|
+
livePreview: Yup.boolean().required(),
|
|
63
|
+
})),
|
|
63
64
|
values: { livePreview: true },
|
|
64
65
|
};
|
|
65
66
|
}
|
|
@@ -68,7 +69,10 @@ function BaseLineCorrectionInnerPanel(props) {
|
|
|
68
69
|
const dispatch = useDispatch();
|
|
69
70
|
const previousPreviewRef = useRef(true);
|
|
70
71
|
const { algorithm: baseAlgorithm = 'polynomial' } = props?.filter?.value || {};
|
|
71
|
-
const
|
|
72
|
+
const { value: algorithm, onItemSelect, ...defaultSelectProps } = useSelect({
|
|
73
|
+
defaultSelectedItem: algorithmsList.find((item) => item.value === baseAlgorithm),
|
|
74
|
+
itemTextKey: 'label',
|
|
75
|
+
});
|
|
72
76
|
const handleApplyFilter = (values, triggerSource = 'apply') => {
|
|
73
77
|
const { livePreview, ...options } = values;
|
|
74
78
|
switch (triggerSource) {
|
|
@@ -103,12 +107,30 @@ function BaseLineCorrectionInnerPanel(props) {
|
|
|
103
107
|
type: 'RESET_SELECTED_TOOL',
|
|
104
108
|
});
|
|
105
109
|
};
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
const { resolver, values } = getData(algorithm?.value, props?.filter?.value || {});
|
|
111
|
+
const { handleSubmit, control, register, reset } = useForm({
|
|
112
|
+
defaultValues: values,
|
|
113
|
+
resolver: resolver,
|
|
114
|
+
});
|
|
115
|
+
function submitHandler() {
|
|
116
|
+
void handleSubmit((values) => handleApplyFilter(values, 'onChange'))();
|
|
108
117
|
}
|
|
109
|
-
const
|
|
110
|
-
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items:
|
|
111
|
-
|
|
118
|
+
const { onChange: onLivePreviewChange, ...otherLivePreviewRegisterOptions } = register(`livePreview`);
|
|
119
|
+
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Algorithm: ", style: headerLabelStyle, children: _jsx(Select, { items: algorithmsList, filterable: false, itemsEqual: "value", onItemSelect: (item) => {
|
|
120
|
+
onItemSelect(item);
|
|
121
|
+
const { values } = getData(item.value, props?.filter?.value || {});
|
|
122
|
+
reset(values);
|
|
123
|
+
}, ...defaultSelectProps, children: _jsx(Button, { text: algorithm?.label, rightIcon: "double-caret-vertical" }) }) }), algorithm && algorithm?.value === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "Max iterations:", style: headerLabelStyle, children: _jsx(NumberInput2Controller, { control: control, name: "maxIterations", min: 0, stepSize: 1, style: { width: '60px' }, debounceTime: 250, onValueChange: () => {
|
|
124
|
+
submitHandler();
|
|
125
|
+
} }) }), _jsx(Label, { title: "Tolerance:", style: headerLabelStyle, children: _jsx(NumberInput2Controller, { control: control, name: "tolerance", min: 0, stepSize: 0.001, majorStepSize: 0.001, minorStepSize: 0.001, style: { width: '60px' }, debounceTime: 250, onValueChange: () => {
|
|
126
|
+
submitHandler();
|
|
127
|
+
} }) })] })), algorithm &&
|
|
128
|
+
['autoPolynomial', 'polynomial'].includes(algorithm?.value) && (_jsx(Label, { title: "Degree [1 - 6]:", shortTitle: "Degree:", style: headerLabelStyle, children: _jsx(NumberInput2Controller, { control: control, name: "degree", min: 1, max: 6, style: { width: '60px' }, debounceTime: 250, onValueChange: () => {
|
|
129
|
+
submitHandler();
|
|
130
|
+
} }) })), _jsx(Label, { title: "Live preview", style: headerLabelStyle, children: _jsx(Checkbox, { style: { margin: 0 }, ...otherLivePreviewRegisterOptions, onChange: (event) => {
|
|
131
|
+
void onLivePreviewChange(event);
|
|
132
|
+
submitHandler();
|
|
133
|
+
} }) }), _jsx(ActionButtons, { onDone: () => handleSubmit((values) => handleApplyFilter(values))(), onCancel: handleCancelFilter })] }));
|
|
112
134
|
}
|
|
113
135
|
const MemoizedBaseLineCorrectionPanel = memo(BaseLineCorrectionInnerPanel);
|
|
114
136
|
export default function BaseLineCorrectionPanel() {
|
|
@@ -18,7 +18,7 @@ import GeneralSettingsModal from '../modal/setting/GeneralSettings';
|
|
|
18
18
|
import WorkspaceItem from '../modal/setting/WorkspaceItem';
|
|
19
19
|
import { options } from '../toolbar/ToolTypes';
|
|
20
20
|
import ApodizationOptionsPanel from './ApodizationOptionsPanel';
|
|
21
|
-
import AutoPeakPickingOptionPanel from './AutoPeakPickingOptionPanel';
|
|
21
|
+
import { AutoPeakPickingOptionPanel } from './AutoPeakPickingOptionPanel';
|
|
22
22
|
import BaseLineCorrectionPanel from './BaseLineCorrectionPanel';
|
|
23
23
|
import { HeaderContainer } from './HeaderContainer';
|
|
24
24
|
import PhaseCorrectionPanel from './PhaseCorrectionPanel';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormGroup } from '@blueprintjs/core';
|
|
2
3
|
import { Select } from '@blueprintjs/select';
|
|
3
4
|
import { Filters } from 'nmr-processing';
|
|
4
5
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
@@ -6,22 +7,11 @@ import { Button, useSelect } from 'react-science/ui';
|
|
|
6
7
|
import { useChartData } from '../context/ChartContext';
|
|
7
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
8
9
|
import ActionButtons from '../elements/ActionButtons';
|
|
9
|
-
import Input from '../elements/Input';
|
|
10
10
|
import InputRange from '../elements/InputRange';
|
|
11
|
-
import
|
|
11
|
+
import { NumberInput2 } from '../elements/NumberInput2';
|
|
12
12
|
import { useFilter } from '../hooks/useFilter';
|
|
13
13
|
import useSpectrum from '../hooks/useSpectrum';
|
|
14
|
-
import { headerLabelStyle } from './Header';
|
|
15
14
|
import { HeaderContainer } from './HeaderContainer';
|
|
16
|
-
const inputStyle = {
|
|
17
|
-
input: {
|
|
18
|
-
width: '70px',
|
|
19
|
-
textAlign: 'center',
|
|
20
|
-
},
|
|
21
|
-
inputWrapper: {
|
|
22
|
-
height: '100%',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
15
|
const defaultPhasingTypeItem = {
|
|
26
16
|
label: 'Manual',
|
|
27
17
|
value: 'manual',
|
|
@@ -109,17 +99,15 @@ export default function PhaseCorrectionPanel() {
|
|
|
109
99
|
ph0Ref.current.setValue(value.ph0);
|
|
110
100
|
ph1Ref.current.setValue(value.ph1);
|
|
111
101
|
}, []);
|
|
112
|
-
const handleInput = useCallback((
|
|
113
|
-
const { name
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
setValue(valueRef.current);
|
|
122
|
-
}
|
|
102
|
+
const handleInput = useCallback((valueAsNumber, valueAsString, element) => {
|
|
103
|
+
const { name } = element;
|
|
104
|
+
if (Number.isNaN(valueAsNumber))
|
|
105
|
+
return;
|
|
106
|
+
const newValue = { ...valueRef.current, [name]: Number(valueAsNumber) };
|
|
107
|
+
calcPhaseCorrectionHandler(newValue, name);
|
|
108
|
+
updateInputRangeInitialValue(newValue);
|
|
109
|
+
valueRef.current = newValue;
|
|
110
|
+
setValue(valueRef.current);
|
|
123
111
|
}, [calcPhaseCorrectionHandler, updateInputRangeInitialValue]);
|
|
124
112
|
const handleRangeChange = useCallback((e) => {
|
|
125
113
|
const newValue = { ...valueRef.current, [e.name]: e.value };
|
|
@@ -133,5 +121,5 @@ export default function PhaseCorrectionPanel() {
|
|
|
133
121
|
type: 'RESET_SELECTED_TOOL',
|
|
134
122
|
});
|
|
135
123
|
}
|
|
136
|
-
return (_jsxs(HeaderContainer, { children: [_jsx("div", { style: { padding: '0 5px' }, children: _jsx(Select, { items: algorithms, filterable: false, itemsEqual: "value", ...defaultSelectProps, children: _jsx(Button, { text: phaseCorrectionTypeItem?.label, rightIcon: "double-caret-vertical" }) }) }), phaseCorrectionTypeItem?.value === 'manual' && (_jsxs(_Fragment, { children: [_jsx(
|
|
124
|
+
return (_jsxs(HeaderContainer, { children: [_jsx("div", { style: { padding: '0 5px' }, children: _jsx(Select, { items: algorithms, filterable: false, itemsEqual: "value", ...defaultSelectProps, children: _jsx(Button, { text: phaseCorrectionTypeItem?.label, rightIcon: "double-caret-vertical" }) }) }), phaseCorrectionTypeItem?.value === 'manual' && (_jsxs(_Fragment, { children: [_jsx(FormGroup, { label: "PH0:", inline: true, style: { paddingLeft: '5px', margin: 0 }, children: _jsx(NumberInput2, { name: "ph0", onValueChange: handleInput, value: value.ph0, debounceTime: 250, style: { width: 50 } }) }), _jsx(FormGroup, { label: "PH1:", inline: true, style: { paddingLeft: '5px', margin: 0 }, children: _jsx(NumberInput2, { name: "ph1", onValueChange: handleInput, value: value.ph1, debounceTime: 250, style: { width: 50 } }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change PH0 (click and drag)", shortLabel: "Ph0", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change PH1 (click and drag)", shortLabel: "Ph1", style: { width: '20%' }, onChange: handleRangeChange })] })), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
|
|
137
125
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox, Button } from '@blueprintjs/core';
|
|
3
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
3
5
|
import * as Yup from 'yup';
|
|
4
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
5
7
|
import { useToaster } from '../context/ToasterContext';
|
|
6
|
-
import Button from '../elements/Button';
|
|
7
8
|
import Label from '../elements/Label';
|
|
8
|
-
import
|
|
9
|
-
import FormikInput from '../elements/formik/FormikInput';
|
|
9
|
+
import { NumberInput2Controller } from '../elements/NumberInput2Controller';
|
|
10
10
|
import { MIN_AREA_POINTS, useCheckPointsNumberInWindowArea, } from '../hooks/useCheckPointsNumberInWindowArea';
|
|
11
11
|
import { headerLabelStyle } from './Header';
|
|
12
12
|
import { HeaderContainer } from './HeaderContainer';
|
|
13
13
|
const validationSchema = Yup.object().shape({
|
|
14
14
|
minMaxRatio: Yup.number().min(0).required(),
|
|
15
|
+
lookNegative: Yup.boolean().required(),
|
|
15
16
|
});
|
|
16
17
|
const initialValues = {
|
|
17
18
|
minMaxRatio: 0.05,
|
|
@@ -19,6 +20,11 @@ const initialValues = {
|
|
|
19
20
|
};
|
|
20
21
|
function RangesPickingOptionPanel() {
|
|
21
22
|
const dispatch = useDispatch();
|
|
23
|
+
const { handleSubmit, register, control, formState: { isValid }, } = useForm({
|
|
24
|
+
defaultValues: initialValues,
|
|
25
|
+
resolver: yupResolver(validationSchema),
|
|
26
|
+
mode: 'onChange',
|
|
27
|
+
});
|
|
22
28
|
const pointsNumber = useCheckPointsNumberInWindowArea();
|
|
23
29
|
const toaster = useToaster();
|
|
24
30
|
function handleRangesPicking(values) {
|
|
@@ -35,12 +41,6 @@ function RangesPickingOptionPanel() {
|
|
|
35
41
|
});
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
|
-
return (
|
|
39
|
-
input: {
|
|
40
|
-
width: '70px',
|
|
41
|
-
textAlign: 'center',
|
|
42
|
-
},
|
|
43
|
-
inputWrapper: { height: '100%' },
|
|
44
|
-
}, step: 0.01, min: 0 }) }), _jsx(Button.Done, { onClick: () => handleSubmit(), style: { margin: '0 10px' }, disabled: !isValid, children: "Auto ranges picking" })] })) }) }));
|
|
44
|
+
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Detect negative", style: headerLabelStyle, children: _jsx(Checkbox, { style: { margin: 0 }, ...register(`lookNegative`), defaultChecked: false }) }), _jsx(Label, { title: "Min/max ratio:", style: headerLabelStyle, children: _jsx(NumberInput2Controller, { control: control, name: "minMaxRatio", min: 0, stepSize: 0.01, majorStepSize: 0.01, minorStepSize: 0.01, style: { width: '70px' } }) }), _jsx(Button, { intent: "success", onClick: () => handleSubmit(handleRangesPicking)(), style: { margin: '0 10px' }, disabled: !isValid, children: "Auto ranges picking" })] }));
|
|
45
45
|
}
|
|
46
46
|
export default RangesPickingOptionPanel;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from '@blueprintjs/core';
|
|
3
3
|
import { Filters } from 'nmr-processing';
|
|
4
4
|
import { memo, useRef } from 'react';
|
|
5
|
+
import { useForm } from 'react-hook-form';
|
|
5
6
|
import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
|
|
6
7
|
import { useDispatch } from '../context/DispatchContext';
|
|
7
8
|
import ActionButtons from '../elements/ActionButtons';
|
|
8
9
|
import Label from '../elements/Label';
|
|
9
|
-
import
|
|
10
|
-
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
11
|
-
import FormikSelect from '../elements/formik/FormikSelect';
|
|
10
|
+
import { Select2Controller } from '../elements/Select2Controller';
|
|
12
11
|
import { useFilter } from '../hooks/useFilter';
|
|
13
12
|
import useSpectrum from '../hooks/useSpectrum';
|
|
14
13
|
import { headerLabelStyle } from './Header';
|
|
15
14
|
import { HeaderContainer } from './HeaderContainer';
|
|
16
|
-
const
|
|
15
|
+
const sizes = generateNumbersPowerOfX(8, 21);
|
|
17
16
|
function useInitZeroFillingSize() {
|
|
18
17
|
const filter = useFilter(Filters.zeroFilling.id);
|
|
19
18
|
const { data } = useSpectrum();
|
|
@@ -29,6 +28,9 @@ function ZeroFillingOptionsInnerPanel(props) {
|
|
|
29
28
|
const { size } = props;
|
|
30
29
|
const dispatch = useDispatch();
|
|
31
30
|
const previousPreviewRef = useRef(true);
|
|
31
|
+
const { handleSubmit, register, control } = useForm({
|
|
32
|
+
defaultValues: { nbPoints: size, livePreview: true },
|
|
33
|
+
});
|
|
32
34
|
function handleApplyFilter(values, triggerSource = 'apply') {
|
|
33
35
|
const { livePreview, ...options } = values;
|
|
34
36
|
switch (triggerSource) {
|
|
@@ -63,7 +65,16 @@ function ZeroFillingOptionsInnerPanel(props) {
|
|
|
63
65
|
type: 'RESET_SELECTED_TOOL',
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
const { onChange: onLivePreviewChange, ...otherLivePreviewRegisterOptions } = register('livePreview');
|
|
69
|
+
function submitHandler(triggerSource = 'apply') {
|
|
70
|
+
void handleSubmit((values) => handleApplyFilter(values, triggerSource))();
|
|
71
|
+
}
|
|
72
|
+
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Size:", style: headerLabelStyle, children: _jsx(Select2Controller, { control: control, name: "nbPoints", items: sizes, onItemSelect: () => {
|
|
73
|
+
submitHandler('onChange');
|
|
74
|
+
} }) }), _jsx(Label, { title: "Live preview", style: { label: { padding: '0 5px' } }, children: _jsx(Checkbox, { style: { margin: 0 }, ...otherLivePreviewRegisterOptions, onChange: (event) => {
|
|
75
|
+
void onLivePreviewChange(event);
|
|
76
|
+
submitHandler('onChange');
|
|
77
|
+
} }) }), _jsx(ActionButtons, { onDone: () => submitHandler(), onCancel: handleCancelFilter })] }));
|
|
67
78
|
}
|
|
68
79
|
const MemoizedZeroFillingOptionsPanel = memo(ZeroFillingOptionsInnerPanel);
|
|
69
80
|
export default function ZeroFillingOptionsPanel() {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@blueprintjs/core';
|
|
3
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
4
5
|
import * as Yup from 'yup';
|
|
5
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
|
-
import Button from '../elements/Button';
|
|
7
7
|
import Label from '../elements/Label';
|
|
8
|
-
import
|
|
9
|
-
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
8
|
+
import { NumberInput2Controller } from '../elements/NumberInput2Controller';
|
|
10
9
|
import { headerLabelStyle } from './Header';
|
|
11
10
|
import { HeaderContainer } from './HeaderContainer';
|
|
12
11
|
const validationSchema = Yup.object().shape({
|
|
13
|
-
zonesNoiseFactor: Yup.number().min(0).required(),
|
|
12
|
+
zonesNoiseFactor: Yup.number().integer().min(0).required(),
|
|
13
|
+
zonesMinMaxRatio: Yup.number().min(0).required(),
|
|
14
14
|
});
|
|
15
15
|
const initialValues = {
|
|
16
16
|
zonesNoiseFactor: 1,
|
|
@@ -18,21 +18,22 @@ const initialValues = {
|
|
|
18
18
|
};
|
|
19
19
|
function Zones2DOptionPanel() {
|
|
20
20
|
const dispatch = useDispatch();
|
|
21
|
-
|
|
21
|
+
function handleZonesPicking(values) {
|
|
22
22
|
dispatch({
|
|
23
23
|
type: 'AUTO_ZONES_DETECTION',
|
|
24
24
|
payload: values,
|
|
25
25
|
});
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
}
|
|
27
|
+
function handleChangeNoiseFactory(values) {
|
|
28
28
|
dispatch({ type: 'CHANGE_ZONES_NOISE_FACTOR', payload: values });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
}
|
|
30
|
+
const { handleSubmit, formState: { isValid }, control, } = useForm({
|
|
31
|
+
defaultValues: initialValues,
|
|
32
|
+
resolver: yupResolver(validationSchema),
|
|
33
|
+
mode: 'onChange',
|
|
34
|
+
});
|
|
35
|
+
return (_jsxs(HeaderContainer, { children: [_jsx(Label, { title: "Noise factor:", style: headerLabelStyle, children: _jsx(NumberInput2Controller, { control: control, name: "zonesNoiseFactor", min: 0, stepSize: 1, debounceTime: 250, style: { width: '50px' } }) }), _jsx(Label, { title: "Min/max ratio:", style: headerLabelStyle, children: _jsx(NumberInput2Controller, { control: control, name: "zonesMinMaxRatio", min: 0, stepSize: 0.01, majorStepSize: 0.01, minorStepSize: 0.01, debounceTime: 250, style: { width: '50px' }, onValueChange: () => {
|
|
36
|
+
void handleSubmit(handleChangeNoiseFactory)();
|
|
37
|
+
} }) }), _jsx(Button, { intent: "success", onClick: () => handleSubmit(handleZonesPicking)(), style: { margin: '0 10px' }, disabled: !isValid, children: "Auto Zones Picking" })] }));
|
|
37
38
|
}
|
|
38
39
|
export default Zones2DOptionPanel;
|
|
@@ -8,7 +8,7 @@ interface SaveOptions {
|
|
|
8
8
|
export default function useExport(): {
|
|
9
9
|
saveToClipboardHandler: () => Promise<void>;
|
|
10
10
|
saveAsJSONHandler: (spaceIndent?: number, isCompressed?: boolean) => void;
|
|
11
|
-
saveAsSVGHandler: () =>
|
|
11
|
+
saveAsSVGHandler: () => void;
|
|
12
12
|
saveAsPNGHandler: () => Promise<void>;
|
|
13
13
|
saveHandler: (options: SaveOptions) => void;
|
|
14
14
|
};
|
|
@@ -17,11 +17,11 @@ export default function useExport() {
|
|
|
17
17
|
});
|
|
18
18
|
setTimeout(async () => {
|
|
19
19
|
await copyPNGToClipboard(rootRef, 'nmrSVG');
|
|
20
|
-
hideLoading();
|
|
21
20
|
toaster.show({
|
|
22
21
|
message: 'Image copied to clipboard',
|
|
23
22
|
intent: 'success',
|
|
24
23
|
});
|
|
24
|
+
hideLoading();
|
|
25
25
|
}, 0);
|
|
26
26
|
}
|
|
27
27
|
}, [state.data.length, rootRef, toaster]);
|
|
@@ -44,12 +44,12 @@ export default function useExport() {
|
|
|
44
44
|
reportError(error);
|
|
45
45
|
}
|
|
46
46
|
}, [preferencesState, state, toaster]);
|
|
47
|
-
const saveAsSVGHandler = useCallback(
|
|
47
|
+
const saveAsSVGHandler = useCallback(() => {
|
|
48
48
|
if (state.data.length > 0 && rootRef) {
|
|
49
49
|
const hideLoading = toaster.showLoading({
|
|
50
50
|
message: 'Exporting as SVG process in progress',
|
|
51
51
|
});
|
|
52
|
-
setTimeout(() => {
|
|
52
|
+
void setTimeout(async () => {
|
|
53
53
|
const fileName = state.data[0]?.info?.name;
|
|
54
54
|
exportAsSVG(rootRef, 'nmrSVG', fileName);
|
|
55
55
|
hideLoading();
|
|
@@ -61,7 +61,7 @@ export default function useExport() {
|
|
|
61
61
|
const hideLoading = toaster.showLoading({
|
|
62
62
|
message: 'Exporting as PNG process in progress',
|
|
63
63
|
});
|
|
64
|
-
setTimeout(() => {
|
|
64
|
+
void setTimeout(async () => {
|
|
65
65
|
const fileName = state.data[0]?.info?.name;
|
|
66
66
|
exportAsPng(rootRef, 'nmrSVG', fileName);
|
|
67
67
|
hideLoading();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { MultipleSpectraAnalysisPreferences, PanelsPreferences, WorkSpacePanelPreferences } from 'nmr-load-save';
|
|
2
|
-
import { MatrixOptions } from '../../data/types/data1d/MatrixOptions';
|
|
1
|
+
import { MatrixGenerationOptions, MultipleSpectraAnalysisPreferences, PanelsPreferences, WorkSpacePanelPreferences } from 'nmr-load-save';
|
|
3
2
|
type Panel = 'spectra' | 'peaks' | 'integrals' | 'zones' | 'ranges' | 'database' | 'multipleSpectraAnalysis' | 'matrixGeneration' | 'prediction';
|
|
4
|
-
export declare function usePanelPreferences<T extends Panel>(panelKey: T, nucleus: string): T extends 'matrixGeneration' ?
|
|
3
|
+
export declare function usePanelPreferences<T extends Panel>(panelKey: T, nucleus: string): T extends 'matrixGeneration' ? MatrixGenerationOptions : T extends 'multipleSpectraAnalysis' ? MultipleSpectraAnalysisPreferences : WorkSpacePanelPreferences[T];
|
|
5
4
|
export declare function usePanelPreferences<T extends 'database' | 'prediction'>(panelKey: T): WorkSpacePanelPreferences[T];
|
|
6
5
|
export type UsePanelPreferencesByNucleiResult<T extends Panel> = T extends 'spectra' ? PanelsPreferences['spectra'] : T extends 'peaks' ? PanelsPreferences['peaks'] : T extends 'integrals' ? PanelsPreferences['integrals'] : T extends 'zones' ? PanelsPreferences['zones'] : T extends 'ranges' ? PanelsPreferences['ranges'] : T extends 'multipleSpectraAnalysis' ? PanelsPreferences['multipleSpectraAnalysis'] : T extends 'matrixGeneration' ? PanelsPreferences['matrixGeneration'] : void;
|
|
7
6
|
export declare function usePanelPreferencesByNuclei<T extends Panel>(panelKey: T, nuclei: string[]): UsePanelPreferencesByNucleiResult<T>;
|
|
@@ -2,7 +2,7 @@ import has from 'lodash/has';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { getDefaultPredictionOptions } from '../../data/PredictionManager';
|
|
4
4
|
import { usePreferences } from '../context/PreferencesContext';
|
|
5
|
-
import { getIntegralDefaultValues, getPeaksDefaultValues, getZoneDefaultValues, getRangeDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getSpectraDefaultValues, } from '../reducer/preferences/panelsPreferencesDefaultValues';
|
|
5
|
+
import { getIntegralDefaultValues, getPeaksDefaultValues, getZoneDefaultValues, getRangeDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getSpectraDefaultValues, getMatrixGenerationDefaultValues, } from '../reducer/preferences/panelsPreferencesDefaultValues';
|
|
6
6
|
import { getValue } from '../utility/LocalStorage';
|
|
7
7
|
function getDefaultPreferences(panelKey, nucleus) {
|
|
8
8
|
switch (panelKey) {
|
|
@@ -22,6 +22,8 @@ function getDefaultPreferences(panelKey, nucleus) {
|
|
|
22
22
|
return getMultipleSpectraAnalysisDefaultValues(nucleus);
|
|
23
23
|
case 'prediction':
|
|
24
24
|
return getDefaultPredictionOptions();
|
|
25
|
+
case 'matrixGeneration':
|
|
26
|
+
return getMatrixGenerationDefaultValues(nucleus);
|
|
25
27
|
default:
|
|
26
28
|
return {};
|
|
27
29
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function useToggleSpectraVisibility(mode?: 'selected' | 'all'): {
|
|
2
|
+
showSpectraHandler: () => void;
|
|
3
|
+
hideSpectraHandler: () => void;
|
|
4
|
+
getToggleVisibilityButtons: (disabled?: boolean) => {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
tooltip: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FaEye, FaEyeSlash } from 'react-icons/fa';
|
|
3
|
+
import { useChartData } from '../context/ChartContext';
|
|
4
|
+
import { useDispatch } from '../context/DispatchContext';
|
|
5
|
+
export function useToggleSpectraVisibility(mode = 'all') {
|
|
6
|
+
const dispatch = useDispatch();
|
|
7
|
+
const { view: { spectra: { activeTab }, }, } = useChartData();
|
|
8
|
+
function showSpectraHandler() {
|
|
9
|
+
dispatch({
|
|
10
|
+
type: 'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS',
|
|
11
|
+
payload: { nucleus: activeTab, flag: true, mode },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function hideSpectraHandler() {
|
|
15
|
+
dispatch({
|
|
16
|
+
type: 'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS',
|
|
17
|
+
payload: { nucleus: activeTab, flag: false, mode },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function getToggleVisibilityButtons(disabled = false) {
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
disabled,
|
|
24
|
+
icon: _jsx(FaEyeSlash, {}),
|
|
25
|
+
tooltip: `Hide ${mode} spectra`,
|
|
26
|
+
onClick: hideSpectraHandler,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
disabled,
|
|
30
|
+
icon: _jsx(FaEye, {}),
|
|
31
|
+
tooltip: `Show ${mode} spectra`,
|
|
32
|
+
onClick: showSpectraHandler,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
showSpectraHandler,
|
|
38
|
+
hideSpectraHandler,
|
|
39
|
+
getToggleVisibilityButtons,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Workspace } from 'nmr-load-save';
|
|
2
2
|
export declare function useWorkspaceAction(): {
|
|
3
|
-
addNewWorkspace: (workspaceName: string, data?: Omit<Workspace,
|
|
3
|
+
addNewWorkspace: (workspaceName: string, data?: Omit<Workspace, "version" | "label">) => void;
|
|
4
4
|
removeWorkspace: (key: string) => void;
|
|
5
5
|
saveWorkspace: (data?: Partial<Workspace>) => void;
|
|
6
6
|
setActiveWorkspace: (workspace: string) => void;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export declare const Section: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
1
5
|
interface GeneralSettingsModalProps {
|
|
2
6
|
height?: number;
|
|
3
7
|
}
|
|
4
|
-
declare function GeneralSettingsModal(
|
|
8
|
+
declare function GeneralSettingsModal(props: GeneralSettingsModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
9
|
export default GeneralSettingsModal;
|