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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Classes, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import { Formik } from 'formik';
|
|
6
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
7
|
+
import { FaPlus, FaRegTrashAlt } from 'react-icons/fa';
|
|
8
|
+
import { Button } from 'react-science/ui';
|
|
9
|
+
import { array, object, string } from 'yup';
|
|
10
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
11
|
+
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
12
|
+
import { tableInputStyle } from '../../elements/ReactTable/Style';
|
|
13
|
+
import FormikInput from '../../elements/formik/FormikInput';
|
|
14
|
+
import useSpectrum from '../../hooks/useSpectrum';
|
|
15
|
+
import { checkUniqueByKey } from '../../utility/checkUniqueByKey';
|
|
16
|
+
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
17
|
+
const metaInfoValidationSchema = array()
|
|
18
|
+
.of(object().shape({
|
|
19
|
+
key: string().required().trim(),
|
|
20
|
+
value: string().required().trim(),
|
|
21
|
+
}))
|
|
22
|
+
.test('Unique', 'Key need te be unique', function check(metaInfo) {
|
|
23
|
+
// eslint-disable-next-line no-invalid-this
|
|
24
|
+
return checkUniqueByKey(metaInfo, 'key', this);
|
|
25
|
+
});
|
|
26
|
+
export function InformationEditionModal(props) {
|
|
27
|
+
const { isOpen, onCloseDialog } = props;
|
|
28
|
+
const spectrum = useSpectrum();
|
|
29
|
+
if (!isOpen || !spectrum)
|
|
30
|
+
return null;
|
|
31
|
+
const metaInfo = Object.keys(spectrum.customInfo).map((key) => ({
|
|
32
|
+
key,
|
|
33
|
+
value: spectrum.customInfo[key],
|
|
34
|
+
}));
|
|
35
|
+
return (_jsx(Dialog, { isOpen: true, title: "Edit spectrum meta information", onClose: onCloseDialog, style: { width: 700, height: 500 }, children: _jsx(InnerInformationPanel, { metaInfo: metaInfo, onCloseDialog: onCloseDialog }) }));
|
|
36
|
+
}
|
|
37
|
+
function InnerInformationPanel(props) {
|
|
38
|
+
const { metaInfo = [], onCloseDialog } = props;
|
|
39
|
+
const dispatch = useDispatch();
|
|
40
|
+
const formRef = useRef(null);
|
|
41
|
+
const addHandler = useCallback((data, index = 0) => {
|
|
42
|
+
const meta = { key: '', value: '' };
|
|
43
|
+
void formRef.current?.setValues([
|
|
44
|
+
...data.slice(0, index),
|
|
45
|
+
meta,
|
|
46
|
+
...data.slice(index),
|
|
47
|
+
]);
|
|
48
|
+
}, []);
|
|
49
|
+
const deleteHandler = useCallback((data, index) => {
|
|
50
|
+
const meta = data.filter((_, columnIndex) => columnIndex !== index);
|
|
51
|
+
void formRef.current?.setValues(meta);
|
|
52
|
+
}, []);
|
|
53
|
+
function saveHandler(metaArray) {
|
|
54
|
+
const meta = {};
|
|
55
|
+
for (const { key, value } of metaArray) {
|
|
56
|
+
meta[key] = value;
|
|
57
|
+
}
|
|
58
|
+
dispatch({ type: 'UPDATE_SPECTRUM_META', payload: { meta } });
|
|
59
|
+
onCloseDialog();
|
|
60
|
+
}
|
|
61
|
+
const COLUMNS = useMemo(() => [
|
|
62
|
+
{
|
|
63
|
+
Header: '#',
|
|
64
|
+
style: { width: '25px', textAlign: 'center' },
|
|
65
|
+
accessor: (_, index) => index + 1,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
Header: 'Key',
|
|
69
|
+
style: { padding: 0 },
|
|
70
|
+
Cell: ({ row }) => {
|
|
71
|
+
return (_jsx(FormikInput, { name: `${row.index}.key`, style: tableInputStyle }));
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
Header: 'Value',
|
|
76
|
+
style: { padding: 0 },
|
|
77
|
+
Cell: ({ row }) => {
|
|
78
|
+
return (_jsx(FormikInput, { name: `${row.index}.value`, style: tableInputStyle }));
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
Header: '',
|
|
83
|
+
style: { width: '60px' },
|
|
84
|
+
id: 'action-button',
|
|
85
|
+
Cell: ({ data, row }) => {
|
|
86
|
+
return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-evenly' }, children: [_jsx(Button, { small: true, outlined: true, intent: "success", tooltipProps: { content: '', disabled: true }, onClick: (e) => {
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
addHandler(data, row.index + 1);
|
|
89
|
+
}, children: _jsx(FaPlus, { className: Classes.ICON }) }), _jsx(Button, { small: true, outlined: true, intent: "danger", tooltipProps: { content: '', disabled: true }, onClick: (e) => {
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
deleteHandler(data, row.index);
|
|
92
|
+
}, children: _jsx(FaRegTrashAlt, { className: Classes.ICON }) })] }));
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
], [addHandler, deleteHandler]);
|
|
96
|
+
return (_jsx(Formik, { innerRef: formRef, initialValues: metaInfo, validationSchema: metaInfoValidationSchema, onSubmit: saveHandler, children: ({ values, submitForm, isValid }) => (_jsxs(_Fragment, { children: [_jsx(DialogBody, { css: css `
|
|
97
|
+
background-color: white;
|
|
98
|
+
`, children: _jsxs("div", { css: tablePanelStyle, style: { height: 'calc(100% - 30px)' }, children: [_jsx("div", { style: { padding: '5px 0', display: 'flex' }, children: _jsx(Button, { intent: "success", small: true, outlined: true, onClick: () => addHandler(values), tooltipProps: { content: '', disabled: true }, children: "Add a new meta" }) }), _jsx(ReactTable, { data: values, columns: COLUMNS, emptyDataRowText: "No meta", style: {
|
|
99
|
+
'thead tr th': { zIndex: 1 },
|
|
100
|
+
td: { padding: 0 },
|
|
101
|
+
}, rowStyle: {
|
|
102
|
+
hover: { backgroundColor: '#f7f7f7' },
|
|
103
|
+
active: { backgroundColor: '#f5f5f5' },
|
|
104
|
+
} })] }) }), _jsx(DialogFooter, { children: _jsx(Button, { intent: "success", onClick: submitForm, tooltipProps: { content: '', disabled: true }, disabled: !isValid, children: "Save meta" }) })] })) }));
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function InformationPanel(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { InfoPanel } from 'react-science/ui';
|
|
4
|
-
import useSpectrum from '
|
|
4
|
+
import useSpectrum from '../../hooks/useSpectrum';
|
|
5
5
|
const emptyData = { info: {}, meta: {} };
|
|
6
|
-
export
|
|
6
|
+
export function InformationPanel() {
|
|
7
7
|
const { info, meta, customInfo } = useSpectrum(emptyData);
|
|
8
8
|
const data = useMemo(() => [
|
|
9
9
|
{ description: 'Custom information', data: customInfo || {} },
|
|
@@ -13,7 +13,7 @@ import FormikInput from '../../elements/formik/FormikInput';
|
|
|
13
13
|
import FormikSelect from '../../elements/formik/FormikSelect';
|
|
14
14
|
const NUMBER_OF_POINTS_1D = generateNumbersPowerOfX(12, 19);
|
|
15
15
|
const NUMBER_OF_POINTS_2D = generateNumbersPowerOfX(10, 10, {
|
|
16
|
-
format:
|
|
16
|
+
format: String,
|
|
17
17
|
});
|
|
18
18
|
const predictionFormValidation = Yup.object().shape({
|
|
19
19
|
name: Yup.string().label('Name'),
|
|
@@ -39,7 +39,13 @@ export interface TwoDimensionPhaseCorrection {
|
|
|
39
39
|
activeTraceDirection: TraceDirection;
|
|
40
40
|
addTracesToBothDirections: boolean;
|
|
41
41
|
}
|
|
42
|
-
export
|
|
42
|
+
export interface MatrixGenerationOptions {
|
|
43
|
+
showBoxPlot: boolean;
|
|
44
|
+
showStocsy: boolean;
|
|
45
|
+
scaleRatio: number;
|
|
46
|
+
chemicalShift: number | null;
|
|
47
|
+
}
|
|
48
|
+
export declare const getDefaultTwoDimensionsPhaseCorrectionTraceOptions: () => TwoDimensionPhaseCorrection["traces"];
|
|
43
49
|
export declare function getDefaultViewState(): ViewState;
|
|
44
50
|
export declare const getInitialState: () => State;
|
|
45
51
|
export declare const initialState: State;
|
|
@@ -276,6 +276,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
276
276
|
return SpectraActions.handleOrderSpectra(draft, action);
|
|
277
277
|
case 'SIMULATE_SPECTRUM':
|
|
278
278
|
return SpectraActions.handleSimulateSpectrum(draft, action);
|
|
279
|
+
case 'UPDATE_SPECTRUM_META':
|
|
280
|
+
return SpectraActions.handleUpdateSpectrumMeta(draft, action);
|
|
279
281
|
case 'SET_SELECTED_TOOL':
|
|
280
282
|
return ToolsActions.setSelectedTool(draft, action);
|
|
281
283
|
case 'RESET_SELECTED_TOOL':
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { get1DColor, mapRanges } from '../../../data/data1d/Spectrum1D';
|
|
2
2
|
import { generateSpectrumFromRanges, } from '../../../data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges';
|
|
3
3
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
4
|
+
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
4
5
|
import { setDomain } from './DomainActions';
|
|
5
6
|
function handleResurrectSpectrumFromJcamp(draft, action) {
|
|
6
7
|
const { ranges } = action.payload;
|
|
@@ -17,16 +18,32 @@ function handleResurrectSpectrumFromJcamp(draft, action) {
|
|
|
17
18
|
},
|
|
18
19
|
};
|
|
19
20
|
draft.data.push(spectrum);
|
|
20
|
-
setDomain(draft);
|
|
21
|
+
setDomain(draft, { isYDomainShared: false });
|
|
22
|
+
//rescale the vertical zoom
|
|
21
23
|
setZoom(draft, { scale: 0.8, spectrumID: spectrum.id });
|
|
24
|
+
//keep the last horizontal zoom
|
|
25
|
+
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
26
|
+
const zoomValue = zoomHistory.getLast();
|
|
27
|
+
if (zoomValue) {
|
|
28
|
+
draft.xDomain = zoomValue.xDomain;
|
|
29
|
+
draft.yDomain = zoomValue.yDomain;
|
|
30
|
+
}
|
|
22
31
|
}
|
|
23
32
|
function handleResurrectSpectrumFromRanges(draft, action) {
|
|
24
33
|
const { ranges, info } = action.payload;
|
|
25
34
|
const datum = generateSpectrumFromRanges(ranges, info, draft.usedColors);
|
|
26
|
-
if (datum)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
if (!datum)
|
|
36
|
+
return;
|
|
37
|
+
draft.data.push(datum);
|
|
38
|
+
setDomain(draft, { isYDomainShared: false });
|
|
39
|
+
//rescale the vertical zoom
|
|
40
|
+
setZoom(draft, { scale: 0.8, spectrumID: datum.id });
|
|
41
|
+
//keep the last horizontal zoom
|
|
42
|
+
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
43
|
+
const zoomValue = zoomHistory.getLast();
|
|
44
|
+
if (zoomValue) {
|
|
45
|
+
draft.xDomain = zoomValue.xDomain;
|
|
46
|
+
draft.yDomain = zoomValue.yDomain;
|
|
30
47
|
}
|
|
31
48
|
}
|
|
32
49
|
function handleToggleSimilarityTree(draft) {
|
|
@@ -16,13 +16,16 @@ type MoveXAxisAction = ActionType<'MOVE', {
|
|
|
16
16
|
shiftY: number;
|
|
17
17
|
}>;
|
|
18
18
|
export type DomainActions = SetXDomainAction | SetYDomainAction | SetAxisDomainAction | MoveXAxisAction;
|
|
19
|
-
|
|
19
|
+
interface GetDomainOptions {
|
|
20
|
+
domainSpectraScope?: 'visible' | 'all';
|
|
21
|
+
}
|
|
22
|
+
declare function getDomain(draft: Draft<State>, options?: GetDomainOptions): {
|
|
20
23
|
xDomain: [number, number] | never[] | [undefined, undefined];
|
|
21
24
|
yDomain: [number, number] | never[] | [undefined, undefined];
|
|
22
25
|
yDomains: Record<string, number[]>;
|
|
23
26
|
xDomains: Record<string, number[]>;
|
|
24
27
|
};
|
|
25
|
-
export interface SetDomainOptions {
|
|
28
|
+
export interface SetDomainOptions extends GetDomainOptions {
|
|
26
29
|
updateYDomain?: boolean;
|
|
27
30
|
isYDomainShared?: boolean;
|
|
28
31
|
updateXDomain?: boolean;
|
|
@@ -22,7 +22,8 @@ function getActiveData(draft) {
|
|
|
22
22
|
}
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
-
function getDomain(draft) {
|
|
25
|
+
function getDomain(draft, options = {}) {
|
|
26
|
+
const { domainSpectraScope = 'visible' } = options;
|
|
26
27
|
let xArray = [];
|
|
27
28
|
let yArray = [];
|
|
28
29
|
const yDomains = {};
|
|
@@ -36,7 +37,8 @@ function getDomain(draft) {
|
|
|
36
37
|
const domain = [data.x[0], data.x.at(-1)];
|
|
37
38
|
yDomains[id] = _extent;
|
|
38
39
|
xDomains[id] = domain;
|
|
39
|
-
if (
|
|
40
|
+
if (domainSpectraScope === 'all' ||
|
|
41
|
+
(domainSpectraScope === 'visible' && display.isVisible)) {
|
|
40
42
|
xArray = xArray.concat(domain);
|
|
41
43
|
yArray = yArray.concat(_extent);
|
|
42
44
|
}
|
|
@@ -120,11 +122,11 @@ function get2DDomain(state) {
|
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
function setDomain(draft, options) {
|
|
123
|
-
const { updateYDomain = true, isYDomainShared = true, updateXDomain = true, } = options || {};
|
|
125
|
+
const { updateYDomain = true, isYDomainShared = true, updateXDomain = true, domainSpectraScope, } = options || {};
|
|
124
126
|
let domain;
|
|
125
127
|
if (draft.view.spectra.activeTab) {
|
|
126
128
|
if (draft.displayerMode === '1D') {
|
|
127
|
-
domain = getDomain(draft);
|
|
129
|
+
domain = getDomain(draft, { domainSpectraScope });
|
|
128
130
|
}
|
|
129
131
|
else {
|
|
130
132
|
domain = get2DDomain(draft);
|
|
@@ -761,7 +761,7 @@ function handleDeleteSpectraFilter(draft, action) {
|
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
resetSelectedTool(draft);
|
|
764
|
-
setDomain(draft);
|
|
764
|
+
setDomain(draft, { domainSpectraScope: 'all' });
|
|
765
765
|
setMode(draft);
|
|
766
766
|
}
|
|
767
767
|
}
|
|
@@ -791,7 +791,7 @@ function handleSignalProcessingFilter(draft, action) {
|
|
|
791
791
|
], { forceReapply: true });
|
|
792
792
|
}
|
|
793
793
|
const { updateXDomain, updateYDomain } = signalProcessing.DOMAIN_UPDATE_RULES;
|
|
794
|
-
setDomain(draft, { updateXDomain, updateYDomain });
|
|
794
|
+
setDomain(draft, { updateXDomain, updateYDomain, domainSpectraScope: 'all' });
|
|
795
795
|
}
|
|
796
796
|
//action
|
|
797
797
|
function handleAddExclusionZone(draft, action) {
|
|
@@ -116,7 +116,10 @@ function initData(draft, action, options = {}) {
|
|
|
116
116
|
const state = getInitialState();
|
|
117
117
|
return produce(state, (initialDraft) => {
|
|
118
118
|
setData(initialDraft, action.payload);
|
|
119
|
-
setActiveTab(initialDraft, {
|
|
119
|
+
setActiveTab(initialDraft, {
|
|
120
|
+
tab: viewState?.spectra?.activeTab || '',
|
|
121
|
+
domainOptions: { domainSpectraScope: 'all' },
|
|
122
|
+
});
|
|
120
123
|
initialDraft.width = draft.width;
|
|
121
124
|
initialDraft.height = draft.height;
|
|
122
125
|
setPreferences(initialDraft, viewState);
|
|
@@ -152,7 +155,7 @@ function handleLoadDropFiles(draft, action) {
|
|
|
152
155
|
}
|
|
153
156
|
else {
|
|
154
157
|
setData(draft, payload);
|
|
155
|
-
setActiveTab(draft);
|
|
158
|
+
setActiveTab(draft, { domainOptions: { domainSpectraScope: 'all' } });
|
|
156
159
|
changeSpectrumVerticalAlignment(draft, { verticalAlign: 'auto-check' });
|
|
157
160
|
// set source undefined when dragging and dropping a spectra file to prevent export spectra with the data source.
|
|
158
161
|
if (resetSourceObject && spectra?.length > 0) {
|
|
@@ -5,6 +5,7 @@ import { SpectrumSimulationOptions } from '../../../data/data1d/spectrumSimulati
|
|
|
5
5
|
import { Nuclei, Nucleus } from '../../../data/types/common/Nucleus';
|
|
6
6
|
import { State } from '../Reducer';
|
|
7
7
|
import { ActionType } from '../types/ActionType';
|
|
8
|
+
import { SetDomainOptions } from './DomainActions';
|
|
8
9
|
type ChangeSpectrumVisibilityByIdAction = ActionType<'CHANGE_SPECTRUM_VISIBILITY', {
|
|
9
10
|
id: string;
|
|
10
11
|
key: 'isVisible' | 'isPositiveVisible' | 'isNegativeVisible';
|
|
@@ -12,6 +13,7 @@ type ChangeSpectrumVisibilityByIdAction = ActionType<'CHANGE_SPECTRUM_VISIBILITY
|
|
|
12
13
|
type ChangeSpectraVisibilityByNucleusAction = ActionType<'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS', {
|
|
13
14
|
nucleus: Nucleus;
|
|
14
15
|
flag: boolean;
|
|
16
|
+
mode?: 'selected' | 'all';
|
|
15
17
|
}>;
|
|
16
18
|
type ChangeActiveSpectrumAction = ActionType<'CHANGE_ACTIVE_SPECTRUM', {
|
|
17
19
|
modifier?: 'shift[false]_ctrl[true]' | 'shift[true]_ctrl[false]' | 'shift[true]_ctrl[true]' | (string & {});
|
|
@@ -23,6 +25,7 @@ type ChangeSpectrumSettingAction = ActionType<'CHANGE_SPECTRUM_SETTING', {
|
|
|
23
25
|
}>;
|
|
24
26
|
type DeleteSpectraAction = ActionType<'DELETE_SPECTRA', {
|
|
25
27
|
id?: string;
|
|
28
|
+
domainOptions?: SetDomainOptions;
|
|
26
29
|
}>;
|
|
27
30
|
type AddMissingProjectionAction = ActionType<'ADD_MISSING_PROJECTION', {
|
|
28
31
|
nucleus: Nuclei[];
|
|
@@ -56,7 +59,10 @@ type SimulateSpectrumAction = ActionType<'SIMULATE_SPECTRUM', {
|
|
|
56
59
|
keepSpectrum?: boolean;
|
|
57
60
|
spinSystem: string;
|
|
58
61
|
} & SpectrumSimulationOptions>;
|
|
59
|
-
|
|
62
|
+
type UpdateSpectrumMetaAction = ActionType<'UPDATE_SPECTRUM_META', {
|
|
63
|
+
meta: Record<string, string>;
|
|
64
|
+
}>;
|
|
65
|
+
export type SpectrumActions = ActionType<'TOGGLE_SPECTRA_LEGEND'> | ChangeSpectrumVisibilityByIdAction | ChangeSpectraVisibilityByNucleusAction | ChangeActiveSpectrumAction | ChangeSpectrumSettingAction | DeleteSpectraAction | AddMissingProjectionAction | AlignSpectraAction | GenerateSpectrumFromPublicationStringAction | ImportSpectraMetaInfoAction | ReColorSpectraBasedOnDistinctValueAction | OrderSpectraAction | SimulateSpectrumAction | UpdateSpectrumMetaAction;
|
|
60
66
|
declare function setSpectraMetaInfo(draft: Draft<State>, spectraMetaInfo: Record<string, Record<string, any>>): void;
|
|
61
67
|
declare function handleChangeSpectrumVisibilityById(draft: Draft<State>, action: ChangeSpectrumVisibilityByIdAction): void;
|
|
62
68
|
declare function handleChangeSpectraVisibilityByNucleus(draft: Draft<State>, action: ChangeSpectraVisibilityByNucleusAction): void;
|
|
@@ -71,4 +77,5 @@ declare function handleToggleSpectraLegend(draft: Draft<State>): void;
|
|
|
71
77
|
declare function handleRecolorSpectraBasedOnDistinctValue(draft: Draft<State>, action: ReColorSpectraBasedOnDistinctValueAction): void;
|
|
72
78
|
declare function handleOrderSpectra(draft: Draft<State>, action: OrderSpectraAction): void;
|
|
73
79
|
declare function handleSimulateSpectrum(draft: Draft<State>, simulateSpectrumOptions: SimulateSpectrumAction): void;
|
|
74
|
-
|
|
80
|
+
declare function handleUpdateSpectrumMeta(draft: Draft<State>, action: UpdateSpectrumMetaAction): null | undefined;
|
|
81
|
+
export { handleChangeSpectrumVisibilityById, handleChangeSpectraVisibilityByNucleus, handleChangeActiveSpectrum, handleChangeSpectrumSetting, handleDeleteSpectra, handleAddMissingProjectionHandler, handleAlignSpectraHandler, handleGenerateSpectrumFromPublicationStringHandler, handleImportSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, handleSimulateSpectrum, setSpectraMetaInfo, handleUpdateSpectrumMeta, };
|
|
@@ -7,6 +7,7 @@ import { getReferenceShift, isSpectrum1D, get1DColor, initiateDatum1D, generateS
|
|
|
7
7
|
import { simulateSpectrum, } from '../../../data/data1d/spectrumSimulation';
|
|
8
8
|
import { getMissingProjection, isSpectrum2D, get2DColor, } from '../../../data/data2d/Spectrum2D';
|
|
9
9
|
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
10
|
+
import { adjustAlpha, generateColor, } from '../../../data/utilities/generateColor';
|
|
10
11
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
11
12
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
12
13
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
@@ -93,10 +94,15 @@ function handleChangeSpectrumVisibilityById(draft, action) {
|
|
|
93
94
|
}
|
|
94
95
|
//action
|
|
95
96
|
function handleChangeSpectraVisibilityByNucleus(draft, action) {
|
|
96
|
-
const { nucleus, flag } = action.payload;
|
|
97
|
+
const { nucleus, flag, mode = 'all' } = action.payload;
|
|
97
98
|
const activeSpectra = getActiveSpectraAsObject(draft);
|
|
98
99
|
for (const datum of getSpectraByNucleus(nucleus, draft.data)) {
|
|
99
|
-
if (
|
|
100
|
+
if (mode === 'selected') {
|
|
101
|
+
if (activeSpectra && datum.id in activeSpectra) {
|
|
102
|
+
setVisible(datum, flag);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
100
106
|
setVisible(datum, flag);
|
|
101
107
|
}
|
|
102
108
|
}
|
|
@@ -227,16 +233,15 @@ function handleChangeSpectrumSetting(draft, action) {
|
|
|
227
233
|
const spectrum = draft.data[index];
|
|
228
234
|
spectrum.display = display;
|
|
229
235
|
if (isSpectrum2D(spectrum)) {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
contoursLevels[spectrum.id] = checkLevel();
|
|
236
|
+
const { checkLevel } = contoursManager(spectrum);
|
|
237
|
+
checkLevel();
|
|
233
238
|
}
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
241
|
//action
|
|
237
242
|
function handleDeleteSpectra(draft, action) {
|
|
238
243
|
const state = original(draft);
|
|
239
|
-
const { id: spectraId } = action?.payload || {};
|
|
244
|
+
const { id: spectraId, domainOptions } = action?.payload || {};
|
|
240
245
|
if (spectraId) {
|
|
241
246
|
const index = state.data.findIndex((d) => d.id === spectraId);
|
|
242
247
|
draft.data.splice(index, 1);
|
|
@@ -256,6 +261,7 @@ function handleDeleteSpectra(draft, action) {
|
|
|
256
261
|
setActiveTab(draft, {
|
|
257
262
|
tab: draft.view.spectra.activeTab,
|
|
258
263
|
refreshActiveTab: true,
|
|
264
|
+
domainOptions,
|
|
259
265
|
});
|
|
260
266
|
}
|
|
261
267
|
//action
|
|
@@ -317,37 +323,66 @@ function handleImportSpectraMetaInfo(draft, action) {
|
|
|
317
323
|
function handleToggleSpectraLegend(draft) {
|
|
318
324
|
draft.view.spectra.showLegend = !draft.view.spectra.showLegend;
|
|
319
325
|
}
|
|
326
|
+
function groupSpectraByClass(spectra, jpath) {
|
|
327
|
+
const spectraByClass = {};
|
|
328
|
+
for (const spectrum of spectra) {
|
|
329
|
+
const key = String(lodashGet(spectrum, jpath, ''))
|
|
330
|
+
.toLowerCase()
|
|
331
|
+
.trim()
|
|
332
|
+
.replace(/\r?\n|\r/, '');
|
|
333
|
+
if (spectraByClass[key]) {
|
|
334
|
+
spectraByClass[key].push(spectrum);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
spectraByClass[key] = [spectrum];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return spectraByClass;
|
|
341
|
+
}
|
|
320
342
|
//action
|
|
321
343
|
function handleRecolorSpectraBasedOnDistinctValue(draft, action) {
|
|
322
344
|
const { data, view: { spectra: { activeTab }, }, } = draft;
|
|
323
345
|
const { jpath = null, customColors } = action.payload;
|
|
324
|
-
const
|
|
346
|
+
const spectraByNucleus = getSpectraByNucleus(activeTab, data);
|
|
325
347
|
if (jpath) {
|
|
326
348
|
//recolor spectra based on distinct value
|
|
327
|
-
const spectraByClass =
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
.
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
spectrum.display.color = spectraByClass[key].display.color;
|
|
336
|
-
}
|
|
337
|
-
else {
|
|
338
|
-
spectrum.display.positiveColor = spectraByClass[key].display.positiveColor;
|
|
339
|
-
spectrum.display.negativeColor = spectraByClass[key].display.negativeColor;
|
|
349
|
+
const spectraByClass = groupSpectraByClass(spectraByNucleus, jpath);
|
|
350
|
+
const usedColors = [];
|
|
351
|
+
for (const spectra of Object.values(spectraByClass)) {
|
|
352
|
+
let color;
|
|
353
|
+
if (isSpectrum1D(spectra[0])) {
|
|
354
|
+
color = spectra[0].display.color;
|
|
355
|
+
if (usedColors.includes(color)) {
|
|
356
|
+
color = generateColor({ usedColors });
|
|
340
357
|
}
|
|
358
|
+
usedColors.push(color);
|
|
341
359
|
}
|
|
342
360
|
else {
|
|
343
|
-
|
|
361
|
+
const { positiveColor: pColor, negativeColor: nColor } = spectra[0].display;
|
|
362
|
+
color = { positiveColor: pColor, negativeColor: nColor };
|
|
363
|
+
if (usedColors.includes(pColor)) {
|
|
364
|
+
const positiveColor = generateColor({
|
|
365
|
+
usedColors,
|
|
366
|
+
});
|
|
367
|
+
const negativeColor = adjustAlpha(positiveColor, 50);
|
|
368
|
+
color = { positiveColor, negativeColor };
|
|
369
|
+
}
|
|
370
|
+
usedColors.push(color.positiveColor);
|
|
371
|
+
}
|
|
372
|
+
for (const spectrum of spectra) {
|
|
373
|
+
if (typeof color === 'string') {
|
|
374
|
+
spectrum.display = { ...spectrum.display, color };
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
spectrum.display = { ...spectrum.display, ...color };
|
|
378
|
+
}
|
|
344
379
|
}
|
|
345
380
|
}
|
|
346
381
|
}
|
|
347
382
|
else {
|
|
348
383
|
//reset spectra colors
|
|
349
384
|
const usedColors = { '1d': [], '2d': [] };
|
|
350
|
-
for (const spectrum of
|
|
385
|
+
for (const spectrum of spectraByNucleus) {
|
|
351
386
|
if (isSpectrum1D(spectrum)) {
|
|
352
387
|
spectrum.display.color = get1DColor(spectrum, {
|
|
353
388
|
usedColors,
|
|
@@ -427,4 +462,11 @@ function handleSimulateSpectrum(draft, simulateSpectrumOptions) {
|
|
|
427
462
|
setActiveTab(draft);
|
|
428
463
|
}
|
|
429
464
|
}
|
|
430
|
-
|
|
465
|
+
function handleUpdateSpectrumMeta(draft, action) {
|
|
466
|
+
const { payload: { meta }, } = action;
|
|
467
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
468
|
+
if (!activeSpectrum)
|
|
469
|
+
return null;
|
|
470
|
+
draft.data[activeSpectrum.index].customInfo = meta;
|
|
471
|
+
}
|
|
472
|
+
export { handleChangeSpectrumVisibilityById, handleChangeSpectraVisibilityByNucleus, handleChangeActiveSpectrum, handleChangeSpectrumSetting, handleDeleteSpectra, handleAddMissingProjectionHandler, handleAlignSpectraHandler, handleGenerateSpectrumFromPublicationStringHandler, handleImportSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, handleSimulateSpectrum, setSpectraMetaInfo, handleUpdateSpectrumMeta, };
|
|
@@ -466,7 +466,7 @@ function handelSetActiveTab(draft, action) {
|
|
|
466
466
|
}
|
|
467
467
|
function levelChangeHandler(draft, action) {
|
|
468
468
|
const { deltaY, altKey } = action.payload.options;
|
|
469
|
-
const { data, view: { spectra: { activeTab },
|
|
469
|
+
const { data, view: { spectra: { activeTab }, }, } = draft;
|
|
470
470
|
const activeSpectra = getActiveSpectra(draft) || [];
|
|
471
471
|
const activeSpectraObj = {};
|
|
472
472
|
for (const activeSpectrum of activeSpectra) {
|
|
@@ -476,9 +476,8 @@ function levelChangeHandler(draft, action) {
|
|
|
476
476
|
(activeSpectraObj?.[spectrum.id] || activeSpectra.length === 0));
|
|
477
477
|
try {
|
|
478
478
|
for (const spectrum of spectra) {
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
levels[spectrum.id] = zoom.wheel(deltaY, altKey);
|
|
479
|
+
const zoom = contoursManager(spectrum);
|
|
480
|
+
zoom.wheel(deltaY, altKey);
|
|
482
481
|
}
|
|
483
482
|
}
|
|
484
483
|
catch (error) {
|
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import {
|
|
2
|
+
import { MatrixGenerationOptions } from 'nmr-load-save';
|
|
3
|
+
import { MatrixOptions } from '../../../../data/types/data1d/MatrixOptions';
|
|
4
|
+
import { ZoomOptions } from '../../../EventsTrackers/BrushTracker';
|
|
5
|
+
import { FilterType } from '../../../utility/filterType';
|
|
6
|
+
import { ActionType } from '../../types/ActionType';
|
|
7
|
+
import { PreferencesState } from '../preferencesReducer';
|
|
8
|
+
type setMatrixGenerationOptionsAction = ActionType<'SET_MATRIX_GENERATION_OPTIONS', {
|
|
9
|
+
nucleus: string;
|
|
10
|
+
options: MatrixOptions;
|
|
11
|
+
}>;
|
|
12
|
+
type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
13
|
+
zone: {
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
};
|
|
17
|
+
range: {
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
};
|
|
21
|
+
nucleus: string;
|
|
22
|
+
}>;
|
|
23
|
+
type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
24
|
+
zone: {
|
|
25
|
+
id: string;
|
|
26
|
+
from: number;
|
|
27
|
+
to: number;
|
|
28
|
+
};
|
|
29
|
+
nucleus: string;
|
|
30
|
+
}>;
|
|
31
|
+
type ToggleMatrixGenerationViewAction = ActionType<'TOGGLE_MATRIX_GENERATION_VIEW_PROPERTY', {
|
|
32
|
+
key: keyof FilterType<MatrixGenerationOptions, boolean>;
|
|
33
|
+
nucleus: string;
|
|
34
|
+
}>;
|
|
35
|
+
type ChangeMatrixGenerationScaleAction = ActionType<'CHANGE_MATRIX_GENERATION_SCALE', {
|
|
36
|
+
zoomOptions: ZoomOptions;
|
|
37
|
+
nucleus: string;
|
|
38
|
+
}>;
|
|
39
|
+
type ChangeMatrixGenerationStocsyChemicalShiftAction = ActionType<'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT', {
|
|
40
|
+
nucleus: string;
|
|
41
|
+
chemicalShift: number;
|
|
42
|
+
}>;
|
|
43
|
+
export type MatrixGenerationActions = ToggleMatrixGenerationViewAction | deleteMatrixGenerationExclusionZoneAction | addMatrixGenerationExclusionZoneAction | setMatrixGenerationOptionsAction | ChangeMatrixGenerationScaleAction | ChangeMatrixGenerationStocsyChemicalShiftAction;
|
|
3
44
|
declare function addExclusionZone(draft: Draft<PreferencesState>, action: addMatrixGenerationExclusionZoneAction): void;
|
|
4
45
|
declare function deleteExclusionZone(draft: Draft<PreferencesState>, action: any): void;
|
|
5
46
|
declare function setMatrixGenerationOptions(draft: Draft<PreferencesState>, action: any): void;
|
|
6
|
-
|
|
47
|
+
declare function toggleMatrixGenerationViewProperty(draft: Draft<PreferencesState>, action: ToggleMatrixGenerationViewAction): void;
|
|
48
|
+
declare function resetDefaultViewMatrixGenerationOptions(draft: Draft<PreferencesState>, action: ToggleMatrixGenerationViewAction): void;
|
|
49
|
+
declare function changeMatrixGenerationScale(draft: Draft<PreferencesState>, action: ChangeMatrixGenerationScaleAction): void;
|
|
50
|
+
declare function changeMatrixGenerationStocsyChemicalShift(draft: Draft<PreferencesState>, action: ChangeMatrixGenerationStocsyChemicalShiftAction): null | undefined;
|
|
51
|
+
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, resetDefaultViewMatrixGenerationOptions, };
|