nmrium 0.19.1 → 0.20.1
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 -3
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
- package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
- package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
- package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
- package/lib/component/1d/Line.js +11 -23
- package/lib/component/1d/Viewer1D.js +36 -5
- package/lib/component/1d/ranges/Ranges.js +3 -3
- package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
- package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib/component/2d/Contours.js +12 -11
- package/lib/component/2d/Left1DChart.js +7 -9
- package/lib/component/2d/Top1DChart.js +7 -7
- package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +12 -3
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +28 -25
- package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
- package/lib/component/hooks/useXYReduce.d.ts +2 -1
- package/lib/component/loader/DropZone.js +1 -1
- package/lib/component/modal/ModalStyle.js +5 -2
- package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -67
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
- package/lib/component/panels/Panels.js +10 -0
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
- package/lib/component/reducer/Reducer.d.ts +0 -16
- package/lib/component/reducer/Reducer.js +4 -5
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
- package/lib/component/reducer/actions/FiltersActions.js +60 -18
- package/lib/component/reducer/actions/LoadActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib/component/reducer/actions/RangesActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
- package/lib/component/reducer/actions/ToolsActions.js +1 -30
- package/lib/component/reducer/helper/getRange.d.ts +6 -1
- package/lib/component/reducer/helper/getRange.js +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +2 -5
- package/lib/component/utility/PathBuilder.d.ts +7 -0
- package/lib/component/utility/PathBuilder.js +17 -0
- package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
- package/lib/component/utility/getSpectraByNucleus.js +4 -0
- package/lib/data/Filters.d.ts +2 -1
- package/lib/data/Filters.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
- package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
- package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
- package/lib/data/types/data1d/ExclusionZone.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -3
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
- package/lib-cjs/component/1d/Line.js +11 -23
- package/lib-cjs/component/1d/Viewer1D.js +36 -5
- package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
- package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib-cjs/component/2d/Contours.js +12 -11
- package/lib-cjs/component/2d/Left1DChart.js +7 -9
- package/lib-cjs/component/2d/Top1DChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +12 -3
- package/lib-cjs/component/NMRium.js +28 -25
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
- package/lib-cjs/component/loader/DropZone.js +1 -1
- package/lib-cjs/component/modal/ModalStyle.js +5 -2
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +48 -66
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
- package/lib-cjs/component/panels/Panels.js +10 -0
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
- package/lib-cjs/component/reducer/Reducer.js +4 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
- package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -32
- package/lib-cjs/component/reducer/helper/getRange.js +1 -1
- package/lib-cjs/component/toolbar/FunctionToolBar.js +2 -5
- package/lib-cjs/component/utility/PathBuilder.js +21 -0
- package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
- package/lib-cjs/data/Filters.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
- package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
- package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -21
- package/lib/component/1d/ExclusionZone.d.ts +0 -8
- package/lib/component/1d/ExclusionZone.js +0 -30
- package/lib/component/1d/ExclusionZones.d.ts +0 -2
- package/lib/component/1d/ExclusionZones.js +0 -10
- package/lib-cjs/component/1d/ExclusionZone.js +0 -32
- package/lib-cjs/component/1d/ExclusionZones.js +0 -16
|
@@ -73,6 +73,15 @@ const styles = (0, react_1.css) `
|
|
|
73
73
|
.container {
|
|
74
74
|
flex: 1;
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
.infoText {
|
|
78
|
+
padding: 10px;
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
text-align: left;
|
|
81
|
+
color: white;
|
|
82
|
+
background-color: #5f5f5f;
|
|
83
|
+
border-radius: 5px;
|
|
84
|
+
}
|
|
76
85
|
`;
|
|
77
86
|
function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
|
|
78
87
|
const refForm = (0, react_2.useRef)();
|
|
@@ -129,6 +138,6 @@ function MultipleSpectraFiltersModal({ onClose = () => null, nucleus = '', }) {
|
|
|
129
138
|
break;
|
|
130
139
|
}
|
|
131
140
|
}, [filter, submitHandler]);
|
|
132
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Apply filters" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content container", children: [(0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Filter :" }, void 0), (0, jsx_runtime_1.jsx)(Select_1.default, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler }, void 0)] }, void 0), filterOptions] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn primary", children: "Apply" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "btn", children: "Close" }, void 0)] }, void 0)] }, void 0));
|
|
141
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "Apply filters" }, void 0), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "inner-content container", children: [(0, jsx_runtime_1.jsx)("p", { className: "infoText", children: "This filter will use the exclusions zones defined in the first spectrum." }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "row margin-10", children: [(0, jsx_runtime_1.jsx)("span", { className: "custom-label", children: "Filter :" }, void 0), (0, jsx_runtime_1.jsx)(Select_1.default, { data: List, style: { width: 275, height: 30, margin: 0 }, onChange: filterChangeHandler }, void 0)] }, void 0), filterOptions] }, void 0), (0, jsx_runtime_1.jsxs)("div", { className: "footer-container", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: handleSave, className: "btn primary", children: "Apply" }, void 0), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "btn", children: "Close" }, void 0)] }, void 0)] }, void 0));
|
|
133
142
|
}
|
|
134
143
|
exports.default = MultipleSpectraFiltersModal;
|
|
@@ -0,0 +1,40 @@
|
|
|
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("@emotion/react/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource @emotion/react */
|
|
8
|
+
const cheminfo_font_1 = require("cheminfo-font");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
11
|
+
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
12
|
+
const Modal_1 = require("../../elements/popup/Modal");
|
|
13
|
+
const ExportAsMatrixModal_1 = __importDefault(require("../../modal/ExportAsMatrixModal"));
|
|
14
|
+
const MultipleSpectraFiltersModal_1 = __importDefault(require("../../modal/MultipleSpectraFiltersModal"));
|
|
15
|
+
const Types_1 = require("../../reducer/types/Types");
|
|
16
|
+
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
17
|
+
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
18
|
+
function MatrixGenerationPanel() {
|
|
19
|
+
const modal = (0, Modal_1.useModal)();
|
|
20
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
21
|
+
const openFiltersModal = (0, react_1.useCallback)(() => {
|
|
22
|
+
dispatch({ type: Types_1.RESET_SELECTED_TOOL });
|
|
23
|
+
modal.show((0, jsx_runtime_1.jsx)(MultipleSpectraFiltersModal_1.default, {}, void 0), {
|
|
24
|
+
isBackgroundBlur: false,
|
|
25
|
+
position: Modal_1.positions.TOP_CENTER,
|
|
26
|
+
width: 550,
|
|
27
|
+
height: 250,
|
|
28
|
+
});
|
|
29
|
+
}, [modal, dispatch]);
|
|
30
|
+
const openExportAsMatrixModal = (0, react_1.useCallback)(() => {
|
|
31
|
+
dispatch({ type: Types_1.RESET_SELECTED_TOOL });
|
|
32
|
+
modal.show((0, jsx_runtime_1.jsx)(ExportAsMatrixModal_1.default, {}, void 0), {
|
|
33
|
+
isBackgroundBlur: false,
|
|
34
|
+
position: Modal_1.positions.TOP_CENTER,
|
|
35
|
+
width: 500,
|
|
36
|
+
});
|
|
37
|
+
}, [modal, dispatch]);
|
|
38
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: BasicPanelStyle_1.tablePanelStyle, children: [(0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Add Filter", onClick: openFiltersModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAddFilter, { style: { fontSize: '18px' } }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Export spectra as a Matrix", onClick: openExportAsMatrixModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrExportAsMatrix, {}, void 0) }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "inner-container" }, void 0)] }, void 0));
|
|
39
|
+
}
|
|
40
|
+
exports.default = MatrixGenerationPanel;
|
|
@@ -20,61 +20,43 @@ const MoleculeStructureEditorModal_1 = __importDefault(require("../../modal/Mole
|
|
|
20
20
|
const Types_1 = require("../../reducer/types/Types");
|
|
21
21
|
const MoleculePanelHeader_1 = __importDefault(require("./MoleculePanelHeader"));
|
|
22
22
|
const useAtomAssignment_1 = __importDefault(require("./useAtomAssignment"));
|
|
23
|
-
const styles =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
display:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
const toolbarStyle = (0, react_1.css) `
|
|
65
|
-
display: flex;
|
|
66
|
-
flex-direction: row;
|
|
67
|
-
border-bottom: 0.55px solid rgb(240, 240, 240);
|
|
68
|
-
padding: 0px 5px;
|
|
69
|
-
|
|
70
|
-
p {
|
|
71
|
-
margin: 0;
|
|
72
|
-
text-align: right;
|
|
73
|
-
width: 100%;
|
|
74
|
-
line-height: 22px;
|
|
75
|
-
padding: 0px 10px;
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
23
|
+
const styles = {
|
|
24
|
+
panel: (0, react_1.css)({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexGrow: 1,
|
|
27
|
+
width: '100%',
|
|
28
|
+
height: '100%',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
}),
|
|
31
|
+
molecule: (0, react_1.css)({
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flex: '1 1 0%',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
minHeight: 0,
|
|
36
|
+
}),
|
|
37
|
+
toolbar: (0, react_1.css)({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
borderBottom: '0.55px solid rgb(240, 240, 240)',
|
|
40
|
+
padding: '0px 10px',
|
|
41
|
+
justifyContent: 'end',
|
|
42
|
+
height: 22,
|
|
43
|
+
}),
|
|
44
|
+
slider: (0, react_1.css)({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
flexGrow: 1,
|
|
50
|
+
minHeight: 0,
|
|
51
|
+
}),
|
|
52
|
+
items: (0, react_1.css)({
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
flex: '1 1 0%',
|
|
56
|
+
height: '100%',
|
|
57
|
+
minHeight: 0,
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
78
60
|
function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab, displayerMode, }) {
|
|
79
61
|
const [currentIndex, setCurrentIndex] = (0, react_2.useState)(0);
|
|
80
62
|
const [molecules, setMolecules] = (0, react_2.useState)([]);
|
|
@@ -104,17 +86,17 @@ function MoleculePanelInner({ zones, ranges, molecules: moleculesProp, activeTab
|
|
|
104
86
|
const moleculeIndexHandler = (0, react_2.useCallback)((index) => {
|
|
105
87
|
setCurrentIndex(index);
|
|
106
88
|
}, []);
|
|
107
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler }, void 0), (0, jsx_runtime_1.jsx)("div", {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: styles.panel, children: [(0, jsx_runtime_1.jsx)(MoleculePanelHeader_1.default, { currentIndex: currentIndex, molecules: molecules, onOpenMoleculeEditor: () => openMoleculeEditorHandler(), onMoleculeIndexChange: moleculeIndexHandler }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.molecule, children: (0, jsx_runtime_1.jsx)(NextPrev_1.default, { onChange: (slideIndex) => setCurrentIndex(slideIndex), defaultIndex: currentIndex, children: molecules && molecules.length > 0 ? (molecules.map((mol, index) => ((0, jsx_runtime_1.jsxs)("div", { css: styles.items, children: [(0, jsx_runtime_1.jsxs)("span", { css: styles.toolbar, children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: mol.mf }, void 0), " - ", mol.mw?.toFixed(2)] }, void 0), (0, jsx_runtime_1.jsx)("div", { css: styles.slider, className: "mol-svg-container", onDoubleClick: () => openMoleculeEditorHandler(mol), style: {
|
|
90
|
+
backgroundColor: (index + 1) % 2 !== 0 ? '#fafafa' : 'white',
|
|
91
|
+
}, children: (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ height, width }) => {
|
|
92
|
+
return ((0, jsx_runtime_1.jsx)(react_ocl_nmr_1.default, { OCL: full_1.default, id: `molSVG${index}`, width: width, height: height, molfile: mol.molfile || '', setMolfile: (molfile) => handleReplaceMolecule(mol.key, molfile), setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight &&
|
|
93
|
+
currentDiaIDsToHighlight.length > 0
|
|
94
|
+
? 'red'
|
|
95
|
+
: '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight &&
|
|
96
|
+
currentDiaIDsToHighlight.length > 0
|
|
97
|
+
? currentDiaIDsToHighlight
|
|
98
|
+
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover }, void 0));
|
|
99
|
+
} }, void 0) }, void 0)] }, mol.key)))) : ((0, jsx_runtime_1.jsx)("div", { style: { width: '100%', height: '100%' }, onClick: () => openMoleculeEditorHandler() }, void 0)) }, void 0) }, void 0)] }, void 0));
|
|
118
100
|
}
|
|
119
101
|
const MemoizedMoleculePanel = (0, react_2.memo)(MoleculePanelInner);
|
|
120
102
|
const emptyData = { ranges: {}, zones: {} };
|
|
@@ -103,15 +103,10 @@ function useAtomAssignment({ displayerMode, activeTab, zones, ranges, }) {
|
|
|
103
103
|
return (0, Utilities_1.getCurrentDiaIDsToHighlight)(assignmentData, displayerMode).concat(highlights);
|
|
104
104
|
}, [assignmentData, data, displayerMode, highlightData.highlight]);
|
|
105
105
|
const toggleAssignment = (0, react_1.useCallback)((diaID, atomInformation) => {
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
if (assignedDiaIDsMerged.some((_oclID) => atomInformation.oclIDs.includes(_oclID)) &&
|
|
109
|
-
!diaID.some((_oclID) => atomInformation.oclIDs.includes(_oclID))) {
|
|
110
|
-
alert.info('Atom is already assigned to another signal!');
|
|
111
|
-
return diaID;
|
|
112
|
-
}
|
|
106
|
+
// a previous version of the code prevented to assign many time the same atom
|
|
107
|
+
// see revision cc13abc18f77b6787b923e3c4edaef51750d9e90
|
|
113
108
|
return (0, Utilities_1.toggleDiaIDs)(diaID, atomInformation);
|
|
114
|
-
}, [
|
|
109
|
+
}, []);
|
|
115
110
|
const handleOnClickAtom = (0, react_1.useCallback)((atom, event) => {
|
|
116
111
|
if (!(0, checkModifierKeyActivated_1.default)(event)) {
|
|
117
112
|
if (activeAssignment.isActive) {
|
package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js
CHANGED
|
@@ -18,8 +18,6 @@ const ToggleButton_1 = __importDefault(require("../../elements/ToggleButton"));
|
|
|
18
18
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
19
19
|
const Modal_1 = require("../../elements/popup/Modal");
|
|
20
20
|
const AlignSpectraModal_1 = __importDefault(require("../../modal/AlignSpectraModal"));
|
|
21
|
-
const ExportAsMatrixModal_1 = __importDefault(require("../../modal/ExportAsMatrixModal"));
|
|
22
|
-
const MultipleSpectraFiltersModal_1 = __importDefault(require("../../modal/MultipleSpectraFiltersModal"));
|
|
23
21
|
const Types_1 = require("../../reducer/types/Types");
|
|
24
22
|
const Events_1 = __importDefault(require("../../utility/Events"));
|
|
25
23
|
const Export_1 = require("../../utility/Export");
|
|
@@ -61,15 +59,6 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
|
|
|
61
59
|
width: 500,
|
|
62
60
|
});
|
|
63
61
|
}, [activeTab, modal, dispatch]);
|
|
64
|
-
const openFiltersModal = (0, react_2.useCallback)(() => {
|
|
65
|
-
dispatch({ type: Types_1.RESET_SELECTED_TOOL });
|
|
66
|
-
modal.show((0, jsx_runtime_1.jsx)(MultipleSpectraFiltersModal_1.default, {}, void 0), {
|
|
67
|
-
isBackgroundBlur: false,
|
|
68
|
-
position: Alert_1.positions.TOP_CENTER,
|
|
69
|
-
width: 550,
|
|
70
|
-
height: 250,
|
|
71
|
-
});
|
|
72
|
-
}, [modal, dispatch]);
|
|
73
62
|
const copyToClipboardHandler = (0, react_2.useCallback)(async () => {
|
|
74
63
|
const data = (0, MultipleAnalysis_1.getDataAsString)(spectraAnalysis, activeTab);
|
|
75
64
|
const success = await (0, Export_1.copyTextToClipboard)(data);
|
|
@@ -80,14 +69,6 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
|
|
|
80
69
|
alert.error('copy to clipboard failed');
|
|
81
70
|
}
|
|
82
71
|
}, [activeTab, alert, spectraAnalysis]);
|
|
83
|
-
const openExportAsMatrixModal = (0, react_2.useCallback)(() => {
|
|
84
|
-
dispatch({ type: Types_1.RESET_SELECTED_TOOL });
|
|
85
|
-
modal.show((0, jsx_runtime_1.jsx)(ExportAsMatrixModal_1.default, {}, void 0), {
|
|
86
|
-
isBackgroundBlur: false,
|
|
87
|
-
position: Alert_1.positions.TOP_CENTER,
|
|
88
|
-
width: 500,
|
|
89
|
-
});
|
|
90
|
-
}, [modal, dispatch]);
|
|
91
72
|
return ((0, jsx_runtime_1.jsxs)("div", { css: [
|
|
92
73
|
BasicPanelStyle_1.tablePanelStyle,
|
|
93
74
|
isFlipped &&
|
|
@@ -100,9 +81,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
|
|
|
100
81
|
// style={styles.button}
|
|
101
82
|
onClick: copyToClipboardHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Spectra calibration",
|
|
102
83
|
// style={styles.button}
|
|
103
|
-
onClick: openAlignSpectra, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay, { style: { fontSize: '18px' } }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "Y Spectra Tracker", popupPlacement: "right", onClick: showTrackerHandler, children: (0, jsx_runtime_1.jsx)(io5_1.IoPulseOutline, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(
|
|
104
|
-
// style={styles.button}
|
|
105
|
-
onClick: openFiltersModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAddFilter, { style: { fontSize: '18px' } }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Export spectra as a Matrix", onClick: openExportAsMatrixModal, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrExportAsMatrix, {}, void 0) }, void 0)] }, void 0)), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler }, void 0)), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisTable_1.default, { data: data, activeTab: activeTab }, void 0)) : ((0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisPreferences_1.default, { data: data, onAfterSave: afterSaveHandler, ref: settingRef }, void 0)) }, void 0)] }, void 0));
|
|
84
|
+
onClick: openAlignSpectra, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay, { style: { fontSize: '18px' } }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "Y Spectra Tracker", popupPlacement: "right", onClick: showTrackerHandler, children: (0, jsx_runtime_1.jsx)(io5_1.IoPulseOutline, {}, void 0) }, void 0)] }, void 0)), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler }, void 0)), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisTable_1.default, { data: data, activeTab: activeTab }, void 0)) : ((0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisPreferences_1.default, { data: data, onAfterSave: afterSaveHandler, ref: settingRef }, void 0)) }, void 0)] }, void 0));
|
|
106
85
|
}
|
|
107
86
|
const MemoizedMultipleSpectraAnalysisPanel = (0, react_2.memo)(MultipleSpectraAnalysisPanelInner);
|
|
108
87
|
function MultipleSpectraAnalysisPanel() {
|
|
@@ -15,6 +15,7 @@ const Constants_1 = require("../reducer/core/Constants");
|
|
|
15
15
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
16
16
|
const InformationPanel_1 = __importDefault(require("./InformationPanel"));
|
|
17
17
|
const IntegralPanel_1 = __importDefault(require("./IntegralsPanel/IntegralPanel"));
|
|
18
|
+
const MatrixGenerationPanel_1 = __importDefault(require("./MatrixGenerationPanel/MatrixGenerationPanel"));
|
|
18
19
|
const MoleculePanel_1 = __importDefault(require("./MoleculesPanel/MoleculePanel"));
|
|
19
20
|
const MultipleSpectraAnalysisPanel_1 = __importDefault(require("./MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel"));
|
|
20
21
|
const PeaksPanel_1 = __importDefault(require("./PeaksPanel/PeaksPanel"));
|
|
@@ -75,6 +76,14 @@ const accordionItems = [
|
|
|
75
76
|
hidePreferenceKey: 'hideMultipleSpectraAnalysisPanel',
|
|
76
77
|
mode: null,
|
|
77
78
|
},
|
|
79
|
+
{
|
|
80
|
+
title: 'Matrix Generation',
|
|
81
|
+
component: (0, jsx_runtime_1.jsx)(MatrixGenerationPanel_1.default, {}, void 0),
|
|
82
|
+
openWhen: [],
|
|
83
|
+
hidePreferenceKey: '',
|
|
84
|
+
mode: null,
|
|
85
|
+
isExperimental: true,
|
|
86
|
+
},
|
|
78
87
|
{
|
|
79
88
|
title: 'Zones',
|
|
80
89
|
component: (0, jsx_runtime_1.jsx)(ZonesPanel_1.default, {}, void 0),
|
|
@@ -109,6 +118,7 @@ exports.PANELS_ACCORDION = {
|
|
|
109
118
|
peakPicking: 'Peaks',
|
|
110
119
|
integral: 'Integrals',
|
|
111
120
|
rangesPicking: 'Ranges',
|
|
121
|
+
zone2D: 'Zones',
|
|
112
122
|
};
|
|
113
123
|
function PanelsInner({ displayerMode }) {
|
|
114
124
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
@@ -44,7 +44,7 @@ function Spectrum2DHistogram({ color = 'red', data, options = {}, }) {
|
|
|
44
44
|
}
|
|
45
45
|
return { sanPlot, lines };
|
|
46
46
|
}, [data.z, options, yLogBase]);
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "San Plot" }, void 0), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
48
48
|
borderTop: '1px solid #ededed',
|
|
49
49
|
marginTop: '10px',
|
|
50
50
|
paddingTop: '10px',
|
|
@@ -114,6 +114,13 @@ function ZonesTable({ tableData, onUnlink, context, nuclei }) {
|
|
|
114
114
|
}, [tableData]);
|
|
115
115
|
const { items: sortedData, isSortedDesc, onSort } = (0, useTableSortBy_1.default)(data);
|
|
116
116
|
const rows = (0, react_2.useMemo)(() => sortedData.map((rowData, index) => ((0, jsx_runtime_1.jsx)(ZonesTableRow_1.default, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, onContextMenu: (e, rowData) => contextMenuHandler(e, rowData) }, `${rowData.tableMetaInfo.id}`))), [contextMenuHandler, sortedData, onUnlink]);
|
|
117
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("table", { css: tableStyle, children: [(0, jsx_runtime_1.jsxs)("thead", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: "#" }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: "\u03B4 (ppm)" }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: (0, jsx_runtime_1.jsx)(fa_1.FaLink, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: "\u03A3" }, void 0), (0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: "Kind" }, void 0), (0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: '' }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.
|
|
117
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("table", { css: tableStyle, children: [(0, jsx_runtime_1.jsxs)("thead", { children: [(0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: "#" }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: "\u03B4 (ppm)" }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: (0, jsx_runtime_1.jsx)(fa_1.FaLink, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { colSpan: 2, children: "\u03A3" }, void 0), (0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: "Kind" }, void 0), (0, jsx_runtime_1.jsx)("th", { rowSpan: 2, children: '' }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: (0, jsx_runtime_1.jsxs)(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: (0, jsx_runtime_1.jsxs)(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F2", children: nuclei[0] }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(SurroundedText, { text: "F1", children: nuclei[1] }, void 0) }, void 0)] }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)("tbody", { children: rows }, void 0)] }, void 0), (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: context }, void 0)] }, void 0));
|
|
118
|
+
}
|
|
119
|
+
function SurroundedText(props) {
|
|
120
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
121
|
+
position: 'absolute',
|
|
122
|
+
fontSize: 8,
|
|
123
|
+
color: '#3539E6',
|
|
124
|
+
}, children: props.text }, void 0), (0, jsx_runtime_1.jsx)("div", { style: { marginLeft: 5 }, children: props.children }, void 0)] }, void 0));
|
|
118
125
|
}
|
|
119
126
|
exports.default = ZonesTable;
|
|
@@ -110,7 +110,6 @@ exports.initialState = {
|
|
|
110
110
|
selectedOptionPanel: null,
|
|
111
111
|
data: {
|
|
112
112
|
baseLineZones: [],
|
|
113
|
-
exclusionZones: {},
|
|
114
113
|
pivot: { value: 0, index: 0 },
|
|
115
114
|
zonesNoiseFactor: 1,
|
|
116
115
|
activeFilterID: null,
|
|
@@ -276,6 +275,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
276
275
|
return FiltersActions.filterSnapshotHandler(draft, action);
|
|
277
276
|
case types.APPLY_MULTIPLE_SPECTRA_FILTER:
|
|
278
277
|
return FiltersActions.handleMultipleSpectraFilter(draft, action);
|
|
278
|
+
case types.ADD_EXCLUSION_ZONE:
|
|
279
|
+
return FiltersActions.handleAddExclusionZone(draft, action);
|
|
280
|
+
case types.DELETE_EXCLUSION_ZONE:
|
|
281
|
+
return FiltersActions.handleDeleteExclusionZone(draft, action);
|
|
279
282
|
case types.CHANGE_VISIBILITY:
|
|
280
283
|
return SpectrumsActions.handleSpectrumVisibility(draft, action);
|
|
281
284
|
case types.CHANGE_PEAKS_MARKERS_VISIBILITY:
|
|
@@ -376,10 +379,6 @@ function innerSpectrumReducer(draft, action) {
|
|
|
376
379
|
return ToolsActions.handleAddBaseLineZone(draft, action.zone);
|
|
377
380
|
case types.DELETE_BASE_LINE_ZONE:
|
|
378
381
|
return ToolsActions.handleDeleteBaseLineZone(draft, action.id);
|
|
379
|
-
case types.ADD_EXCLUSION_ZONE:
|
|
380
|
-
return ToolsActions.handleAddExclusionZone(draft, action);
|
|
381
|
-
case types.DELETE_EXCLUSION_ZONE:
|
|
382
|
-
return ToolsActions.handleDeleteExclusionZone(draft, action);
|
|
383
382
|
case types.APPLY_BASE_LINE_CORRECTION_FILTER:
|
|
384
383
|
return FiltersActions.handleBaseLineCorrectionFilter(draft, action);
|
|
385
384
|
case types.SET_KEY_PREFERENCES:
|
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
|
|
25
|
+
exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
|
|
26
26
|
const immer_1 = require("immer");
|
|
27
27
|
const Filters = __importStar(require("../../../data/Filters"));
|
|
28
28
|
const FiltersManager = __importStar(require("../../../data/FiltersManager"));
|
|
@@ -30,8 +30,11 @@ const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
|
30
30
|
const autoPhaseCorrection_1 = require("../../../data/data1d/filter1d/autoPhaseCorrection");
|
|
31
31
|
const phaseCorrection_1 = require("../../../data/data1d/filter1d/phaseCorrection");
|
|
32
32
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
33
|
+
const generateID_1 = __importDefault(require("../../../data/utilities/generateID"));
|
|
34
|
+
const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
33
35
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
34
36
|
const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
|
|
37
|
+
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
35
38
|
const DomainActions_1 = require("./DomainActions");
|
|
36
39
|
const PreferencesActions_1 = require("./PreferencesActions");
|
|
37
40
|
const ToolsActions_1 = require("./ToolsActions");
|
|
@@ -281,25 +284,66 @@ function filterSnapshotHandler(draft, action) {
|
|
|
281
284
|
}
|
|
282
285
|
exports.filterSnapshotHandler = filterSnapshotHandler;
|
|
283
286
|
function handleMultipleSpectraFilter(draft, action) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
FiltersManager.applyFilter(datum, filters);
|
|
300
|
-
}
|
|
287
|
+
const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
288
|
+
if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
|
|
289
|
+
const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
|
|
290
|
+
?.value || [];
|
|
291
|
+
for (const spectrum of spectra) {
|
|
292
|
+
const filters = action.payload.map((filter) => {
|
|
293
|
+
if (filter.name === Filters.equallySpaced.id) {
|
|
294
|
+
return {
|
|
295
|
+
...filter,
|
|
296
|
+
options: { ...filter.options, exclusions },
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return filter;
|
|
300
|
+
});
|
|
301
|
+
FiltersManager.applyFilter(spectrum, filters);
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
(0, DomainActions_1.setDomain)(draft);
|
|
304
305
|
}
|
|
305
306
|
exports.handleMultipleSpectraFilter = handleMultipleSpectraFilter;
|
|
307
|
+
function handleAddExclusionZone(draft, action) {
|
|
308
|
+
const { from: startX, to: endX } = action.payload;
|
|
309
|
+
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
310
|
+
let spectra;
|
|
311
|
+
if (draft.activeSpectrum?.id) {
|
|
312
|
+
const index = draft.activeSpectrum?.index;
|
|
313
|
+
spectra = [draft.data[index]];
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
317
|
+
}
|
|
318
|
+
for (const spectrum of spectra) {
|
|
319
|
+
FiltersManager.applyFilter(spectrum, [
|
|
320
|
+
{
|
|
321
|
+
name: Filters.exclusionZones.id,
|
|
322
|
+
options: [
|
|
323
|
+
{
|
|
324
|
+
id: (0, generateID_1.default)(),
|
|
325
|
+
from: range[0],
|
|
326
|
+
to: range[1],
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
]);
|
|
331
|
+
}
|
|
332
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
333
|
+
}
|
|
334
|
+
exports.handleAddExclusionZone = handleAddExclusionZone;
|
|
335
|
+
function handleDeleteExclusionZone(draft, action) {
|
|
336
|
+
const { id, spectrumID } = action.payload;
|
|
337
|
+
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
|
|
338
|
+
const exclusionZonesFilter = draft.data[spectrumIndex].filters.find((filter) => filter.name === Filters.exclusionZones.id);
|
|
339
|
+
if (exclusionZonesFilter) {
|
|
340
|
+
if (exclusionZonesFilter.value.length === 1) {
|
|
341
|
+
FiltersManager.deleteFilter(draft.data[spectrumIndex], exclusionZonesFilter.id);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
exclusionZonesFilter.value = exclusionZonesFilter.value.filter((zone) => zone.id !== id);
|
|
345
|
+
FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
|
|
@@ -35,17 +35,16 @@ function setColors(draft, colors) {
|
|
|
35
35
|
draft.usedColors['2d'] = draft.usedColors['2d'].concat(colors['2d']);
|
|
36
36
|
}
|
|
37
37
|
function setData(draft, data) {
|
|
38
|
-
const { spectra, molecules, correlations,
|
|
38
|
+
const { spectra, molecules, correlations, usedColors } = data || {
|
|
39
39
|
spectra: [],
|
|
40
40
|
molecules: [],
|
|
41
41
|
correlations: {},
|
|
42
42
|
multipleAnalysis: {},
|
|
43
|
-
exclusionZones:
|
|
43
|
+
exclusionZones: [],
|
|
44
44
|
};
|
|
45
45
|
setColors(draft, usedColors);
|
|
46
46
|
draft.data = spectra;
|
|
47
47
|
draft.molecules = MoleculeManager.fromJSON(molecules);
|
|
48
|
-
draft.toolOptions.data.exclusionZones = exclusionZones;
|
|
49
48
|
if (!correlations || Object.keys(correlations).length === 0) {
|
|
50
49
|
draft.correlations = (0, nmr_correlation_1.buildCorrelationData)([], {
|
|
51
50
|
tolerance: Constants_1.DefaultTolerance,
|
|
@@ -38,8 +38,8 @@ function addMoleculeHandler(draft, molfile) {
|
|
|
38
38
|
* if it's the first creation of a molecule after the molecules list was empty,
|
|
39
39
|
* set the relative sum for ranges and integrals base on the first molecule
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const molecule = draft.molecules[0] || null;
|
|
42
|
+
if (isEmpty && molecule) {
|
|
43
43
|
(0, SumManager_1.changeSpectraRelativeSum)(draft, molecule.key, molecule);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applyKeyPreferencesHandler = exports.setKeyPreferencesHandler = exports.changeSpectrumVerticalAlignment = void 0;
|
|
7
|
-
const immer_1 = require("immer");
|
|
8
7
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
9
8
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
10
9
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
@@ -50,8 +49,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
50
49
|
}
|
|
51
50
|
exports.changeSpectrumVerticalAlignment = changeSpectrumVerticalAlignment;
|
|
52
51
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
53
|
-
const
|
|
54
|
-
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = state;
|
|
52
|
+
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = draft;
|
|
55
53
|
if (activeTab) {
|
|
56
54
|
const groupByNucleus = (0, GroupByInfoKey_1.default)('nucleus');
|
|
57
55
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
@@ -89,11 +87,10 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
89
87
|
}
|
|
90
88
|
exports.setKeyPreferencesHandler = setKeyPreferencesHandler;
|
|
91
89
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
92
|
-
const
|
|
93
|
-
const preferences = state.keysPreferences[keyCode];
|
|
90
|
+
const preferences = draft.keysPreferences[keyCode];
|
|
94
91
|
if (preferences) {
|
|
95
92
|
draft.activeTab = preferences.activeTab;
|
|
96
|
-
|
|
93
|
+
draft.data.forEach((datum, index) => {
|
|
97
94
|
if ((0, nucleusToString_1.default)(datum.info.nucleus) === preferences.activeTab) {
|
|
98
95
|
draft.data[index].display = Object.assign((0, cloneDeep_1.default)(datum.display), preferences.data[datum.id].display);
|
|
99
96
|
}
|
|
@@ -111,7 +108,7 @@ function applyKeyPreferencesHandler(draft, keyCode) {
|
|
|
111
108
|
if (draft.displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
112
109
|
for (const datumID of Object.keys(preferences.level)) {
|
|
113
110
|
const { levelPositive, levelNegative } = preferences.level[datumID];
|
|
114
|
-
const index =
|
|
111
|
+
const index = draft.data.findIndex((datum) => datum.id === datumID);
|
|
115
112
|
const processController = draft.data[index]
|
|
116
113
|
.processingController;
|
|
117
114
|
processController.setLevel(levelPositive, levelNegative);
|
|
@@ -237,7 +237,7 @@ function handleChangeRangeSum(draft, options) {
|
|
|
237
237
|
}
|
|
238
238
|
exports.handleChangeRangeSum = handleChangeRangeSum;
|
|
239
239
|
function handleAddRange(draft, action) {
|
|
240
|
-
const { startX, endX } = action;
|
|
240
|
+
const { startX, endX } = action.payload;
|
|
241
241
|
const { activeSpectrum, activeTab: nucleus, molecules } = draft;
|
|
242
242
|
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
243
243
|
if (activeSpectrum?.id) {
|
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.resetSpectraScale = exports.setSpectraSameTopHandler = exports.setTab = exports.setActiveTab = exports.levelChangeHandler = exports.handelSetActiveTab = exports.zoomOut = exports.handleZoom = exports.setVerticalIndicatorXPosition = exports.handleBrushEnd = exports.handleToggleRealImaginaryVisibility = exports.handleDeleteBaseLineZone = exports.handleAddBaseLineZone = exports.handleChangeSpectrumDisplayMode = exports.setSpectrumsVerticalAlign = exports.setSelectedOptionPanel = exports.setSelectedTool = exports.resetSelectedTool = void 0;
|
|
26
26
|
const d3_1 = require("d3");
|
|
27
27
|
const immer_1 = require("immer");
|
|
28
28
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
@@ -493,34 +493,3 @@ function resetSpectraScale(draft) {
|
|
|
493
493
|
(0, Zoom_1.setZoom)(draft, { scale: 0.8 });
|
|
494
494
|
}
|
|
495
495
|
exports.resetSpectraScale = resetSpectraScale;
|
|
496
|
-
function handleAddExclusionZone(draft, action) {
|
|
497
|
-
const { from, to } = action.payload;
|
|
498
|
-
const scaleX = (0, scale_1.getXScale)(draft);
|
|
499
|
-
const start = scaleX.invert(from);
|
|
500
|
-
const end = scaleX.invert(to);
|
|
501
|
-
let zone = [];
|
|
502
|
-
if (start > end) {
|
|
503
|
-
zone = [end, start];
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
zone = [start, end];
|
|
507
|
-
}
|
|
508
|
-
const newExclusionZone = {
|
|
509
|
-
id: (0, generateID_1.default)(),
|
|
510
|
-
from: zone[0],
|
|
511
|
-
to: zone[1],
|
|
512
|
-
};
|
|
513
|
-
if (draft.toolOptions.data.exclusionZones[draft.activeTab]) {
|
|
514
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab].push(newExclusionZone);
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab] = [newExclusionZone];
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
exports.handleAddExclusionZone = handleAddExclusionZone;
|
|
521
|
-
function handleDeleteExclusionZone(draft, action) {
|
|
522
|
-
const id = action.payload.id;
|
|
523
|
-
const index = draft.toolOptions.data.exclusionZones[draft.activeTab].findIndex((zone) => zone.id === id);
|
|
524
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab].splice(index, 1);
|
|
525
|
-
}
|
|
526
|
-
exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
|