nmrium 0.49.0 → 0.50.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/README.md +7 -7
- package/lib/component/1d/Chart1D.js +3 -1
- package/lib/component/1d/LinesSeries.js +1 -1
- package/lib/component/1d/SimilarityTree.d.ts +1 -0
- package/lib/component/1d/SimilarityTree.js +60 -0
- package/lib/component/1d/Viewer1D.js +9 -11
- package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -7
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +114 -125
- package/lib/component/1d/multiplicityTree/MultiplicityTrees.d.ts +1 -0
- package/lib/component/1d/multiplicityTree/MultiplicityTrees.js +23 -0
- package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +18 -0
- package/lib/component/1d/multiplicityTree/generateTreeNodes.js +66 -0
- package/lib/component/1d/ranges/Range.d.ts +1 -1
- package/lib/component/1d/ranges/Range.js +8 -9
- package/lib/component/elements/CloseButton.d.ts +2 -10
- package/lib/component/elements/CloseButton.js +3 -20
- package/lib/component/elements/CounterLabel.d.ts +3 -3
- package/lib/component/elements/CounterLabel.js +3 -4
- package/lib/component/elements/PreferencesButton.d.ts +2 -4
- package/lib/component/elements/PreferencesButton.js +3 -3
- package/lib/component/elements/ReactTable/ReactTable.js +5 -2
- package/lib/component/elements/SaveButton.d.ts +2 -11
- package/lib/component/elements/SaveButton.js +4 -19
- package/lib/component/elements/ToolBarButton.d.ts +2 -0
- package/lib/component/elements/ToolBarButton.js +5 -0
- package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
- package/lib/component/elements/ToolbarPopoverItem.js +10 -0
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
- package/lib/component/hooks/useSaveSettings.js +3 -2
- package/lib/component/main/InnerNMRiumContents.js +1 -1
- package/lib/component/modal/AboutPredictionModal.js +4 -8
- package/lib/component/modal/AboutSpectrumSimulationModal.js +4 -8
- package/lib/component/modal/CopyClipboardModal.js +2 -2
- package/lib/component/modal/EditPeakShapeModal.js +2 -2
- package/lib/component/modal/ExportAsJcampModal.d.ts +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +7 -3
- package/lib/component/modal/ImportPublicationStringModal.js +15 -11
- package/lib/component/modal/LoadJCAMPModal.js +12 -9
- package/lib/component/modal/LogsHistoryModal.d.ts +1 -1
- package/lib/component/modal/LogsHistoryModal.js +9 -4
- package/lib/component/modal/MoleculeStructureEditorModal.js +10 -3
- package/lib/component/modal/MultipletAnalysisModal.js +8 -8
- package/lib/component/modal/PredictSpectraModal.js +6 -5
- package/lib/component/modal/SaveAsModal.js +2 -2
- package/lib/component/modal/aboutUs/AboutUsModal.js +11 -26
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +4 -3
- package/lib/component/modal/changeSum/ChangeSumModal.js +10 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +1 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +9 -6
- package/lib/component/modal/editRange/EditRangeModal.js +8 -6
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +13 -10
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -0
- package/lib/component/modal/editZone/EditZoneModal.js +3 -3
- package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -2
- package/lib/component/modal/setting/GeneralSettings.js +17 -38
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +2 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +22 -25
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +5 -5
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +43 -13
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +71 -34
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +46 -5
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +40 -9
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +2 -2
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +2 -2
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +30 -19
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -28
- package/lib/component/panels/databasePanel/DatabasePanel.js +6 -6
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +4 -6
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +13 -14
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
- package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
- package/lib/component/panels/header/DefaultPanelHeader.js +30 -9
- package/lib/component/panels/header/PanelHeader.js +0 -1
- package/lib/component/panels/header/PreferencesHeader.d.ts +2 -4
- package/lib/component/panels/header/PreferencesHeader.js +9 -23
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +39 -10
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +3 -3
- package/lib/component/reducer/Reducer.js +3 -0
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +5 -1
- package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
- package/lib/component/toolbar/ToolBar.js +237 -9
- package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
- package/lib/component/toolbar/toolbarMenu.js +77 -0
- package/lib/component/utility/booleanToString.d.ts +6 -0
- package/lib/component/utility/booleanToString.js +4 -0
- package/lib/utils/clipboard/clipboardComponents.d.ts +2 -2
- package/lib/utils/clipboard/clipboardComponents.js +8 -3
- package/lib/versionInfo.js +1 -1
- package/package.json +17 -16
- package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
- package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
- package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
- package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
- package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
- package/lib/component/elements/DeleteButton.d.ts +0 -8
- package/lib/component/elements/DeleteButton.js +0 -6
- package/lib/component/elements/DropdownMenu.d.ts +0 -9
- package/lib/component/elements/DropdownMenu.js +0 -7
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -10
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -10
- package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
- package/lib/component/toolbar/BasicToolBar.js +0 -165
- package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
- package/lib/component/toolbar/FunctionToolBar.js +0 -148
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { SvgNmrIntegrate
|
|
4
|
+
import { SvgNmrIntegrate } from 'cheminfo-font';
|
|
5
5
|
import lodashGet from 'lodash/get';
|
|
6
6
|
import { useCallback, useMemo, useState, useRef, memo } from 'react';
|
|
7
7
|
import { ImLink } from 'react-icons/im';
|
|
8
8
|
import { useChartData } from '../../context/ChartContext';
|
|
9
9
|
import { useDispatch } from '../../context/DispatchContext';
|
|
10
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
11
|
-
import ToolTip from '../../elements/ToolTip/ToolTip';
|
|
12
10
|
import { useModal } from '../../elements/popup/Modal';
|
|
11
|
+
import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectrumIntegralsViewState';
|
|
13
12
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
14
13
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
|
|
14
|
+
import { booleanToString } from '../../utility/booleanToString';
|
|
15
15
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
16
|
-
import DefaultPanelHeader
|
|
16
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
17
17
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
18
18
|
import IntegralTable from './IntegralTable';
|
|
19
19
|
import IntegralsPreferences from './IntegralsPreferences';
|
|
20
|
-
import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectrumIntegralsViewState';
|
|
21
|
-
const style = css `
|
|
22
|
-
.sum-button {
|
|
23
|
-
width: 22px;
|
|
24
|
-
height: 22px;
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
button {
|
|
31
|
-
margin-right: 2px;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
20
|
function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
35
21
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
36
22
|
const dispatch = useDispatch();
|
|
@@ -93,21 +79,32 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
93
79
|
}
|
|
94
80
|
return [];
|
|
95
81
|
}, [filterIsActive, info.dimension, integrals, xDomain]);
|
|
96
|
-
const
|
|
82
|
+
const total = integrals?.values?.length || 0;
|
|
97
83
|
return (_jsxs("div", { css: [
|
|
98
84
|
tablePanelStyle,
|
|
99
|
-
style,
|
|
100
85
|
isFlipped &&
|
|
101
86
|
css `
|
|
102
87
|
th {
|
|
103
88
|
position: relative;
|
|
104
89
|
}
|
|
105
90
|
`,
|
|
106
|
-
], children: [!isFlipped && (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
91
|
+
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: filteredData?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', onSettingClick: settingsPanelHandler, leftButtons: [
|
|
92
|
+
{
|
|
93
|
+
component: (_jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integration", currentSum: currentSum, sumOptions: integrals?.options })),
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
icon: _jsx(ImLink, {}),
|
|
97
|
+
title: 'Fixed integration values',
|
|
98
|
+
onClick: toggleConstantSumHandler,
|
|
99
|
+
active: integrals?.options?.isSumConstant || false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
icon: _jsx(SvgNmrIntegrate, {}),
|
|
103
|
+
title: `${booleanToString(!showIntegralsValues)} integrals values`,
|
|
104
|
+
onClick: handleShowIntegralsValues,
|
|
105
|
+
active: showIntegralsValues,
|
|
106
|
+
},
|
|
107
|
+
] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, info: info, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
|
|
111
108
|
}
|
|
112
109
|
const MemoizedIntegralPanel = memo(IntegralPanelInner);
|
|
113
110
|
const emptyData = { integrals: {}, info: {} };
|
|
@@ -3,16 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
3
3
|
import { SvgNmrExportAsMatrix, SvgNmrMultipleAnalysis } from 'cheminfo-font';
|
|
4
4
|
import { Formik } from 'formik';
|
|
5
5
|
import { useRef } from 'react';
|
|
6
|
+
import { FaCheck } from 'react-icons/fa';
|
|
6
7
|
import * as yup from 'yup';
|
|
7
8
|
import { getMatrixFilters } from '../../../data/matrixGeneration';
|
|
8
9
|
import { useChartData } from '../../context/ChartContext';
|
|
9
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
10
11
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
11
12
|
import StyledButton from '../../elements/Button';
|
|
12
|
-
import Button from '../../elements/ButtonToolTip';
|
|
13
13
|
import { GroupPane } from '../../elements/GroupPane';
|
|
14
14
|
import Label from '../../elements/Label';
|
|
15
|
-
import SaveButton from '../../elements/SaveButton';
|
|
16
15
|
import ToggleButton from '../../elements/ToggleButton';
|
|
17
16
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
18
17
|
import FormikOnChange from '../../elements/formik/FormikOnChange';
|
|
@@ -83,7 +82,21 @@ function MatrixGenerationPanel() {
|
|
|
83
82
|
if (xDomain[0] === undefined || xDomain[1] === undefined) {
|
|
84
83
|
return null;
|
|
85
84
|
}
|
|
86
|
-
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, {
|
|
85
|
+
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { leftButtons: [
|
|
86
|
+
{
|
|
87
|
+
icon: _jsx(SvgNmrExportAsMatrix, {}),
|
|
88
|
+
title: 'Export spectra as a matrix',
|
|
89
|
+
onClick: handleExportAsMatrix,
|
|
90
|
+
},
|
|
91
|
+
], rightButtons: [
|
|
92
|
+
{
|
|
93
|
+
onClick: () => formRef.current?.submitForm(),
|
|
94
|
+
title: 'Signal processing',
|
|
95
|
+
id: 'save-button',
|
|
96
|
+
intent: 'success',
|
|
97
|
+
icon: _jsx(FaCheck, {}),
|
|
98
|
+
},
|
|
99
|
+
] }), _jsx("div", { className: "inner-container", children: _jsx(PreferencesContainer, { style: { backgroundColor: 'white' }, children: _jsx(Formik, { innerRef: formRef, onSubmit: handleSave, initialValues: matrixOptions, enableReinitialize: true, validationSchema: schema, children: _jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Filters", style: GroupPanelStyle, renderHeader: (text) => (_jsx(FiltersPanelGroupHeader, { text: text, onAdd: handleAddFilter })), children: _jsx(FiltersOptions, {}) }), _jsx(GroupPane, { style: GroupPanelStyle, text: "Exclusions zones", renderHeader: (text) => (_jsx(ExclusionZonesGroupHeader, { text: text })), children: _jsx(ExclusionsZonesTable, {}) }), _jsxs(GroupPane, { text: "More options", style: GroupPanelStyle, children: [_jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "range.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { container: { paddingLeft: '10px' } }, children: _jsx(FormikInput, { name: "range.to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of points", style: {
|
|
87
100
|
...labelStyle,
|
|
88
101
|
wrapper: {},
|
|
89
102
|
container: { paddingTop: '10px' },
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { FaCopy, FaDownload, FaFileExport, FaFileImage, FaPaste, FaPlus, FaRegTrashAlt, } from 'react-icons/fa';
|
|
5
5
|
import { IoOpenOutline } from 'react-icons/io5';
|
|
6
|
+
import { Toolbar } from 'react-science/ui';
|
|
6
7
|
import { getMolecules } from '../../../data/molecules/MoleculeManager';
|
|
7
8
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
8
9
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
9
10
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
10
11
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
12
|
import { useGlobal } from '../../context/GlobalContext';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { DropdownMenu } from '../../elements/DropdownMenu';
|
|
13
|
+
import { PreferencesButton } from '../../elements/PreferencesButton';
|
|
14
|
+
import { ToolbarPopoverItem, } from '../../elements/ToolbarPopoverItem';
|
|
15
15
|
import { useAlert } from '../../elements/popup/Alert';
|
|
16
16
|
import AboutPredictionModal from '../../modal/AboutPredictionModal';
|
|
17
17
|
import PredictSpectraModal from '../../modal/PredictSpectraModal';
|
|
@@ -154,5 +154,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
const hasMolecules = molecules && molecules.length > 0;
|
|
157
|
-
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (
|
|
157
|
+
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), _jsxs(Toolbar, { children: [renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(ToolbarPopoverItem, { options: MOL_EXPORT_MENU, onClick: exportHandler, disabled: !hasMolecules, title: "Export As", icon: _jsx(FaFileExport, {}) }), _jsx(Toolbar.Item, { title: "Paste molfile", icon: _jsx(FaPaste, {}), onClick: handlePasteMolfileAction }), _jsx(Toolbar.Item, { title: "Add molecule", icon: _jsx(FaPlus, {}), onClick: onOpenMoleculeEditor })] })), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { title: "Delete molecule", icon: _jsx(FaRegTrashAlt, {}), onClick: handleDelete, disabled: !hasMolecules }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(Toolbar.Item, { title: "Float molecule", icon: _jsx(IoOpenOutline, {}), onClick: floatMoleculeHandler, active: moleculesView?.[moleculeKey]?.floating.visible || false, disabled: !hasMolecules }), _jsx(Toolbar.Item, { title: "Show atom number", icon: _jsx("p", { style: styles.atomLabel, children: "#" }), onClick: showAtomNumbersHandler, active: moleculesView?.[moleculeKey]?.showAtomNumber || false, disabled: !hasMolecules })] }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(PreferencesButton, { title: "Preferences", onClick: onClickPreferences })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
|
|
158
158
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { SvgNmrFt } from 'cheminfo-font';
|
|
4
|
+
import { SvgNmrFt, SvgNmrPeaks, SvgNmrPeaksTopLabels } from 'cheminfo-font';
|
|
5
5
|
import SvgPeaks from 'cheminfo-font/lib-react-cjs/lib-react-tsx/nmr/Peaks';
|
|
6
6
|
import { useCallback, useMemo, useState, useRef, memo } from 'react';
|
|
7
7
|
import { FaThinkPeaks } from 'react-icons/fa';
|
|
@@ -9,20 +9,18 @@ import isInRange from '../../../data/utilities/isInRange';
|
|
|
9
9
|
import { useChartData } from '../../context/ChartContext';
|
|
10
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
11
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
12
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
13
|
-
import Button from '../../elements/Button';
|
|
14
12
|
import { useAlert } from '../../elements/popup/Alert';
|
|
15
13
|
import { useModal } from '../../elements/popup/Modal';
|
|
16
14
|
import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
|
|
17
15
|
import useCheckExperimentalFeature from '../../hooks/useCheckExperimentalFeature';
|
|
18
16
|
import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
|
|
19
17
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
18
|
+
import { booleanToString } from '../../utility/booleanToString';
|
|
20
19
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
21
|
-
import DefaultPanelHeader
|
|
20
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
22
21
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
23
22
|
import PeaksPreferences from './PeaksPreferences';
|
|
24
23
|
import PeaksTable from './PeaksTable';
|
|
25
|
-
import { PeaksToggleActions } from './PeaksToggleActions';
|
|
26
24
|
function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
27
25
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
28
26
|
const [isFlipped, setFlipStatus] = useState(false);
|
|
@@ -90,8 +88,44 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
90
88
|
function toggleDisplayingMode() {
|
|
91
89
|
dispatch({ type: 'TOGGLE_PEAKS_DISPLAYING_MODE' });
|
|
92
90
|
}
|
|
93
|
-
const
|
|
94
|
-
const
|
|
91
|
+
const total = peaks?.values?.length || 0;
|
|
92
|
+
const disabled = !peaks?.values || peaks.values.length === 0;
|
|
93
|
+
const { showPeaks, displayingMode, showPeaksShapes, showPeaksSum } = peaksViewState;
|
|
94
|
+
const leftButtons = [
|
|
95
|
+
{
|
|
96
|
+
disabled,
|
|
97
|
+
icon: _jsx(SvgNmrPeaks, {}),
|
|
98
|
+
title: `${booleanToString(!showPeaks)} peaks`,
|
|
99
|
+
onClick: () => toggleViewProperty('showPeaks'),
|
|
100
|
+
active: showPeaks,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
disabled,
|
|
104
|
+
icon: _jsx(SvgNmrPeaksTopLabels, {}),
|
|
105
|
+
title: `${displayingMode === 'spread' ? 'Single' : 'Spread'} mode`,
|
|
106
|
+
onClick: toggleDisplayingMode,
|
|
107
|
+
active: displayingMode === 'spread',
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
if (isExperimental) {
|
|
111
|
+
leftButtons.unshift({
|
|
112
|
+
disabled,
|
|
113
|
+
icon: _jsx(SvgPeaks, {}),
|
|
114
|
+
title: `${booleanToString(!showPeaksShapes)} peaks shapes`,
|
|
115
|
+
onClick: () => toggleViewProperty('showPeaksShapes'),
|
|
116
|
+
active: showPeaksShapes,
|
|
117
|
+
}, {
|
|
118
|
+
disabled,
|
|
119
|
+
icon: _jsx(SvgNmrFt, {}),
|
|
120
|
+
title: `${booleanToString(!showPeaksSum)} peaks sum`,
|
|
121
|
+
onClick: () => toggleViewProperty('showPeaksSum'),
|
|
122
|
+
active: showPeaksSum,
|
|
123
|
+
}, {
|
|
124
|
+
icon: _jsx(FaThinkPeaks, {}),
|
|
125
|
+
title: 'Optimize peaks',
|
|
126
|
+
onClick: optimizePeaksHandler,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
95
129
|
return (_jsxs("div", { css: [
|
|
96
130
|
tablePanelStyle,
|
|
97
131
|
isFlipped &&
|
|
@@ -103,11 +137,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
103
137
|
}
|
|
104
138
|
}
|
|
105
139
|
`,
|
|
106
|
-
], children: [!isFlipped && (
|
|
107
|
-
? 'Hide peaks shapes'
|
|
108
|
-
: 'Show peaks shapes', popupPlacement: "right", onClick: () => toggleViewProperty('showPeaksShapes'), disabled: disbale, value: peaksViewState.showPeaksShapes, children: _jsx(SvgPeaks, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { style: { marginLeft: '2px', marginRight: '2px' }, popupTitle: peaksViewState.showPeaksSum
|
|
109
|
-
? 'Hide peaks sum'
|
|
110
|
-
: 'Show peaks sum', popupPlacement: "right", onClick: () => toggleViewProperty('showPeaksSum'), disabled: disbale, value: peaksViewState.showPeaksSum, children: _jsx(SvgNmrFt, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(Button.BarButton, { onClick: optimizePeaksHandler, toolTip: "Optimize peaks", tooltipOrientation: "horizontal", children: _jsx(FaThinkPeaks, {}) })] })), _jsx(PeaksToggleActions, { disbale: disbale, showPeaks: peaksViewState.showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), displayingMode: peaksViewState.displayingMode, onDisplayingModeToggle: toggleDisplayingMode })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(PeaksTable, { data: filteredPeaks, info: info, activeTab: activeTab })) : (_jsx(PeaksPreferences, { ref: settingRef })) })] }));
|
|
140
|
+
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: filteredPeaks?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Peaks", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all peaks' : 'Hide peaks out of view', onSettingClick: settingsPanelHandler, leftButtons: leftButtons })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(PeaksTable, { data: filteredPeaks, info: info, activeTab: activeTab })) : (_jsx(PeaksPreferences, { ref: settingRef })) })] }));
|
|
111
141
|
}
|
|
112
142
|
const MemoizedPeaksPanel = memo(PeaksPanelInner);
|
|
113
143
|
const emptyData = { peaks: null, info: {} };
|
|
@@ -7,5 +7,5 @@ declare function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSet
|
|
|
7
7
|
isFilterActive: any;
|
|
8
8
|
filterCounter: any;
|
|
9
9
|
activeTab: any;
|
|
10
|
-
}): import("
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default RangesHeader;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { SvgNmrIntegrate, SvgNmrSum } from 'cheminfo-font';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SvgNmrIntegrate, SvgNmrPeaks, SvgNmrPeaksTopLabels, } from 'cheminfo-font';
|
|
5
3
|
import lodashGet from 'lodash/get';
|
|
6
4
|
import { rangesToACS } from 'nmr-processing';
|
|
7
5
|
import { FaFileExport, FaUnlink, FaSitemap, FaChartBar } from 'react-icons/fa';
|
|
@@ -10,34 +8,14 @@ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardCompon
|
|
|
10
8
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
11
9
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
12
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
13
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
14
|
-
import Button from '../../elements/ButtonToolTip';
|
|
15
11
|
import { useAlert } from '../../elements/popup/Alert';
|
|
16
12
|
import { useModal } from '../../elements/popup/Modal';
|
|
17
13
|
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
18
14
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
19
15
|
import CopyClipboardModal from '../../modal/CopyClipboardModal';
|
|
20
16
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
|
|
21
|
-
import {
|
|
22
|
-
import DefaultPanelHeader
|
|
23
|
-
const style = css `
|
|
24
|
-
.btn {
|
|
25
|
-
background-color: transparent;
|
|
26
|
-
border: none;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.icon svg {
|
|
30
|
-
font-size: 12px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.preview-publication-icon svg {
|
|
34
|
-
font-size: 13px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
button {
|
|
38
|
-
margin-right: 2px;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
17
|
+
import { booleanToString } from '../../utility/booleanToString';
|
|
18
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
41
19
|
function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, activeTab, }) {
|
|
42
20
|
const dispatch = useDispatch();
|
|
43
21
|
const modal = useModal();
|
|
@@ -128,13 +106,72 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
128
106
|
dispatch({ type: 'TOGGLE_RANGES_PEAKS_DISPLAYING_MODE' });
|
|
129
107
|
}
|
|
130
108
|
const hasRanges = Array.isArray(ranges?.values) && ranges.values.length > 0;
|
|
131
|
-
const
|
|
132
|
-
return (_jsxs("div", {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
109
|
+
const total = ranges?.values?.length || 0;
|
|
110
|
+
return (_jsxs("div", { children: [_jsx(DefaultPanelHeader, { total: total, counter: filterCounter, onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', onSettingClick: onSettingClick, leftButtons: [
|
|
111
|
+
{
|
|
112
|
+
disabled: !hasRanges,
|
|
113
|
+
icon: _jsx(FaFileExport, {}),
|
|
114
|
+
title: 'Preview publication string',
|
|
115
|
+
onClick: saveAsHTMLHandler,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
component: (_jsx(ChangeSumModal, { onSave: changeRangesSumHandler, sumType: "ranges", currentSum: currentSum, sumOptions: ranges?.options })),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
disabled: !hasRanges,
|
|
122
|
+
icon: _jsx(FaUnlink, {}),
|
|
123
|
+
title: 'Remove all assignments',
|
|
124
|
+
onClick: handleOnRemoveAssignments,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
disabled: !hasRanges,
|
|
128
|
+
icon: _jsx(FaSitemap, {}),
|
|
129
|
+
title: `${booleanToString(!showMultiplicityTrees)} multiplicity trees in spectrum`,
|
|
130
|
+
onClick: handleSetShowMultiplicityTrees,
|
|
131
|
+
active: showMultiplicityTrees,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
disabled: !hasRanges,
|
|
135
|
+
icon: _jsx(FaChartBar, {}),
|
|
136
|
+
title: `${booleanToString(!showJGraph)} J Graph`,
|
|
137
|
+
onClick: handleShowJGraph,
|
|
138
|
+
active: showJGraph,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
disabled: !hasRanges,
|
|
142
|
+
icon: _jsx(SvgNmrIntegrate, {}),
|
|
143
|
+
title: `${booleanToString(!showIntegrals)} integrals`,
|
|
144
|
+
onClick: handleShowIntegrals,
|
|
145
|
+
active: showIntegrals,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
disabled: !hasRanges,
|
|
149
|
+
icon: _jsx(SvgNmrIntegrate, {}),
|
|
150
|
+
title: `${booleanToString(!showIntegralsValues)} integrals values`,
|
|
151
|
+
onClick: handleShowIntegralsValues,
|
|
152
|
+
active: showIntegralsValues,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
icon: _jsx(ImLink, {}),
|
|
156
|
+
title: 'Fixed integration sum',
|
|
157
|
+
onClick: changeSumConstantFlagHandler,
|
|
158
|
+
active: ranges?.options?.isSumConstant,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'ranges-toggle-peaks',
|
|
162
|
+
disabled: !hasRanges,
|
|
163
|
+
icon: _jsx(SvgNmrPeaks, {}),
|
|
164
|
+
title: `${booleanToString(!showPeaks)} peaks`,
|
|
165
|
+
onClick: () => toggleViewProperty('showPeaks'),
|
|
166
|
+
active: showPeaks,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
disabled: !hasRanges,
|
|
170
|
+
icon: _jsx(SvgNmrPeaksTopLabels, {}),
|
|
171
|
+
title: `${displayingMode === 'spread' ? 'Single' : 'Spread'} mode`,
|
|
172
|
+
onClick: toggleDisplayingMode,
|
|
173
|
+
active: displayingMode === 'spread',
|
|
174
|
+
},
|
|
175
|
+
] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
|
|
139
176
|
}
|
|
140
177
|
export default RangesHeader;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SvgNmrSameTop, SvgNmrResetScale } from 'cheminfo-font';
|
|
3
3
|
import { memo, useCallback } from 'react';
|
|
4
4
|
import { FaCreativeCommonsSamplingPlus, FaEye, FaEyeSlash, } from 'react-icons/fa';
|
|
5
5
|
import { IoColorPaletteOutline } from 'react-icons/io5';
|
|
6
6
|
import { useChartData } from '../../context/ChartContext';
|
|
7
7
|
import { useDispatch } from '../../context/DispatchContext';
|
|
8
|
-
import Button from '../../elements/Button';
|
|
9
8
|
import { useAlert } from '../../elements/popup/Alert';
|
|
10
9
|
import { useModal } from '../../elements/popup/Modal';
|
|
11
10
|
import { useActiveSpectra } from '../../hooks/useActiveSpectra';
|
|
12
11
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
13
12
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
14
|
-
import DefaultPanelHeader
|
|
13
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
15
14
|
import { SpectraAutomaticPickingButton } from '../header/SpectraAutomaticPickingButton';
|
|
16
15
|
function getMissingProjection(SpectrumsData, activeTab) {
|
|
17
16
|
let nucleus = activeTab.split(',');
|
|
@@ -73,7 +72,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
73
72
|
function resetScaleHandler() {
|
|
74
73
|
dispatch({ type: 'RESET_SPECTRA_SCALE' });
|
|
75
74
|
}
|
|
76
|
-
function
|
|
75
|
+
function reColorSpectraHandler() {
|
|
77
76
|
dispatch({
|
|
78
77
|
type: 'RECOLOR_SPECTRA_COLOR',
|
|
79
78
|
payload: {},
|
|
@@ -81,7 +80,49 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
81
80
|
}
|
|
82
81
|
const hasActiveSpectra = activeSpectra && activeSpectra?.length > 0;
|
|
83
82
|
const spectraLengthPerTab = getSpectraByNucleus(activeTab, data)?.length;
|
|
84
|
-
|
|
83
|
+
let leftButtons = [
|
|
84
|
+
{
|
|
85
|
+
disabled: !hasActiveSpectra,
|
|
86
|
+
icon: _jsx(FaEyeSlash, {}),
|
|
87
|
+
title: 'Hide selected spectra',
|
|
88
|
+
onClick: hideAllSpectrumsHandler,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
disabled: !hasActiveSpectra,
|
|
92
|
+
icon: _jsx(FaEye, {}),
|
|
93
|
+
title: 'Show selected spectra',
|
|
94
|
+
onClick: showAllSpectrumsHandler,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
if (displayerMode === '2D' && activeSpectrum?.info.isFt) {
|
|
98
|
+
leftButtons.push({
|
|
99
|
+
icon: _jsx(FaCreativeCommonsSamplingPlus, {}),
|
|
100
|
+
title: 'Add missing projection',
|
|
101
|
+
onClick: addMissingProjectionHandler,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (displayerMode === '1D' && spectraLengthPerTab > 1) {
|
|
105
|
+
leftButtons.push({
|
|
106
|
+
icon: _jsx(SvgNmrResetScale, {}),
|
|
107
|
+
title: 'Reset scale',
|
|
108
|
+
onClick: resetScaleHandler,
|
|
109
|
+
}, {
|
|
110
|
+
icon: _jsx(SvgNmrSameTop, {}),
|
|
111
|
+
title: 'Same top',
|
|
112
|
+
onClick: setSameTopHandler,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
leftButtons = leftButtons.concat([
|
|
116
|
+
{
|
|
117
|
+
component: _jsx(SpectraAutomaticPickingButton, {}),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
icon: _jsx(IoColorPaletteOutline, {}),
|
|
121
|
+
title: 'Recolor spectra',
|
|
122
|
+
onClick: reColorSpectraHandler,
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
125
|
+
return (_jsx(DefaultPanelHeader, { onDelete: handleDelete, total: data?.length, counter: spectraLengthPerTab, deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, onSettingClick: onSettingClick, leftButtons: leftButtons }));
|
|
85
126
|
}
|
|
86
127
|
const MemoizedSpectraPanelHeader = memo(SpectraPanelHeaderInner);
|
|
87
128
|
export default function SpectrumsTabs({ onSettingClick, }) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { saveAs } from 'file-saver';
|
|
2
3
|
import lodashGet from 'lodash/get';
|
|
3
4
|
import { useMemo, useCallback, useState } from 'react';
|
|
4
5
|
import { FaCopy, FaRegTrashAlt, FaFileExport } from 'react-icons/fa';
|
|
5
6
|
import { IoColorPaletteOutline } from 'react-icons/io5';
|
|
7
|
+
import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
|
|
6
8
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
7
9
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
8
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
@@ -42,6 +44,8 @@ var SpectraContextMenuOptionsKeys;
|
|
|
42
44
|
SpectraContextMenuOptionsKeys["CopyToClipboard"] = "CopyToClipboard";
|
|
43
45
|
SpectraContextMenuOptionsKeys["Delete"] = "Delete";
|
|
44
46
|
SpectraContextMenuOptionsKeys["ExportAsJcamp"] = "ExportAsJcamp";
|
|
47
|
+
SpectraContextMenuOptionsKeys["ExportAsText"] = "ExportAsText";
|
|
48
|
+
SpectraContextMenuOptionsKeys["CopyAsText"] = "CopyAsText";
|
|
45
49
|
})(SpectraContextMenuOptionsKeys || (SpectraContextMenuOptionsKeys = {}));
|
|
46
50
|
const Spectra2DContextMenuOptions = [
|
|
47
51
|
{
|
|
@@ -54,11 +58,6 @@ const Spectra2DContextMenuOptions = [
|
|
|
54
58
|
icon: _jsx(FaRegTrashAlt, {}),
|
|
55
59
|
data: { id: SpectraContextMenuOptionsKeys.Delete },
|
|
56
60
|
},
|
|
57
|
-
{
|
|
58
|
-
text: 'Export as JCAMP-DX',
|
|
59
|
-
icon: _jsx(FaFileExport, {}),
|
|
60
|
-
data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
|
|
61
|
-
},
|
|
62
61
|
];
|
|
63
62
|
const Spectra1DContextMenuOptions = [
|
|
64
63
|
...Spectra2DContextMenuOptions,
|
|
@@ -67,6 +66,16 @@ const Spectra1DContextMenuOptions = [
|
|
|
67
66
|
icon: _jsx(FaFileExport, {}),
|
|
68
67
|
data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
|
|
69
68
|
},
|
|
69
|
+
{
|
|
70
|
+
text: 'Export as text',
|
|
71
|
+
icon: _jsx(FaFileExport, {}),
|
|
72
|
+
data: { id: SpectraContextMenuOptionsKeys.ExportAsText },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
text: 'Copy as text',
|
|
76
|
+
icon: _jsx(FaCopy, {}),
|
|
77
|
+
data: { id: SpectraContextMenuOptionsKeys.CopyAsText },
|
|
78
|
+
},
|
|
70
79
|
];
|
|
71
80
|
export function SpectraTable(props) {
|
|
72
81
|
const { data, activeSpectra, onChangeVisibility, onOpenSettingModal, onChangeActiveSpectrum, nucleus, } = props;
|
|
@@ -75,6 +84,7 @@ export function SpectraTable(props) {
|
|
|
75
84
|
const spectraPreferences = usePanelPreferences('spectra', nucleus);
|
|
76
85
|
const activeSpectraObj = getActiveSpectraAsObject(activeSpectra);
|
|
77
86
|
const [exportedSpectrum, setExportedSpectrum] = useState();
|
|
87
|
+
const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = useClipboard();
|
|
78
88
|
const COLUMNS = useMemo(() => ({
|
|
79
89
|
visible: {
|
|
80
90
|
id: 'hide-show-spectrum',
|
|
@@ -104,7 +114,6 @@ export function SpectraTable(props) {
|
|
|
104
114
|
},
|
|
105
115
|
},
|
|
106
116
|
}), [onChangeVisibility, onOpenSettingModal]);
|
|
107
|
-
const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = useClipboard();
|
|
108
117
|
const selectContextMenuHandler = useCallback((option, spectrum) => {
|
|
109
118
|
const { id } = option;
|
|
110
119
|
switch (id) {
|
|
@@ -126,6 +135,17 @@ export function SpectraTable(props) {
|
|
|
126
135
|
setExportedSpectrum(spectrum);
|
|
127
136
|
break;
|
|
128
137
|
}
|
|
138
|
+
case SpectraContextMenuOptionsKeys.ExportAsText: {
|
|
139
|
+
const data = convertSpectrumToText(spectrum);
|
|
140
|
+
const blob = new Blob([data], { type: 'text/plain' });
|
|
141
|
+
saveAs(blob, `${spectrum.info.name}.tsv`);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case SpectraContextMenuOptionsKeys.CopyAsText: {
|
|
145
|
+
const data = convertSpectrumToText(spectrum);
|
|
146
|
+
void rawWriteWithType(data, 'text/plain').then(() => alert.success('Spectrum copied to clipboard'));
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
129
149
|
default: {
|
|
130
150
|
break;
|
|
131
151
|
}
|
|
@@ -192,9 +212,10 @@ export function SpectraTable(props) {
|
|
|
192
212
|
activated: { opacity: 1 },
|
|
193
213
|
};
|
|
194
214
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
215
|
+
const contextMenu = nucleus.split(',').length === 1
|
|
216
|
+
? Spectra1DContextMenuOptions
|
|
217
|
+
: Spectra2DContextMenuOptions;
|
|
218
|
+
return (_jsxs(_Fragment, { children: [_jsx(ReactTable, { rowStyle: handleRowStyle, activeRow: handleActiveRow, data: data, columns: tableColumns, onClick: (e, data) => onChangeActiveSpectrum(e, data.original), enableVirtualScroll: true, approxItemHeight: 24, contextMenu: contextMenu, onContextMenuSelect: selectContextMenuHandler, onSortEnd: handleSortEnd, style: { 'table td': { paddingTop: 0, paddingBottom: 0 } } }), exportedSpectrum && (_jsx(ExportAsJcampModal, { spectrum: exportedSpectrum, closeDialog: () => {
|
|
198
219
|
setExportedSpectrum(null);
|
|
199
220
|
} })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra" })] }));
|
|
200
221
|
}
|
|
@@ -214,3 +235,13 @@ const ColumnHeader = ({ label, col, }) => {
|
|
|
214
235
|
textOverflow: 'ellipsis',
|
|
215
236
|
}, children: label }));
|
|
216
237
|
};
|
|
238
|
+
function convertSpectrumToText(spectrum) {
|
|
239
|
+
if (!isSpectrum1D(spectrum))
|
|
240
|
+
return '';
|
|
241
|
+
const { data: { x, re }, } = spectrum;
|
|
242
|
+
const lines = ['x\ty'];
|
|
243
|
+
for (let i = 0; i < x.length; i++) {
|
|
244
|
+
lines.push(`${x[i]}\t${re[i]}`);
|
|
245
|
+
}
|
|
246
|
+
return lines.join('\n');
|
|
247
|
+
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { getLinkDim } from 'nmr-correlation';
|
|
5
5
|
import { useCallback, useMemo, useState } from 'react';
|
|
6
|
-
import CloseButton from '../../../../elements/CloseButton';
|
|
6
|
+
import { CloseButton } from '../../../../elements/CloseButton';
|
|
7
7
|
import Tab from '../../../../elements/Tab/Tab';
|
|
8
8
|
import Tabs, { PositionsEnum } from '../../../../elements/Tab/Tabs';
|
|
9
9
|
import { getEditedCorrelations } from '../../utilities/Utilities';
|
|
@@ -103,5 +103,5 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
|
|
|
103
103
|
handleOnEdit,
|
|
104
104
|
link,
|
|
105
105
|
]);
|
|
106
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
|
|
106
|
+
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { title: "Close", onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
|
|
107
107
|
}
|