nmrium 0.43.0 → 0.43.1-pre.1692874523
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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
- package/lib/component/2d/Viewer2D.js +1 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -2
- package/lib/component/context/DispatchContext.d.ts +3 -1
- package/lib/component/elements/CounterLabel.d.ts +7 -0
- package/lib/component/elements/CounterLabel.js +12 -0
- package/lib/component/elements/EditableColumn.js +12 -6
- package/lib/component/elements/Input.d.ts +3 -12
- package/lib/component/elements/Input.js +24 -76
- package/lib/component/elements/Message.js +0 -1
- package/lib/component/elements/PreferencesButton.d.ts +4 -0
- package/lib/component/elements/PreferencesButton.js +6 -0
- package/lib/component/elements/formik/FormikInput.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.js +3 -6
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/ZeroFillingOptionsPanel.js +4 -4
- package/lib/component/main/InnerNMRiumContents.js +1 -2
- package/lib/component/modal/AlignSpectraModal.js +78 -29
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
- package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
- package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +5 -1
- package/lib/component/panels/InformationPanel.js +9 -100
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +10 -6
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
- package/lib/component/panels/Panels.js +6 -7
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
- package/lib/component/panels/header/DefaultPanelHeader.js +4 -10
- package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +2 -2
- package/lib/component/reducer/Reducer.js +4 -2
- package/lib/component/reducer/actions/DomainActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +3 -3
- package/lib/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib/component/reducer/actions/ToolsActions.js +10 -10
- package/lib/component/reducer/core/Constants.d.ts +0 -4
- package/lib/component/reducer/core/Constants.js +0 -5
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib/component/toolbar/ToolTypes.d.ts +2 -2
- package/lib/component/toolbar/ToolTypes.js +23 -24
- package/lib/data/constants/References.d.ts +5 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
- package/lib-cjs/component/2d/Viewer2D.js +1 -3
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +1 -2
- package/lib-cjs/component/elements/CounterLabel.js +16 -0
- package/lib-cjs/component/elements/EditableColumn.js +12 -6
- package/lib-cjs/component/elements/Input.js +23 -75
- package/lib-cjs/component/elements/Message.js +0 -1
- package/lib-cjs/component/elements/PreferencesButton.js +13 -0
- package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
- package/lib-cjs/component/header/Header.js +1 -1
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +4 -4
- package/lib-cjs/component/main/InnerNMRiumContents.js +1 -2
- package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
- package/lib-cjs/component/panels/InformationPanel.js +7 -98
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib-cjs/component/panels/Panels.js +6 -7
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -9
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +4 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
- package/lib-cjs/component/reducer/core/Constants.js +1 -6
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib-cjs/component/toolbar/ToolTypes.js +23 -24
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +3 -3
- /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
|
@@ -8,10 +8,6 @@ const debounce_1 = __importDefault(require("lodash/debounce"));
|
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const useCombinedRefs_1 = __importDefault(require("../hooks/useCombinedRefs"));
|
|
10
10
|
const styles = {
|
|
11
|
-
label: {
|
|
12
|
-
lineHeight: 2,
|
|
13
|
-
userSelect: 'none',
|
|
14
|
-
},
|
|
15
11
|
inputWrapper: {
|
|
16
12
|
borderRadius: '5px',
|
|
17
13
|
borderWidth: '0.55px',
|
|
@@ -26,7 +22,6 @@ const styles = {
|
|
|
26
22
|
outline: 'none',
|
|
27
23
|
flex: 1,
|
|
28
24
|
height: '100%',
|
|
29
|
-
textAlign: 'center',
|
|
30
25
|
width: '100%',
|
|
31
26
|
},
|
|
32
27
|
clearButton: {
|
|
@@ -39,103 +34,56 @@ const styles = {
|
|
|
39
34
|
padding: 0,
|
|
40
35
|
},
|
|
41
36
|
};
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
const pattern = /^(?:-?\d*|\d+)(?:\.\d{0,20})?$/;
|
|
45
|
-
if (value.trim() === '' || pattern.test(value)) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
function identity(value) {
|
|
53
|
-
return value;
|
|
54
|
-
}
|
|
55
|
-
function preventPropagate(event) {
|
|
56
|
-
event.stopPropagation();
|
|
37
|
+
function mapValue(value) {
|
|
38
|
+
return typeof value === 'number' && value === 0 ? value : value || '';
|
|
57
39
|
}
|
|
58
40
|
const Input = (0, react_1.forwardRef)((props, ref) => {
|
|
59
|
-
const { value =
|
|
41
|
+
const { value: externalValue = undefined, name, style = {
|
|
60
42
|
input: {},
|
|
61
43
|
inputWrapper: {},
|
|
62
|
-
}, onChange
|
|
63
|
-
const [
|
|
64
|
-
const
|
|
44
|
+
}, onChange, checkValue = () => true, type = 'text', autoSelect = false, className, renderIcon, canClear = false, onClear, datalist = [], debounceTime = 0, ...otherProps } = props;
|
|
45
|
+
const [internalValue, setInternalValue] = (0, react_1.useState)();
|
|
46
|
+
const value = debounceTime ? internalValue : externalValue;
|
|
65
47
|
const localRef = (0, react_1.useRef)();
|
|
66
48
|
const combinedRef = (0, useCombinedRefs_1.default)([ref, localRef]);
|
|
67
|
-
const debounceOnChange = (0, react_1.useMemo)(() => (0, debounce_1.default)((
|
|
68
|
-
onChange?.(
|
|
49
|
+
const debounceOnChange = (0, react_1.useMemo)(() => (0, debounce_1.default)((e) => {
|
|
50
|
+
onChange?.(e);
|
|
69
51
|
}, debounceTime), [debounceTime, onChange]);
|
|
70
52
|
(0, react_1.useEffect)(() => {
|
|
71
|
-
|
|
72
|
-
}, [value]);
|
|
73
|
-
(0, react_1.useEffect)(() => {
|
|
74
|
-
if (enableAutoSelect) {
|
|
53
|
+
if (autoSelect) {
|
|
75
54
|
combinedRef?.current?.select();
|
|
76
55
|
}
|
|
77
|
-
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
? null
|
|
84
|
-
: Number(value)
|
|
85
|
-
: nullable && !value
|
|
86
|
-
? null
|
|
87
|
-
: value;
|
|
88
|
-
return format()(val);
|
|
89
|
-
}
|
|
56
|
+
}, [autoSelect, combinedRef]);
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
if (debounceTime) {
|
|
59
|
+
setInternalValue(externalValue);
|
|
60
|
+
}
|
|
61
|
+
}, [debounceTime, externalValue]);
|
|
90
62
|
function onChangeHandler(e) {
|
|
91
63
|
e.stopPropagation();
|
|
92
64
|
e.preventDefault();
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
const formatValue = format();
|
|
96
|
-
setVal(formatValue(_value));
|
|
97
|
-
valueRef.current = _value;
|
|
98
|
-
const val = {
|
|
99
|
-
...e,
|
|
100
|
-
target: { name: e.target.name, value: getValue(_value) },
|
|
101
|
-
};
|
|
65
|
+
const val = e.target.value;
|
|
66
|
+
if (checkValue(val)) {
|
|
102
67
|
if (debounceTime) {
|
|
103
|
-
|
|
68
|
+
setInternalValue(val);
|
|
69
|
+
debounceOnChange(e);
|
|
104
70
|
}
|
|
105
71
|
else {
|
|
106
|
-
onChange?.(
|
|
72
|
+
onChange?.(e);
|
|
107
73
|
}
|
|
108
74
|
}
|
|
109
75
|
}
|
|
110
|
-
function handleKeyDown(event) {
|
|
111
|
-
onKeyDown({
|
|
112
|
-
...event,
|
|
113
|
-
target: {
|
|
114
|
-
name: event.target.name,
|
|
115
|
-
value: getValue(valueRef.current),
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function handleKeyUp(event) {
|
|
120
|
-
onKeyUp({
|
|
121
|
-
...event,
|
|
122
|
-
target: {
|
|
123
|
-
name: event.target.name,
|
|
124
|
-
value: getValue(valueRef.current),
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
76
|
function clearHandler() {
|
|
129
|
-
|
|
77
|
+
localRef.current?.setAttribute('value', '');
|
|
130
78
|
onClear?.();
|
|
131
79
|
}
|
|
132
80
|
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
133
|
-
...(renderIcon ||
|
|
81
|
+
...((renderIcon || canClear) && { padding: '0 5px' }),
|
|
134
82
|
...styles.inputWrapper,
|
|
135
83
|
...style?.inputWrapper,
|
|
136
84
|
}, className: `input ${className || ''}`, children: [renderIcon?.(), (0, jsx_runtime_1.jsx)("input", { ...otherProps, ref: combinedRef, name: name, style: {
|
|
137
85
|
...styles.input,
|
|
138
86
|
...style?.input,
|
|
139
|
-
}, type:
|
|
87
|
+
}, type: type, value: mapValue(value), onChange: onChangeHandler, list: `${name || ''}-data-list` }), canClear && value && ((0, jsx_runtime_1.jsx)("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: (0, jsx_runtime_1.jsx)("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), (0, jsx_runtime_1.jsx)("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => ((0, jsx_runtime_1.jsx)("option", { value: value }, value))) })] }));
|
|
140
88
|
});
|
|
141
89
|
exports.default = Input;
|
|
@@ -27,7 +27,6 @@ exports.messagesColorPalettes = {
|
|
|
27
27
|
function Message(props) {
|
|
28
28
|
const { style = {}, type, children } = props;
|
|
29
29
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
30
|
-
fontSize: '1rem',
|
|
31
30
|
padding: '0.375rem 0.75rem',
|
|
32
31
|
borderRadius: '0.25rem',
|
|
33
32
|
backgroundColor: exports.messagesColorPalettes[type].tint,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PreferencesButton = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const fa_1 = require("react-icons/fa");
|
|
9
|
+
const ToolTip_1 = __importDefault(require("./ToolTip/ToolTip"));
|
|
10
|
+
function PreferencesButton({ onClick }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(ToolTip_1.default, { title: "Preferences", popupPlacement: "left", children: (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClick, children: (0, jsx_runtime_1.jsx)(fa_1.FaCog, {}) }) }));
|
|
12
|
+
}
|
|
13
|
+
exports.PreferencesButton = PreferencesButton;
|
|
@@ -7,14 +7,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const formik_1 = require("formik");
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const Input_1 = __importDefault(require("../Input"));
|
|
10
|
-
function identity(value) {
|
|
11
|
-
return value;
|
|
12
|
-
}
|
|
13
10
|
function FormikInput(props) {
|
|
14
|
-
const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange
|
|
11
|
+
const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
|
|
15
12
|
const { values, handleChange, errors, touched, setFieldValue } = (0, formik_1.useFormikContext)();
|
|
16
13
|
function changeHandler(e) {
|
|
17
|
-
onChange(e);
|
|
14
|
+
onChange?.(e);
|
|
18
15
|
if (mapOnChangeValue) {
|
|
19
16
|
void setFieldValue(name, mapOnChangeValue(e.target.value));
|
|
20
17
|
}
|
|
@@ -41,6 +38,6 @@ function FormikInput(props) {
|
|
|
41
38
|
}
|
|
42
39
|
: {}),
|
|
43
40
|
},
|
|
44
|
-
},
|
|
41
|
+
}, className: className, ...resProps }));
|
|
45
42
|
}
|
|
46
43
|
exports.default = FormikInput;
|
|
@@ -17,8 +17,8 @@ const Button_1 = __importDefault(require("../elements/Button"));
|
|
|
17
17
|
const Header_1 = require("../elements/Header");
|
|
18
18
|
const DropDownButton_1 = __importDefault(require("../elements/dropDownButton/DropDownButton"));
|
|
19
19
|
const useSaveSettings_1 = require("../hooks/useSaveSettings");
|
|
20
|
-
const AboutUsModal_1 = __importDefault(require("../modal/AboutUsModal"));
|
|
21
20
|
const LogsHistoryModal_1 = require("../modal/LogsHistoryModal");
|
|
21
|
+
const AboutUsModal_1 = __importDefault(require("../modal/aboutUs/AboutUsModal"));
|
|
22
22
|
const GeneralSettings_1 = __importDefault(require("../modal/setting/GeneralSettings"));
|
|
23
23
|
const WorkspaceItem_1 = __importDefault(require("../modal/setting/WorkspaceItem"));
|
|
24
24
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
@@ -4,20 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const formik_1 = require("formik");
|
|
7
8
|
const nmr_processing_1 = require("nmr-processing");
|
|
8
9
|
const react_1 = require("react");
|
|
9
10
|
const generateNumbersPowerOfX_1 = __importDefault(require("../../data/utilities/generateNumbersPowerOfX"));
|
|
10
11
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
11
12
|
const ActionButtons_1 = __importDefault(require("../elements/ActionButtons"));
|
|
12
13
|
const Label_1 = __importDefault(require("../elements/Label"));
|
|
14
|
+
const FormikCheckBox_1 = __importDefault(require("../elements/formik/FormikCheckBox"));
|
|
15
|
+
const FormikOnChange_1 = __importDefault(require("../elements/formik/FormikOnChange"));
|
|
16
|
+
const FormikSelect_1 = __importDefault(require("../elements/formik/FormikSelect"));
|
|
13
17
|
const useFilter_1 = require("../hooks/useFilter");
|
|
14
18
|
const useSpectrum_1 = __importDefault(require("../hooks/useSpectrum"));
|
|
15
19
|
const Header_1 = require("./Header");
|
|
16
20
|
const HeaderContainer_1 = require("./HeaderContainer");
|
|
17
|
-
const formik_1 = require("formik");
|
|
18
|
-
const FormikSelect_1 = __importDefault(require("../elements/formik/FormikSelect"));
|
|
19
|
-
const FormikCheckBox_1 = __importDefault(require("../elements/formik/FormikCheckBox"));
|
|
20
|
-
const FormikOnChange_1 = __importDefault(require("../elements/formik/FormikOnChange"));
|
|
21
21
|
const Sizes = (0, generateNumbersPowerOfX_1.default)(8, 21);
|
|
22
22
|
function useInitZeroFillingSize() {
|
|
23
23
|
const filter = (0, useFilter_1.useFilter)(nmr_processing_1.Filters.zeroFilling.id);
|
|
@@ -17,7 +17,6 @@ const ChartContext_1 = require("../context/ChartContext");
|
|
|
17
17
|
const Header_1 = __importDefault(require("../header/Header"));
|
|
18
18
|
const DropZone_1 = __importDefault(require("../loader/DropZone"));
|
|
19
19
|
const Panels_1 = __importDefault(require("../panels/Panels"));
|
|
20
|
-
const Constants_1 = require("../reducer/core/Constants");
|
|
21
20
|
const ToolBar_1 = __importDefault(require("../toolbar/ToolBar"));
|
|
22
21
|
const SplitPaneWrapper_1 = require("./SplitPaneWrapper");
|
|
23
22
|
const StateError_1 = require("./StateError");
|
|
@@ -83,7 +82,7 @@ function InnerNMRiumContents(props) {
|
|
|
83
82
|
width: '100%',
|
|
84
83
|
height: '100%',
|
|
85
84
|
position: 'relative',
|
|
86
|
-
}, children: [(0, jsx_runtime_1.jsx)(FloatMoleculeStructures_1.default, {}), displayerMode ===
|
|
85
|
+
}, children: [(0, jsx_runtime_1.jsx)(FloatMoleculeStructures_1.default, {}), displayerMode === '1D' ? ((0, jsx_runtime_1.jsx)(Viewer1D_1.default, { emptyText: emptyText })) : ((0, jsx_runtime_1.jsx)(Viewer2D_1.default, { emptyText: emptyText }))] })] }), (0, jsx_runtime_1.jsx)(Panels_1.default, {})] }), (0, jsx_runtime_1.jsx)("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
|
|
87
86
|
position: 'absolute',
|
|
88
87
|
pointerEvents: 'none',
|
|
89
88
|
zIndex: 2,
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -16,6 +39,10 @@ const Select_1 = __importDefault(require("../elements/Select"));
|
|
|
16
39
|
const FormikInput_1 = __importDefault(require("../elements/formik/FormikInput"));
|
|
17
40
|
const Events_1 = __importDefault(require("../utility/Events"));
|
|
18
41
|
const ModalStyle_1 = require("./ModalStyle");
|
|
42
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
43
|
+
const useSpectraPerNucleus_1 = __importDefault(require("../hooks/useSpectraPerNucleus"));
|
|
44
|
+
const Yup = __importStar(require("yup"));
|
|
45
|
+
const Message_1 = __importDefault(require("../elements/Message"));
|
|
19
46
|
const labelStyle = {
|
|
20
47
|
label: { flex: 4, fontWeight: '500' },
|
|
21
48
|
wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
|
|
@@ -27,44 +54,89 @@ const inputStyle = {
|
|
|
27
54
|
},
|
|
28
55
|
};
|
|
29
56
|
const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
|
|
57
|
+
const DEFAULT_OPTIONS = {
|
|
58
|
+
from: -1,
|
|
59
|
+
to: 1,
|
|
60
|
+
nbPeaks: 1,
|
|
61
|
+
targetX: 0,
|
|
62
|
+
};
|
|
63
|
+
const schemaValidation = Yup.object({
|
|
64
|
+
from: Yup.number().required(),
|
|
65
|
+
to: Yup.number().required(),
|
|
66
|
+
nbPeaks: Yup.number().required(),
|
|
67
|
+
targetX: Yup.number().required(),
|
|
68
|
+
});
|
|
69
|
+
function checkSpectra(options, spectra) {
|
|
70
|
+
const { from, to } = options;
|
|
71
|
+
for (const spectrum of spectra) {
|
|
72
|
+
const { data: { x }, } = spectrum;
|
|
73
|
+
const min = x[0];
|
|
74
|
+
const max = x.at(-1);
|
|
75
|
+
if (from < min || to > max) {
|
|
76
|
+
throw new Error('Some spectra do not have data in the selected range');
|
|
77
|
+
}
|
|
78
|
+
if (Math.abs((0, ml_spectra_processing_1.xFindClosestIndex)(x, from) - (0, ml_spectra_processing_1.xFindClosestIndex)(x, to)) < 10) {
|
|
79
|
+
throw new Error('The selected range is too small to provide accurate results');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function checkOptions(options) {
|
|
84
|
+
const returnedOptions = { ...options };
|
|
85
|
+
if (options.from > options.to) {
|
|
86
|
+
returnedOptions.to = options.from;
|
|
87
|
+
returnedOptions.from = options.to;
|
|
88
|
+
}
|
|
89
|
+
return returnedOptions;
|
|
90
|
+
}
|
|
91
|
+
function getList(nucleus) {
|
|
92
|
+
if (!References_1.REFERENCES?.[nucleus]) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
const list = Object.entries(References_1.REFERENCES[nucleus]).map((item) => ({
|
|
96
|
+
value: item[0],
|
|
97
|
+
label: item[0],
|
|
98
|
+
}));
|
|
99
|
+
return baseList.concat(list);
|
|
100
|
+
}
|
|
30
101
|
function AlignSpectraModal({ onClose = () => null, nucleus, }) {
|
|
31
|
-
const
|
|
102
|
+
const spectra = (0, useSpectraPerNucleus_1.default)();
|
|
32
103
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [dispatch, onClose]);
|
|
104
|
+
const [options, setOptions] = (0, react_1.useState)(DEFAULT_OPTIONS);
|
|
105
|
+
const [error, setError] = (0, react_1.useState)('');
|
|
106
|
+
function submitHandler(inputOptions) {
|
|
107
|
+
const options = checkOptions(inputOptions);
|
|
108
|
+
setOptions(options);
|
|
109
|
+
try {
|
|
110
|
+
checkSpectra(options, spectra);
|
|
111
|
+
dispatch({ type: 'ALIGN_SPECTRA', payload: options });
|
|
112
|
+
onClose();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
const message = error.message;
|
|
116
|
+
setError(message);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
49
119
|
(0, react_1.useEffect)(() => {
|
|
50
120
|
function handler(event) {
|
|
51
121
|
const [from, to] = event.range;
|
|
52
|
-
|
|
122
|
+
setOptions((prevOptions) => ({ ...prevOptions, from, to }));
|
|
53
123
|
}
|
|
54
124
|
Events_1.default.on('brushEnd', handler);
|
|
55
125
|
return () => {
|
|
56
126
|
Events_1.default.off('brushEnd', handler);
|
|
57
127
|
};
|
|
58
128
|
}, []);
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
129
|
+
function optionChangeHandler(key) {
|
|
130
|
+
const { delta: targetX = 0, ...otherOptions } = References_1.REFERENCES?.[nucleus]?.[key] || {};
|
|
131
|
+
const value = {
|
|
132
|
+
...DEFAULT_OPTIONS,
|
|
133
|
+
targetX,
|
|
134
|
+
...otherOptions,
|
|
135
|
+
};
|
|
136
|
+
setOptions(value);
|
|
137
|
+
setError('');
|
|
138
|
+
}
|
|
139
|
+
const List = getList(nucleus);
|
|
140
|
+
return ((0, jsx_runtime_1.jsx)("div", { css: ModalStyle_1.ModalStyles, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: options, enableReinitialize: true, onSubmit: submitHandler, validationSchema: schemaValidation, validate: () => setError(''), children: ({ submitForm }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Spectra calibration" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content", style: { flex: 1, minHeight: '220px' }, children: [error && (0, jsx_runtime_1.jsx)(Message_1.default, { type: "error", children: error }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Options", style: labelStyle, children: (0, jsx_runtime_1.jsx)(Select_1.default, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Range", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Peaks", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "nbPeaks", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Target PPM", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "targetX", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: submitForm, children: "Done" }) })] })) }) }));
|
|
69
141
|
}
|
|
70
142
|
exports.default = AlignSpectraModal;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useMoleculeEditor = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
8
5
|
/** @jsxImportSource @emotion/react */
|
|
9
6
|
const react_1 = require("react");
|
|
10
7
|
const full_1 = require("react-ocl/full");
|
|
8
|
+
const ui_1 = require("react-science/ui");
|
|
11
9
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
12
|
-
const ActionButtons_1 = __importDefault(require("../elements/ActionButtons"));
|
|
13
|
-
const Modal_1 = require("../elements/popup/Modal");
|
|
14
|
-
const options_1 = require("../elements/popup/options");
|
|
15
|
-
const ModalStyle_1 = require("./ModalStyle");
|
|
16
10
|
function MoleculeStructureEditorModal(props) {
|
|
17
|
-
const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, } = props;
|
|
11
|
+
const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, isOpen = false, } = props;
|
|
18
12
|
const [molfile, setMolfile] = (0, react_1.useState)(null);
|
|
19
13
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
20
14
|
(0, react_1.useEffect)(() => {
|
|
@@ -62,17 +56,17 @@ function MoleculeStructureEditorModal(props) {
|
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
58
|
}, [molfile, selectedMolecule, dispatch, floatMoleculeOnSave, onClose]);
|
|
65
|
-
return ((0, jsx_runtime_1.
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(ui_1.ConfirmModal, { headerColor: "transparent", isOpen: isOpen, onRequestClose: handleClose, onCancel: handleClose, onConfirm: handleSave, maxWidth: 700, children: (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }) }) }));
|
|
66
60
|
}
|
|
67
61
|
function useMoleculeEditor(floatMoleculeOnSave = false) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
const [isOpen, openModal, closeModal] = (0, ui_1.useOnOff)(false);
|
|
63
|
+
const [molecule, setMolecule] = (0, react_1.useState)();
|
|
64
|
+
const modal = ((0, jsx_runtime_1.jsx)(MoleculeStructureEditorModal, { selectedMolecule: molecule, floatMoleculeOnSave: floatMoleculeOnSave, onClose: closeModal, isOpen: isOpen }));
|
|
65
|
+
const openMoleculeEditor = (0, react_1.useCallback)((molecule) => {
|
|
66
|
+
setMolecule(molecule);
|
|
67
|
+
openModal();
|
|
68
|
+
}, [openModal]);
|
|
69
|
+
return { modal, openMoleculeEditor };
|
|
76
70
|
}
|
|
77
71
|
exports.useMoleculeEditor = useMoleculeEditor;
|
|
78
72
|
exports.default = MoleculeStructureEditorModal;
|
|
@@ -131,7 +131,7 @@ function MultipletAnalysisModal({ data, activeSpectrum, scaleX, startX, endX, on
|
|
|
131
131
|
try {
|
|
132
132
|
const result = (0, multiplet_analysis_1.analyseMultiplet)(analysesProps, {
|
|
133
133
|
frequency: info.originFrequency,
|
|
134
|
-
minimalResolution: 0.
|
|
134
|
+
minimalResolution: 0.1,
|
|
135
135
|
maxTestedJ: 17,
|
|
136
136
|
takeBestPartMultiplet: true,
|
|
137
137
|
correctVerticalOffset: true,
|
|
@@ -8,8 +8,9 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("@emotion/react");
|
|
9
9
|
const cheminfo_font_1 = require("cheminfo-font");
|
|
10
10
|
const ui_1 = require("react-science/ui");
|
|
11
|
-
const versionInfo_1 = __importDefault(require("
|
|
12
|
-
const Logo_1 = __importDefault(require("
|
|
11
|
+
const versionInfo_1 = __importDefault(require("../../../versionInfo"));
|
|
12
|
+
const Logo_1 = __importDefault(require("../../elements/Logo"));
|
|
13
|
+
const AboutUsZakodium_1 = __importDefault(require("./AboutUsZakodium"));
|
|
13
14
|
const styles = (0, react_1.css) `
|
|
14
15
|
width: 40vw;
|
|
15
16
|
min-width: 500px;
|
|
@@ -97,7 +98,7 @@ function AboutUsModal() {
|
|
|
97
98
|
display: 'flex',
|
|
98
99
|
alignItems: 'center',
|
|
99
100
|
justifyContent: 'center',
|
|
100
|
-
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.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)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children:
|
|
101
|
+
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: (0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: (0, jsx_runtime_1.jsx)("div", { className: "header", children: (0, jsx_runtime_1.jsx)("span", { children: "About NMRium" }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)(Logo_1.default, { width: 160, height: 50 }), "Version ", (0, jsx_runtime_1.jsx)(VersionInfo, {}), (0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), (0, jsx_runtime_1.jsx)("div", { className: "center-container", children: (0, jsx_runtime_1.jsx)("span", { className: "separator" }) }), (0, jsx_runtime_1.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)." }), (0, jsx_runtime_1.jsxs)("div", { className: "center-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "separator" }), (0, jsx_runtime_1.jsx)("span", { className: "title", children: "Funding is provided by" }), (0, jsx_runtime_1.jsx)("span", { className: "separator" })] }), (0, jsx_runtime_1.jsx)("div", { className: "content", children: (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(AboutUsZakodium_1.default, {}) }), (0, jsx_runtime_1.jsx)("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
|
|
101
102
|
}
|
|
102
103
|
exports.default = AboutUsModal;
|
|
103
104
|
function VersionInfo() {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const ui_1 = require("react-science/ui");
|
|
9
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
10
|
+
function AboutUsZakodium() {
|
|
11
|
+
const [isSecretOpen, openSecret] = (0, ui_1.useOnOff)();
|
|
12
|
+
function handleClick(event) {
|
|
13
|
+
if (event.shiftKey && event.altKey) {
|
|
14
|
+
openSecret();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { onClick: handleClick, children: "Zakodium" }), ` Sàrl (Switzerland).`, isSecretOpen && (0, jsx_runtime_1.jsx)(SecretThrower, {})] }));
|
|
18
|
+
}
|
|
19
|
+
exports.default = AboutUsZakodium;
|
|
20
|
+
const ThrowerDiv = styled_1.default.div `
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 1rem;
|
|
24
|
+
`;
|
|
25
|
+
/**
|
|
26
|
+
* This component is here for us so we can test the impact of thrown exceptions
|
|
27
|
+
* in the deployed application.
|
|
28
|
+
*/
|
|
29
|
+
function SecretThrower() {
|
|
30
|
+
const [shouldThrow, setShouldThrow] = (0, ui_1.useOnOff)();
|
|
31
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
32
|
+
if (shouldThrow) {
|
|
33
|
+
throw new Error('Error thrown in React render');
|
|
34
|
+
}
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(ThrowerDiv, { children: [(0, jsx_runtime_1.jsx)(ui_1.Button, { onClick: setShouldThrow, children: "Throw in React render" }), (0, jsx_runtime_1.jsx)(ui_1.Button, { onClick: () => dispatch({
|
|
36
|
+
type: 'SECRET_THROW_ERROR',
|
|
37
|
+
payload: { randomNumber: Math.random() },
|
|
38
|
+
}), children: "Throw in main reducer" })] }));
|
|
39
|
+
}
|
|
@@ -119,6 +119,6 @@ function ChangeSumModalContents(props) {
|
|
|
119
119
|
const isStructurePanelVisible = panels?.structuresPanel?.display || false;
|
|
120
120
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ui_1.Modal.Header, { children: currentSum
|
|
121
121
|
? `Set new ${sumType} sum (Current: ${currentSum.toFixed(2)})`
|
|
122
|
-
: `Set new ${sumType} Sum` }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && ((0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Auto", tabid: "auto", children: (0, jsx_runtime_1.jsx)(SelectMolecule_1.default, { name: "molecule" }) })), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Manual", tabid: "manual", children: (0, jsx_runtime_1.jsx)(ManualContainer, { children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "sum", type: "number",
|
|
122
|
+
: `Set new ${sumType} Sum` }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Body, { children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && ((0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Auto", tabid: "auto", children: (0, jsx_runtime_1.jsx)(SelectMolecule_1.default, { name: "molecule" }) })), (0, jsx_runtime_1.jsx)(Tab_1.default, { title: "Manual", tabid: "manual", children: (0, jsx_runtime_1.jsx)(ManualContainer, { children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "sum", type: "number", placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), (0, jsx_runtime_1.jsx)(ui_1.Modal.Footer, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => formRef.current.submitForm(), style: { width: 80 }, children: "Set" }) })] }));
|
|
123
123
|
}
|
|
124
124
|
exports.ChangeSumModalContents = ChangeSumModalContents;
|
|
@@ -212,7 +212,7 @@ function MetaImportationModal({ onClose, file }) {
|
|
|
212
212
|
padding: '5px',
|
|
213
213
|
fontSize: '14px',
|
|
214
214
|
},
|
|
215
|
-
}, placeholder: "Example: info.plus", datalist: datalist,
|
|
215
|
+
}, placeholder: "Example: info.plus", datalist: datalist, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => (0, convertPathArrayToString_1.convertPathArrayToString)(paths) }) })] }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 'calc(100% - 160px)' }, children: (0, jsx_runtime_1.jsx)(ReactTable_1.default, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
|
|
216
216
|
}
|
|
217
217
|
function fileValidator(file) {
|
|
218
218
|
if (!(0, parseMeta_1.isMetaFile)(file)) {
|
|
@@ -40,6 +40,6 @@ const LOGS_LEVELS = [
|
|
|
40
40
|
value: level,
|
|
41
41
|
}));
|
|
42
42
|
function GeneralTabContent() {
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Spectra", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number" }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Experimental features", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "display.general.experimentalFeatures.display" }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Rendering", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Spectra rendering ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Logging settings", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Level ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Spectra", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1 }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Experimental features", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "display.general.experimentalFeatures.display" }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Rendering", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Spectra rendering ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Logging settings", children: (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Level ", children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
|
|
44
44
|
}
|
|
45
45
|
exports.default = GeneralTabContent;
|
|
@@ -75,7 +75,7 @@ const COLUMNS = [
|
|
|
75
75
|
case 'checkbox':
|
|
76
76
|
return ((0, jsx_runtime_1.jsx)(CheckBoxCell_1.CheckBoxCell, { name: `nmrLoaders.${row.original.name}`, defaultValue: false }));
|
|
77
77
|
case 'input':
|
|
78
|
-
return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } }
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } } }));
|
|
79
79
|
case 'select':
|
|
80
80
|
return ((0, jsx_runtime_1.jsx)(FormikSelect_1.default, { name: `nmrLoaders.${row.original.name}`, style: { width: '100%' }, items: row.original.options }));
|
|
81
81
|
default:
|
|
@@ -53,8 +53,12 @@ const infoBlockValidation = (0, yup_1.object)({
|
|
|
53
53
|
jpath: (0, yup_1.array)().of((0, yup_1.string)()).min(1),
|
|
54
54
|
})),
|
|
55
55
|
});
|
|
56
|
+
const generalValidation = (0, yup_1.object)({
|
|
57
|
+
dimmedSpectraOpacity: (0, yup_1.number)().required(),
|
|
58
|
+
});
|
|
56
59
|
exports.validation = (0, yup_1.lazy)((obj) => (0, yup_1.object)().shape({
|
|
57
60
|
formatting: formattingValidation(obj),
|
|
58
61
|
databases: databasesValidation,
|
|
59
62
|
infoBlock: infoBlockValidation,
|
|
63
|
+
general: generalValidation,
|
|
60
64
|
}));
|