nmrium 0.46.1 → 0.48.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/Line.js +1 -1
- package/lib/component/1d/LinesSeries.d.ts +1 -1
- package/lib/component/1d/LinesSeries.js +24 -3
- package/lib/component/1d/integral/Integration.js +2 -1
- package/lib/component/1d/peaks/Peaks.js +5 -4
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/utilities/scale.d.ts +1 -0
- package/lib/component/1d/utilities/scale.js +2 -1
- package/lib/component/context/KeyModifierContext.d.ts +1 -1
- package/lib/component/elements/formik/FormikColorPickerDropdown.d.ts +6 -0
- package/lib/component/elements/formik/FormikColorPickerDropdown.js +14 -0
- package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js +1 -0
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
- package/lib/component/hooks/useExport.js +2 -2
- package/lib/component/hooks/useSetActiveSpectrumAction.d.ts +3 -0
- package/lib/component/hooks/useSetActiveSpectrumAction.js +16 -0
- package/lib/component/hooks/useVerticalAlign.d.ts +1 -1
- package/lib/component/loader/DropZone.js +4 -2
- package/lib/component/main/InnerNMRium.js +1 -1
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -4
- package/lib/component/modal/setting/GeneralSettings.js +2 -1
- package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.d.ts +2 -0
- package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +131 -0
- package/lib/component/modal/setting/settingsValidation.js +12 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +16 -2
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +2 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -2
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +26 -38
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -9
- package/lib/component/panels/SpectrumsPanel/base/RenderAsHTML.d.ts +7 -0
- package/lib/component/panels/SpectrumsPanel/base/RenderAsHTML.js +21 -0
- package/lib/component/panels/SpectrumsPanel/base/SpectrumName.js +0 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +6 -1
- package/lib/component/panels/databasePanel/DatabasePreferences.js +2 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +3 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +15 -4
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
- package/lib/component/reducer/actions/DomainActions.js +2 -2
- package/lib/component/reducer/actions/FiltersActions.js +1 -2
- package/lib/component/reducer/actions/IntegralsActions.d.ts +8 -2
- package/lib/component/reducer/actions/IntegralsActions.js +10 -1
- package/lib/component/reducer/actions/LoadActions.d.ts +3 -1
- package/lib/component/reducer/actions/LoadActions.js +9 -4
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -4
- package/lib/component/reducer/helper/getVerticalAlign.d.ts +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +0 -4
- package/lib/component/toolbar/FunctionToolBar.js +2 -1
- package/lib/component/utility/export.d.ts +3 -2
- package/lib/component/utility/export.js +42 -26
- package/lib/component/workspaces/exercise.js +1 -0
- package/lib/component/workspaces/prediction.js +5 -0
- package/lib/component/workspaces/simulation.js +5 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +41 -0
- package/lib/data/PredictionManager.js +1 -1
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +9 -1
- package/lib/data/data1d/Spectrum1D/get1DColor.js +12 -4
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +7 -6
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +2 -76
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +10 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +70 -0
- package/lib/data/data1d/multipleSpectraAnalysis.js +27 -40
- package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +9 -2
- package/lib/data/data2d/Spectrum2D/get2DColor.js +13 -5
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +10 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +7 -2
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -2
- package/lib/data/utilities/getCustomColor.d.ts +4 -0
- package/lib/data/utilities/getCustomColor.js +38 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +25 -25
- package/lib/component/elements/formik/FormikColorInput.d.ts +0 -8
- package/lib/component/elements/formik/FormikColorInput.js +0 -15
package/lib/component/1d/Line.js
CHANGED
|
@@ -26,6 +26,6 @@ function Line({ data, id, display, index }) {
|
|
|
26
26
|
}
|
|
27
27
|
}, [scaleX, scaleY, id, data, xyReduce]);
|
|
28
28
|
const { color: stroke, opacity: strokeOpacity } = parseColor(display?.color || 'black');
|
|
29
|
-
return (_jsx("path", { className: "line", "data-testid": "spectrum-line", stroke: stroke, fill: "none", strokeOpacity: opacity === 1 ? strokeOpacity : opacity, d: paths, transform: `translate(0,-${shiftY * index})` }
|
|
29
|
+
return (_jsx("path", { id: id, className: "line", "data-testid": "spectrum-line", stroke: stroke, fill: "none", strokeOpacity: opacity === 1 ? strokeOpacity : opacity, d: paths, transform: `translate(0,-${shiftY * index})` }));
|
|
30
30
|
}
|
|
31
31
|
export default Line;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function LinesSeries(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
declare function LinesSeries(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default LinesSeries;
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
2
4
|
import { get1DDataXY } from '../../data/data1d/Spectrum1D/get1DDataXY';
|
|
3
5
|
import { isSpectrum1D } from '../../data/data1d/Spectrum1D/isSpectrum1D';
|
|
4
6
|
import { useChartData } from '../context/ChartContext';
|
|
7
|
+
import { useScaleChecked } from '../context/ScaleContext';
|
|
5
8
|
import { useActiveSpectra } from '../hooks/useActiveSpectra';
|
|
9
|
+
import { useSetActiveSpectrumAction } from '../hooks/useSetActiveSpectrumAction';
|
|
10
|
+
import { useVerticalAlign } from '../hooks/useVerticalAlign';
|
|
6
11
|
import Line from './Line';
|
|
12
|
+
import { SPECTRA_BOTTOM_MARGIN } from './utilities/scale';
|
|
13
|
+
const BOX_SIZE = 10;
|
|
14
|
+
const style = css `
|
|
15
|
+
fill: transparent;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
fill: #ff6f0057;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
7
21
|
function LinesSeries() {
|
|
8
|
-
const { data, displayerKey, xDomains } = useChartData();
|
|
22
|
+
const { data, displayerKey, xDomains, width, margin, height } = useChartData();
|
|
9
23
|
const activeSpectra = useActiveSpectra();
|
|
24
|
+
const { shiftY } = useScaleChecked();
|
|
25
|
+
const verticalAlign = useVerticalAlign();
|
|
26
|
+
const innerWidth = width - margin.left - margin.right;
|
|
27
|
+
const innerHeight = height - margin.bottom - SPECTRA_BOTTOM_MARGIN;
|
|
10
28
|
const spectra = (data?.filter((d) => isSpectrum1D(d) && d.display.isVisible && xDomains[d.id]) || []);
|
|
11
|
-
|
|
29
|
+
const { setActiveSpectrum } = useSetActiveSpectrumAction();
|
|
30
|
+
return (_jsxs("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "spectrums", children: [spectra.map((d, i) => (_jsxs("g", { children: [_jsx(Line, { display: d.display, id: d.id, data: get1DDataXY(d), index: i }), verticalAlign === 'stack' && (_jsx("rect", { css: style, y: innerHeight - shiftY * i - BOX_SIZE / 2, x: margin.left, width: `${innerWidth}px`, height: `${BOX_SIZE}px`, onClick: (e) => {
|
|
31
|
+
setActiveSpectrum(e, d.id);
|
|
32
|
+
} }))] }, d.id))), activeSpectra?.map((activeSpectrum) => (_jsx("use", { href: `#${activeSpectrum.id}` }, activeSpectrum.id)))] }));
|
|
12
33
|
}
|
|
13
34
|
export default LinesSeries;
|
|
@@ -7,6 +7,7 @@ export function Integration({ integral, nucleus, max }) {
|
|
|
7
7
|
const { x, y } = integral;
|
|
8
8
|
const { scaleRatio } = useActiveSpectrumIntegralsViewState();
|
|
9
9
|
const path = useIntegralPath({ x, y, max, scaleRatio });
|
|
10
|
+
const { showIntegralsValues } = useActiveSpectrumIntegralsViewState();
|
|
10
11
|
const integralPreferences = usePanelPreferences('integrals', nucleus);
|
|
11
|
-
return (_jsxs("g", { children: [_jsx("path", { className: "line", stroke: integralPreferences.color, strokeWidth: integralPreferences.strokeWidth, fill: "none", d: path }), _jsx(IntegralResizable, { integralData: integral, integralFormat: integralPreferences.relative.format })] }));
|
|
12
|
+
return (_jsxs("g", { children: [_jsx("path", { className: "line", stroke: integralPreferences.color, strokeWidth: integralPreferences.strokeWidth, fill: "none", d: path }), showIntegralsValues && (_jsx(IntegralResizable, { integralData: integral, integralFormat: integralPreferences.relative.format }))] }));
|
|
12
13
|
}
|
|
@@ -69,13 +69,14 @@ export default function Peaks(props) {
|
|
|
69
69
|
const { deltaPPM: { format: peakFormat }, } = usePanelPreferences(peaksSource === 'peaks' ? 'peaks' : 'ranges', nucleus);
|
|
70
70
|
const canDisplaySpectrumPeaks = !spectrum.display.isVisible || spectrum.info?.isFid;
|
|
71
71
|
let mode = 'spread';
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
if (peaksSource === 'peaks' &&
|
|
73
|
+
(spectrum.peaks?.values?.length === 0 ||
|
|
74
|
+
!peaksViewState.showPeaks ||
|
|
75
|
+
canDisplaySpectrumPeaks)) {
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
77
78
|
if (peaksSource === 'ranges' &&
|
|
78
|
-
(
|
|
79
|
+
(spectrum.ranges?.values?.length === 0 ||
|
|
79
80
|
!rangesViewState.showPeaks ||
|
|
80
81
|
canDisplaySpectrumPeaks)) {
|
|
81
82
|
return null;
|
|
@@ -8,6 +8,7 @@ import { filterForIDsWithAssignment } from '../../assignment/utilities/filterFor
|
|
|
8
8
|
import { useDispatch } from '../../context/DispatchContext';
|
|
9
9
|
import { ResizerWithScale } from '../../elements/ResizerWithScale';
|
|
10
10
|
import { HighlightEventSource, useHighlight } from '../../highlight';
|
|
11
|
+
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
11
12
|
import { useResizerStatus } from '../../hooks/useResizerStatus';
|
|
12
13
|
import { options } from '../../toolbar/ToolTypes';
|
|
13
14
|
import { IntegralIndicator } from '../integral/IntegralIndicator';
|
|
@@ -32,6 +33,7 @@ function Range({ range, showMultiplicityTrees, selectedTool, relativeFormat, })
|
|
|
32
33
|
const highlightRange = useHighlight([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat(filterForIDsWithAssignment(assignmentData, signals.map((_signal) => _signal.id))), { type: HighlightEventSource.RANGE, extra: { id } });
|
|
33
34
|
const scaleX = useScaleX();
|
|
34
35
|
const dispatch = useDispatch();
|
|
36
|
+
const { showIntegralsValues } = useActiveSpectrumRangesViewState();
|
|
35
37
|
const isBlockedByEditing = selectedTool && selectedTool === options.editRange.id;
|
|
36
38
|
function handleOnStopResizing(position) {
|
|
37
39
|
dispatch({
|
|
@@ -74,7 +76,7 @@ function Range({ range, showMultiplicityTrees, selectedTool, relativeFormat, })
|
|
|
74
76
|
const isResizingActive = useResizerStatus('rangePicking');
|
|
75
77
|
return (_jsxs("g", { "data-testid": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, ...(!assignmentRange.isActive && { css: style }), children: [_jsx(ResizerWithScale, { from: from, to: to, onEnd: handleOnStopResizing, disabled: !isResizingActive, children: ({ x1, x2 }, isActive) => {
|
|
76
78
|
const width = x2 - x1;
|
|
77
|
-
return (_jsxs("g", { children: [isAssigned && !isHighlighted && !isActive && (_jsx("rect", { width: width, height: "10px", fill: "#ffd700", opacity: "0.35", "data-no-export": "true" })), _jsx("rect", { width: width, height: "100%", fill: isHighlighted || isActive ? '#ff6f0057' : 'transparent', "data-no-export": "true" }), _jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 })] }));
|
|
79
|
+
return (_jsxs("g", { children: [isAssigned && !isHighlighted && !isActive && (_jsx("rect", { width: width, height: "10px", fill: "#ffd700", opacity: "0.35", "data-no-export": "true" })), _jsx("rect", { width: width, height: "100%", fill: isHighlighted || isActive ? '#ff6f0057' : 'transparent', "data-no-export": "true" }), showIntegralsValues && (_jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 }))] }));
|
|
78
80
|
} }), showMultiplicityTrees && (_jsx(MultiplicityTree, { range: range, onUnlink: unAssignHandler })), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || diaIDs), x: scaleX()(from) - 16, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
|
|
79
81
|
}
|
|
80
82
|
export default Range;
|
|
@@ -14,6 +14,7 @@ interface ScaleYOptions {
|
|
|
14
14
|
yDomain: number[];
|
|
15
15
|
verticalAlign: VerticalAlignment;
|
|
16
16
|
}
|
|
17
|
+
export declare const SPECTRA_BOTTOM_MARGIN = 40;
|
|
17
18
|
declare function getYScale(options: ScaleYOptions, spectrumId?: number | null | string): import("d3-scale").ScaleLinear<number, number, never>;
|
|
18
19
|
interface IntegralYScaleOptions {
|
|
19
20
|
height: number;
|
|
@@ -9,6 +9,7 @@ function getXScale(options, spectrumId = null) {
|
|
|
9
9
|
: [margin.left, width - margin.right];
|
|
10
10
|
return scaleLinear(spectrumId ? xDomains[spectrumId] : xDomain, range);
|
|
11
11
|
}
|
|
12
|
+
export const SPECTRA_BOTTOM_MARGIN = 40;
|
|
12
13
|
function getYScale(options, spectrumId = null) {
|
|
13
14
|
const { height, margin, verticalAlign, yDomain, yDomains } = options;
|
|
14
15
|
let domainY = yDomain;
|
|
@@ -16,7 +17,7 @@ function getYScale(options, spectrumId = null) {
|
|
|
16
17
|
domainY = yDomains[spectrumId];
|
|
17
18
|
}
|
|
18
19
|
const [min, max] = domainY;
|
|
19
|
-
let bottomShift =
|
|
20
|
+
let bottomShift = SPECTRA_BOTTOM_MARGIN;
|
|
20
21
|
if (verticalAlign === 'center') {
|
|
21
22
|
bottomShift = 0;
|
|
22
23
|
const maxim = Math.max(Math.abs(max), Math.abs(min));
|
|
@@ -9,7 +9,7 @@ export declare function useKeyModifiers(): KeyModifiers;
|
|
|
9
9
|
interface KeyModifierProviderProps {
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
}
|
|
12
|
-
export declare function getModifiers(event: KeyboardEvent): {
|
|
12
|
+
export declare function getModifiers(event: KeyboardEvent | MouseEvent): {
|
|
13
13
|
ctrlKey: boolean;
|
|
14
14
|
shiftKey: boolean;
|
|
15
15
|
altKey: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ColorPickerProps } from 'react-science/ui';
|
|
2
|
+
interface FormikColorPickerDropdownProps extends ColorPickerProps {
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
declare function FormikColorPickerDropdown(props: FormikColorPickerDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default FormikColorPickerDropdown;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useFormikContext } from 'formik';
|
|
3
|
+
import lodashGet from 'lodash/get';
|
|
4
|
+
import { ColorPickerDropdown } from 'react-science/ui';
|
|
5
|
+
function FormikColorPickerDropdown(props) {
|
|
6
|
+
const { onChangeComplete = () => null, name, ...colorPickerProps } = props;
|
|
7
|
+
const { values, setFieldValue } = useFormikContext();
|
|
8
|
+
function colorChangeHandler(color) {
|
|
9
|
+
onChangeComplete(color);
|
|
10
|
+
void setFieldValue(name, color.hex);
|
|
11
|
+
}
|
|
12
|
+
return (_jsx(ColorPickerDropdown, { ...colorPickerProps, onChangeComplete: colorChangeHandler, color: { hex: lodashGet(values, name) } }));
|
|
13
|
+
}
|
|
14
|
+
export default FormikColorPickerDropdown;
|
|
@@ -2,6 +2,7 @@ import { useChartData } from '../context/ChartContext';
|
|
|
2
2
|
import { useActiveSpectrum } from './useActiveSpectrum';
|
|
3
3
|
export const defaultIntegralsViewState = {
|
|
4
4
|
scaleRatio: 1,
|
|
5
|
+
showIntegralsValues: true,
|
|
5
6
|
};
|
|
6
7
|
export function useActiveSpectrumIntegralsViewState() {
|
|
7
8
|
const activeSpectrum = useActiveSpectrum();
|
|
@@ -17,8 +17,8 @@ export default function useExport() {
|
|
|
17
17
|
const saveToClipboardHandler = useCallback(async () => {
|
|
18
18
|
if (state.data.length > 0 && rootRef) {
|
|
19
19
|
const hideLoading = await alert.showLoading('Exporting as NMRium process in progress');
|
|
20
|
-
setTimeout(() => {
|
|
21
|
-
copyPNGToClipboard(rootRef, 'nmrSVG');
|
|
20
|
+
setTimeout(async () => {
|
|
21
|
+
await copyPNGToClipboard(rootRef, 'nmrSVG');
|
|
22
22
|
hideLoading();
|
|
23
23
|
alert.success('Image copied to clipboard');
|
|
24
24
|
}, 0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useDispatch } from '../context/DispatchContext';
|
|
2
|
+
import { getModifiers } from '../context/KeyModifierContext';
|
|
3
|
+
export function useSetActiveSpectrumAction() {
|
|
4
|
+
const dispatch = useDispatch();
|
|
5
|
+
function setActiveSpectrum(e, id) {
|
|
6
|
+
setTimeout(() => {
|
|
7
|
+
const { ctrlKey, shiftKey } = getModifiers(e);
|
|
8
|
+
const modifier = `shift[${shiftKey ? 'true' : 'false'}]_ctrl[${ctrlKey ? 'true' : 'false'}]`;
|
|
9
|
+
dispatch({
|
|
10
|
+
type: 'CHANGE_ACTIVE_SPECTRUM',
|
|
11
|
+
payload: { modifier, id },
|
|
12
|
+
});
|
|
13
|
+
}, 0);
|
|
14
|
+
}
|
|
15
|
+
return { setActiveSpectrum };
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useVerticalAlign():
|
|
1
|
+
export declare function useVerticalAlign(): import("../reducer/Reducer").VerticalAlignment;
|
|
@@ -50,7 +50,7 @@ const containerStyle = css `
|
|
|
50
50
|
function DropZone(props) {
|
|
51
51
|
const { width, height } = useChartData();
|
|
52
52
|
const dispatch = useDispatch();
|
|
53
|
-
const { dispatch: dispatchPreferences, current } = usePreferences();
|
|
53
|
+
const { dispatch: dispatchPreferences, current: workspacePreferences } = usePreferences();
|
|
54
54
|
const preferences = usePreferences();
|
|
55
55
|
const isToolEnabled = useCheckToolsVisibility();
|
|
56
56
|
const openImportMetaInformationModal = useMetaInformationImportationModal();
|
|
@@ -70,10 +70,11 @@ function DropZone(props) {
|
|
|
70
70
|
parseMetaFileResult = await parseMetaFile(metaFile);
|
|
71
71
|
}
|
|
72
72
|
const { nmrLoaders: sourceSelector } = preferences.current;
|
|
73
|
+
const { onLoadProcessing, spectraColors } = workspacePreferences;
|
|
73
74
|
const { nmriumState, containsNmrium } = await readDropFiles(fileCollection, {
|
|
74
75
|
sourceSelector,
|
|
75
76
|
logger: logger.child({ context: 'nmr-processing' }),
|
|
76
|
-
onLoadProcessing
|
|
77
|
+
onLoadProcessing,
|
|
77
78
|
experimentalFeatures,
|
|
78
79
|
});
|
|
79
80
|
if (nmriumState?.settings) {
|
|
@@ -91,6 +92,7 @@ function DropZone(props) {
|
|
|
91
92
|
nmriumState,
|
|
92
93
|
containsNmrium,
|
|
93
94
|
parseMetaFileResult,
|
|
95
|
+
spectraColors,
|
|
94
96
|
},
|
|
95
97
|
});
|
|
96
98
|
}
|
|
@@ -44,7 +44,7 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
|
|
|
44
44
|
return rootRef?.current ? getBlob(rootRef.current, 'nmrSVG') : null;
|
|
45
45
|
},
|
|
46
46
|
}), []);
|
|
47
|
-
return (_jsx("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: _jsx(GlobalProvider, { value: {
|
|
47
|
+
return (_jsx("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, translate: "no", children: _jsx(GlobalProvider, { value: {
|
|
48
48
|
rootRef: rootRef.current,
|
|
49
49
|
elementsWrapperRef: elementsWrapperRef.current,
|
|
50
50
|
viewerRef: viewerRef.current,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as Yup from 'yup';
|
|
2
2
|
import { hasCouplingConstant } from '../../../../panels/extra/utilities/MultiplicityUtilities';
|
|
3
3
|
const editRangeFormValidation = Yup.object().shape({
|
|
4
|
-
signals: Yup.array()
|
|
5
|
-
.of(Yup.object().shape({
|
|
4
|
+
signals: Yup.array().of(Yup.object().shape({
|
|
6
5
|
js: Yup.array()
|
|
7
6
|
.of(Yup.object().shape({
|
|
8
7
|
multiplicity: Yup.string().required(),
|
|
@@ -22,7 +21,6 @@ const editRangeFormValidation = Yup.object().shape({
|
|
|
22
21
|
}),
|
|
23
22
|
}))
|
|
24
23
|
.min(1, 'There must be at least one coupling in a signal'),
|
|
25
|
-
}))
|
|
26
|
-
.min(1, 'There must be at least one signal in a range!'),
|
|
24
|
+
})),
|
|
27
25
|
});
|
|
28
26
|
export default editRangeFormValidation;
|
|
@@ -26,6 +26,7 @@ import GeneralTabContent from './settings-tabs/GeneralTabContent';
|
|
|
26
26
|
import ImportationFiltersTabContent from './settings-tabs/ImportationFiltersTabContent';
|
|
27
27
|
import InfoBlockTabContent from './settings-tabs/InfoBlockTabContent';
|
|
28
28
|
import OnLoadProcessingTabContent from './settings-tabs/OnLoadProcessingTabContent';
|
|
29
|
+
import SpectraColorsTabContent from './settings-tabs/SpectraColorsTabContent';
|
|
29
30
|
import ToolsTabContent from './settings-tabs/ToolsTabContent';
|
|
30
31
|
import { validation } from './settingsValidation';
|
|
31
32
|
const styles = css `
|
|
@@ -235,7 +236,7 @@ function GeneralSettingsModal({ height }) {
|
|
|
235
236
|
marginLeft: '10px',
|
|
236
237
|
}, children: _jsx(FaRegCopy, {}) }), _jsx(Button.Action, { size: "xSmall", fill: "outline", onClick: handlePastWorkspaceAction, toolTip: "Past workspace preferences", tooltipOrientation: "horizontal", style: {
|
|
237
238
|
marginLeft: '10px',
|
|
238
|
-
}, children: _jsx(FaPaste, {}) })] })] }) }), _jsx(Modal.Body, { children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { title: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { title: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { title: "Panels", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { title: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { title: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), _jsx(Tab, { title: "Import filters", tabid: "importation-filters", children: _jsx("div", { className: "inner-content", children: _jsx(ImportationFiltersTabContent, {}) }) }), _jsx(Tab, { title: "Title Block", tabid: "title-block", children: _jsx("div", { className: "inner-content", children: _jsx(InfoBlockTabContent, {}) }) }), _jsx(Tab, { title: "On Load Processing", tabid: "on-load-processing", children: _jsx("div", { className: "inner-content", children: _jsx(OnLoadProcessingTabContent, {}) }) })] }) }) }) }), _jsx(Modal.Footer, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
|
|
239
|
+
}, children: _jsx(FaPaste, {}) })] })] }) }), _jsx(Modal.Body, { children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { title: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { title: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { title: "Panels", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { title: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { title: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), _jsx(Tab, { title: "Import filters", tabid: "importation-filters", children: _jsx("div", { className: "inner-content", children: _jsx(ImportationFiltersTabContent, {}) }) }), _jsx(Tab, { title: "Title Block", tabid: "title-block", children: _jsx("div", { className: "inner-content", children: _jsx(InfoBlockTabContent, {}) }) }), _jsx(Tab, { title: "On Load Processing", tabid: "on-load-processing", children: _jsx("div", { className: "inner-content", children: _jsx(OnLoadProcessingTabContent, {}) }) }), _jsx(Tab, { title: "Spectra colors", tabid: "spectra-colors", children: _jsx("div", { className: "inner-content", children: _jsx(SpectraColorsTabContent, {}) }) })] }) }) }) }), _jsx(Modal.Footer, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
|
|
239
240
|
closeDialog?.();
|
|
240
241
|
} }), _jsx(Button.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), _jsx(SaveSettingsModal, {}), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePastWorkspace, text: text, label: "Workspace" })] }));
|
|
241
242
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useFormikContext } from 'formik';
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { FaPlus, FaTimes } from 'react-icons/fa';
|
|
5
|
+
import { useChartData } from '../../../context/ChartContext';
|
|
6
|
+
import Button from '../../../elements/Button';
|
|
7
|
+
import { GroupPane } from '../../../elements/GroupPane';
|
|
8
|
+
import ReactTable from '../../../elements/ReactTable/ReactTable';
|
|
9
|
+
import FormikColorPickerDropdown from '../../../elements/formik/FormikColorPickerDropdown';
|
|
10
|
+
import FormikInput from '../../../elements/formik/FormikInput';
|
|
11
|
+
import { convertPathArrayToString } from '../../../utility/convertPathArrayToString';
|
|
12
|
+
import { getSpectraObjectPaths } from '../../../utility/getSpectraObjectPaths';
|
|
13
|
+
const styles = {
|
|
14
|
+
input: {
|
|
15
|
+
width: '100%',
|
|
16
|
+
},
|
|
17
|
+
column: {
|
|
18
|
+
padding: '2px',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const colorInputStyle = {
|
|
22
|
+
padding: 0,
|
|
23
|
+
minWidth: '80px',
|
|
24
|
+
width: '80px',
|
|
25
|
+
...styles.column,
|
|
26
|
+
};
|
|
27
|
+
function getObjectKey(key) {
|
|
28
|
+
return `spectraColors.${key}`;
|
|
29
|
+
}
|
|
30
|
+
function SpectraColorsTabContent() {
|
|
31
|
+
const { values, setFieldValue } = useFormikContext();
|
|
32
|
+
const { data } = useChartData();
|
|
33
|
+
const { datalist, paths } = useMemo(() => getSpectraObjectPaths(data), [data]);
|
|
34
|
+
const { oneDimension = [], twoDimensions = [] } = values?.spectraColors || {};
|
|
35
|
+
const addHandler = useCallback((data, index, key) => {
|
|
36
|
+
let columns = [];
|
|
37
|
+
const emptyField = key === 'oneDimension'
|
|
38
|
+
? {
|
|
39
|
+
value: null,
|
|
40
|
+
jpath: ['info', 'experiment'],
|
|
41
|
+
color: 'red',
|
|
42
|
+
}
|
|
43
|
+
: {
|
|
44
|
+
value: null,
|
|
45
|
+
jpath: ['info', 'experiment'],
|
|
46
|
+
positiveColor: 'red',
|
|
47
|
+
negativeColor: 'blue',
|
|
48
|
+
};
|
|
49
|
+
if (data && Array.isArray(data)) {
|
|
50
|
+
columns = [...data.slice(0, index), emptyField, ...data.slice(index)];
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
columns.push(emptyField);
|
|
54
|
+
}
|
|
55
|
+
void setFieldValue(getObjectKey(key), columns);
|
|
56
|
+
}, [setFieldValue]);
|
|
57
|
+
const deleteHandler = useCallback((data, index, key) => {
|
|
58
|
+
const _fields = data.filter((_, columnIndex) => columnIndex !== index);
|
|
59
|
+
void setFieldValue(getObjectKey(key), _fields);
|
|
60
|
+
}, [setFieldValue]);
|
|
61
|
+
return (_jsxs("div", { children: [_jsx(SpectraColorsFields, { groupLabel: "One dimension", baseObjectPath: "oneDimension", data: oneDimension, datalist: datalist, paths: paths, onAdd: addHandler, onDelete: deleteHandler }), _jsx(SpectraColorsFields, { groupLabel: "Two dimensions", baseObjectPath: "twoDimensions", data: twoDimensions, datalist: datalist, paths: paths, onAdd: addHandler, onDelete: deleteHandler })] }));
|
|
62
|
+
}
|
|
63
|
+
function SpectraColorsFields(props) {
|
|
64
|
+
const { onAdd, onDelete, datalist, paths, data, baseObjectPath, groupLabel } = props;
|
|
65
|
+
const COLUMNS = useMemo(() => {
|
|
66
|
+
const objectPath = getObjectKey(baseObjectPath);
|
|
67
|
+
const baseColumns = [
|
|
68
|
+
{
|
|
69
|
+
Header: '#',
|
|
70
|
+
style: { width: '25px', ...styles.column },
|
|
71
|
+
accessor: (_, index) => index + 1,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
Header: 'Field',
|
|
75
|
+
style: { padding: 0, ...styles.column },
|
|
76
|
+
Cell: ({ row }) => {
|
|
77
|
+
return (_jsx(FormikInput, { name: `${objectPath}.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => {
|
|
78
|
+
return paths?.[key.toString().trim()] || key;
|
|
79
|
+
}, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
Header: 'Value',
|
|
84
|
+
style: { padding: 0, ...styles.column },
|
|
85
|
+
Cell: ({ row }) => {
|
|
86
|
+
return (_jsx(FormikInput, { name: `${objectPath}.${row.index}.value`, style: { input: styles.input } }));
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
const operationsField = {
|
|
91
|
+
Header: '',
|
|
92
|
+
style: { width: '70px', ...styles.column },
|
|
93
|
+
id: 'operation-button',
|
|
94
|
+
Cell: ({ data, row }) => {
|
|
95
|
+
const record = row.original;
|
|
96
|
+
return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => onAdd(data, row.index + 1, baseObjectPath), children: _jsx(FaPlus, {}) }), !record?.name && (_jsx(Button.Danger, { fill: "outline", onClick: () => onDelete(data, row.index, baseObjectPath), children: _jsx(FaTimes, {}) }))] }));
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (baseObjectPath === 'oneDimension') {
|
|
100
|
+
const colorField = {
|
|
101
|
+
Header: 'Color',
|
|
102
|
+
style: colorInputStyle,
|
|
103
|
+
Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.color` })),
|
|
104
|
+
};
|
|
105
|
+
return [...baseColumns, colorField, operationsField];
|
|
106
|
+
}
|
|
107
|
+
const colorFields = [
|
|
108
|
+
{
|
|
109
|
+
Header: 'Positive color',
|
|
110
|
+
style: colorInputStyle,
|
|
111
|
+
Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.positiveColor` })),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
Header: 'Negative color',
|
|
115
|
+
style: colorInputStyle,
|
|
116
|
+
Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.negativeColor` })),
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
return [...baseColumns, ...colorFields, operationsField];
|
|
120
|
+
}, [baseObjectPath, datalist, onAdd, onDelete, paths]);
|
|
121
|
+
return (_jsx(GroupPane, { text: groupLabel, renderHeader: (text) => {
|
|
122
|
+
return (_jsx(FieldsBlockHeader, { text: text, onAdd: () => onAdd(data, 0, baseObjectPath) }));
|
|
123
|
+
}, children: _jsx(ReactTable, { style: {
|
|
124
|
+
'table, table td, table th': { border: 'none' },
|
|
125
|
+
'table thead': { borderBottom: '1px solid #f9f9f9' },
|
|
126
|
+
}, data: data, columns: COLUMNS, emptyDataRowText: "No Fields" }) }));
|
|
127
|
+
}
|
|
128
|
+
function FieldsBlockHeader({ onAdd, text }) {
|
|
129
|
+
return (_jsxs("div", { className: "section-header", style: { display: 'flex' }, children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button.Done, { fill: "outline", size: "xSmall", onClick: onAdd, children: "Add custom color" })] }));
|
|
130
|
+
}
|
|
131
|
+
export default SpectraColorsTabContent;
|
|
@@ -49,7 +49,17 @@ const databasesValidation = object().shape({
|
|
|
49
49
|
const infoBlockValidation = object({
|
|
50
50
|
fields: array().of(object({
|
|
51
51
|
label: string().required(),
|
|
52
|
-
jpath: array().of(string()).min(1),
|
|
52
|
+
jpath: array().of(string()).required().min(1),
|
|
53
|
+
})),
|
|
54
|
+
});
|
|
55
|
+
const spectraColorsSchemaValidation = object({
|
|
56
|
+
oneDimension: array().of(object({
|
|
57
|
+
value: string().required(),
|
|
58
|
+
jpath: array().of(string()).required().min(1),
|
|
59
|
+
})),
|
|
60
|
+
twoDimensions: array().of(object({
|
|
61
|
+
value: string().required(),
|
|
62
|
+
jpath: array().of(string()).required().min(1),
|
|
53
63
|
})),
|
|
54
64
|
});
|
|
55
65
|
const generalValidation = object({
|
|
@@ -60,4 +70,5 @@ export const validation = lazy((obj) => object().shape({
|
|
|
60
70
|
databases: databasesValidation,
|
|
61
71
|
infoBlock: infoBlockValidation,
|
|
62
72
|
general: generalValidation,
|
|
73
|
+
spectraColors: spectraColorsSchemaValidation,
|
|
63
74
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { SvgNmrSum } from 'cheminfo-font';
|
|
4
|
+
import { SvgNmrIntegrate, SvgNmrSum } from 'cheminfo-font';
|
|
5
5
|
import lodashGet from 'lodash/get';
|
|
6
6
|
import { useCallback, useMemo, useState, useRef, memo } from 'react';
|
|
7
7
|
import { ImLink } from 'react-icons/im';
|
|
@@ -17,6 +17,7 @@ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHe
|
|
|
17
17
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
18
18
|
import IntegralTable from './IntegralTable';
|
|
19
19
|
import IntegralsPreferences from './IntegralsPreferences';
|
|
20
|
+
import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectrumIntegralsViewState';
|
|
20
21
|
const style = css `
|
|
21
22
|
.sum-button {
|
|
22
23
|
width: 22px;
|
|
@@ -25,13 +26,24 @@ const style = css `
|
|
|
25
26
|
align-items: center;
|
|
26
27
|
justify-content: center;
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
button {
|
|
31
|
+
margin-right: 2px;
|
|
32
|
+
}
|
|
28
33
|
`;
|
|
29
34
|
function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
30
35
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
31
36
|
const dispatch = useDispatch();
|
|
37
|
+
const { showIntegralsValues } = useActiveSpectrumIntegralsViewState();
|
|
32
38
|
const modal = useModal();
|
|
33
39
|
const [isFlipped, setFlipStatus] = useState(false);
|
|
34
40
|
const settingRef = useRef();
|
|
41
|
+
function handleShowIntegralsValues() {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: 'TOGGLE_INTEGRALS_VIEW_PROPERTY',
|
|
44
|
+
payload: { key: 'showIntegralsValues' },
|
|
45
|
+
});
|
|
46
|
+
}
|
|
35
47
|
const yesHandler = useCallback(() => {
|
|
36
48
|
dispatch({ type: 'DELETE_INTEGRAL', payload: {} });
|
|
37
49
|
}, [dispatch]);
|
|
@@ -93,7 +105,9 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
93
105
|
`,
|
|
94
106
|
], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: currentSum
|
|
95
107
|
? `Change integration sum (${currentSum.toFixed(2)})`
|
|
96
|
-
: 'Change integration sum', popupPlacement: "right", children: _jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integrals", currentSum: currentSum, sumOptions: integrals?.options, renderButton: (onClick) => (_jsx("button", { className: "sum-button", type: "button", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration values", popupPlacement: "right", onClick: toggleConstantSumHandler, value: integrals?.options?.isSumConstant || false, children: _jsx(ImLink, {}) })
|
|
108
|
+
: 'Change integration sum', popupPlacement: "right", children: _jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integrals", currentSum: currentSum, sumOptions: integrals?.options, renderButton: (onClick) => (_jsx("button", { className: "sum-button", type: "button", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration values", popupPlacement: "right", onClick: toggleConstantSumHandler, value: integrals?.options?.isSumConstant || false, children: _jsx(ImLink, {}) }), _jsx(ActiveButton, { popupTitle: showIntegralsValues
|
|
109
|
+
? 'Hide integrals values'
|
|
110
|
+
: 'Show integrals values', popupPlacement: "right", onClick: handleShowIntegralsValues, value: showIntegralsValues, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, info: info, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
|
|
97
111
|
}
|
|
98
112
|
const MemoizedIntegralPanel = memo(IntegralPanelInner);
|
|
99
113
|
const emptyData = { integrals: {}, info: {} };
|
|
@@ -3,7 +3,7 @@ import { Formik } from 'formik';
|
|
|
3
3
|
import { useCallback, useImperativeHandle, useRef, memo, forwardRef, useMemo, } from 'react';
|
|
4
4
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
5
5
|
import Label from '../../elements/Label';
|
|
6
|
-
import
|
|
6
|
+
import FormikColorPickerDropdown from '../../elements/formik/FormikColorPickerDropdown';
|
|
7
7
|
import { formatFieldLabelStyle } from '../../elements/formik/FormikColumnFormatField';
|
|
8
8
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
9
9
|
import useNucleus from '../../hooks/useNucleus';
|
|
@@ -72,7 +72,7 @@ function IntegralsPreferences(props, ref) {
|
|
|
72
72
|
formRef.current.submitForm();
|
|
73
73
|
},
|
|
74
74
|
}));
|
|
75
|
-
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: preferencesByNuclei, onSubmit: saveHandler, innerRef: formRef, children: _jsx(_Fragment, { children: nuclei?.map((n) => (_jsx(NucleusPreferences, { nucleus: n, fields: formatFields, renderTop: () => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(
|
|
75
|
+
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: preferencesByNuclei, onSubmit: saveHandler, innerRef: formRef, children: _jsx(_Fragment, { children: nuclei?.map((n) => (_jsx(NucleusPreferences, { nucleus: n, fields: formatFields, renderTop: () => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(FormikColorPickerDropdown, { name: `nuclei.${n}.color` })] }) }), _jsx(Label, { title: "stroke width :", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(FormikInput, { name: `nuclei.${n}.strokeWidth`, type: "number", style: {
|
|
76
76
|
input: {
|
|
77
77
|
textAlign: 'center',
|
|
78
78
|
padding: '2px',
|
|
@@ -58,12 +58,13 @@ function MatrixGenerationPanel() {
|
|
|
58
58
|
const { view: { spectra: { activeTab }, }, xDomain, data, } = useChartData();
|
|
59
59
|
const formRef = useRef(null);
|
|
60
60
|
const nucleusMatrixOptions = usePanelPreferences('matrixGeneration', activeTab);
|
|
61
|
+
const spectraPreferences = usePanelPreferences('spectra', activeTab);
|
|
61
62
|
const matrixOptions = getMatrixOptions(nucleusMatrixOptions, {
|
|
62
63
|
from: xDomain[0],
|
|
63
64
|
to: xDomain[1],
|
|
64
65
|
});
|
|
65
66
|
function handleExportAsMatrix() {
|
|
66
|
-
exportAsMatrix(data, 'Spectra Matrix');
|
|
67
|
+
exportAsMatrix(data, spectraPreferences?.columns || [], 'Spectra Matrix');
|
|
67
68
|
}
|
|
68
69
|
function handleSave(options) {
|
|
69
70
|
dispatch({ type: 'APPLY_SIGNAL_PROCESSING_FILTER', payload: { options } });
|
|
@@ -8,7 +8,8 @@ interface MoleculePanelHeaderProps {
|
|
|
8
8
|
onOpenMoleculeEditor: () => void;
|
|
9
9
|
renderSource?: 'moleculePanel' | 'predictionPanel';
|
|
10
10
|
onClickPreferences?: () => void;
|
|
11
|
+
onClickPastMolecule?: () => void;
|
|
11
12
|
children?: ReactNode;
|
|
12
13
|
}
|
|
13
|
-
export default function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMoleculeIndexChange, onOpenMoleculeEditor, renderSource, onClickPreferences, children, }: MoleculePanelHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMoleculeIndexChange, onOpenMoleculeEditor, renderSource, onClickPreferences, onClickPastMolecule, children, }: MoleculePanelHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|