nmrium 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +1 -1
- package/lib/component/1d/FooterBanner.js +17 -10
- package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
- package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
- package/lib/component/1d/integral/IntegralIndicator.js +27 -0
- package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
- package/lib/component/1d/integral/IntegralResizable.js +69 -0
- package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
- package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
- package/lib/component/1d/ranges/Range.js +27 -50
- package/lib/component/1d/utilities/scale.js +2 -2
- package/lib/component/2d/Contours.js +61 -42
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +1 -1
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColorPicker.js +5 -8
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.js +8 -19
- package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.js +13 -10
- package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
- package/lib/component/elements/formik/FormikSlider.js +8 -11
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useExport.js +1 -1
- package/lib/component/loader/DropZone.js +9 -1
- package/lib/component/modal/ExportAsMatrixModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib/component/reducer/Reducer.d.ts +20 -59
- package/lib/component/reducer/Reducer.js +24 -10
- package/lib/component/reducer/actions/DomainActions.js +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +12 -3
- package/lib/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib/component/reducer/actions/PeaksActions.js +7 -6
- package/lib/component/reducer/actions/PreferencesActions.js +18 -36
- package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
- package/lib/component/reducer/actions/RangesActions.js +20 -16
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +15 -28
- package/lib/component/reducer/actions/ZonesActions.js +9 -8
- package/lib/component/reducer/core/Constants.js +1 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/toolbar/BasicToolBar.js +8 -7
- package/lib/component/utility/FileUtility.d.ts +1 -8
- package/lib/component/utility/FileUtility.js +2 -17
- package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
- package/lib/component/utility/{Export.js → export.js} +27 -44
- package/lib/component/utility/formatNumber.d.ts +6 -1
- package/lib/component/utility/formatNumber.js +4 -3
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +4 -4
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +1 -2
- package/lib/data/SpectraManager.js +22 -55
- package/lib/data/data1d/filter1d/fft.js +21 -4
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
- package/lib/data/data2d/Spectrum2D/contours.js +132 -0
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Data2D.d.ts +2 -0
- package/lib/data/types/data2d/Datum2D.d.ts +0 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +16 -9
- package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
- package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
- package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
- package/lib-cjs/component/1d/ranges/Range.js +27 -50
- package/lib-cjs/component/1d/utilities/scale.js +2 -2
- package/lib-cjs/component/2d/Contours.js +60 -41
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +2 -2
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
- package/lib-cjs/component/elements/formik/FormikInput.js +8 -19
- package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
- package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useExport.js +6 -6
- package/lib-cjs/component/loader/DropZone.js +9 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib-cjs/component/reducer/Reducer.js +23 -9
- package/lib-cjs/component/reducer/actions/DomainActions.js +3 -2
- package/lib-cjs/component/reducer/actions/FiltersActions.js +12 -3
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +18 -36
- package/lib-cjs/component/reducer/actions/RangesActions.js +20 -16
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
- package/lib-cjs/component/reducer/actions/ToolsActions.js +15 -28
- package/lib-cjs/component/reducer/actions/ZonesActions.js +9 -8
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/toolbar/BasicToolBar.js +7 -6
- package/lib-cjs/component/utility/FileUtility.js +2 -18
- package/lib-cjs/component/utility/{Export.js → export.js} +51 -45
- package/lib-cjs/component/utility/formatNumber.js +4 -3
- package/lib-cjs/component/workspaces/exercise.js +4 -4
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +23 -57
- package/lib-cjs/data/data1d/filter1d/fft.js +20 -3
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
- package/lib/component/1d/IntegralResizable.js +0 -72
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
- package/lib/data/data1d/Data1DManager.d.ts +0 -3
- package/lib/data/data1d/Data1DManager.js +0 -98
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/data2d/Data2DManager.d.ts +0 -3
- package/lib/data/data2d/Data2DManager.js +0 -34
- package/lib/data/types/data2d/Contour.d.ts +0 -4
- package/lib/data/types/data2d/Contour.js +0 -1
- package/lib/data/types/data2d/Contours.d.ts +0 -2
- package/lib/data/types/data2d/Contours.js +0 -1
- package/lib-cjs/component/1d/IntegralResizable.js +0 -77
- package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
- package/lib-cjs/data/data1d/Data1DManager.js +0 -104
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/data2d/Data2DManager.js +0 -40
- package/lib-cjs/data/types/data2d/Contour.js +0 -2
- package/lib-cjs/data/types/data2d/Contours.js +0 -2
|
@@ -11,7 +11,7 @@ const GlobalContext_1 = require("../context/GlobalContext");
|
|
|
11
11
|
const Alert_1 = require("../elements/popup/Alert");
|
|
12
12
|
const Modal_1 = require("../elements/popup/Modal");
|
|
13
13
|
const SaveAsModal_1 = __importDefault(require("../modal/SaveAsModal"));
|
|
14
|
-
const
|
|
14
|
+
const export_1 = require("../utility/export");
|
|
15
15
|
function useExport() {
|
|
16
16
|
const { rootRef } = (0, GlobalContext_1.useGlobal)();
|
|
17
17
|
const modal = (0, Modal_1.useModal)();
|
|
@@ -21,7 +21,7 @@ function useExport() {
|
|
|
21
21
|
if (state.data.length > 0 && rootRef) {
|
|
22
22
|
const hideLoading = await alert.showLoading('Exporting as NMRium process in progress');
|
|
23
23
|
setTimeout(() => {
|
|
24
|
-
(0,
|
|
24
|
+
(0, export_1.copyPNGToClipboard)(rootRef, 'nmrSVG');
|
|
25
25
|
hideLoading();
|
|
26
26
|
alert.success('Image copied to clipboard');
|
|
27
27
|
}, 0);
|
|
@@ -35,7 +35,7 @@ function useExport() {
|
|
|
35
35
|
//exported file name by default will be the first spectrum name
|
|
36
36
|
const fileName = state.data[0]?.display?.name;
|
|
37
37
|
const exportedData = (0, SpectraManager_1.toJSON)(state, 'nmrium');
|
|
38
|
-
await (0,
|
|
38
|
+
await (0, export_1.exportAsJSON)(exportedData, fileName, spaceIndent, isCompressed);
|
|
39
39
|
hideLoading();
|
|
40
40
|
}
|
|
41
41
|
void handle();
|
|
@@ -47,7 +47,7 @@ function useExport() {
|
|
|
47
47
|
const hideLoading = await alert.showLoading('Exporting as SVG process in progress');
|
|
48
48
|
setTimeout(() => {
|
|
49
49
|
const fileName = state.data[0]?.display?.name;
|
|
50
|
-
(0,
|
|
50
|
+
(0, export_1.exportAsSVG)(rootRef, 'nmrSVG', fileName);
|
|
51
51
|
hideLoading();
|
|
52
52
|
}, 0);
|
|
53
53
|
}
|
|
@@ -57,7 +57,7 @@ function useExport() {
|
|
|
57
57
|
const hideLoading = await alert.showLoading('Exporting as PNG process in progress');
|
|
58
58
|
setTimeout(() => {
|
|
59
59
|
const fileName = state.data[0]?.display?.name;
|
|
60
|
-
(0,
|
|
60
|
+
(0, export_1.exportAsPng)(rootRef, 'nmrSVG', fileName);
|
|
61
61
|
hideLoading();
|
|
62
62
|
}, 0);
|
|
63
63
|
}
|
|
@@ -70,7 +70,7 @@ function useExport() {
|
|
|
70
70
|
void (async () => {
|
|
71
71
|
const exportedData = (0, SpectraManager_1.toJSON)(state, 'nmrium', dataExportOption);
|
|
72
72
|
const spaceIndent = pretty ? 2 : 0;
|
|
73
|
-
await (0,
|
|
73
|
+
await (0, export_1.exportAsJSON)(exportedData, name, spaceIndent, compressed);
|
|
74
74
|
hideLoading();
|
|
75
75
|
})();
|
|
76
76
|
}, 0);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
4
4
|
/** @jsxImportSource @emotion/react */
|
|
5
5
|
const react_1 = require("@emotion/react");
|
|
6
|
+
const filelist_utils_1 = require("filelist-utils");
|
|
6
7
|
const react_2 = require("react");
|
|
7
8
|
const react_dropzone_1 = require("react-dropzone");
|
|
8
9
|
const fa_1 = require("react-icons/fa");
|
|
@@ -50,7 +51,14 @@ function DropZone(props) {
|
|
|
50
51
|
files.forEach((file) => {
|
|
51
52
|
Object.defineProperty(file, 'webkitRelativePath', { value: file.path });
|
|
52
53
|
});
|
|
53
|
-
|
|
54
|
+
(0, filelist_utils_1.fileCollectionFromFileList)(files)
|
|
55
|
+
.then((fileCollection) => {
|
|
56
|
+
dispatch({ type: Types_1.LOAD_DROP_FILES, fileCollection });
|
|
57
|
+
})
|
|
58
|
+
.catch((e) => {
|
|
59
|
+
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: false });
|
|
60
|
+
reportError(e);
|
|
61
|
+
});
|
|
54
62
|
}, [dispatch]);
|
|
55
63
|
const onDrop = (0, react_2.useCallback)((droppedFiles) => {
|
|
56
64
|
dispatch({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
|
|
@@ -13,7 +13,7 @@ const Label_1 = __importDefault(require("../elements/Label"));
|
|
|
13
13
|
const FormikForm_1 = __importDefault(require("../elements/formik/FormikForm"));
|
|
14
14
|
const FormikInput_1 = __importDefault(require("../elements/formik/FormikInput"));
|
|
15
15
|
const Events_1 = __importDefault(require("../utility/Events"));
|
|
16
|
-
const
|
|
16
|
+
const export_1 = require("../utility/export");
|
|
17
17
|
const ModalStyle_1 = require("./ModalStyle");
|
|
18
18
|
const INITIAL_VALUE = { from: -1, to: 1, nbPoints: 1024 };
|
|
19
19
|
function ExportAsMatrixModal({ onClose = () => null, }) {
|
|
@@ -23,7 +23,7 @@ function ExportAsMatrixModal({ onClose = () => null, }) {
|
|
|
23
23
|
refForm.current.submitForm();
|
|
24
24
|
}, []);
|
|
25
25
|
const submitHandler = (0, react_1.useCallback)((options) => {
|
|
26
|
-
(0,
|
|
26
|
+
(0, export_1.exportAsMatrix)(data, options, 'fileName');
|
|
27
27
|
onClose();
|
|
28
28
|
}, [data, onClose]);
|
|
29
29
|
(0, react_1.useEffect)(() => {
|
|
@@ -21,7 +21,7 @@ const styles = {
|
|
|
21
21
|
color: 'red',
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
|
-
const EDIT_SIGNAL_INFO_TEXT = `Focus on an input field and press Shift + Drag
|
|
24
|
+
const EDIT_SIGNAL_INFO_TEXT = `Focus on an input field and press Shift + Drag and Drop to draw a coupling constant in spectrum view.`;
|
|
25
25
|
const ADD_SIGNAL_INFO_TEXT = `Focus on the input field and press Shift + Left mouse click to select new signal delta value in spectrum view.`;
|
|
26
26
|
const InfoText = (props) => {
|
|
27
27
|
const { value, type = 'info' } = props;
|
|
@@ -7,6 +7,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const Label_1 = __importDefault(require("../../elements/Label"));
|
|
8
8
|
const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
|
|
9
9
|
function GeneralTabContent() {
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "section-header", children: "Spectra" }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("p", { className: "section-header", children: "Spectra" }), (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) => value >= 0 && value <= 1, type: "number" }) })] }));
|
|
11
11
|
}
|
|
12
12
|
exports.default = GeneralTabContent;
|
|
@@ -39,6 +39,6 @@ function MoleculeHeader(props) {
|
|
|
39
39
|
const label = event.target.value;
|
|
40
40
|
dispatch({ type: Types_1.CHANGE_MOLECULE_LABEL, payload: { label, id } });
|
|
41
41
|
}, [dispatch]);
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: styles.toolbar, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)("span", { children: "Label" }), (0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event) })] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: styles.toolbar, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex' }, children: [(0, jsx_runtime_1.jsx)("span", { children: "Label" }), (0, jsx_runtime_1.jsx)(EditableColumn_1.default, { value: currentMolecule.label, style: styles.labelInput, validate: validateLabel, onSave: (event) => saveLabelHandler(currentMolecule.id, event), textOverFlowEllipses: true })] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(react_mf_1.MF, { mf: currentMolecule.mf }), " - ", currentMolecule.mw?.toFixed(2)] })] }));
|
|
43
43
|
}
|
|
44
44
|
exports.default = MoleculeHeader;
|
|
@@ -21,7 +21,7 @@ const Alert_1 = require("../../elements/popup/Alert");
|
|
|
21
21
|
const Modal_1 = require("../../elements/popup/Modal");
|
|
22
22
|
const PredictSpectraModal_1 = __importDefault(require("../../modal/PredictSpectraModal"));
|
|
23
23
|
const Types_1 = require("../../reducer/types/Types");
|
|
24
|
-
const
|
|
24
|
+
const export_1 = require("../../utility/export");
|
|
25
25
|
const toolbarStyle = (0, react_1.css) `
|
|
26
26
|
display: flex;
|
|
27
27
|
flex-direction: row;
|
|
@@ -72,17 +72,17 @@ function MoleculePanelHeader({ currentIndex, molecules, floatingMolecules, onMol
|
|
|
72
72
|
const saveAsSVGHandler = (0, react_2.useCallback)(() => {
|
|
73
73
|
if (!rootRef)
|
|
74
74
|
return;
|
|
75
|
-
(0,
|
|
75
|
+
(0, export_1.exportAsSVG)(rootRef, `molSVG${currentIndex}`, 'molFile');
|
|
76
76
|
}, [rootRef, currentIndex]);
|
|
77
77
|
const saveAsPNGHandler = (0, react_2.useCallback)(() => {
|
|
78
78
|
if (!rootRef)
|
|
79
79
|
return;
|
|
80
|
-
(0,
|
|
80
|
+
(0, export_1.copyPNGToClipboard)(rootRef, `molSVG${currentIndex}`);
|
|
81
81
|
alert.success('MOL copied as PNG to clipboard');
|
|
82
82
|
}, [rootRef, alert, currentIndex]);
|
|
83
83
|
const saveAsMolHandler = (0, react_2.useCallback)(() => {
|
|
84
84
|
if (molecules[currentIndex]) {
|
|
85
|
-
void (0,
|
|
85
|
+
void (0, export_1.copyTextToClipboard)(molecules[currentIndex].molfile).then((flag) => {
|
|
86
86
|
if (flag) {
|
|
87
87
|
alert.success('MOLFile copied to clipboard');
|
|
88
88
|
}
|
package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js
CHANGED
|
@@ -20,7 +20,7 @@ const Modal_1 = require("../../elements/popup/Modal");
|
|
|
20
20
|
const AlignSpectraModal_1 = __importDefault(require("../../modal/AlignSpectraModal"));
|
|
21
21
|
const Types_1 = require("../../reducer/types/Types");
|
|
22
22
|
const Events_1 = __importDefault(require("../../utility/Events"));
|
|
23
|
-
const
|
|
23
|
+
const export_1 = require("../../utility/export");
|
|
24
24
|
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
25
25
|
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
26
26
|
const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
|
|
@@ -62,7 +62,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectraAnalysis, }) {
|
|
|
62
62
|
const copyToClipboardHandler = (0, react_2.useCallback)(() => {
|
|
63
63
|
void (async () => {
|
|
64
64
|
const data = (0, MultipleAnalysis_1.getDataAsString)(spectraAnalysis, activeTab);
|
|
65
|
-
const success = await (0,
|
|
65
|
+
const success = await (0, export_1.copyTextToClipboard)(data);
|
|
66
66
|
if (success) {
|
|
67
67
|
alert.success('Data copied to clipboard');
|
|
68
68
|
}
|
|
@@ -41,7 +41,7 @@ function PeaksTable({ activeTab, data }) {
|
|
|
41
41
|
});
|
|
42
42
|
}, [modal, peaksPreferences]);
|
|
43
43
|
const saveDeltaPPMRefsHandler = (0, react_1.useCallback)((event, row) => {
|
|
44
|
-
const shiftValue = parseFloat(event.target.value) - parseFloat(row.
|
|
44
|
+
const shiftValue = parseFloat(event.target.value) - parseFloat(row.x);
|
|
45
45
|
dispatch({ type: Types_1.SHIFT_SPECTRUM, shiftValue });
|
|
46
46
|
}, [dispatch]);
|
|
47
47
|
const COLUMNS = (0, react_1.useMemo)(() => [
|
|
@@ -23,7 +23,7 @@ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
|
23
23
|
const CopyClipboardModal_1 = __importDefault(require("../../modal/CopyClipboardModal"));
|
|
24
24
|
const ChangeSumModal_1 = __importDefault(require("../../modal/changeSum/ChangeSumModal"));
|
|
25
25
|
const Types_1 = require("../../reducer/types/Types");
|
|
26
|
-
const
|
|
26
|
+
const export_1 = require("../../utility/export");
|
|
27
27
|
const formatNumber_1 = require("../../utility/formatNumber");
|
|
28
28
|
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
29
29
|
const useEditRangeModal_1 = __importDefault(require("./hooks/useEditRangeModal"));
|
|
@@ -98,7 +98,7 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
|
|
|
98
98
|
}, [dispatch, id]);
|
|
99
99
|
const saveToClipboardHandler = (0, react_2.useCallback)((value) => {
|
|
100
100
|
void (async () => {
|
|
101
|
-
const success = await (0,
|
|
101
|
+
const success = await (0, export_1.copyHTMLToClipboard)(value);
|
|
102
102
|
if (success) {
|
|
103
103
|
alert.success('Data copied to clipboard');
|
|
104
104
|
}
|
|
@@ -16,7 +16,7 @@ const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
|
16
16
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
17
17
|
const Reducer_1 = require("../../reducer/Reducer");
|
|
18
18
|
const Types_1 = require("../../reducer/types/Types");
|
|
19
|
-
const
|
|
19
|
+
const export_1 = require("../../utility/export");
|
|
20
20
|
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
21
21
|
const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
|
|
22
22
|
const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
|
|
@@ -79,7 +79,7 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
|
|
|
79
79
|
y: Array.from(re.slice(fromIndex, toIndex)),
|
|
80
80
|
...value,
|
|
81
81
|
};
|
|
82
|
-
const success = await (0,
|
|
82
|
+
const success = await (0, export_1.copyTextToClipboard)(JSON.stringify(dataToClipboard, undefined, 2));
|
|
83
83
|
if (success) {
|
|
84
84
|
alert.show('Data copied to clipboard');
|
|
85
85
|
}
|
|
@@ -20,7 +20,6 @@ const RelativeColumn_1 = __importDefault(require("./TableColumns/RelativeColumn"
|
|
|
20
20
|
const SignalAssignmentsColumn_1 = __importDefault(require("./TableColumns/SignalAssignmentsColumn"));
|
|
21
21
|
const SignalDeltaColumn_1 = __importDefault(require("./TableColumns/SignalDeltaColumn"));
|
|
22
22
|
const SignalDeltaHzColumn_1 = __importDefault(require("./TableColumns/SignalDeltaHzColumn"));
|
|
23
|
-
const format_1 = __importDefault(require("./TableColumns/format"));
|
|
24
23
|
const HighlightedRowStyle = (0, react_1.css) `
|
|
25
24
|
background-color: #ff6f0057;
|
|
26
25
|
`;
|
|
@@ -37,7 +36,6 @@ function RangesTableRow({ rowData, onUnlink, onContextMenu, preferences, info, }
|
|
|
37
36
|
const highlightData = (0, highlight_1.useHighlightData)();
|
|
38
37
|
const [unlinkRangeButtonVisibility, showUnlinkRangeButton] = (0, react_2.useState)(false);
|
|
39
38
|
const [unlinkSignalButtonVisibility, showUnlinkSignalButton] = (0, react_2.useState)(false);
|
|
40
|
-
const getFormat = (0, format_1.default)(preferences);
|
|
41
39
|
const rowSpanTags = (0, react_2.useMemo)(() => {
|
|
42
40
|
return {
|
|
43
41
|
rowSpan: rowData.tableMetaInfo.rowSpan,
|
|
@@ -115,6 +113,6 @@ function RangesTableRow({ rowData, onUnlink, onContextMenu, preferences, info, }
|
|
|
115
113
|
? ConstantlyHighlightedRowStyle
|
|
116
114
|
: null;
|
|
117
115
|
}, [assignmentRange.isActive, highlightRange.isActive, rowData]);
|
|
118
|
-
return ((0, jsx_runtime_1.jsxs)("tr", { onContextMenu: (e) => onContextMenu(e, rowData), css: trCss, children: [(0, jsx_runtime_1.jsx)("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 }), preferences.from.show && ((0, jsx_runtime_1.jsx)(RangeColumn_1.default, { value: rowData.from, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.from.format })), preferences.to.show && ((0, jsx_runtime_1.jsx)(RangeColumn_1.default, { value: rowData.to, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && ((0, jsx_runtime_1.jsx)(SignalDeltaColumn_1.default, { rowData: rowData, onHoverSignal: onHoverSignal, deltaPPMFormat: preferences.deltaPPM.format })), preferences.deltaHz.show && ((0, jsx_runtime_1.jsx)(SignalDeltaHzColumn_1.default, { rowData: rowData, onHoverSignal: onHoverSignal, deltaHzFormat: preferences.deltaHz.format, info: info })), preferences.relative.show && ((0, jsx_runtime_1.jsx)(RelativeColumn_1.default, { rowData: rowData, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && ((0, jsx_runtime_1.jsx)(AbsoluteColumn_1.default, { value: rowData.absolute, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format:
|
|
116
|
+
return ((0, jsx_runtime_1.jsxs)("tr", { onContextMenu: (e) => onContextMenu(e, rowData), css: trCss, children: [(0, jsx_runtime_1.jsx)("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 }), preferences.from.show && ((0, jsx_runtime_1.jsx)(RangeColumn_1.default, { value: rowData.from, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.from.format })), preferences.to.show && ((0, jsx_runtime_1.jsx)(RangeColumn_1.default, { value: rowData.to, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && ((0, jsx_runtime_1.jsx)(SignalDeltaColumn_1.default, { rowData: rowData, onHoverSignal: onHoverSignal, deltaPPMFormat: preferences.deltaPPM.format })), preferences.deltaHz.show && ((0, jsx_runtime_1.jsx)(SignalDeltaHzColumn_1.default, { rowData: rowData, onHoverSignal: onHoverSignal, deltaHzFormat: preferences.deltaHz.format, info: info })), preferences.relative.show && ((0, jsx_runtime_1.jsx)(RelativeColumn_1.default, { rowData: rowData, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && ((0, jsx_runtime_1.jsx)(AbsoluteColumn_1.default, { value: rowData.absolute, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.absolute.format })), (0, jsx_runtime_1.jsx)("td", { ...onHoverSignal, children: (0, get_1.default)(rowData, 'tableMetaInfo.signal.multiplicity', '') }), preferences.coupling.show && ((0, jsx_runtime_1.jsx)(CouplingColumn_1.default, { rowData: rowData, onHoverSignal: onHoverSignal, format: preferences.coupling.format })), (0, jsx_runtime_1.jsx)(SignalAssignmentsColumn_1.default, { rowData: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, unlinkVisibility: unlinkSignalButtonVisibility, onUnlinkVisibilityChange: (flag) => showUnlinkSignalButton(flag), onLink: linkHandler, onUnlink: unlinkHandler }), (0, jsx_runtime_1.jsx)(RangeAssignmentsColumn_1.default, { rowData: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, unlinkVisibility: unlinkRangeButtonVisibility, onUnlinkVisibilityChange: (flag) => showUnlinkRangeButton(flag), onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData }), (0, jsx_runtime_1.jsx)(ActionsColumn_1.default, { rowData: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind })] }));
|
|
119
117
|
}
|
|
120
118
|
exports.default = RangesTableRow;
|
|
@@ -14,8 +14,8 @@ const Tabs_1 = __importDefault(require("../../elements/Tab/Tabs"));
|
|
|
14
14
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
15
15
|
const Reducer_1 = require("../../reducer/Reducer");
|
|
16
16
|
const Types_1 = require("../../reducer/types/Types");
|
|
17
|
-
const Export_1 = require("../../utility/Export");
|
|
18
17
|
const GroupByInfoKey_1 = __importDefault(require("../../utility/GroupByInfoKey"));
|
|
18
|
+
const export_1 = require("../../utility/export");
|
|
19
19
|
const SpectrumListItem_1 = __importDefault(require("./SpectrumListItem"));
|
|
20
20
|
const SpectrumSetting_1 = __importDefault(require("./base/setting/SpectrumSetting"));
|
|
21
21
|
function SpectrumsTabsInner({ data, activeSpectrum, activeTab, onTabChange, }) {
|
|
@@ -75,7 +75,7 @@ function SpectrumsTabsInner({ data, activeSpectrum, activeTab, onTabChange, }) {
|
|
|
75
75
|
onClick: (spectrumData) => {
|
|
76
76
|
void (async () => {
|
|
77
77
|
const { x, y, info } = spectrumData;
|
|
78
|
-
const success = await (0,
|
|
78
|
+
const success = await (0, export_1.copyTextToClipboard)(JSON.stringify({ x, y, info }, undefined, 2));
|
|
79
79
|
if (success) {
|
|
80
80
|
alert.success('Data copied to clipboard');
|
|
81
81
|
}
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const FormikColorPicker_1 = __importDefault(require("../../../../elements/formik/FormikColorPicker"));
|
|
8
8
|
const FormikForm_1 = __importDefault(require("../../../../elements/formik/FormikForm"));
|
|
9
|
+
const FormikOnChange_1 = __importDefault(require("../../../../elements/formik/FormikOnChange"));
|
|
9
10
|
const Spectrum1DHistogram_1 = __importDefault(require("./Spectrum1DHistogram"));
|
|
10
11
|
function Spectrum1DSetting({ data: SpectrumData, onSubmit, }) {
|
|
11
|
-
return ((0, jsx_runtime_1.
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(FormikForm_1.default, { initialValues: SpectrumData.display, onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: '1.25rem' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'block', position: 'relative' }, children: (0, jsx_runtime_1.jsx)(FormikColorPicker_1.default, { name: "color" }) }), (0, jsx_runtime_1.jsx)(Spectrum1DHistogram_1.default, { color: "red", data: SpectrumData.data })] }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: onSubmit })] }));
|
|
12
13
|
}
|
|
13
14
|
exports.default = Spectrum1DSetting;
|
|
@@ -9,6 +9,7 @@ const react_1 = require("@emotion/react");
|
|
|
9
9
|
const FormikColorPicker_1 = __importDefault(require("../../../../elements/formik/FormikColorPicker"));
|
|
10
10
|
const FormikForm_1 = __importDefault(require("../../../../elements/formik/FormikForm"));
|
|
11
11
|
const FormikInput_1 = __importDefault(require("../../../../elements/formik/FormikInput"));
|
|
12
|
+
const FormikOnChange_1 = __importDefault(require("../../../../elements/formik/FormikOnChange"));
|
|
12
13
|
const FormikSlider_1 = __importDefault(require("../../../../elements/formik/FormikSlider"));
|
|
13
14
|
const Spectrum2DHistogram_1 = __importDefault(require("./Spectrum2DHistogram"));
|
|
14
15
|
const style = (color) => (0, react_1.css) `
|
|
@@ -19,6 +20,6 @@ const style = (color) => (0, react_1.css) `
|
|
|
19
20
|
`;
|
|
20
21
|
function Spectrum2DSetting({ data: SpectrumData, onSubmit, }) {
|
|
21
22
|
const { positiveColor, negativeColor } = SpectrumData.display;
|
|
22
|
-
return ((0, jsx_runtime_1.
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(FormikForm_1.default, { initialValues: SpectrumData.display, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { css: style(positiveColor), children: [(0, jsx_runtime_1.jsx)("span", { style: { padding: '0 10px' }, children: "Positive" }), (0, jsx_runtime_1.jsx)(FormikColorPicker_1.default, { name: "positiveColor" }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: '5px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "contour Levels [ min - max ]" }), (0, jsx_runtime_1.jsx)(FormikSlider_1.default, { name: "contourOptions.positive.contourLevels", debounceTime: 100 }), (0, jsx_runtime_1.jsx)("span", { className: "label", children: "number of Layers " }), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "contourOptions.positive.numberOfLayers", type: "number", debounceTime: 250 })] })] }), (0, jsx_runtime_1.jsxs)("div", { css: style(negativeColor), children: [(0, jsx_runtime_1.jsx)("span", { style: { padding: '0 10px' }, children: "Negative" }), (0, jsx_runtime_1.jsx)(FormikColorPicker_1.default, { name: "negativeColor" }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: '5px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "contour Levels [ min - max ]" }), (0, jsx_runtime_1.jsx)(FormikSlider_1.default, { name: "contourOptions.negative.contourLevels", debounceTime: 100 }), (0, jsx_runtime_1.jsx)("span", { className: "label", children: "number of Layers " }), (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "contourOptions.negative.numberOfLayers", type: "number", debounceTime: 250 })] })] }), (0, jsx_runtime_1.jsx)(Spectrum2DHistogram_1.default, { data: SpectrumData.data })] }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: onSubmit })] }));
|
|
23
24
|
}
|
|
24
25
|
exports.default = Spectrum2DSetting;
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processSnapPlot = void 0;
|
|
4
4
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
const calculateSanPlot_1 = require("../../../../../data/utilities/calculateSanPlot");
|
|
5
6
|
function processSnapPlot(dimension, data, yLogBase) {
|
|
6
|
-
const
|
|
7
|
-
? prepare1DData(data)
|
|
8
|
-
: prepare2DData(data);
|
|
9
|
-
const sanResult = (0, ml_spectra_processing_1.xNoiseSanPlot)(input);
|
|
7
|
+
const sanResult = (0, calculateSanPlot_1.calculateSanPlot)(dimension, data);
|
|
10
8
|
const sanPlot = {};
|
|
11
9
|
const lines = {};
|
|
12
10
|
for (let plotKey in sanResult.sanplot) {
|
|
@@ -21,27 +19,6 @@ function processSnapPlot(dimension, data, yLogBase) {
|
|
|
21
19
|
return { sanPlot, lines };
|
|
22
20
|
}
|
|
23
21
|
exports.processSnapPlot = processSnapPlot;
|
|
24
|
-
function prepare1DData(data) {
|
|
25
|
-
const length = data.re.length;
|
|
26
|
-
const jump = Math.floor(length / 307200) || 1;
|
|
27
|
-
const array = new Float64Array((length / jump) >> 0);
|
|
28
|
-
let index = 0;
|
|
29
|
-
for (let i = 0; i < array.length; i += jump) {
|
|
30
|
-
array[index++] = data.re[i];
|
|
31
|
-
}
|
|
32
|
-
return array;
|
|
33
|
-
}
|
|
34
|
-
function prepare2DData(data) {
|
|
35
|
-
let cols = data.z[0].length;
|
|
36
|
-
let rows = data.z.length;
|
|
37
|
-
let jump = Math.floor((cols * rows) / 204800) || 1;
|
|
38
|
-
const array = new Float64Array(((cols * rows) / jump) >> 0);
|
|
39
|
-
let index = 0;
|
|
40
|
-
for (let i = 0; i < array.length; i += jump) {
|
|
41
|
-
array[index++] = data.z[(i / rows) >> 0][i % rows];
|
|
42
|
-
}
|
|
43
|
-
return array;
|
|
44
|
-
}
|
|
45
22
|
function getLine(value, data, options) {
|
|
46
23
|
const { log10, abs } = Math;
|
|
47
24
|
const { yLogBase } = options;
|
|
@@ -35,10 +35,13 @@ class ColumnsHelper {
|
|
|
35
35
|
: this.defaultPreference[formatKey];
|
|
36
36
|
const { formatPrefix = '', formatSuffix = '', showPrefixSuffixCallback = () => true, } = options;
|
|
37
37
|
if (showPrefixSuffixCallback(row)) {
|
|
38
|
-
return (0, formatNumber_1.formatNumber)(row.original[columnKey], format,
|
|
38
|
+
return (0, formatNumber_1.formatNumber)(row.original[columnKey], format, {
|
|
39
|
+
prefix: formatPrefix,
|
|
40
|
+
suffix: formatSuffix,
|
|
41
|
+
});
|
|
39
42
|
}
|
|
40
43
|
else {
|
|
41
|
-
return (0, formatNumber_1.formatNumber)(row.original[columnKey], format
|
|
44
|
+
return (0, formatNumber_1.formatNumber)(row.original[columnKey], format);
|
|
42
45
|
}
|
|
43
46
|
});
|
|
44
47
|
}
|
|
@@ -29,7 +29,8 @@ const immer_1 = require("immer");
|
|
|
29
29
|
const nmr_correlation_1 = require("nmr-correlation");
|
|
30
30
|
const nmr_load_save_1 = require("nmr-load-save");
|
|
31
31
|
const PredictionManager_1 = require("../../data/PredictionManager");
|
|
32
|
-
const
|
|
32
|
+
const Spectrum1D_1 = require("../../data/data1d/Spectrum1D");
|
|
33
|
+
const Spectrum2D_1 = require("../../data/data2d/Spectrum2D");
|
|
33
34
|
const ChartContext_1 = require("../context/ChartContext");
|
|
34
35
|
const Constants_1 = require("../panels/SummaryPanel/CorrelationTable/Constants");
|
|
35
36
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
@@ -67,7 +68,6 @@ exports.zoneStateInit = {
|
|
|
67
68
|
const getInitialState = () => ({
|
|
68
69
|
actionType: '',
|
|
69
70
|
data: [],
|
|
70
|
-
contours: {},
|
|
71
71
|
tempData: null,
|
|
72
72
|
xDomain: [],
|
|
73
73
|
yDomain: [],
|
|
@@ -86,7 +86,7 @@ const getInitialState = () => ({
|
|
|
86
86
|
margin: {
|
|
87
87
|
top: 10,
|
|
88
88
|
right: 20,
|
|
89
|
-
bottom:
|
|
89
|
+
bottom: 50,
|
|
90
90
|
left: 0,
|
|
91
91
|
},
|
|
92
92
|
mode: 'RTL',
|
|
@@ -96,6 +96,9 @@ const getInitialState = () => ({
|
|
|
96
96
|
ranges: [],
|
|
97
97
|
zones: [],
|
|
98
98
|
spectra: { activeSpectra: {}, activeTab: '' },
|
|
99
|
+
zoom: {
|
|
100
|
+
levels: {},
|
|
101
|
+
},
|
|
99
102
|
},
|
|
100
103
|
verticalAlign: {
|
|
101
104
|
align: 'bottom',
|
|
@@ -160,23 +163,34 @@ function initState(state) {
|
|
|
160
163
|
}
|
|
161
164
|
exports.initState = initState;
|
|
162
165
|
function dispatchMiddleware(dispatch) {
|
|
163
|
-
|
|
166
|
+
let usedColors = { '1d': [], '2d': [] };
|
|
164
167
|
return (action) => {
|
|
165
168
|
switch (action.type) {
|
|
166
169
|
case types.INITIATE: {
|
|
167
170
|
if (action.payload) {
|
|
168
|
-
|
|
169
|
-
void
|
|
170
|
-
|
|
171
|
+
usedColors = { '1d': [], '2d': [] };
|
|
172
|
+
void (0, nmr_load_save_1.readNMRiumObject)(action.payload).then((data) => {
|
|
173
|
+
const { spectra: spectraIn } = data;
|
|
174
|
+
const spectra = [];
|
|
175
|
+
for (let spectrum of spectraIn) {
|
|
176
|
+
const { info } = spectrum;
|
|
177
|
+
if (info.dimension === 1) {
|
|
178
|
+
spectra.push((0, Spectrum1D_1.initiateDatum1D)(spectrum, usedColors));
|
|
179
|
+
}
|
|
180
|
+
else if (info.dimension === 2) {
|
|
181
|
+
spectra.push((0, Spectrum2D_1.initiateDatum2D)(spectrum, usedColors));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
action.payload = { ...data, usedColors, spectra };
|
|
171
185
|
dispatch(action);
|
|
172
186
|
});
|
|
173
187
|
}
|
|
174
188
|
break;
|
|
175
189
|
}
|
|
176
190
|
case types.LOAD_DROP_FILES: {
|
|
177
|
-
const {
|
|
191
|
+
const { fileCollection } = action;
|
|
178
192
|
action.usedColors = usedColors;
|
|
179
|
-
(0, nmr_load_save_1.read)(
|
|
193
|
+
(0, nmr_load_save_1.read)(fileCollection)
|
|
180
194
|
.then((data) => {
|
|
181
195
|
action.data = data;
|
|
182
196
|
dispatch(action);
|
|
@@ -9,12 +9,13 @@ const get1DDataXY_1 = require("../../../data/data1d/Spectrum1D/get1DDataXY");
|
|
|
9
9
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
10
10
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
11
11
|
const Constants_1 = require("../core/Constants");
|
|
12
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
12
13
|
function getActiveData(draft) {
|
|
13
14
|
let data = draft.data.filter((datum) => (0, nucleusToString_1.default)(datum.info.nucleus) === draft.view.spectra.activeTab &&
|
|
14
15
|
datum.info.dimension === 1);
|
|
15
16
|
// todo: refactor this
|
|
16
|
-
const activeSpectrum =
|
|
17
|
-
if (activeSpectrum) {
|
|
17
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
18
|
+
if (activeSpectrum?.id) {
|
|
18
19
|
const activeSpectrumIndex = data.findIndex((datum) => datum.id === activeSpectrum?.id);
|
|
19
20
|
if (activeSpectrumIndex !== -1) {
|
|
20
21
|
const isFid = data[activeSpectrumIndex].info.isFid || false;
|
|
@@ -137,7 +137,10 @@ function applyManualPhaseCorrectionFilter(draft, filterOptions) {
|
|
|
137
137
|
const { index } = activeSpectrum;
|
|
138
138
|
const { ph0, ph1 } = filterOptions;
|
|
139
139
|
FiltersManager.applyFilter(draft.data[index], [
|
|
140
|
-
{
|
|
140
|
+
{
|
|
141
|
+
name: Filters.phaseCorrection.id,
|
|
142
|
+
options: { ph0, ph1, absolute: false },
|
|
143
|
+
},
|
|
141
144
|
]);
|
|
142
145
|
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
143
146
|
draft.tempData = null;
|
|
@@ -148,7 +151,10 @@ function applyAbsoluteFilter(draft) {
|
|
|
148
151
|
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
149
152
|
const { index } = activeSpectrum;
|
|
150
153
|
FiltersManager.applyFilter(draft.data[index], [
|
|
151
|
-
{
|
|
154
|
+
{
|
|
155
|
+
name: Filters.phaseCorrection.id,
|
|
156
|
+
options: { absolute: true, ph0: 0, ph1: 0 },
|
|
157
|
+
},
|
|
152
158
|
]);
|
|
153
159
|
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
154
160
|
draft.tempData = null;
|
|
@@ -160,7 +166,10 @@ function applyAutoPhaseCorrectionFilter(draft) {
|
|
|
160
166
|
const { index } = activeSpectrum;
|
|
161
167
|
const { ph0, ph1 } = (0, autoPhaseCorrection_1.apply)(draft.data[index]);
|
|
162
168
|
FiltersManager.applyFilter(draft.data[index], [
|
|
163
|
-
{
|
|
169
|
+
{
|
|
170
|
+
name: Filters.phaseCorrection.id,
|
|
171
|
+
options: { ph0, ph1, absolute: false },
|
|
172
|
+
},
|
|
164
173
|
]);
|
|
165
174
|
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
166
175
|
draft.tempData = null;
|
|
@@ -9,11 +9,12 @@ const immer_1 = require("immer");
|
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
10
10
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
11
11
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
12
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
12
13
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
13
14
|
const DomainActions_1 = require("./DomainActions");
|
|
14
15
|
function handleChangeIntegralSum(draft, options) {
|
|
15
16
|
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
16
|
-
const activeSpectrum =
|
|
17
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
17
18
|
if (activeSpectrum?.id) {
|
|
18
19
|
const { index } = activeSpectrum;
|
|
19
20
|
const datum = data[index];
|
|
@@ -25,7 +26,7 @@ exports.handleChangeIntegralSum = handleChangeIntegralSum;
|
|
|
25
26
|
function addIntegral(draft, action) {
|
|
26
27
|
const { startX, endX } = action;
|
|
27
28
|
const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
28
|
-
const activeSpectrum =
|
|
29
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
29
30
|
const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
|
|
30
31
|
if (activeSpectrum?.id) {
|
|
31
32
|
const datum = data[activeSpectrum.index];
|
|
@@ -51,7 +52,7 @@ function addIntegral(draft, action) {
|
|
|
51
52
|
}
|
|
52
53
|
exports.addIntegral = addIntegral;
|
|
53
54
|
function deleteIntegral(draft, action) {
|
|
54
|
-
const activeSpectrum =
|
|
55
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
55
56
|
if (activeSpectrum) {
|
|
56
57
|
const state = (0, immer_1.original)(draft);
|
|
57
58
|
const { index } = activeSpectrum;
|
|
@@ -69,7 +70,7 @@ function deleteIntegral(draft, action) {
|
|
|
69
70
|
}
|
|
70
71
|
exports.deleteIntegral = deleteIntegral;
|
|
71
72
|
function changeIntegral(draft, action) {
|
|
72
|
-
const activeSpectrum =
|
|
73
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
73
74
|
const state = (0, immer_1.original)(draft);
|
|
74
75
|
const integral = action.payload.data;
|
|
75
76
|
if (activeSpectrum?.id) {
|
|
@@ -91,7 +92,7 @@ function changeIntegral(draft, action) {
|
|
|
91
92
|
}
|
|
92
93
|
exports.changeIntegral = changeIntegral;
|
|
93
94
|
function handleChangeIntegralsRelativeValue(draft, action) {
|
|
94
|
-
const activeSpectrum =
|
|
95
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
95
96
|
const data = action.payload.data;
|
|
96
97
|
if (activeSpectrum?.id) {
|
|
97
98
|
const { index } = activeSpectrum;
|
|
@@ -9,9 +9,10 @@ const immer_1 = require("immer");
|
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
10
10
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
11
11
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
12
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
12
13
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
13
14
|
function addPeak(draft, mouseCoordinates) {
|
|
14
|
-
const activeSpectrum =
|
|
15
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
15
16
|
const state = (0, immer_1.original)(draft);
|
|
16
17
|
if (activeSpectrum?.id && state) {
|
|
17
18
|
const { index } = activeSpectrum;
|
|
@@ -39,7 +40,7 @@ function addPeak(draft, mouseCoordinates) {
|
|
|
39
40
|
exports.addPeak = addPeak;
|
|
40
41
|
function addPeaks(draft, action) {
|
|
41
42
|
const state = (0, immer_1.original)(draft);
|
|
42
|
-
const activeSpectrum =
|
|
43
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
43
44
|
if (activeSpectrum) {
|
|
44
45
|
const { index } = activeSpectrum;
|
|
45
46
|
const datumOriginal = state.data[index];
|
|
@@ -63,7 +64,7 @@ function addPeaks(draft, action) {
|
|
|
63
64
|
}
|
|
64
65
|
exports.addPeaks = addPeaks;
|
|
65
66
|
function deletePeak(draft, peakData) {
|
|
66
|
-
const activeSpectrum =
|
|
67
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
67
68
|
if (activeSpectrum) {
|
|
68
69
|
const { index } = activeSpectrum;
|
|
69
70
|
const state = (0, immer_1.original)(draft);
|
|
@@ -79,7 +80,7 @@ function deletePeak(draft, peakData) {
|
|
|
79
80
|
exports.deletePeak = deletePeak;
|
|
80
81
|
function handleOptimizePeaks(draft, action) {
|
|
81
82
|
const { peaks } = action.payload;
|
|
82
|
-
const activeSpectrum =
|
|
83
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
83
84
|
if (activeSpectrum?.id) {
|
|
84
85
|
const { index } = activeSpectrum;
|
|
85
86
|
const datum = draft.data[index];
|
|
@@ -94,7 +95,7 @@ function handleOptimizePeaks(draft, action) {
|
|
|
94
95
|
}
|
|
95
96
|
exports.handleOptimizePeaks = handleOptimizePeaks;
|
|
96
97
|
function handleAutoPeakPicking(draft, autOptions) {
|
|
97
|
-
const activeSpectrum =
|
|
98
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
98
99
|
if (activeSpectrum?.id) {
|
|
99
100
|
draft.toolOptions.selectedTool = ToolTypes_1.options.zoom.id;
|
|
100
101
|
draft.toolOptions.selectedOptionPanel = null;
|
|
@@ -114,7 +115,7 @@ function handleAutoPeakPicking(draft, autOptions) {
|
|
|
114
115
|
exports.handleAutoPeakPicking = handleAutoPeakPicking;
|
|
115
116
|
function changePeakShapeHandler(draft, action) {
|
|
116
117
|
const { shape, id } = action.payload;
|
|
117
|
-
const activeSpectrum =
|
|
118
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
118
119
|
if (activeSpectrum?.id) {
|
|
119
120
|
const { index } = activeSpectrum;
|
|
120
121
|
const datum = draft.data[index];
|