nmrium 0.45.1-pre.1701344673 → 0.46.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/tool/PeakPointer.js +6 -16
- package/lib/component/1d/utilities/scale.js +13 -8
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +15 -4
- package/lib/component/elements/ContextMenuBluePrint.d.ts +16 -0
- package/lib/component/elements/ContextMenuBluePrint.js +20 -0
- package/lib/component/elements/DropdownMenu.d.ts +9 -0
- package/lib/component/elements/DropdownMenu.js +7 -0
- package/lib/component/elements/Header.d.ts +1 -1
- package/lib/component/elements/Header.js +4 -6
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
- package/lib/component/elements/ReactTable/ReactTable.d.ts +5 -5
- package/lib/component/header/Header.js +3 -4
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -1
- package/lib/component/hooks/useToolsFunctions.js +2 -2
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +0 -8
- package/lib/component/modal/MoleculeStructureEditorModal.js +31 -8
- package/lib/component/modal/PredictSpectraModal.js +3 -2
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -5
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +4 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +3 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -14
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -2
- package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
- package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +12 -17
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +1 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +6 -2
- package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -1
- package/lib/component/reducer/actions/MoleculeActions.js +6 -2
- package/lib/component/reducer/actions/PeaksActions.js +4 -3
- package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.d.ts +3 -0
- package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.js +24 -0
- package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -1
- package/lib/component/toolbar/BasicToolBar.js +53 -34
- package/lib/component/toolbar/FunctionToolBar.js +102 -9
- package/lib/component/toolbar/ToolBar.js +1 -1
- package/lib/component/utility/getClosePeak.d.ts +10 -0
- package/lib/component/utility/getClosePeak.js +15 -0
- package/lib/component/utility/maxAbsoluteValue.d.ts +3 -0
- package/lib/component/utility/maxAbsoluteValue.js +21 -0
- package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/index.js +0 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +2 -2
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/parseMeta/mapErrors.js +3 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +39 -38
- package/lib/component/elements/ToolbarMenu.d.ts +0 -18
- package/lib/component/elements/ToolbarMenu.js +0 -102
- package/lib/component/elements/toggle/ToggleButton.d.ts +0 -13
- package/lib/component/elements/toggle/ToggleButton.js +0 -24
- package/lib/component/elements/toggle/ToggleButtonGroup.d.ts +0 -8
- package/lib/component/elements/toggle/ToggleButtonGroup.js +0 -48
- package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.d.ts +0 -17
- package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +0 -18
- package/lib/data/data2d/Processing2D.d.ts +0 -32
- package/lib/data/data2d/Processing2D.js +0 -130
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import max from 'ml-array-max';
|
|
3
|
-
import { get1DDataXY } from '../../../data/data1d/Spectrum1D/get1DDataXY';
|
|
4
2
|
import { useBrushTracker } from '../../EventsTrackers/BrushTracker';
|
|
5
3
|
import { useMouseTracker } from '../../EventsTrackers/MouseTracker';
|
|
6
4
|
import { useChartData } from '../../context/ChartContext';
|
|
@@ -8,6 +6,7 @@ import { useScaleChecked } from '../../context/ScaleContext';
|
|
|
8
6
|
import { useActiveSpectrum } from '../../hooks/useActiveSpectrum';
|
|
9
7
|
import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus';
|
|
10
8
|
import { options } from '../../toolbar/ToolTypes';
|
|
9
|
+
import { getClosePeak } from '../../utility/getClosePeak';
|
|
11
10
|
const styles = {
|
|
12
11
|
radius: 10,
|
|
13
12
|
borderColor: '#1f1f1f',
|
|
@@ -16,18 +15,6 @@ const styles = {
|
|
|
16
15
|
SVGPadding: 1,
|
|
17
16
|
};
|
|
18
17
|
const LookWidth = 10;
|
|
19
|
-
function getClosePeak(spectrum, range) {
|
|
20
|
-
const datum = get1DDataXY(spectrum);
|
|
21
|
-
const maxIndex = datum.x.findIndex((number) => number >= range[1]) - 1;
|
|
22
|
-
const minIndex = datum.x.findIndex((number) => number >= range[0]);
|
|
23
|
-
const yDataRange = datum.y.slice(minIndex, maxIndex);
|
|
24
|
-
if (!yDataRange || yDataRange.length === 0)
|
|
25
|
-
return null;
|
|
26
|
-
const y = max(yDataRange);
|
|
27
|
-
const xIndex = minIndex + yDataRange.indexOf(y);
|
|
28
|
-
const x = datum.x[xIndex];
|
|
29
|
-
return { x, y };
|
|
30
|
-
}
|
|
31
18
|
function PeakPointer() {
|
|
32
19
|
const { height, width, margin, toolOptions: { selectedTool }, } = useChartData();
|
|
33
20
|
const { scaleX, scaleY, shiftY } = useScaleChecked();
|
|
@@ -48,13 +35,16 @@ function PeakPointer() {
|
|
|
48
35
|
const spectrumIndex = spectra.findIndex((d) => d.id === activeSpectrum.id);
|
|
49
36
|
if (spectrumIndex === -1)
|
|
50
37
|
return null;
|
|
51
|
-
const
|
|
38
|
+
const [from, to] = [
|
|
52
39
|
scaleX().invert(position.x - LookWidth),
|
|
53
40
|
scaleX().invert(position.x + LookWidth),
|
|
54
41
|
].sort((a, b) => {
|
|
55
42
|
return a - b;
|
|
56
43
|
});
|
|
57
|
-
const closePeak = getClosePeak(spectra[spectrumIndex],
|
|
44
|
+
const closePeak = getClosePeak(spectra[spectrumIndex], {
|
|
45
|
+
from,
|
|
46
|
+
to,
|
|
47
|
+
});
|
|
58
48
|
if (!closePeak)
|
|
59
49
|
return null;
|
|
60
50
|
const x = scaleX()(closePeak.x);
|
|
@@ -11,17 +11,22 @@ function getXScale(options, spectrumId = null) {
|
|
|
11
11
|
}
|
|
12
12
|
function getYScale(options, spectrumId = null) {
|
|
13
13
|
const { height, margin, verticalAlign, yDomain, yDomains } = options;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
let domainY = yDomain;
|
|
15
|
+
if (spectrumId && yDomains?.[spectrumId]) {
|
|
16
|
+
domainY = yDomains[spectrumId];
|
|
17
|
+
}
|
|
18
|
+
const [min, max] = domainY;
|
|
19
|
+
let bottomShift = 40;
|
|
20
|
+
if (verticalAlign === 'center') {
|
|
21
|
+
bottomShift = 0;
|
|
22
|
+
const maxim = Math.max(Math.abs(max), Math.abs(min));
|
|
23
|
+
domainY = [-maxim, maxim];
|
|
20
24
|
}
|
|
21
25
|
else {
|
|
22
|
-
domainY = [0,
|
|
26
|
+
domainY = [0, domainY[1]];
|
|
23
27
|
}
|
|
24
|
-
|
|
28
|
+
const innerHeight = height - margin.bottom - bottomShift;
|
|
29
|
+
return scaleLinear(domainY, [innerHeight, margin.top]);
|
|
25
30
|
}
|
|
26
31
|
function getIntegralYScale(options) {
|
|
27
32
|
const { height, margin, yDomain, scaleRatio } = options;
|
|
@@ -20,6 +20,20 @@ const styles = {
|
|
|
20
20
|
height: '2px',
|
|
21
21
|
},
|
|
22
22
|
};
|
|
23
|
+
function getInfoValue(spectrum, field) {
|
|
24
|
+
const { jpath, format } = field;
|
|
25
|
+
const value = lodashGet(spectrum, jpath, '');
|
|
26
|
+
switch (typeof value) {
|
|
27
|
+
case 'number':
|
|
28
|
+
return formatNumber(value, format);
|
|
29
|
+
case 'string':
|
|
30
|
+
return value;
|
|
31
|
+
case 'boolean':
|
|
32
|
+
return value ? 'Yes' : 'No';
|
|
33
|
+
default:
|
|
34
|
+
return JSON.stringify(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
23
37
|
function SpectrumInfoBlock() {
|
|
24
38
|
const { margin } = useChartData();
|
|
25
39
|
const spectrum = useSpectrum();
|
|
@@ -29,10 +43,7 @@ function SpectrumInfoBlock() {
|
|
|
29
43
|
return (_jsx("g", { className: "spectra-info-block", transform: `translate(${margin.left + 5} ${margin.top})`, children: fields
|
|
30
44
|
.filter((field) => field.visible)
|
|
31
45
|
.map((field, index) => {
|
|
32
|
-
|
|
33
|
-
return (_jsxs(SVGGroup, { transform: `translate(0,${20 * (index + 1)})`, space: 5, children: [_jsxs("text", { alignmentBaseline: "middle", style: styles.label, children: [field.label, " :"] }), _jsx("text", { alignmentBaseline: "middle", style: styles.value, children: field?.format && typeof value === 'number'
|
|
34
|
-
? formatNumber(value, field.format)
|
|
35
|
-
: value })] }, field.jpath + field.label));
|
|
46
|
+
return (_jsxs(SVGGroup, { transform: `translate(0,${20 * (index + 1)})`, space: 5, children: [_jsxs("text", { alignmentBaseline: "middle", style: styles.label, children: [field.label, " :"] }), _jsx("text", { alignmentBaseline: "middle", style: styles.value, children: getInfoValue(spectrum, field) })] }, field.jpath + field.label));
|
|
36
47
|
}) }));
|
|
37
48
|
}
|
|
38
49
|
export default SpectrumInfoBlock;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ContextMenuProps as BluePrintContextMenuProps, MenuItemProps } from '@blueprintjs/core';
|
|
2
|
+
import { ComponentProps, ElementType, ReactNode } from 'react';
|
|
3
|
+
export interface ContextMenuItem extends MenuItemProps {
|
|
4
|
+
data?: object;
|
|
5
|
+
}
|
|
6
|
+
type ElementProps<E = 'div'> = E extends ElementType ? ComponentProps<E> : never;
|
|
7
|
+
export interface BaseContextMenuProps {
|
|
8
|
+
options: ContextMenuItem[];
|
|
9
|
+
onSelect: (data?: object) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface ContextMenuProps<E> extends BaseContextMenuProps, Omit<BluePrintContextMenuProps, 'onSelect' | 'content' | 'children'> {
|
|
12
|
+
as?: E;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function ContextMenu<E extends ElementType = 'div'>(props: ContextMenuProps<E> & ElementProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Menu, MenuItem, showContextMenu, } from '@blueprintjs/core';
|
|
3
|
+
export function ContextMenu(props) {
|
|
4
|
+
const { options, onSelect, children, as: Wrapper = 'div', ...other } = props;
|
|
5
|
+
function handleContextMenu(event) {
|
|
6
|
+
if (!Array.isArray(options) || options.length === 0) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const content = (_jsx(Menu, { children: options.map((option) => (_jsx(MenuItem, { ...option, onClick: () => onSelect(option?.data) }, JSON.stringify(option)))) }));
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
showContextMenu({
|
|
12
|
+
content,
|
|
13
|
+
targetOffset: {
|
|
14
|
+
left: event.clientX,
|
|
15
|
+
top: event.clientY,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return (_jsx(Wrapper, { ...other, onContextMenu: handleContextMenu, children: children }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MenuItemProps, PopoverProps } from '@blueprintjs/core';
|
|
2
|
+
export interface DropdownMenuItem extends MenuItemProps {
|
|
3
|
+
data?: object;
|
|
4
|
+
}
|
|
5
|
+
export interface DropdownMenuProps extends Omit<PopoverProps, 'onSelect' | 'content'> {
|
|
6
|
+
options: DropdownMenuItem[];
|
|
7
|
+
onSelect: (data?: object) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function DropdownMenu(props: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Menu, MenuItem, Popover, } from '@blueprintjs/core';
|
|
3
|
+
export function DropdownMenu(props) {
|
|
4
|
+
const { options, onSelect, children, ...other } = props;
|
|
5
|
+
const content = (_jsx(Menu, { children: options.map((option) => (_jsx(MenuItem, { ...option, onClick: () => onSelect(option?.data) }, JSON.stringify(option)))) }));
|
|
6
|
+
return (_jsx(Popover, { ...other, content: content, children: children }));
|
|
7
|
+
}
|
|
@@ -7,5 +7,5 @@ interface HeaderProps {
|
|
|
7
7
|
containerStyle?: CSSProperties;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
export declare function Header(props: HeaderProps): import("
|
|
10
|
+
export declare function Header(props: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
2
|
const styles = {
|
|
5
|
-
header:
|
|
3
|
+
header: {
|
|
6
4
|
width: '100%',
|
|
7
5
|
display: 'flex',
|
|
8
6
|
flexDirection: 'row',
|
|
9
7
|
justifyContent: 'space-between',
|
|
10
8
|
borderBottom: '1px solid rgb(247, 247, 247);',
|
|
11
9
|
boxShadow: 'rgb(255, 255, 255) 0px 1px 0px 0px inset',
|
|
12
|
-
}
|
|
10
|
+
},
|
|
13
11
|
};
|
|
14
12
|
export function Header(props) {
|
|
15
13
|
const { children, style: { leftStyle = {}, rightStyle = {}, containerStyle = {} } = {}, } = props;
|
|
16
|
-
return (_jsxs("div", {
|
|
14
|
+
return (_jsxs("div", { style: { ...styles.header, ...containerStyle }, children: [_jsx("div", { style: leftStyle, children: children[0] }), _jsx("div", { style: rightStyle, children: children[1] })] }));
|
|
17
15
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import { HighlightEventSource } from '../../../highlight/index';
|
|
3
|
-
import { BaseRowStyle,
|
|
3
|
+
import { BaseRowStyle, TableContextMenuProps } from '../ReactTable';
|
|
4
4
|
export interface ClickEvent {
|
|
5
5
|
onClick?: (event: Event, data: unknown) => void;
|
|
6
6
|
}
|
|
7
|
-
interface ReactTableRowProps extends ClickEvent,
|
|
7
|
+
interface ReactTableRowProps extends ClickEvent, TableContextMenuProps {
|
|
8
8
|
row: any;
|
|
9
9
|
highlightedSource?: HighlightEventSource;
|
|
10
10
|
isRowActive: boolean;
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useMemo, useEffect, useCallback } from 'react';
|
|
5
|
-
import { DropdownMenu } from 'react-science/ui';
|
|
6
5
|
import { HighlightEventSource, useHighlight } from '../../../highlight/index';
|
|
6
|
+
import { ContextMenu } from '../../ContextMenuBluePrint';
|
|
7
7
|
function getRowStyle(isActive, rowStyle = {}, disableDefaultRowStyle) {
|
|
8
8
|
const { hover = {}, active = {}, base = {}, activated = {} } = rowStyle;
|
|
9
9
|
const hoverStyle = disableDefaultRowStyle
|
|
@@ -51,7 +51,7 @@ function ReactTableRow(props) {
|
|
|
51
51
|
const clickHandler = useCallback((event) => {
|
|
52
52
|
onClick?.(event, row);
|
|
53
53
|
}, [onClick, row]);
|
|
54
|
-
return (_jsx(
|
|
54
|
+
return (_jsx(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, row.original), as: "tr", style: { position: 'static' }, css: getRowStyle(highlight.isActive || isRowActive, rowStyle, disableDefaultRowStyle), ...row.getRowProps(), ...highlight.onHover, children: row.cells.map((cell) => {
|
|
55
55
|
const { style, padding } = cell.column;
|
|
56
56
|
if (cell.isRowSpanned) {
|
|
57
57
|
return null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
3
3
|
import { CSSProperties } from 'react';
|
|
4
|
-
import { DropdownMenuProps } from 'react-science/ui';
|
|
5
4
|
import { CellProps, Column as ReactColumn, UseSortByColumnOptions } from 'react-table';
|
|
6
5
|
import { HighlightEventSource } from '../../highlight';
|
|
6
|
+
import { BaseContextMenuProps } from '../ContextMenuBluePrint';
|
|
7
7
|
import { ClickEvent } from './Elements/ReactTableRow';
|
|
8
8
|
interface ExtraColumn<T extends object> {
|
|
9
9
|
enableRowSpan?: boolean;
|
|
@@ -20,11 +20,11 @@ export interface BaseRowStyle {
|
|
|
20
20
|
hover?: CSSProperties;
|
|
21
21
|
base?: CSSProperties;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
24
|
-
onContextMenuSelect?: (selected: Parameters<
|
|
25
|
-
contextMenu?:
|
|
23
|
+
export interface TableContextMenuProps {
|
|
24
|
+
onContextMenuSelect?: (selected: Parameters<BaseContextMenuProps['onSelect']>[0], data: any) => void;
|
|
25
|
+
contextMenu?: BaseContextMenuProps['options'];
|
|
26
26
|
}
|
|
27
|
-
interface ReactTableProps extends
|
|
27
|
+
interface ReactTableProps extends TableContextMenuProps, ClickEvent, SortEvent {
|
|
28
28
|
data: any;
|
|
29
29
|
columns: any;
|
|
30
30
|
highlightedSource?: HighlightEventSource;
|
|
@@ -87,7 +87,6 @@ function HeaderInner(props) {
|
|
|
87
87
|
return _jsx(Zones2DOptionPanel, {});
|
|
88
88
|
default:
|
|
89
89
|
return null;
|
|
90
|
-
break;
|
|
91
90
|
}
|
|
92
91
|
}, [selectedOptionPanel]);
|
|
93
92
|
const changeWorkspaceHandler = useCallback((option) => {
|
|
@@ -101,11 +100,11 @@ function HeaderInner(props) {
|
|
|
101
100
|
function renderItem(item) {
|
|
102
101
|
return _jsx(WorkspaceItem, { item: item });
|
|
103
102
|
}
|
|
104
|
-
return (_jsx("div", { css: styles, children: _jsxs(Header, { style: { leftStyle: { flex: 1 } }, children: [_jsxs(HeaderContainer, { style: {
|
|
103
|
+
return (_jsx("div", { css: styles, children: _jsxs(Header, { style: { leftStyle: { flex: 1 }, containerStyle: { padding: '2px' } }, children: [_jsxs(HeaderContainer, { style: {
|
|
105
104
|
alignItems: 'center',
|
|
106
|
-
}, children: [_jsx("div", { children: _jsx(Toolbar, {
|
|
105
|
+
}, children: [_jsx("div", { children: _jsx(Toolbar, { children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
|
|
107
106
|
alignItems: 'center',
|
|
108
|
-
}, children: [!hideWorkspaces && (_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem })), !hideGeneralSettings && _jsx(SaveButton, {}), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, {
|
|
107
|
+
}, children: [!hideWorkspaces && (_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem })), !hideGeneralSettings && _jsx(SaveButton, {}), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { children: [!general?.hideHelp && (_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), icon: _jsx(FaQuestionCircle, {}) })), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !isFullscreenEnabled && !general?.hideMaximize && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onEnableFullscreen, title: "Full Screen", className: "windowButton", icon: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
|
|
109
108
|
}
|
|
110
109
|
function SaveButton() {
|
|
111
110
|
const { workspace, workspaces, originalWorkspaces } = usePreferences();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NMRiumToolBarPreferences } from 'nmr-load-save';
|
|
2
2
|
import { Info1D, Info2D } from 'nmr-processing';
|
|
3
3
|
type SpectrumInfo = Info1D | Info2D;
|
|
4
|
-
interface CheckOptions {
|
|
4
|
+
export interface CheckOptions {
|
|
5
5
|
checkSpectrumType?: boolean;
|
|
6
6
|
checkMode?: boolean;
|
|
7
7
|
extraInfoCheckParameters?: SpectrumInfo;
|
|
@@ -34,7 +34,7 @@ export default function useToolsFunctions() {
|
|
|
34
34
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
35
35
|
dispatch({
|
|
36
36
|
type: 'FULL_ZOOM_OUT',
|
|
37
|
-
payload: { zoomType: '
|
|
37
|
+
payload: { zoomType: 'HORIZONTAL' },
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
const callback = lodashDebounce(() => {
|
|
@@ -47,7 +47,7 @@ export default function useToolsFunctions() {
|
|
|
47
47
|
debounceClickEventsRef.current.clicks = [];
|
|
48
48
|
dispatch({
|
|
49
49
|
type: 'FULL_ZOOM_OUT',
|
|
50
|
-
payload: {},
|
|
50
|
+
payload: { zoomType: 'FULL' },
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}, [dispatch, debounceClickEventsRef]);
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { StateMoleculeExtended } from '../../data/molecules/Molecule';
|
|
2
|
-
interface MoleculeStructureEditorModalProps {
|
|
3
|
-
onClose?: (element?: string) => void;
|
|
4
|
-
selectedMolecule?: StateMoleculeExtended;
|
|
5
|
-
floatMoleculeOnSave?: boolean;
|
|
6
|
-
isOpen?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare function MoleculeStructureEditorModal(props: MoleculeStructureEditorModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
2
|
export declare function useMoleculeEditor(floatMoleculeOnSave?: boolean): {
|
|
10
3
|
modal: import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
4
|
openMoleculeEditor: (molecule?: StateMoleculeExtended) => void;
|
|
12
5
|
};
|
|
13
|
-
export default MoleculeStructureEditorModal;
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import {
|
|
3
|
+
import { Molecule } from 'openchemlib/full';
|
|
4
|
+
import { TopicMolecule } from 'openchemlib-utils';
|
|
5
|
+
import { useState, useEffect, useCallback, useMemo } from 'react';
|
|
4
6
|
import { StructureEditor } from 'react-ocl/full';
|
|
5
7
|
import { ConfirmModal, Modal, useOnOff } from 'react-science/ui';
|
|
6
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
7
9
|
function MoleculeStructureEditorModal(props) {
|
|
8
10
|
const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, isOpen = false, } = props;
|
|
11
|
+
const initialMolfile = selectedMolecule?.molfile;
|
|
12
|
+
const initialEnhancedMolfile = useMemo(() => {
|
|
13
|
+
if (!initialMolfile) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
// Add mapNo to molfile, so we can remap diaIDs after edition.
|
|
17
|
+
const molecule = Molecule.fromMolfile(initialMolfile);
|
|
18
|
+
const topicMolecule = new TopicMolecule(molecule);
|
|
19
|
+
topicMolecule.ensureMapNo();
|
|
20
|
+
const newMolfile = topicMolecule.toMolfile({ version: 3 });
|
|
21
|
+
return { molfile: newMolfile, topicMolecule };
|
|
22
|
+
}, [initialMolfile]);
|
|
9
23
|
const [molfile, setMolfile] = useState(null);
|
|
10
24
|
const dispatch = useDispatch();
|
|
11
25
|
useEffect(() => {
|
|
12
|
-
if (
|
|
13
|
-
setMolfile(
|
|
26
|
+
if (initialEnhancedMolfile) {
|
|
27
|
+
setMolfile(initialEnhancedMolfile.molfile);
|
|
14
28
|
}
|
|
15
29
|
else {
|
|
16
30
|
setMolfile(null);
|
|
17
31
|
}
|
|
18
|
-
}, [
|
|
32
|
+
}, [initialEnhancedMolfile]);
|
|
19
33
|
const cb = useCallback((newMolfile, molecule) => {
|
|
20
34
|
if (molecule.getAllAtoms() === 0) {
|
|
21
35
|
setMolfile(null);
|
|
@@ -29,14 +43,17 @@ function MoleculeStructureEditorModal(props) {
|
|
|
29
43
|
}, [onClose]);
|
|
30
44
|
const handleSave = useCallback(() => {
|
|
31
45
|
if (molfile) {
|
|
32
|
-
if (selectedMolecule) {
|
|
46
|
+
if (selectedMolecule && initialEnhancedMolfile) {
|
|
33
47
|
const { id, label } = selectedMolecule;
|
|
48
|
+
const editedMolecule = Molecule.fromMolfile(molfile);
|
|
49
|
+
const mappings = initialEnhancedMolfile.topicMolecule.getDiaIDsMapping(editedMolecule);
|
|
34
50
|
dispatch({
|
|
35
51
|
type: 'SET_MOLECULE',
|
|
36
52
|
payload: {
|
|
37
53
|
molfile,
|
|
38
54
|
id,
|
|
39
55
|
label,
|
|
56
|
+
mappings,
|
|
40
57
|
},
|
|
41
58
|
});
|
|
42
59
|
onClose('replace');
|
|
@@ -52,8 +69,15 @@ function MoleculeStructureEditorModal(props) {
|
|
|
52
69
|
onClose('new');
|
|
53
70
|
}
|
|
54
71
|
}
|
|
55
|
-
}, [
|
|
56
|
-
|
|
72
|
+
}, [
|
|
73
|
+
molfile,
|
|
74
|
+
selectedMolecule,
|
|
75
|
+
initialEnhancedMolfile,
|
|
76
|
+
dispatch,
|
|
77
|
+
floatMoleculeOnSave,
|
|
78
|
+
onClose,
|
|
79
|
+
]);
|
|
80
|
+
return (_jsx(ConfirmModal, { headerColor: "transparent", isOpen: isOpen, onRequestClose: handleClose, onCancel: handleClose, onConfirm: handleSave, maxWidth: 700, children: _jsx(Modal.Body, { children: _jsx(StructureEditor, { initialMolfile: initialEnhancedMolfile?.molfile, svgMenu: true, fragment: false, onChange: cb }) }) }));
|
|
57
81
|
}
|
|
58
82
|
export function useMoleculeEditor(floatMoleculeOnSave = false) {
|
|
59
83
|
const [isOpen, openModal, closeModal] = useOnOff(false);
|
|
@@ -65,4 +89,3 @@ export function useMoleculeEditor(floatMoleculeOnSave = false) {
|
|
|
65
89
|
}, [openModal]);
|
|
66
90
|
return { modal, openMoleculeEditor };
|
|
67
91
|
}
|
|
68
|
-
export default MoleculeStructureEditorModal;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Checkbox } from '@blueprintjs/core';
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { SvgNmrFt } from 'cheminfo-font';
|
|
5
6
|
import { useCallback, useRef, useState, useMemo } from 'react';
|
|
6
|
-
import {
|
|
7
|
+
import { Modal, useOnOff } from 'react-science/ui';
|
|
7
8
|
import { getDefaultPredictionOptions, predictSpectra, } from '../../data/PredictionManager';
|
|
8
9
|
import { useChartData } from '../context/ChartContext';
|
|
9
10
|
import { useDispatch } from '../context/DispatchContext';
|
|
@@ -106,6 +107,6 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
|
|
|
106
107
|
return (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { color: { base: '#4e4e4e', hover: '#4e4e4e' }, onClick: openDialog, toolTip: "Predict spectra", tooltipOrientation: "horizontal", children: _jsx(SvgNmrFt, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: () => {
|
|
107
108
|
onClose();
|
|
108
109
|
closeDialog();
|
|
109
|
-
}, width: 600, maxWidth: 1000, children: _jsxs("div", { css: [ModalStyles, styles], children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header handle", children: _jsx("span", { children: "Prediction of NMR spectrum" }) }) }), _jsxs("div", { className: "inner-content", children: [_jsx(PredictionPreferences, { onSubmit: submitHandler, options: initValues, ref: refForm }), _jsx("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), _jsx("div", { className: "warning-container", children: _jsx(Checkbox, { onChange: setApproved, checked: isApproved, label: "I confirm that the chemical structure is not confidential." }
|
|
110
|
+
}, width: 600, maxWidth: 1000, children: _jsxs("div", { css: [ModalStyles, styles], children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header handle", children: _jsx("span", { children: "Prediction of NMR spectrum" }) }) }), _jsxs("div", { className: "inner-content", children: [_jsx(PredictionPreferences, { onSubmit: submitHandler, options: initValues, ref: refForm }), _jsx("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), _jsx("div", { className: "warning-container", children: _jsx(Checkbox, { onChange: (value) => setApproved(value.target.checked), checked: isApproved, label: "I confirm that the chemical structure is not confidential." }) })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] }) })] }));
|
|
110
111
|
}
|
|
111
112
|
export default PredictSpectraModal;
|
|
@@ -89,11 +89,7 @@ const styles = css `
|
|
|
89
89
|
`;
|
|
90
90
|
function AboutUsModal() {
|
|
91
91
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
92
|
-
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { onClick: openDialog,
|
|
93
|
-
display: 'flex',
|
|
94
|
-
alignItems: 'center',
|
|
95
|
-
justifyContent: 'center',
|
|
96
|
-
}, children: _jsx(SvgLogoNmrium, {}) }) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: _jsx(AboutUsZakodium, {}) }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
|
|
92
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { onClick: openDialog, id: "logo", title: "About NMRium", icon: _jsx(SvgLogoNmrium, {}) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: _jsx(AboutUsZakodium, {}) }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
|
|
97
93
|
}
|
|
98
94
|
export default AboutUsModal;
|
|
99
95
|
function VersionInfo() {
|
|
@@ -51,6 +51,7 @@ function AddSignalFormTab({ onFocus, onBlur, range, preferences }, ref) {
|
|
|
51
51
|
return Yup.object().shape({
|
|
52
52
|
newSignalDelta: Yup.number()
|
|
53
53
|
.test(`test-range`, '', function testNewSignalDelta(value) {
|
|
54
|
+
// eslint-disable-next-line no-invalid-this
|
|
54
55
|
const { path, createError } = this;
|
|
55
56
|
if (value && value > range.from && value < range.to) {
|
|
56
57
|
return true;
|
|
@@ -7,8 +7,11 @@ const editRangeFormValidation = Yup.object().shape({
|
|
|
7
7
|
.of(Yup.object().shape({
|
|
8
8
|
multiplicity: Yup.string().required(),
|
|
9
9
|
coupling: Yup.mixed().test('checkValue', '', function testCoupling(value) {
|
|
10
|
+
// eslint-disable-next-line no-invalid-this
|
|
10
11
|
const { path, createError } = this;
|
|
11
|
-
const hasCoupling = hasCouplingConstant(
|
|
12
|
+
const hasCoupling = hasCouplingConstant(
|
|
13
|
+
// eslint-disable-next-line no-invalid-this
|
|
14
|
+
this.parent.multiplicity);
|
|
12
15
|
if ((!hasCoupling && !value) || (hasCoupling && value)) {
|
|
13
16
|
return true;
|
|
14
17
|
}
|
|
@@ -168,7 +168,7 @@ function MetaImportationModal({ onClose, file }) {
|
|
|
168
168
|
});
|
|
169
169
|
onClose?.();
|
|
170
170
|
}
|
|
171
|
-
return (_jsxs("div", { css: ModalStyles, style: { overflow: 'hidden' }, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import Meta Information" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { style: styles.container, children: _jsx("div", { style: { flex: 1, width: '100%' }, children: !parseResult ? (_jsx(DropZone, { fileValidator: fileValidator,
|
|
171
|
+
return (_jsxs("div", { css: ModalStyles, style: { overflow: 'hidden' }, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import Meta Information" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { style: styles.container, children: _jsx("div", { style: { flex: 1, width: '100%' }, children: !parseResult ? (_jsx(DropZone, { fileValidator: fileValidator, emptyDescription: "Drag and Drop CSV or tab-delimited file (.csv, .txt or .tsv)", onDrop: handleDrop })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { height: '130px' }, children: [_jsx(Formik, { innerRef: formRef, initialValues: {
|
|
172
172
|
source: null,
|
|
173
173
|
target: '',
|
|
174
174
|
}, onSubmit: handleLinkSpectra, validationSchema: validationSchema, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Source field", style: { label: { width: '100px' } }, children: _jsx(FormikSelect, { name: "source", items: mapColumnToSelectItems(parseResult?.meta.fields || []), style: {
|
|
@@ -221,7 +221,7 @@ function GeneralSettingsModal({ height }) {
|
|
|
221
221
|
function handlePastWorkspaceAction() {
|
|
222
222
|
void readText().then(handlePastWorkspace);
|
|
223
223
|
}
|
|
224
|
-
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings",
|
|
224
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", icon: _jsx(FaWrench, {}) }), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: [_jsx(Modal.Header, { children: _jsxs("div", { style: {
|
|
225
225
|
display: 'flex',
|
|
226
226
|
flexDirection: 'column',
|
|
227
227
|
}, children: [_jsx("span", { children: "General Settings" }), _jsxs("div", { style: {
|
|
@@ -61,7 +61,7 @@ function InfoBlockTabContent() {
|
|
|
61
61
|
Header: 'Field',
|
|
62
62
|
style: { padding: 0, ...styles.column },
|
|
63
63
|
Cell: ({ row }) => {
|
|
64
|
-
return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] ||
|
|
64
|
+
return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] || key, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
{
|
|
@@ -31,7 +31,9 @@ const formattingValidation = (obj) => object().shape({
|
|
|
31
31
|
const { value, fields } = nucleusFrequencies[key];
|
|
32
32
|
if (value > 1) {
|
|
33
33
|
for (const field of fields) {
|
|
34
|
-
errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name,
|
|
34
|
+
errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name,
|
|
35
|
+
// eslint-disable-next-line no-invalid-this
|
|
36
|
+
`${this.path}.${field}.name`));
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -3,7 +3,6 @@ import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { FaCog, FaCopy, FaDownload, FaFileExport, FaFileImage, FaPaste, FaPlus, FaRegTrashAlt, } from 'react-icons/fa';
|
|
5
5
|
import { IoOpenOutline } from 'react-icons/io5';
|
|
6
|
-
import { DropdownMenu } from 'react-science/ui';
|
|
7
6
|
import { getMolecules } from '../../../data/molecules/MoleculeManager';
|
|
8
7
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
9
8
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
@@ -12,6 +11,7 @@ import { useDispatch } from '../../context/DispatchContext';
|
|
|
12
11
|
import { useGlobal } from '../../context/GlobalContext';
|
|
13
12
|
import ActiveButton from '../../elements/ActiveButton';
|
|
14
13
|
import Button from '../../elements/Button';
|
|
14
|
+
import { DropdownMenu } from '../../elements/DropdownMenu';
|
|
15
15
|
import { useAlert } from '../../elements/popup/Alert';
|
|
16
16
|
import AboutPredictionModal from '../../modal/AboutPredictionModal';
|
|
17
17
|
import PredictSpectraModal from '../../modal/PredictSpectraModal';
|
|
@@ -34,38 +34,31 @@ const styles = {
|
|
|
34
34
|
lineHeight: 1,
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
-
const LabelWrapper = ({ children }) => {
|
|
38
|
-
return _jsx("p", { style: { padding: '0.4em' }, children: children });
|
|
39
|
-
};
|
|
40
37
|
const MOL_EXPORT_MENU = [
|
|
41
38
|
{
|
|
42
|
-
type: 'option',
|
|
43
39
|
icon: _jsx(FaCopy, {}),
|
|
44
|
-
|
|
40
|
+
text: 'Copy as molfile V3',
|
|
45
41
|
data: {
|
|
46
42
|
id: 'molfileV3',
|
|
47
43
|
},
|
|
48
44
|
},
|
|
49
45
|
{
|
|
50
|
-
type: 'option',
|
|
51
46
|
icon: _jsx(FaCopy, {}),
|
|
52
|
-
|
|
47
|
+
text: 'Copy as molfile V2',
|
|
53
48
|
data: {
|
|
54
49
|
id: 'molfileV2',
|
|
55
50
|
},
|
|
56
51
|
},
|
|
57
52
|
{
|
|
58
|
-
type: 'option',
|
|
59
53
|
icon: _jsx(FaFileImage, {}),
|
|
60
|
-
|
|
54
|
+
text: 'Copy as PNG',
|
|
61
55
|
data: {
|
|
62
56
|
id: 'png',
|
|
63
57
|
},
|
|
64
58
|
},
|
|
65
59
|
{
|
|
66
|
-
type: 'option',
|
|
67
60
|
icon: _jsx(FaDownload, {}),
|
|
68
|
-
|
|
61
|
+
text: 'Export as SVG',
|
|
69
62
|
data: {
|
|
70
63
|
id: 'svg',
|
|
71
64
|
},
|
|
@@ -97,7 +90,7 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
97
90
|
const exportHandler = useCallback((selected) => {
|
|
98
91
|
const molecule = molecules?.[currentIndex];
|
|
99
92
|
if (molecule) {
|
|
100
|
-
switch (selected?.
|
|
93
|
+
switch (selected?.id) {
|
|
101
94
|
case 'molfileV3':
|
|
102
95
|
saveAsMolHandler(molecule.molfile);
|
|
103
96
|
break;
|
|
@@ -160,5 +153,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
160
153
|
});
|
|
161
154
|
}
|
|
162
155
|
const hasMolecules = molecules && molecules.length > 0;
|
|
163
|
-
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, {
|
|
156
|
+
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
|
|
164
157
|
}
|