nmrium 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +3 -1
- package/lib/component/1d/LinesSeries.js +1 -1
- package/lib/component/1d/SimilarityTree.d.ts +1 -0
- package/lib/component/1d/SimilarityTree.js +60 -0
- package/lib/component/1d/SpectraLegends.js +1 -1
- package/lib/component/1d/Viewer1D.js +142 -124
- package/lib/component/1d/jCouplingGraph/JsCoupling.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -7
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +114 -125
- package/lib/component/1d/multiplicityTree/MultiplicityTrees.d.ts +1 -0
- package/lib/component/1d/multiplicityTree/MultiplicityTrees.js +23 -0
- package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +18 -0
- package/lib/component/1d/multiplicityTree/generateTreeNodes.js +66 -0
- package/lib/component/1d/ranges/Atoms.d.ts +7 -0
- package/lib/component/1d/ranges/Atoms.js +43 -0
- package/lib/component/1d/ranges/Range.d.ts +1 -1
- package/lib/component/1d/ranges/Range.js +10 -9
- package/lib/component/1d/tool/BaseLine.d.ts +2 -0
- package/lib/component/1d/tool/BaseLine.js +26 -0
- package/lib/component/1d/tool/BaseLineZones.js +18 -3
- package/lib/component/2d/Chart2D.js +6 -4
- package/lib/component/2d/Viewer2D.js +35 -26
- package/lib/component/context/KeyModifierContext.d.ts +13 -2
- package/lib/component/context/KeyModifierContext.js +35 -4
- package/lib/component/context/LoggerContext.d.ts +9 -0
- package/lib/component/context/LoggerContext.js +21 -7
- package/lib/component/context/PreferencesContext.d.ts +1 -108
- package/lib/component/context/TopicMoleculeContext.d.ts +8 -0
- package/lib/component/context/TopicMoleculeContext.js +30 -0
- package/lib/component/elements/CloseButton.d.ts +2 -10
- package/lib/component/elements/CloseButton.js +3 -20
- package/lib/component/elements/CounterLabel.js +0 -1
- package/lib/component/elements/DeleteButton.d.ts +5 -7
- package/lib/component/elements/DeleteButton.js +7 -5
- package/lib/component/elements/FilterButton.d.ts +6 -0
- package/lib/component/elements/FilterButton.js +8 -0
- package/lib/component/elements/Input.js +4 -1
- package/lib/component/elements/PreferencesButton.d.ts +2 -4
- package/lib/component/elements/PreferencesButton.js +5 -3
- package/lib/component/elements/ReactTable/ReactTable.js +5 -2
- package/lib/component/elements/ResizerWithScale.js +19 -2
- package/lib/component/elements/SVGGroup.js +2 -2
- package/lib/component/elements/SaveButton.d.ts +2 -11
- package/lib/component/elements/SaveButton.js +4 -19
- package/lib/component/elements/ToolBarButton.d.ts +9 -0
- package/lib/component/elements/ToolBarButton.js +14 -0
- package/lib/component/elements/formik/FormikTextarea.js +8 -9
- package/lib/component/elements/linearAxis/LinearVerticalAxis.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
- package/lib/component/elements/resizer/SVGResizer.js +1 -1
- package/lib/component/header/BaseLineCorrectionPanel.js +3 -2
- package/lib/component/header/Header.js +2 -2
- package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
- package/lib/component/hooks/useSaveSettings.js +3 -2
- package/lib/component/hooks/useToolsFunctions.js +4 -2
- package/lib/component/main/InnerNMRium.js +2 -1
- package/lib/component/main/InnerNMRiumContents.js +1 -1
- package/lib/component/modal/AboutPredictionModal.js +4 -8
- package/lib/component/modal/AboutSpectrumSimulationModal.js +4 -8
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +2 -2
- package/lib/component/modal/ExportAsJcampModal.d.ts +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +8 -4
- package/lib/component/modal/ImportPublicationStringModal.d.ts +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +80 -32
- package/lib/component/modal/LoadJCAMPModal.js +12 -9
- package/lib/component/modal/LogsHistoryModal.d.ts +1 -1
- package/lib/component/modal/LogsHistoryModal.js +9 -4
- package/lib/component/modal/MoleculeStructureEditorModal.js +10 -3
- package/lib/component/modal/MultipletAnalysisModal.js +8 -8
- package/lib/component/modal/PredictSpectraModal.js +6 -5
- package/lib/component/modal/SaveAsModal.js +2 -2
- package/lib/component/modal/aboutUs/AboutUsModal.js +11 -26
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +4 -3
- package/lib/component/modal/changeSum/ChangeSumModal.js +10 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +1 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +9 -6
- package/lib/component/modal/editRange/EditRangeModal.js +8 -6
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +13 -10
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -0
- package/lib/component/modal/editZone/EditZoneModal.js +3 -3
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +17 -38
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +9 -11
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +2 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -23
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +7 -8
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +8 -6
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +3 -6
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +8 -31
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +2 -2
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +39 -5
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +42 -11
- package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +4 -2
- package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +19 -16
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +2 -26
- package/lib/component/panels/databasePanel/DatabasePanel.js +6 -6
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +4 -6
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +12 -13
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -4
- package/lib/component/panels/header/PanelHeader.js +0 -1
- package/lib/component/panels/header/PreferencesHeader.d.ts +2 -4
- package/lib/component/panels/header/PreferencesHeader.js +9 -23
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -9
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +3 -3
- package/lib/component/reducer/Reducer.js +5 -0
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +5 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -4
- package/lib/component/reducer/actions/FiltersActions.js +92 -55
- package/lib/component/reducer/actions/LoadActions.js +10 -8
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +3 -3
- package/lib/component/reducer/actions/ToolsActions.d.ts +8 -5
- package/lib/component/reducer/actions/ToolsActions.js +51 -44
- package/lib/component/toolbar/BasicToolBar.js +11 -29
- package/lib/component/utility/export.js +3 -0
- package/lib/component/workspaces/exercise.js +1 -0
- package/lib/component/workspaces/prediction.js +1 -16
- package/lib/component/workspaces/simulation.js +1 -2
- package/lib/component/workspaces/workspaceDefaultProperties.js +4 -3
- package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/index.js +0 -1
- package/lib/utils/clipboard/clipboardComponents.d.ts +2 -2
- package/lib/utils/clipboard/clipboardComponents.js +8 -3
- package/lib/versionInfo.js +1 -1
- package/package.json +25 -23
- package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
- package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
- package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
- package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
- package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +0 -2
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.js +0 -6
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { memo } from 'react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
2
|
import { FaCheck } from 'react-icons/fa';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
border: none;
|
|
10
|
-
height: 100%;
|
|
11
|
-
|
|
12
|
-
svg {
|
|
13
|
-
fill: green;
|
|
14
|
-
font-size: 16px;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
function SaveButton(props) {
|
|
18
|
-
const { className = '', disabled = false, popupPlacement = 'left', popupTitle = 'Save', onClick, } = props;
|
|
19
|
-
return (_jsx("div", { className: className, children: _jsx(ToolTip, { title: popupTitle, popupPlacement: popupPlacement, children: _jsx("button", { css: styles, type: "button", onClick: onClick, disabled: disabled, className: className, children: _jsx(FaCheck, {}) }) }) }));
|
|
3
|
+
import { ToolBarButton } from './ToolBarButton';
|
|
4
|
+
export function SaveButton(props) {
|
|
5
|
+
return (_jsx(ToolBarButton, { id: "save-button", ...props, intent: "success", icon: _jsx(FaCheck, {}), placement: "bottom-start" }));
|
|
20
6
|
}
|
|
21
|
-
export default memo(SaveButton);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonProps, Placement } from '@blueprintjs/core';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
import { ToolbarItemProps } from 'react-science/ui';
|
|
4
|
+
export interface ToolBarButtonProps extends Omit<ToolbarItemProps, 'onClick' | 'title'>, Pick<ButtonProps, 'onClick' | 'title'> {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
export declare function ToolBarButton(props: ToolBarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from 'react-science/ui';
|
|
3
|
+
export function ToolBarButton(props) {
|
|
4
|
+
const { intent, title = '', placement = 'bottom', style = {}, ...other } = props;
|
|
5
|
+
return (_jsx(Button, { ...other, intent: intent, minimal: true, tooltipProps: {
|
|
6
|
+
content: title,
|
|
7
|
+
placement,
|
|
8
|
+
intent,
|
|
9
|
+
compact: true,
|
|
10
|
+
}, style: {
|
|
11
|
+
fontSize: '1.25em',
|
|
12
|
+
...style,
|
|
13
|
+
} }));
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useFormikContext } from 'formik';
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
|
-
import { useCallback, useEffect
|
|
4
|
+
import { useCallback, useEffect } from 'react';
|
|
5
5
|
function FormikTextarea(props) {
|
|
6
6
|
const { name, style = {}, onChange = () => null, className = '', value, placeholder = '', ...resProps } = props;
|
|
7
7
|
const { values, handleChange, setFieldValue, errors } = useFormikContext();
|
|
@@ -14,16 +14,15 @@ function FormikTextarea(props) {
|
|
|
14
14
|
void setFieldValue(name, value);
|
|
15
15
|
}
|
|
16
16
|
}, [name, setFieldValue, value]);
|
|
17
|
-
const isInvalid =
|
|
18
|
-
return lodashGet(errors, name);
|
|
19
|
-
}, [errors, name]);
|
|
17
|
+
const isInvalid = lodashGet(errors, name);
|
|
20
18
|
return (_jsx("textarea", { name, className, placeholder, value: value || lodashGet(values, name), onChange: changeHandler, style: {
|
|
21
19
|
...style,
|
|
22
|
-
...(isInvalid
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
...(isInvalid
|
|
21
|
+
? {
|
|
22
|
+
borderColor: 'red',
|
|
23
|
+
borderWidth: '1px',
|
|
24
|
+
}
|
|
25
|
+
: {}),
|
|
27
26
|
}, ...resProps }));
|
|
28
27
|
}
|
|
29
28
|
export default FormikTextarea;
|
|
@@ -5,7 +5,7 @@ const VerticalAxis = forwardRef((props, ref) => {
|
|
|
5
5
|
const { x, y, height, width, showGrid, ticks } = props;
|
|
6
6
|
return (_jsxs("g", { ref: ref, transform: `translate(${x}, ${y})`, children: [_jsx("line", { y2: height, x1: 15, x2: 15, stroke: "black" }), ticks.map(({ label, position }, index) => (
|
|
7
7
|
// eslint-disable-next-line react/no-array-index-key
|
|
8
|
-
_jsxs("g", { children: [showGrid && width && (_jsx("line", { y1: position, y2: position, x1: 15, x2: width - x, stroke: "lightgray" })), _jsx("line", { y1: position, y2: position, x1: 15, x2: 10, stroke: "black" }), _jsx("text", { y: position, dominantBaseline: "middle", textAnchor: "end", children: label })] }, index + label + position)))] }));
|
|
8
|
+
_jsxs("g", { children: [showGrid && width && (_jsx("line", { y1: position, y2: position, x1: 15, x2: width - x, stroke: "lightgray" })), _jsx("line", { y1: position, y2: position, x1: 15, x2: 10, stroke: "black" }), _jsx("text", { y: position, dominantBaseline: "middle", textAnchor: "end", fill: "black", children: label })] }, index + label + position)))] }));
|
|
9
9
|
});
|
|
10
10
|
export function LinearVerticalAxis(props) {
|
|
11
11
|
const { scale, ...other } = props;
|
|
@@ -15,6 +15,7 @@ interface ConfirmationDialogProps {
|
|
|
15
15
|
className: string;
|
|
16
16
|
}) => ReactNode;
|
|
17
17
|
id?: string;
|
|
18
|
+
disableDefaultStyle?: boolean;
|
|
18
19
|
}
|
|
19
|
-
declare function ConfirmationDialog({ style, buttons, onClose, message, render, id, }: ConfirmationDialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function ConfirmationDialog({ style, buttons, onClose, message, render, id, disableDefaultStyle, }: ConfirmationDialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
21
|
export default ConfirmationDialog;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { DialogBody } from '@blueprintjs/core';
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { useCallback } from 'react';
|
|
5
6
|
const styles = css `
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
width: 30vw;
|
|
10
|
-
min-width: 350px;
|
|
11
|
-
border-top: 10px solid #ed0000;
|
|
7
|
+
background-color: white;
|
|
8
|
+
padding: 0;
|
|
12
9
|
|
|
13
10
|
.message {
|
|
14
11
|
font-weight: bold;
|
|
@@ -53,13 +50,19 @@ const styles = css `
|
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
`;
|
|
56
|
-
|
|
53
|
+
const defaultStyle = {
|
|
54
|
+
display: 'block',
|
|
55
|
+
borderRadius: '5px',
|
|
56
|
+
minWidth: '400px',
|
|
57
|
+
borderTop: '10px solid #ed0000',
|
|
58
|
+
};
|
|
59
|
+
function ConfirmationDialog({ style = {}, buttons = [], onClose, message, render, id, disableDefaultStyle = false, }) {
|
|
57
60
|
const optionsHandler = useCallback((e, { handler = () => null, preventClose = false }) => {
|
|
58
61
|
handler(e);
|
|
59
62
|
if (!preventClose) {
|
|
60
63
|
onClose();
|
|
61
64
|
}
|
|
62
65
|
}, [onClose]);
|
|
63
|
-
return (_jsxs("div", { style:
|
|
66
|
+
return (_jsx(DialogBody, { css: styles, children: _jsxs("div", { style: { ...(!disableDefaultStyle && defaultStyle), ...style }, "data-testid": id, children: [render ? (render({ message, className: 'message' })) : (_jsx("p", { className: "message", children: message })), _jsx("div", { className: "buttons-container", children: buttons.map((option) => (_jsx("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }) }));
|
|
64
67
|
}
|
|
65
68
|
export default ConfirmationDialog;
|
|
@@ -35,5 +35,5 @@ export default function SVGResizer(props) {
|
|
|
35
35
|
return (_jsxs("g", { transform: `translate(${position.x1} 0)`, children: [typeof children === 'function' ? children(position, isActive) : children, !disabled && (_jsxs(_Fragment, { children: [' ', _jsx(SVGResizerHandle, { onPointerDown: left.onPointerDown, position: 0 }), _jsx(SVGResizerHandle, { onPointerDown: right.onPointerDown, position: Math.ceil(position.x2 - position.x1) })] }))] }));
|
|
36
36
|
}
|
|
37
37
|
function SVGResizerHandle(props) {
|
|
38
|
-
return (_jsxs("g", { onPointerDown: props.onPointerDown, css: styles.container,
|
|
38
|
+
return (_jsxs("g", { onPointerDown: props.onPointerDown, css: styles.container, transform: `translate(${props.position})`, "data-no-export": "true", children: [_jsx("rect", { x: "-5px", style: style.innerContainer }), _jsx("rect", { x: "-2.5px", style: style.anchor })] }));
|
|
39
39
|
}
|
|
@@ -24,6 +24,7 @@ const inputStyle = {
|
|
|
24
24
|
inputWrapper: { height: '100%' },
|
|
25
25
|
};
|
|
26
26
|
const formData = (algorithm, filterValues) => {
|
|
27
|
+
const { zones, algorithm: baseAlgorithm, ...other } = filterValues;
|
|
27
28
|
switch (algorithm) {
|
|
28
29
|
case 'airpls': {
|
|
29
30
|
const validation = Yup.object().shape({
|
|
@@ -37,7 +38,7 @@ const formData = (algorithm, filterValues) => {
|
|
|
37
38
|
livePreview: true,
|
|
38
39
|
maxIterations: 100,
|
|
39
40
|
tolerance: 0.001,
|
|
40
|
-
...(
|
|
41
|
+
...(baseAlgorithm === 'airpls' ? other : {}),
|
|
41
42
|
},
|
|
42
43
|
};
|
|
43
44
|
}
|
|
@@ -52,7 +53,7 @@ const formData = (algorithm, filterValues) => {
|
|
|
52
53
|
algorithm,
|
|
53
54
|
livePreview: true,
|
|
54
55
|
degree: 3,
|
|
55
|
-
...(
|
|
56
|
+
...(baseAlgorithm === 'polynomial' ? other : {}),
|
|
56
57
|
},
|
|
57
58
|
};
|
|
58
59
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useMemo, useCallback, memo } from 'react';
|
|
5
|
-
import { FaRegWindowMaximize, FaQuestionCircle, FaRegSave, } from 'react-icons/fa';
|
|
5
|
+
import { FaRegWindowMaximize, FaQuestionCircle, FaRegSave, FaFilm, } from 'react-icons/fa';
|
|
6
6
|
import { Toolbar } from 'react-science/ui';
|
|
7
7
|
import { docsBaseUrl } from '../../constants';
|
|
8
8
|
import { useChartData } from '../context/ChartContext';
|
|
@@ -104,7 +104,7 @@ function HeaderInner(props) {
|
|
|
104
104
|
alignItems: 'center',
|
|
105
105
|
}, children: [_jsx("div", { children: _jsx(Toolbar, { children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
|
|
106
106
|
alignItems: 'center',
|
|
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, {}) }))] }) })] })] }) }));
|
|
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, {}) })), _jsx(Toolbar.Item, { id: "user-manual", title: "NMRium channel", onClick: () => window.open('https://www.youtube.com/@nmrium', '_blank'), icon: _jsx(FaFilm, {}) }), !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, {}) }))] }) })] })] }) }));
|
|
108
108
|
}
|
|
109
109
|
function SaveButton() {
|
|
110
110
|
const { workspace, workspaces, originalWorkspaces } = usePreferences();
|
|
@@ -19,7 +19,7 @@ export function useCheckToolsVisibility() {
|
|
|
19
19
|
(checkSpectrumType && checkSpectrum(spectrum, spectraOptions));
|
|
20
20
|
const isToolActivated = (flag && !isExperimental) ||
|
|
21
21
|
(isExperimental && isExperimentalFeatureActivated);
|
|
22
|
-
return (isToolActivated &&
|
|
22
|
+
return !!(isToolActivated &&
|
|
23
23
|
modeFlag &&
|
|
24
24
|
spectrumCheckFlag &&
|
|
25
25
|
(!extraInfoCheckParameters ||
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog } from '@blueprintjs/core';
|
|
2
3
|
import { Formik } from 'formik';
|
|
3
4
|
import { useRef, forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
+
import { useOnOff } from 'react-science/ui';
|
|
5
6
|
import * as Yup from 'yup';
|
|
6
7
|
import { usePreferences } from '../context/PreferencesContext';
|
|
7
8
|
import FormikInput from '../elements/formik/FormikInput';
|
|
@@ -68,7 +69,7 @@ export function useSaveSettings() {
|
|
|
68
69
|
id: 'save-workspace-dialog',
|
|
69
70
|
onClose: closeDialog,
|
|
70
71
|
};
|
|
71
|
-
return (_jsx(
|
|
72
|
+
return (_jsx(Dialog, { onClose: closeDialog, isOpen: isOpenDialog, title: "Save workspace", children: _jsx(ConfirmationDialog, { disableDefaultStyle: true, ...alertConfig }) }));
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
75
|
}
|
|
@@ -3,6 +3,7 @@ import lodashMap from 'lodash/map';
|
|
|
3
3
|
import { useCallback, useRef, useState } from 'react';
|
|
4
4
|
import { useToggleAccordion } from 'react-science/ui';
|
|
5
5
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
6
7
|
import { useAlert } from '../elements/popup/Alert';
|
|
7
8
|
import { TOOLS_PANELS_ACCORDION } from '../panels/Panels';
|
|
8
9
|
import { options } from '../toolbar/ToolTypes';
|
|
@@ -12,6 +13,7 @@ export default function useToolsFunctions() {
|
|
|
12
13
|
const { open: openPanel } = useToggleAccordion();
|
|
13
14
|
const [isRealSpectrumShown, setIsRealSpectrumShown] = useState(false);
|
|
14
15
|
const debounceClickEventsRef = useRef({ clicks: [] });
|
|
16
|
+
const { current: { general: { invert }, }, } = usePreferences();
|
|
15
17
|
const handleChangeOption = useCallback((selectedTool) => {
|
|
16
18
|
if ([
|
|
17
19
|
options.peakPicking.id,
|
|
@@ -20,7 +22,7 @@ export default function useToolsFunctions() {
|
|
|
20
22
|
options.exclusionZones.id,
|
|
21
23
|
options.rangePicking.id,
|
|
22
24
|
].includes(selectedTool)) {
|
|
23
|
-
alert.show(
|
|
25
|
+
alert.show(`Press ${!invert ? 'Shift +' : ''} Left Mouse button to select zone`);
|
|
24
26
|
}
|
|
25
27
|
if (Object.keys(TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
|
|
26
28
|
openPanel(TOOLS_PANELS_ACCORDION[selectedTool]);
|
|
@@ -29,7 +31,7 @@ export default function useToolsFunctions() {
|
|
|
29
31
|
type: 'SET_SELECTED_TOOL',
|
|
30
32
|
payload: { selectedTool: selectedTool || options.zoom.id },
|
|
31
33
|
});
|
|
32
|
-
}, [alert, dispatch, openPanel]);
|
|
34
|
+
}, [alert, dispatch, invert, openPanel]);
|
|
33
35
|
const handleFullZoomOut = useCallback(() => {
|
|
34
36
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
35
37
|
dispatch({
|
|
@@ -7,6 +7,7 @@ import { GlobalProvider } from '../context/GlobalContext';
|
|
|
7
7
|
import { KeyModifiersProvider } from '../context/KeyModifierContext';
|
|
8
8
|
import { LoggerProvider } from '../context/LoggerContext';
|
|
9
9
|
import { PreferencesProvider } from '../context/PreferencesContext';
|
|
10
|
+
import { TopicMoleculeProvider } from '../context/TopicMoleculeContext';
|
|
10
11
|
import { AlertProvider } from '../elements/popup/Alert';
|
|
11
12
|
import { ModalProvider } from '../elements/popup/Modal';
|
|
12
13
|
import { HighlightProvider } from '../highlight';
|
|
@@ -48,5 +49,5 @@ export function InnerNMRium({ data: nmriumData, workspace, customWorkspaces, pre
|
|
|
48
49
|
rootRef: rootRef.current,
|
|
49
50
|
elementsWrapperRef: elementsWrapperRef.current,
|
|
50
51
|
viewerRef: viewerRef.current,
|
|
51
|
-
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { isFullscreenEnabled: isFullscreenEnabled, toggleFullscreen: toggleFullscreen, emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }));
|
|
52
|
+
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx(LoggerProvider, { children: _jsx(KeyModifiersProvider, { children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(NMRiumStateProvider, { onChange: onChange, nmriumData: nmriumData, children: _jsx(TopicMoleculeProvider, { children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx(InnerNMRiumContents, { isFullscreenEnabled: isFullscreenEnabled, toggleFullscreen: toggleFullscreen, emptyText: emptyText, mainDivRef: mainDivRef, elementsWrapperRef: elementsWrapperRef, rootRef: rootRef, viewerRef: viewerRef }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
52
53
|
}
|
|
@@ -79,7 +79,7 @@ export function InnerNMRiumContents(props) {
|
|
|
79
79
|
}, children: [_jsx(FloatMoleculeStructures, {}), displayerMode === '1D' ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
|
|
80
80
|
position: 'absolute',
|
|
81
81
|
pointerEvents: 'none',
|
|
82
|
-
zIndex:
|
|
82
|
+
zIndex: 10,
|
|
83
83
|
left: 0,
|
|
84
84
|
right: 0,
|
|
85
85
|
top: 0,
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Dialog, DialogBody } from '@blueprintjs/core';
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { FaInfo } from 'react-icons/fa';
|
|
5
|
-
import {
|
|
6
|
-
import Button from '../elements/Button';
|
|
6
|
+
import { Toolbar, useOnOff } from 'react-science/ui';
|
|
7
7
|
const styles = css `
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.content {
|
|
11
|
-
padding: 2em;
|
|
12
|
-
}
|
|
8
|
+
background-color: white;
|
|
13
9
|
|
|
14
10
|
ul {
|
|
15
11
|
list-style-type: disc;
|
|
@@ -44,6 +40,6 @@ const styles = css `
|
|
|
44
40
|
`;
|
|
45
41
|
function AboutPredictionModal() {
|
|
46
42
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
47
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(FaInfo, {}), onClick: openDialog, title: "About Prediction" }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About Prediction", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }));
|
|
48
44
|
}
|
|
49
45
|
export default AboutPredictionModal;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Dialog, DialogBody } from '@blueprintjs/core';
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { FaInfo } from 'react-icons/fa';
|
|
5
|
-
import {
|
|
6
|
-
import Button from '../elements/Button';
|
|
6
|
+
import { Toolbar, useOnOff } from 'react-science/ui';
|
|
7
7
|
const styles = css `
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.content {
|
|
11
|
-
padding: 2em;
|
|
12
|
-
}
|
|
8
|
+
background-color: white;
|
|
13
9
|
|
|
14
10
|
ul {
|
|
15
11
|
list-style-type: disc;
|
|
@@ -44,6 +40,6 @@ const styles = css `
|
|
|
44
40
|
`;
|
|
45
41
|
function AboutSpectrumSimulationModal() {
|
|
46
42
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
47
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, title: "About Prediction", icon: _jsx(FaInfo, {}) }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About spectrum simulation", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }));
|
|
48
44
|
}
|
|
49
45
|
export default AboutSpectrumSimulationModal;
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { FaCopy } from 'react-icons/fa';
|
|
5
|
-
import CloseButton from '../elements/CloseButton';
|
|
5
|
+
import { CloseButton } from '../elements/CloseButton';
|
|
6
6
|
const styles = css `
|
|
7
7
|
overflow: auto;
|
|
8
8
|
width: 400px;
|
|
@@ -6,7 +6,7 @@ import { useCallback, useRef, useState } from 'react';
|
|
|
6
6
|
import * as Yup from 'yup';
|
|
7
7
|
import { useDispatch } from '../context/DispatchContext';
|
|
8
8
|
import ActionButtons from '../elements/ActionButtons';
|
|
9
|
-
import CloseButton from '../elements/CloseButton';
|
|
9
|
+
import { CloseButton } from '../elements/CloseButton';
|
|
10
10
|
import Label from '../elements/Label';
|
|
11
11
|
import Select from '../elements/Select';
|
|
12
12
|
import FormikInput from '../elements/formik/FormikInput';
|
|
@@ -79,6 +79,6 @@ function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
|
|
|
79
79
|
}, [dispatch, onClose, peak.id]);
|
|
80
80
|
const values = getValues(peak, kind);
|
|
81
81
|
const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
|
|
82
|
-
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
|
|
82
|
+
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
|
|
83
83
|
}
|
|
84
84
|
export default EditPeakShapeModal;
|
|
@@ -3,5 +3,5 @@ interface ExportAsJCAMPProps {
|
|
|
3
3
|
closeDialog: () => void;
|
|
4
4
|
spectrum: Spectrum;
|
|
5
5
|
}
|
|
6
|
-
declare function ExportAsJcampModal(props: ExportAsJCAMPProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function ExportAsJcampModal(props: ExportAsJCAMPProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default ExportAsJcampModal;
|
|
@@ -1,7 +1,9 @@
|
|
|
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 { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
2
5
|
import { Formik } from 'formik';
|
|
3
6
|
import { useRef } from 'react';
|
|
4
|
-
import { Modal } from 'react-science/ui';
|
|
5
7
|
import { DataExportStage, exportAsJcamp, } from '../../data/SpectraManager';
|
|
6
8
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
9
|
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
@@ -42,7 +44,7 @@ function ExportAsJcampModal(props) {
|
|
|
42
44
|
const alert = useAlert();
|
|
43
45
|
function submitHandler(options) {
|
|
44
46
|
void (async () => {
|
|
45
|
-
const hideLoading = await alert.showLoading('export as JCAMP in progress');
|
|
47
|
+
const hideLoading = await alert.showLoading('export as JCAMP-DX in progress');
|
|
46
48
|
try {
|
|
47
49
|
exportAsJcamp(spectrum, options);
|
|
48
50
|
}
|
|
@@ -55,7 +57,9 @@ function ExportAsJcampModal(props) {
|
|
|
55
57
|
}
|
|
56
58
|
})();
|
|
57
59
|
}
|
|
58
|
-
return (_jsxs(
|
|
60
|
+
return (_jsxs(Dialog, { isOpen: true, onClose: closeDialog, title: "Export as JCAMP", children: [_jsx(DialogBody, { css: css `
|
|
61
|
+
background-color: white;
|
|
62
|
+
`, children: _jsx(Formik, { innerRef: refForm, initialValues: initValues, onSubmit: submitHandler, children: _jsxs("div", { style: styles.container, children: [_jsxs("div", { style: styles.row, children: [_jsx("span", { style: styles.label, children: " Data " }), _jsx("div", { style: styles.innerContainer, children: _jsx(FormikSelect, { name: "dataExportStage", items: DATA_STAGES, style: { width: '100%' } }) })] }), _jsxs("div", { style: styles.row, children: [_jsx("span", { style: styles.label, children: " Only real " }), _jsx("div", { style: styles.innerContainer, children: _jsx(FormikCheckBox, { name: "onlyReal" }) })] })] }) }) }), _jsx(DialogFooter, { children: _jsx("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "export", onCancel: () => {
|
|
59
63
|
closeDialog?.();
|
|
60
64
|
} }) }) })] }));
|
|
61
65
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface ImportPublicationStringModalProps {
|
|
2
2
|
onClose: () => void;
|
|
3
|
+
isOpen: boolean;
|
|
3
4
|
}
|
|
4
|
-
declare function ImportPublicationStringModal(
|
|
5
|
+
declare function ImportPublicationStringModal(props: ImportPublicationStringModalProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
5
6
|
export default ImportPublicationStringModal;
|
|
@@ -1,56 +1,104 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
3
|
+
import { FifoLogger } from 'fifo-logger';
|
|
4
4
|
import { Formik } from 'formik';
|
|
5
|
-
import
|
|
5
|
+
import debounce from 'lodash/debounce';
|
|
6
|
+
import { resurrect } from 'nmr-processing';
|
|
7
|
+
import { useMemo, useRef, useState } from 'react';
|
|
6
8
|
import * as yup from 'yup';
|
|
7
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
8
10
|
import Button from '../elements/Button';
|
|
9
|
-
import
|
|
11
|
+
import { GroupPane } from '../elements/GroupPane';
|
|
12
|
+
import ReactTable from '../elements/ReactTable/ReactTable';
|
|
10
13
|
import FormikTextarea from '../elements/formik/FormikTextarea';
|
|
11
14
|
import { useAlert } from '../elements/popup/Alert';
|
|
12
|
-
import { ModalStyles } from './ModalStyle';
|
|
13
|
-
const styles = css `
|
|
14
|
-
width: 600px;
|
|
15
|
-
height: 300px;
|
|
16
|
-
|
|
17
|
-
.inner-content {
|
|
18
|
-
flex: 1;
|
|
19
|
-
border: none;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
padding: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.text-area {
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
outline: none;
|
|
28
|
-
resize: none;
|
|
29
|
-
padding: 0 0 0 15px;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
15
|
const validationSchema = yup.object({
|
|
33
16
|
publicationText: yup.string().required(),
|
|
34
17
|
});
|
|
35
|
-
function
|
|
18
|
+
function handleRowStyle(data) {
|
|
19
|
+
const level = (data?.original).level;
|
|
20
|
+
let backgroundColor = 'lightgreen';
|
|
21
|
+
if (level > 40) {
|
|
22
|
+
backgroundColor = 'pink';
|
|
23
|
+
}
|
|
24
|
+
else if (level === 40) {
|
|
25
|
+
backgroundColor = 'lightyellow';
|
|
26
|
+
}
|
|
27
|
+
return { base: { backgroundColor } };
|
|
28
|
+
}
|
|
29
|
+
const INITIAL_VALUES = {
|
|
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
|
+
};
|
|
32
|
+
function ImportPublicationStringModal(props) {
|
|
33
|
+
const { onClose, isOpen } = props;
|
|
36
34
|
const formRef = useRef();
|
|
37
35
|
const dispatch = useDispatch();
|
|
38
36
|
const alert = useAlert();
|
|
39
|
-
const
|
|
37
|
+
const [logs, setLogs] = useState([]);
|
|
38
|
+
const loggerRef = useRef(new FifoLogger({
|
|
39
|
+
onChange: (log, logs) => {
|
|
40
|
+
setLogs(logs.slice());
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
const COLUMNS = useMemo(() => [
|
|
44
|
+
{
|
|
45
|
+
Header: '#',
|
|
46
|
+
accessor: (_, index) => index + 1,
|
|
47
|
+
style: { width: '40px' },
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
Header: 'Label',
|
|
51
|
+
accessor: 'levelLabel',
|
|
52
|
+
style: { width: '60px' },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
Header: 'Message',
|
|
56
|
+
accessor: 'message',
|
|
57
|
+
},
|
|
58
|
+
], []);
|
|
59
|
+
const debounceChanges = useMemo(() => debounce((value) => {
|
|
60
|
+
resurrect(value, { logger: loggerRef.current });
|
|
61
|
+
}, 250), []);
|
|
62
|
+
if (!isOpen)
|
|
63
|
+
return;
|
|
64
|
+
function publicationStringHandler({ publicationText }) {
|
|
40
65
|
void (async () => {
|
|
41
66
|
const hideLoading = await alert.showLoading('Generate spectrum from publication string in progress');
|
|
67
|
+
const { ranges, info: { nucleus, solvent = '', frequency }, parts, } = resurrect(publicationText, { logger: loggerRef.current });
|
|
42
68
|
setTimeout(() => {
|
|
43
69
|
dispatch({
|
|
44
70
|
type: 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING',
|
|
45
|
-
payload:
|
|
71
|
+
payload: {
|
|
72
|
+
ranges,
|
|
73
|
+
info: { nucleus, solvent, frequency, name: parts[0] },
|
|
74
|
+
},
|
|
46
75
|
});
|
|
47
76
|
hideLoading();
|
|
48
77
|
});
|
|
49
78
|
onClose();
|
|
50
79
|
})();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
80
|
+
}
|
|
81
|
+
function handleOnChange(event) {
|
|
82
|
+
loggerRef.current.clear();
|
|
83
|
+
const value = event.target.value;
|
|
84
|
+
if (value) {
|
|
85
|
+
debounceChanges(value);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const isNotValid = logs.some((log) => ['error', 'fatal'].includes(log.levelLabel));
|
|
89
|
+
return (_jsx(Dialog, { title: "Generate spectrum from publication string", isOpen: true, onClose: onClose, style: { width: 800, height: 500 }, children: _jsx(Formik, { innerRef: formRef, initialValues: INITIAL_VALUES, validationSchema: validationSchema, onSubmit: publicationStringHandler, children: ({ isValid }) => (_jsxs(_Fragment, { children: [_jsx(DialogBody, { children: _jsxs("div", { style: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column',
|
|
92
|
+
height: '100%',
|
|
93
|
+
}, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', flex: 1 }, children: [_jsxs("p", { children: ["Paste a publication string in the text area below and click on the button ", _jsx("i", { children: "Generate spectrum" })] }), _jsx(FormikTextarea, { style: {
|
|
94
|
+
width: '100%',
|
|
95
|
+
flex: 1,
|
|
96
|
+
outline: 'none',
|
|
97
|
+
borderWidth: '1px',
|
|
98
|
+
borderColor: '#dedede',
|
|
99
|
+
borderRadius: '5px',
|
|
100
|
+
resize: 'none',
|
|
101
|
+
padding: '15px',
|
|
102
|
+
}, 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" }) }) })] })) }) }));
|
|
55
103
|
}
|
|
56
104
|
export default ImportPublicationStringModal;
|