nmrium 0.52.0 → 0.53.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/ranges/AssignmentLabel.d.ts +7 -0
- package/lib/component/1d/ranges/AssignmentLabel.js +10 -0
- package/lib/component/1d/ranges/Range.js +2 -1
- package/lib/component/elements/EditableColumn.js +3 -3
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
- package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
- package/lib/component/hooks/useToolsFunctions.js +7 -1
- package/lib/component/main/NMRiumStateProvider.js +1 -1
- package/lib/component/modal/ImportPublicationStringModal.d.ts +5 -3
- package/lib/component/modal/ImportPublicationStringModal.js +7 -4
- package/lib/component/panels/RangesPanel/RangesHeader.js +21 -7
- package/lib/component/panels/RangesPanel/RangesPreferences.js +8 -2
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.d.ts +7 -0
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.js +16 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +8 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +1 -1
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/FiltersActions.js +337 -317
- package/lib/component/reducer/actions/RangesActions.d.ts +7 -2
- package/lib/component/reducer/actions/RangesActions.js +16 -2
- package/lib/component/reducer/actions/ToolsActions.js +13 -20
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +6 -4
- package/lib/component/toolbar/ToolBar.js +1 -1
- package/lib/component/utility/export.js +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +15 -15
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
3
|
+
const marginTop = 55;
|
|
4
|
+
export function AssignmentLabel(props) {
|
|
5
|
+
const { range, x } = props;
|
|
6
|
+
const { showAssignmentsLabels } = useActiveSpectrumRangesViewState();
|
|
7
|
+
if (!range.assignment || !showAssignmentsLabels)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx("text", { x: x - 5, y: marginTop, fontSize: "12px", fill: "black", textAnchor: "end", children: range.assignment }));
|
|
10
|
+
}
|
|
@@ -15,6 +15,7 @@ import { IntegralIndicator } from '../integral/IntegralIndicator';
|
|
|
15
15
|
import { useScaleX } from '../utilities/scale';
|
|
16
16
|
import { AssignmentActionsButtons } from './AssignmentActionsButtons';
|
|
17
17
|
import { Atoms } from './Atoms';
|
|
18
|
+
import { AssignmentLabel } from './AssignmentLabel';
|
|
18
19
|
const style = css `
|
|
19
20
|
.target {
|
|
20
21
|
visibility: hidden;
|
|
@@ -78,6 +79,6 @@ function Range({ range, selectedTool, relativeFormat }) {
|
|
|
78
79
|
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) => {
|
|
79
80
|
const width = x2 - x1;
|
|
80
81
|
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 }))] }));
|
|
81
|
-
} }), _jsx(Atoms, { range: range, x: startX }), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || rangeDiaIDs), x: startX, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
|
|
82
|
+
} }), _jsx(AssignmentLabel, { range: range, x: startX }), _jsx(Atoms, { range: range, x: startX }), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || rangeDiaIDs), x: startX, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
|
|
82
83
|
}
|
|
83
84
|
export default Range;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useState, } from 'react';
|
|
3
3
|
import Input from './Input';
|
|
4
4
|
function extractNumber(val, type) {
|
|
@@ -59,14 +59,14 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
59
59
|
? { whiteSpace: 'nowrap', overflow: 'hidden', display: 'inline-flex' }
|
|
60
60
|
: {}),
|
|
61
61
|
...style,
|
|
62
|
-
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (
|
|
62
|
+
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (_jsxs("span", { style: {
|
|
63
63
|
display: 'table-cell',
|
|
64
64
|
verticalAlign: 'middle',
|
|
65
65
|
width: '100%',
|
|
66
66
|
...(textOverFlowEllipses
|
|
67
67
|
? { textOverflow: 'ellipsis', overflow: 'hidden' }
|
|
68
68
|
: {}),
|
|
69
|
-
}, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
|
|
69
|
+
}, children: [value, " \u00A0"] })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
|
|
70
70
|
inputWrapper: {
|
|
71
71
|
...(!isValid && { borderColor: 'red' }),
|
|
72
72
|
width: '100%',
|
|
@@ -2,6 +2,7 @@ import lodashDebounce from 'lodash/debounce';
|
|
|
2
2
|
import lodashMap from 'lodash/map';
|
|
3
3
|
import { useCallback, useRef, useState } from 'react';
|
|
4
4
|
import { useToggleAccordion } from 'react-science/ui';
|
|
5
|
+
import { useChartData } from '../context/ChartContext';
|
|
5
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
7
|
import { usePreferences } from '../context/PreferencesContext';
|
|
7
8
|
import { useToaster } from '../context/ToasterContext';
|
|
@@ -14,7 +15,12 @@ export default function useToolsFunctions() {
|
|
|
14
15
|
const [isRealSpectrumShown, setIsRealSpectrumShown] = useState(false);
|
|
15
16
|
const debounceClickEventsRef = useRef({ clicks: [] });
|
|
16
17
|
const { current: { general: { invert }, }, } = usePreferences();
|
|
18
|
+
const { toolOptions: { selectedTool: previousSelectedTool }, } = useChartData();
|
|
17
19
|
const handleChangeOption = useCallback((selectedTool) => {
|
|
20
|
+
//avoid reselecting the tool if it's already selected
|
|
21
|
+
if (selectedTool === previousSelectedTool) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
18
24
|
if ([
|
|
19
25
|
options.peakPicking.id,
|
|
20
26
|
options.integral.id,
|
|
@@ -33,7 +39,7 @@ export default function useToolsFunctions() {
|
|
|
33
39
|
type: 'SET_SELECTED_TOOL',
|
|
34
40
|
payload: { selectedTool: selectedTool || options.zoom.id },
|
|
35
41
|
});
|
|
36
|
-
}, [dispatch, invert, openPanel, toaster]);
|
|
42
|
+
}, [dispatch, invert, openPanel, previousSelectedTool, toaster]);
|
|
37
43
|
const handleFullZoomOut = useCallback(() => {
|
|
38
44
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
39
45
|
dispatch({
|
|
@@ -65,7 +65,7 @@ export default function NMRiumStateProvider(props) {
|
|
|
65
65
|
.catch((error) => {
|
|
66
66
|
dispatch({ type: 'SET_LOADING_FLAG', payload: { isLoading: false } });
|
|
67
67
|
// eslint-disable-next-line no-alert
|
|
68
|
-
alert(error.message);
|
|
68
|
+
window.alert(error.message);
|
|
69
69
|
reportError(error);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface InnerImportPublicationStringModalProps {
|
|
2
2
|
onClose: () => void;
|
|
3
|
+
}
|
|
4
|
+
interface ImportPublicationStringModalProps extends InnerImportPublicationStringModalProps {
|
|
3
5
|
isOpen: boolean;
|
|
4
6
|
}
|
|
5
|
-
declare function ImportPublicationStringModal(props: ImportPublicationStringModalProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
6
|
-
export
|
|
7
|
+
export declare function ImportPublicationStringModal(props: ImportPublicationStringModalProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
8
|
+
export {};
|
|
@@ -29,8 +29,14 @@ function handleRowStyle(data) {
|
|
|
29
29
|
const INITIAL_VALUES = {
|
|
30
30
|
publicationText: '1H NMR (CDCl3, 400MHz) δ 10.58 (b, 1H), 7.40 (d, 1H, J = 8.0 Hz), 6.19 (d, 1H, J = 7.6 Hz), 4.88 (s, 1H), 2.17 (s, 3H), 1.02 (s, 9H), 1.01 (s, 9H), 0.89 (s, 9H)',
|
|
31
31
|
};
|
|
32
|
-
function ImportPublicationStringModal(props) {
|
|
32
|
+
export function ImportPublicationStringModal(props) {
|
|
33
33
|
const { onClose, isOpen } = props;
|
|
34
|
+
if (!isOpen)
|
|
35
|
+
return;
|
|
36
|
+
return _jsx(InnerImportPublicationStringModal, { onClose: onClose });
|
|
37
|
+
}
|
|
38
|
+
function InnerImportPublicationStringModal(props) {
|
|
39
|
+
const { onClose } = props;
|
|
34
40
|
const formRef = useRef();
|
|
35
41
|
const dispatch = useDispatch();
|
|
36
42
|
const toaster = useToaster();
|
|
@@ -59,8 +65,6 @@ function ImportPublicationStringModal(props) {
|
|
|
59
65
|
const debounceChanges = useMemo(() => debounce((value) => {
|
|
60
66
|
resurrect(value, { logger: loggerRef.current });
|
|
61
67
|
}, 250), []);
|
|
62
|
-
if (!isOpen)
|
|
63
|
-
return;
|
|
64
68
|
function publicationStringHandler({ publicationText }) {
|
|
65
69
|
void (async () => {
|
|
66
70
|
const hideLoading = toaster.showLoading({
|
|
@@ -103,4 +107,3 @@ function ImportPublicationStringModal(props) {
|
|
|
103
107
|
padding: '15px',
|
|
104
108
|
}, name: "publicationText", className: "text-area", placeholder: "Enter publication string", onChange: handleOnChange })] }), _jsx(GroupPane, { text: "Logs", children: _jsx(ReactTable, { columns: COLUMNS, data: logs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle, style: { height: '120px' } }) })] }) }), _jsx(DialogFooter, { children: _jsx("div", { style: { display: 'flex', flexDirection: 'row-reverse' }, children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), disabled: isNotValid || !isValid, children: "Generate spectrum" }) }) })] })) }) }));
|
|
105
109
|
}
|
|
106
|
-
export default ImportPublicationStringModal;
|
|
@@ -3,6 +3,7 @@ import { SvgNmrIntegrate, SvgNmrPeaks, SvgNmrPeaksTopLabels, } from 'cheminfo-fo
|
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
4
|
import { rangesToACS } from 'nmr-processing';
|
|
5
5
|
import { FaFileExport, FaUnlink, FaSitemap, FaChartBar } from 'react-icons/fa';
|
|
6
|
+
import { LuSubtitles } from 'react-icons/lu';
|
|
6
7
|
import { ImLink } from 'react-icons/im';
|
|
7
8
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
8
9
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
@@ -23,7 +24,7 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
23
24
|
const assignmentData = useAssignmentData();
|
|
24
25
|
const currentSum = lodashGet(ranges, 'options.sum', null);
|
|
25
26
|
const rangesPreferences = usePanelPreferences('ranges', activeTab);
|
|
26
|
-
const { showMultiplicityTrees, showJGraph, showIntegrals, showIntegralsValues, showPeaks, displayingMode, } = useActiveSpectrumRangesViewState();
|
|
27
|
+
const { showMultiplicityTrees, showJGraph, showIntegrals, showIntegralsValues, showPeaks, displayingMode, showAssignmentsLabels, } = useActiveSpectrumRangesViewState();
|
|
27
28
|
function changeRangesSumHandler(options) {
|
|
28
29
|
dispatch({ type: 'CHANGE_RANGE_SUM', payload: { options } });
|
|
29
30
|
modal.close();
|
|
@@ -78,6 +79,12 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
78
79
|
payload: { key: 'showJGraph' },
|
|
79
80
|
});
|
|
80
81
|
}
|
|
82
|
+
function handleShowAssignmentsLabel() {
|
|
83
|
+
dispatch({
|
|
84
|
+
type: 'TOGGLE_RANGES_VIEW_PROPERTY',
|
|
85
|
+
payload: { key: 'showAssignmentsLabels' },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
81
88
|
const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = useClipboard();
|
|
82
89
|
function saveToClipboardHandler(value) {
|
|
83
90
|
void rawWriteWithType(value, 'text/html').then(() => toaster.show({ message: 'Data copied to clipboard', intent: 'success' }));
|
|
@@ -117,6 +124,12 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
117
124
|
{
|
|
118
125
|
component: (_jsx(ChangeSumModal, { onSave: changeRangesSumHandler, sumType: "ranges", currentSum: currentSum, sumOptions: ranges?.options })),
|
|
119
126
|
},
|
|
127
|
+
{
|
|
128
|
+
icon: _jsx(ImLink, {}),
|
|
129
|
+
title: 'Fixed integration sum',
|
|
130
|
+
onClick: changeSumConstantFlagHandler,
|
|
131
|
+
active: ranges?.options?.isSumConstant,
|
|
132
|
+
},
|
|
120
133
|
{
|
|
121
134
|
disabled: !hasRanges,
|
|
122
135
|
icon: _jsx(FaUnlink, {}),
|
|
@@ -151,12 +164,6 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
151
164
|
onClick: handleShowIntegralsValues,
|
|
152
165
|
active: showIntegralsValues,
|
|
153
166
|
},
|
|
154
|
-
{
|
|
155
|
-
icon: _jsx(ImLink, {}),
|
|
156
|
-
title: 'Fixed integration sum',
|
|
157
|
-
onClick: changeSumConstantFlagHandler,
|
|
158
|
-
active: ranges?.options?.isSumConstant,
|
|
159
|
-
},
|
|
160
167
|
{
|
|
161
168
|
id: 'ranges-toggle-peaks',
|
|
162
169
|
disabled: !hasRanges,
|
|
@@ -172,6 +179,13 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
172
179
|
onClick: toggleDisplayingMode,
|
|
173
180
|
active: displayingMode === 'spread',
|
|
174
181
|
},
|
|
182
|
+
{
|
|
183
|
+
disabled: !hasRanges,
|
|
184
|
+
icon: _jsx(LuSubtitles, {}),
|
|
185
|
+
title: `${booleanToString(!showAssignmentsLabels)} assignments labels`,
|
|
186
|
+
onClick: handleShowAssignmentsLabel,
|
|
187
|
+
active: showAssignmentsLabels,
|
|
188
|
+
},
|
|
175
189
|
] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
|
|
176
190
|
}
|
|
177
191
|
export default RangesHeader;
|
|
@@ -79,18 +79,24 @@ const formatFields = [
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
id: 12,
|
|
82
|
+
label: 'Assignment label :',
|
|
83
|
+
checkControllerName: 'showAssignmentLabel',
|
|
84
|
+
hideFormatField: true,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 13,
|
|
82
88
|
label: 'Delete action :',
|
|
83
89
|
checkControllerName: 'showDeleteAction',
|
|
84
90
|
hideFormatField: true,
|
|
85
91
|
},
|
|
86
92
|
{
|
|
87
|
-
id:
|
|
93
|
+
id: 14,
|
|
88
94
|
label: 'Zoom action :',
|
|
89
95
|
checkControllerName: 'showZoomAction',
|
|
90
96
|
hideFormatField: true,
|
|
91
97
|
},
|
|
92
98
|
{
|
|
93
|
-
id:
|
|
99
|
+
id: 15,
|
|
94
100
|
label: 'Edit action :',
|
|
95
101
|
checkControllerName: 'showEditAction',
|
|
96
102
|
hideFormatField: true,
|
|
@@ -64,7 +64,7 @@ function RangesTable({ tableData, onUnlink, contextMenu = [], onContextMenuSelec
|
|
|
64
64
|
const showActions = preferences.showDeleteAction ||
|
|
65
65
|
preferences.showEditAction ||
|
|
66
66
|
preferences.showZoomAction;
|
|
67
|
-
return (_jsxs("table", { css: tableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [preferences.showSerialNumber && _jsx("th", { children: "#" }), preferences.from.show && (_jsxs("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && (_jsxs("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show && (_jsxs("th", { id: "from", ...onSort, children: ["\u03B4 (ppm) ", isSortedDesc('from').content] })), preferences.deltaHz.show && _jsx("th", { children: "\u03B4 (Hz) " }), preferences.relative.show && (_jsxs("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })), preferences.absolute.show && _jsx("th", { children: "Absolute" }), preferences.showMultiplicity && _jsx("th", { children: "Mult." }), preferences.coupling.show && _jsx("th", { children: "J (Hz)" }), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { title: "Assign multiplets", children: _jsx(FaLink, { style: { fontSize: 10, margin: 'auto' } }) }), _jsx("th", { title: "Assign ranges", style: { minWidth: '50px' }, children: "\u03A3" })] })), preferences.showKind && _jsx("th", { children: "Kind" }), showActions && _jsx("th", { children: '' })] }) }), _jsx("tbody", { children: data?.map((range) => {
|
|
67
|
+
return (_jsxs("table", { css: tableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [preferences.showSerialNumber && _jsx("th", { children: "#" }), preferences.from.show && (_jsxs("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && (_jsxs("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show && (_jsxs("th", { id: "from", ...onSort, children: ["\u03B4 (ppm) ", isSortedDesc('from').content] })), preferences.deltaHz.show && _jsx("th", { children: "\u03B4 (Hz) " }), preferences.relative.show && (_jsxs("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })), preferences.absolute.show && _jsx("th", { children: "Absolute" }), preferences.showMultiplicity && _jsx("th", { children: "Mult." }), preferences.coupling.show && _jsx("th", { children: "J (Hz)" }), preferences.showAssignmentLabel && (_jsx("th", { title: "Assignment", children: "Assignment" })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { title: "Assign multiplets", children: _jsx(FaLink, { style: { fontSize: 10, margin: 'auto' } }) }), _jsx("th", { title: "Assign ranges", style: { minWidth: '50px' }, children: "\u03A3" })] })), preferences.showKind && _jsx("th", { children: "Kind" }), showActions && _jsx("th", { children: '' })] }) }), _jsx("tbody", { children: data?.map((range) => {
|
|
68
68
|
return (_jsx(RangesTableRow, { rowData: range, onUnlink: onUnlink, preferences: preferences, info: info, contextMenu: contextMenu, onContextMenuSelect: onContextMenuSelect }, range.rowKey));
|
|
69
69
|
}) })] }));
|
|
70
70
|
}
|
|
@@ -10,6 +10,7 @@ import { HighlightEventSource, useHighlight, useHighlightData, } from '../../hig
|
|
|
10
10
|
import AbsoluteColumn from './TableColumns/AbsoluteColumn';
|
|
11
11
|
import ActionsColumn from './TableColumns/ActionsColumn';
|
|
12
12
|
import CouplingColumn from './TableColumns/CouplingColumn';
|
|
13
|
+
import { RangeAssignmentColumn } from './TableColumns/RangeAssignmentColumn';
|
|
13
14
|
import RangeAssignmentsColumn from './TableColumns/RangeAssignmentsColumn';
|
|
14
15
|
import RangeColumn from './TableColumns/RangeColumn';
|
|
15
16
|
import RelativeColumn from './TableColumns/RelativeColumn';
|
|
@@ -105,6 +106,6 @@ function RangesTableRow({ rowData, onUnlink, onContextMenuSelect, contextMenu =
|
|
|
105
106
|
}, [assignmentRange.isActive, highlightRange.isActive, rowData]);
|
|
106
107
|
return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
|
|
107
108
|
? 'm'
|
|
108
|
-
: lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumn, { row: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { row: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData })] })), _jsx(ActionsColumn, { row: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind, showDeleteAction: preferences.showDeleteAction, showEditAction: preferences.showEditAction, showZoomAction: preferences.showZoomAction })] }));
|
|
109
|
+
: lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.showAssignmentLabel && (_jsx(RangeAssignmentColumn, { row: rowData, onHover: onHoverSignal, rowSpanTags: rowSpanTags })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumn, { row: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { row: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData })] })), _jsx(ActionsColumn, { row: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind, showDeleteAction: preferences.showDeleteAction, showEditAction: preferences.showEditAction, showZoomAction: preferences.showZoomAction })] }));
|
|
109
110
|
}
|
|
110
111
|
export default RangesTableRow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OnHoverEvent, RowSpanTags } from '../RangesTableRow';
|
|
2
|
+
import { RangeData } from '../hooks/useMapRanges';
|
|
3
|
+
type RangeAssignmentColumnProps = OnHoverEvent & RowSpanTags & {
|
|
4
|
+
row: RangeData;
|
|
5
|
+
};
|
|
6
|
+
export declare function RangeAssignmentColumn({ row, onHover, rowSpanTags, }: RangeAssignmentColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDispatch } from '../../../context/DispatchContext';
|
|
3
|
+
import EditableColumn from '../../../elements/EditableColumn';
|
|
4
|
+
export function RangeAssignmentColumn({ row, onHover, rowSpanTags, }) {
|
|
5
|
+
const dispatch = useDispatch();
|
|
6
|
+
function saveHandler(event) {
|
|
7
|
+
dispatch({
|
|
8
|
+
type: 'CHANGE_RANGE_ASSIGNMENT_LABEL',
|
|
9
|
+
payload: {
|
|
10
|
+
value: event.target.value,
|
|
11
|
+
rangeID: row.id,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return (_jsx("td", { ...rowSpanTags, ...onHover, children: _jsx(EditableColumn, { value: row?.assignment || '', onSave: saveHandler, style: { padding: '0.1rem 0.4rem' } }) }));
|
|
16
|
+
}
|
|
@@ -15,6 +15,12 @@ import PreferencesHeader from '../header/PreferencesHeader';
|
|
|
15
15
|
import SpectrumSimulationPreferences from './SpectrumSimulationPreferences';
|
|
16
16
|
import SpectrumSimulationSimpleOptions from './SpectrumSimulationSimpleOptions';
|
|
17
17
|
import { SpinSystemTable } from './SpinSystemTable';
|
|
18
|
+
const optionsSchema = Yup.object({
|
|
19
|
+
lineWidth: Yup.number().min(0.1).required(),
|
|
20
|
+
});
|
|
21
|
+
const optionsValidationSchema = Yup.object({
|
|
22
|
+
options: optionsSchema,
|
|
23
|
+
});
|
|
18
24
|
const validationSchema = Yup.object({
|
|
19
25
|
data: Yup.array().of(Yup.array().of(Yup.lazy((value) => {
|
|
20
26
|
if (value === null) {
|
|
@@ -22,6 +28,7 @@ const validationSchema = Yup.object({
|
|
|
22
28
|
}
|
|
23
29
|
return Yup.number().required();
|
|
24
30
|
}))),
|
|
31
|
+
options: optionsSchema,
|
|
25
32
|
});
|
|
26
33
|
export default function SpectrumSimulation() {
|
|
27
34
|
const dispatch = useDispatch();
|
|
@@ -79,7 +86,7 @@ export default function SpectrumSimulation() {
|
|
|
79
86
|
}
|
|
80
87
|
return (_jsx(Formik, { initialValues: { ...defaultSimulationOptions, data }, enableReinitialize: true,
|
|
81
88
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
82
|
-
onSubmit: () => { }, innerRef: formRef, children: ({ values }) => (_jsxs(_Fragment, { children: [_jsxs("div", { css: [
|
|
89
|
+
onSubmit: () => { }, innerRef: formRef, validationSchema: optionsValidationSchema, children: ({ values }) => (_jsxs(_Fragment, { children: [_jsxs("div", { css: [
|
|
83
90
|
tablePanelStyle,
|
|
84
91
|
isFlipped &&
|
|
85
92
|
css `
|
|
@@ -25,5 +25,5 @@ export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, sp
|
|
|
25
25
|
width: '40px',
|
|
26
26
|
textAlign: 'center',
|
|
27
27
|
},
|
|
28
|
-
} }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
|
|
28
|
+
}, step: 0.1, min: 0.1 }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
|
|
29
29
|
}
|
|
@@ -47,7 +47,7 @@ export function SpinSystemTable(props) {
|
|
|
47
47
|
}
|
|
48
48
|
return _jsx("div", {});
|
|
49
49
|
},
|
|
50
|
-
Header: () => (_jsxs("span", { children: ["J", _jsxs("sub", { children: [label, "-"] }), "(Hz)"] })),
|
|
50
|
+
Header: () => (_jsxs("span", { children: ["J", _jsxs("sub", { children: [label, "-X"] }), "(Hz)"] })),
|
|
51
51
|
});
|
|
52
52
|
i++;
|
|
53
53
|
}
|
|
@@ -368,6 +368,8 @@ function innerSpectrumReducer(draft, action) {
|
|
|
368
368
|
return RangesActions.handleChangePeaksDisplayingMode(draft);
|
|
369
369
|
case 'DELETE_RANGE_PEAK':
|
|
370
370
|
return RangesActions.handleDeleteRangePeak(draft, action);
|
|
371
|
+
case 'CHANGE_RANGE_ASSIGNMENT_LABEL':
|
|
372
|
+
return RangesActions.handleChangeRangeAssignmentLabel(draft, action);
|
|
371
373
|
case 'SET_KEY_PREFERENCES':
|
|
372
374
|
return PreferencesActions.handleSetKeyPreferences(draft, action);
|
|
373
375
|
case 'APPLY_KEY_PREFERENCES':
|