nmrium 0.50.0 → 0.51.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/README.md +7 -7
- package/lib/component/1d/Chart1D.js +1 -1
- package/lib/component/1d/LinesSeries.js +2 -2
- package/lib/component/1d/Viewer1D.js +6 -11
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
- package/lib/component/2d/Viewer2D.js +16 -15
- package/lib/component/2d/ft/Contours.js +6 -3
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +12 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +29 -15
- package/lib/component/context/ToasterContext.d.ts +13 -0
- package/lib/component/context/ToasterContext.js +34 -0
- package/lib/component/elements/CloseButton.d.ts +2 -2
- package/lib/component/elements/CloseButton.js +1 -1
- package/lib/component/elements/CounterLabel.d.ts +3 -3
- package/lib/component/elements/CounterLabel.js +3 -3
- package/lib/component/elements/PreferencesButton.d.ts +2 -2
- package/lib/component/elements/PreferencesButton.js +2 -4
- package/lib/component/elements/SaveButton.d.ts +2 -2
- package/lib/component/elements/SaveButton.js +1 -1
- package/lib/component/elements/Select.js +2 -2
- package/lib/component/elements/ToolBarButton.d.ts +1 -8
- package/lib/component/elements/ToolBarButton.js +2 -11
- package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
- package/lib/component/elements/ToolbarPopoverItem.js +10 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
- package/lib/component/header/Header.d.ts +1 -11
- package/lib/component/header/Header.js +5 -6
- package/lib/component/header/PhaseCorrectionPanel.js +24 -33
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
- package/lib/component/header/RangesPickingOptionPanel.js +6 -3
- package/lib/component/hooks/useDialogToggle.d.ts +5 -0
- package/lib/component/hooks/useDialogToggle.js +16 -0
- package/lib/component/hooks/useExport.d.ts +9 -1
- package/lib/component/hooks/useExport.js +34 -36
- package/lib/component/hooks/useSaveSettings.js +6 -3
- package/lib/component/hooks/useToolsFunctions.js +6 -4
- package/lib/component/loader/DropZone.js +14 -14
- package/lib/component/main/InnerNMRium.js +5 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
- package/lib/component/main/InnerNMRiumContents.js +5 -3
- package/lib/component/main/NMRium.js +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +15 -15
- package/lib/component/modal/ImportPublicationStringModal.js +5 -3
- package/lib/component/modal/LoadJCAMPModal.js +6 -4
- package/lib/component/modal/PredictSpectraModal.js +11 -9
- package/lib/component/modal/SaveAsModal.d.ts +3 -4
- package/lib/component/modal/SaveAsModal.js +27 -27
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +2 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
- package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
- package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
- package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
- package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +7 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +48 -14
- package/lib/component/panels/RangesPanel/RangesHeader.js +73 -13
- package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +49 -8
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
- package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
- package/lib/component/panels/filtersPanel/FilterPanel.js +6 -4
- package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
- package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +36 -7
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
- package/lib/component/reducer/Reducer.d.ts +2 -2
- package/lib/component/reducer/Reducer.js +23 -16
- package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
- package/lib/component/reducer/actions/FiltersActions.js +243 -91
- package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -2
- package/lib/component/reducer/actions/MoleculeActions.js +0 -1
- package/lib/component/reducer/actions/RangesActions.js +16 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
- package/lib/component/reducer/actions/ToolsActions.js +75 -14
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
- package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
- package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
- package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
- package/lib/component/toolbar/ToolBar.js +241 -8
- package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
- package/lib/component/toolbar/toolbarMenu.js +77 -0
- package/lib/component/utility/Events.d.ts +11 -0
- package/lib/component/utility/Events.js +22 -0
- package/lib/component/utility/booleanToString.d.ts +6 -0
- package/lib/component/utility/booleanToString.js +4 -0
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
- package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +3 -3
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
- package/lib/data/getDefaultMatrixFilters.js +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
- package/lib/versionInfo.js +1 -1
- package/package.json +31 -30
- package/lib/component/elements/DeleteButton.d.ts +0 -6
- package/lib/component/elements/DeleteButton.js +0 -8
- package/lib/component/elements/DropdownMenu.d.ts +0 -9
- package/lib/component/elements/DropdownMenu.js +0 -7
- package/lib/component/elements/FilterButton.d.ts +0 -6
- package/lib/component/elements/FilterButton.js +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
- package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
- package/lib/component/elements/popup/Alert/Context.js +0 -10
- package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
- package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
- package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
- package/lib/component/elements/popup/Alert/Provider.js +0 -127
- package/lib/component/elements/popup/Alert/index.d.ts +0 -3
- package/lib/component/elements/popup/Alert/index.js +0 -3
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
- package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
- package/lib/component/modal/metaImportation/index.d.ts +0 -2
- package/lib/component/modal/metaImportation/index.js +0 -17
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
- 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
|
@@ -5,15 +5,15 @@ 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
|
-
import { Toolbar } from 'react-science/ui';
|
|
9
8
|
import { useChartData } from '../../context/ChartContext';
|
|
10
9
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
10
|
import { useModal } from '../../elements/popup/Modal';
|
|
12
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';
|
|
@@ -79,7 +79,7 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
79
79
|
}
|
|
80
80
|
return [];
|
|
81
81
|
}, [filterIsActive, info.dimension, integrals, xDomain]);
|
|
82
|
-
const
|
|
82
|
+
const total = integrals?.values?.length || 0;
|
|
83
83
|
return (_jsxs("div", { css: [
|
|
84
84
|
tablePanelStyle,
|
|
85
85
|
isFlipped &&
|
|
@@ -88,9 +88,23 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
88
88
|
position: relative;
|
|
89
89
|
}
|
|
90
90
|
`,
|
|
91
|
-
], children: [!isFlipped && (_jsx(DefaultPanelHeader, {
|
|
92
|
-
|
|
93
|
-
|
|
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 })) })] }));
|
|
94
108
|
}
|
|
95
109
|
const MemoizedIntegralPanel = memo(IntegralPanelInner);
|
|
96
110
|
const emptyData = { integrals: {}, info: {} };
|
|
@@ -3,7 +3,7 @@ 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 {
|
|
6
|
+
import { FaCheck } from 'react-icons/fa';
|
|
7
7
|
import * as yup from 'yup';
|
|
8
8
|
import { getMatrixFilters } from '../../../data/matrixGeneration';
|
|
9
9
|
import { useChartData } from '../../context/ChartContext';
|
|
@@ -12,7 +12,6 @@ import { usePreferences } from '../../context/PreferencesContext';
|
|
|
12
12
|
import StyledButton from '../../elements/Button';
|
|
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' },
|
|
@@ -10,9 +10,9 @@ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
|
10
10
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
11
11
|
import { useDispatch } from '../../context/DispatchContext';
|
|
12
12
|
import { useGlobal } from '../../context/GlobalContext';
|
|
13
|
-
import {
|
|
13
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
14
14
|
import { PreferencesButton } from '../../elements/PreferencesButton';
|
|
15
|
-
import {
|
|
15
|
+
import { ToolbarPopoverItem, } from '../../elements/ToolbarPopoverItem';
|
|
16
16
|
import AboutPredictionModal from '../../modal/AboutPredictionModal';
|
|
17
17
|
import PredictSpectraModal from '../../modal/PredictSpectraModal';
|
|
18
18
|
import { copyPNGToClipboard, exportAsSVG } from '../../utility/export';
|
|
@@ -66,7 +66,7 @@ const MOL_EXPORT_MENU = [
|
|
|
66
66
|
];
|
|
67
67
|
export default function MoleculePanelHeader({ currentIndex, molecules, moleculesView, onMoleculeIndexChange, onOpenMoleculeEditor, renderSource = 'moleculePanel', onClickPreferences, onClickPastMolecule, children, }) {
|
|
68
68
|
const { rootRef } = useGlobal();
|
|
69
|
-
const
|
|
69
|
+
const toaster = useToaster();
|
|
70
70
|
const dispatch = useDispatch();
|
|
71
71
|
const assignmentData = useAssignmentData();
|
|
72
72
|
const moleculeKey = molecules?.[currentIndex]?.id;
|
|
@@ -79,14 +79,20 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
79
79
|
if (!rootRef)
|
|
80
80
|
return;
|
|
81
81
|
await copyPNGToClipboard(rootRef, `molSVG${currentIndex} `);
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
toaster.show({
|
|
83
|
+
message: 'MOL copied as PNG to clipboard',
|
|
84
|
+
intent: 'success',
|
|
85
|
+
});
|
|
86
|
+
}, [rootRef, currentIndex, toaster]);
|
|
84
87
|
const { rawWriteWithType, readText, shouldFallback, cleanShouldFallback, text, } = useClipboard();
|
|
85
88
|
const saveAsMolHandler = useCallback((molfile) => {
|
|
86
89
|
void rawWriteWithType(molfile).then(() => {
|
|
87
|
-
|
|
90
|
+
toaster.show({
|
|
91
|
+
message: 'MOLFile copied to clipboard',
|
|
92
|
+
intent: 'success',
|
|
93
|
+
});
|
|
88
94
|
});
|
|
89
|
-
}, [
|
|
95
|
+
}, [rawWriteWithType, toaster]);
|
|
90
96
|
const exportHandler = useCallback((selected) => {
|
|
91
97
|
const molecule = molecules?.[currentIndex];
|
|
92
98
|
if (molecule) {
|
|
@@ -154,7 +160,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
154
160
|
});
|
|
155
161
|
}
|
|
156
162
|
const hasMolecules = molecules && molecules.length > 0;
|
|
157
|
-
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), _jsxs(
|
|
158
|
-
exportHandler(data);
|
|
159
|
-
}, placement: "right-start", targetTagName: "div", targetProps: { style: { flex: 'none' } }, options: MOL_EXPORT_MENU, children: _jsx(Toolbar.Item, { 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, { onClick: onClickPreferences }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
|
|
163
|
+
return (_jsxs(PanelHeader, { children: [_jsxs(Toolbar, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), 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" })] }));
|
|
160
164
|
}
|
|
@@ -4,11 +4,11 @@ import checkModifierKeyActivated from '../../../data/utilities/checkModifierKeyA
|
|
|
4
4
|
import { useAssignment, useAssignmentData, } from '../../assignment/AssignmentsContext';
|
|
5
5
|
import { filterForIDsWithAssignment } from '../../assignment/utilities/filterForIDsWithAssignment';
|
|
6
6
|
import { useDispatch } from '../../context/DispatchContext';
|
|
7
|
-
import {
|
|
7
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
8
8
|
import { HighlightEventSource, useHighlightData } from '../../highlight';
|
|
9
9
|
import { extractFromAtom, findDatumAndSignalIndex, getCurrentDiaIDsToHighlight, getHighlightsOnHover, toggleDiaIDs, } from './Utilities';
|
|
10
10
|
export default function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }) {
|
|
11
|
-
const
|
|
11
|
+
const toaster = useToaster();
|
|
12
12
|
const dispatch = useDispatch();
|
|
13
13
|
const highlightData = useHighlightData();
|
|
14
14
|
const assignments = useAssignmentData();
|
|
@@ -159,17 +159,19 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
|
|
|
159
159
|
activeAssignment.setActive(axis);
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
162
|
-
|
|
162
|
+
toaster.show({
|
|
163
|
+
message: 'Not assigned! Different atom type or no attached hydrogens found!',
|
|
164
|
+
});
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
}, [
|
|
167
169
|
activeAssignment,
|
|
168
|
-
alert,
|
|
169
170
|
data,
|
|
170
171
|
dispatch,
|
|
171
172
|
displayerMode,
|
|
172
173
|
nucleus,
|
|
174
|
+
toaster,
|
|
173
175
|
toggleAssignment,
|
|
174
176
|
]);
|
|
175
177
|
const handleOnAtomHover = useCallback((diaIDAndInfo) => {
|
|
@@ -1,34 +1,33 @@
|
|
|
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';
|
|
8
|
-
import { Toolbar } from 'react-science/ui';
|
|
9
8
|
import isInRange from '../../../data/utilities/isInRange';
|
|
10
9
|
import { useChartData } from '../../context/ChartContext';
|
|
11
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
12
11
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
13
|
-
import {
|
|
12
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
14
13
|
import { useModal } from '../../elements/popup/Modal';
|
|
15
14
|
import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
|
|
16
15
|
import useCheckExperimentalFeature from '../../hooks/useCheckExperimentalFeature';
|
|
17
16
|
import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
|
|
18
17
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
18
|
+
import { booleanToString } from '../../utility/booleanToString';
|
|
19
19
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
20
|
-
import DefaultPanelHeader
|
|
20
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
21
21
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
22
22
|
import PeaksPreferences from './PeaksPreferences';
|
|
23
23
|
import PeaksTable from './PeaksTable';
|
|
24
|
-
import { PeaksToggleActions } from './PeaksToggleActions';
|
|
25
24
|
function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
26
25
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
27
26
|
const [isFlipped, setFlipStatus] = useState(false);
|
|
28
27
|
const format = useFormatNumberByNucleus(info.nucleus);
|
|
29
28
|
const dispatch = useDispatch();
|
|
30
29
|
const modal = useModal();
|
|
31
|
-
const
|
|
30
|
+
const toaster = useToaster();
|
|
32
31
|
const isExperimental = useCheckExperimentalFeature();
|
|
33
32
|
const settingRef = useRef();
|
|
34
33
|
const yesHandler = useCallback(() => {
|
|
@@ -80,7 +79,10 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
80
79
|
dispatch({ type: 'OPTIMIZE_PEAKS', payload: { peaks: filterPeaks } });
|
|
81
80
|
}
|
|
82
81
|
else {
|
|
83
|
-
|
|
82
|
+
toaster.show({
|
|
83
|
+
message: 'optimization can be done on no more than 4 peaks',
|
|
84
|
+
intent: 'danger',
|
|
85
|
+
});
|
|
84
86
|
}
|
|
85
87
|
};
|
|
86
88
|
function toggleViewProperty(key) {
|
|
@@ -89,8 +91,44 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
89
91
|
function toggleDisplayingMode() {
|
|
90
92
|
dispatch({ type: 'TOGGLE_PEAKS_DISPLAYING_MODE' });
|
|
91
93
|
}
|
|
92
|
-
const
|
|
94
|
+
const total = peaks?.values?.length || 0;
|
|
93
95
|
const disabled = !peaks?.values || peaks.values.length === 0;
|
|
96
|
+
const { showPeaks, displayingMode, showPeaksShapes, showPeaksSum } = peaksViewState;
|
|
97
|
+
const leftButtons = [
|
|
98
|
+
{
|
|
99
|
+
disabled,
|
|
100
|
+
icon: _jsx(SvgNmrPeaks, {}),
|
|
101
|
+
title: `${booleanToString(!showPeaks)} peaks`,
|
|
102
|
+
onClick: () => toggleViewProperty('showPeaks'),
|
|
103
|
+
active: showPeaks,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
disabled,
|
|
107
|
+
icon: _jsx(SvgNmrPeaksTopLabels, {}),
|
|
108
|
+
title: `${displayingMode === 'spread' ? 'Single' : 'Spread'} mode`,
|
|
109
|
+
onClick: toggleDisplayingMode,
|
|
110
|
+
active: displayingMode === 'spread',
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
if (isExperimental) {
|
|
114
|
+
leftButtons.unshift({
|
|
115
|
+
disabled,
|
|
116
|
+
icon: _jsx(SvgPeaks, {}),
|
|
117
|
+
title: `${booleanToString(!showPeaksShapes)} peaks shapes`,
|
|
118
|
+
onClick: () => toggleViewProperty('showPeaksShapes'),
|
|
119
|
+
active: showPeaksShapes,
|
|
120
|
+
}, {
|
|
121
|
+
disabled,
|
|
122
|
+
icon: _jsx(SvgNmrFt, {}),
|
|
123
|
+
title: `${booleanToString(!showPeaksSum)} peaks sum`,
|
|
124
|
+
onClick: () => toggleViewProperty('showPeaksSum'),
|
|
125
|
+
active: showPeaksSum,
|
|
126
|
+
}, {
|
|
127
|
+
icon: _jsx(FaThinkPeaks, {}),
|
|
128
|
+
title: 'Optimize peaks',
|
|
129
|
+
onClick: optimizePeaksHandler,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
94
132
|
return (_jsxs("div", { css: [
|
|
95
133
|
tablePanelStyle,
|
|
96
134
|
isFlipped &&
|
|
@@ -102,11 +140,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
102
140
|
}
|
|
103
141
|
}
|
|
104
142
|
`,
|
|
105
|
-
], children: [!isFlipped && (_jsx(DefaultPanelHeader, {
|
|
106
|
-
? 'Hide peaks shapes'
|
|
107
|
-
: 'Show peaks shapes', onClick: () => toggleViewProperty('showPeaksShapes'), active: peaksViewState.showPeaksShapes }), _jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgNmrFt, {}), title: peaksViewState.showPeaksSum
|
|
108
|
-
? 'Hide peaks sum'
|
|
109
|
-
: 'Show peaks sum', onClick: () => toggleViewProperty('showPeaksSum'), active: peaksViewState.showPeaksSum }), _jsx(Toolbar.Item, { icon: _jsx(FaThinkPeaks, {}), title: "Optimize peaks", onClick: optimizePeaksHandler })] })), _jsx(PeaksToggleActions, { disabled: disabled, togglePeaks: peaksViewState.showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), toggleDisplayingMode: 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 })) })] }));
|
|
143
|
+
], 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 })) })] }));
|
|
110
144
|
}
|
|
111
145
|
const MemoizedPeaksPanel = memo(PeaksPanelInner);
|
|
112
146
|
const emptyData = { peaks: null, info: {} };
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SvgNmrIntegrate } from 'cheminfo-font';
|
|
2
|
+
import { SvgNmrIntegrate, SvgNmrPeaks, SvgNmrPeaksTopLabels, } from 'cheminfo-font';
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
4
|
import { rangesToACS } from 'nmr-processing';
|
|
5
5
|
import { FaFileExport, FaUnlink, FaSitemap, FaChartBar } from 'react-icons/fa';
|
|
6
6
|
import { ImLink } from 'react-icons/im';
|
|
7
|
-
import { Toolbar } from 'react-science/ui';
|
|
8
7
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
9
8
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
10
9
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
11
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
12
|
-
import {
|
|
11
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
13
12
|
import { useModal } from '../../elements/popup/Modal';
|
|
14
13
|
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
15
14
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
16
15
|
import CopyClipboardModal from '../../modal/CopyClipboardModal';
|
|
17
16
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
|
|
18
|
-
import {
|
|
19
|
-
import DefaultPanelHeader
|
|
17
|
+
import { booleanToString } from '../../utility/booleanToString';
|
|
18
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
20
19
|
function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, activeTab, }) {
|
|
21
20
|
const dispatch = useDispatch();
|
|
22
21
|
const modal = useModal();
|
|
23
|
-
const
|
|
22
|
+
const toaster = useToaster();
|
|
24
23
|
const assignmentData = useAssignmentData();
|
|
25
24
|
const currentSum = lodashGet(ranges, 'options.sum', null);
|
|
26
25
|
const rangesPreferences = usePanelPreferences('ranges', activeTab);
|
|
@@ -81,7 +80,7 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
81
80
|
}
|
|
82
81
|
const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = useClipboard();
|
|
83
82
|
function saveToClipboardHandler(value) {
|
|
84
|
-
void rawWriteWithType(value, 'text/html').then(() =>
|
|
83
|
+
void rawWriteWithType(value, 'text/html').then(() => toaster.show({ message: 'Data copied to clipboard', intent: 'success' }));
|
|
85
84
|
}
|
|
86
85
|
function saveAsHTMLHandler() {
|
|
87
86
|
if (Array.isArray(ranges?.values) && ranges.values.length > 0) {
|
|
@@ -107,11 +106,72 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
107
106
|
dispatch({ type: 'TOGGLE_RANGES_PEAKS_DISPLAYING_MODE' });
|
|
108
107
|
}
|
|
109
108
|
const hasRanges = Array.isArray(ranges?.values) && ranges.values.length > 0;
|
|
110
|
-
const
|
|
111
|
-
return (_jsxs("div", { children: [_jsx(DefaultPanelHeader, {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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" })] }));
|
|
116
176
|
}
|
|
117
177
|
export default RangesHeader;
|
|
@@ -9,7 +9,7 @@ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
|
9
9
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
10
10
|
import { useChartData } from '../../context/ChartContext';
|
|
11
11
|
import { useDispatch } from '../../context/DispatchContext';
|
|
12
|
-
import {
|
|
12
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
13
13
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
14
14
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
15
15
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
@@ -27,7 +27,7 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
|
|
|
27
27
|
const [isFilterActive, setFilterIsActive] = useState(false);
|
|
28
28
|
const assignmentData = useAssignmentData();
|
|
29
29
|
const dispatch = useDispatch();
|
|
30
|
-
const
|
|
30
|
+
const toaster = useToaster();
|
|
31
31
|
const [isFlipped, setFlipStatus] = useState(false);
|
|
32
32
|
const settingRef = useRef();
|
|
33
33
|
const rangesData = useMemo(() => {
|
|
@@ -81,9 +81,9 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
|
|
|
81
81
|
...value,
|
|
82
82
|
};
|
|
83
83
|
await rawWriteWithType(JSON.stringify(dataToClipboard, undefined, 2));
|
|
84
|
-
|
|
84
|
+
toaster.show({ message: 'Data copied to clipboard' });
|
|
85
85
|
}
|
|
86
|
-
}, [data, rawWriteWithType,
|
|
86
|
+
}, [data, rawWriteWithType, toaster]);
|
|
87
87
|
const contextMenuSelectHandler = useCallback((option, data) => {
|
|
88
88
|
void saveJSONToClipboardHandler(data);
|
|
89
89
|
}, [saveJSONToClipboardHandler]);
|
|
@@ -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
|
-
import { Toolbar } from 'react-science/ui';
|
|
7
6
|
import { useChartData } from '../../context/ChartContext';
|
|
8
7
|
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
-
import {
|
|
8
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
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(',');
|
|
@@ -27,7 +26,7 @@ function getMissingProjection(SpectrumsData, activeTab) {
|
|
|
27
26
|
}
|
|
28
27
|
function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTab, displayerMode, onSettingClick, }) {
|
|
29
28
|
const modal = useModal();
|
|
30
|
-
const
|
|
29
|
+
const toaster = useToaster();
|
|
31
30
|
const dispatch = useDispatch();
|
|
32
31
|
const handleDelete = useCallback(() => {
|
|
33
32
|
modal.showConfirmDialog({
|
|
@@ -64,7 +63,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
65
|
else {
|
|
67
|
-
|
|
66
|
+
toaster.show({ message: 'Nothing to calculate', intent: 'danger' });
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
function setSameTopHandler() {
|
|
@@ -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, }) {
|
|
@@ -8,9 +8,9 @@ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
|
|
|
8
8
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
9
9
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
10
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
11
12
|
import { ContextMenu, } from '../../elements/ContextMenuBluePrint';
|
|
12
13
|
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
13
|
-
import { useAlert } from '../../elements/popup/Alert';
|
|
14
14
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
15
15
|
import ExportAsJcampModal from '../../modal/ExportAsJcampModal';
|
|
16
16
|
import ColorIndicator from './base/ColorIndicator';
|
|
@@ -79,7 +79,7 @@ const Spectra1DContextMenuOptions = [
|
|
|
79
79
|
];
|
|
80
80
|
export function SpectraTable(props) {
|
|
81
81
|
const { data, activeSpectra, onChangeVisibility, onOpenSettingModal, onChangeActiveSpectrum, nucleus, } = props;
|
|
82
|
-
const
|
|
82
|
+
const toaster = useToaster();
|
|
83
83
|
const dispatch = useDispatch();
|
|
84
84
|
const spectraPreferences = usePanelPreferences('spectra', nucleus);
|
|
85
85
|
const activeSpectraObj = getActiveSpectraAsObject(activeSpectra);
|
|
@@ -121,7 +121,10 @@ export function SpectraTable(props) {
|
|
|
121
121
|
void (async () => {
|
|
122
122
|
const { data, info } = spectrum;
|
|
123
123
|
await rawWriteWithType(JSON.stringify({ data, info }, (_, value) => ArrayBuffer.isView(value) ? Array.from(value) : value, 2));
|
|
124
|
-
|
|
124
|
+
toaster.show({
|
|
125
|
+
message: 'Data copied to clipboard',
|
|
126
|
+
intent: 'success',
|
|
127
|
+
});
|
|
125
128
|
})();
|
|
126
129
|
break;
|
|
127
130
|
}
|
|
@@ -143,14 +146,17 @@ export function SpectraTable(props) {
|
|
|
143
146
|
}
|
|
144
147
|
case SpectraContextMenuOptionsKeys.CopyAsText: {
|
|
145
148
|
const data = convertSpectrumToText(spectrum);
|
|
146
|
-
void rawWriteWithType(data, 'text/plain').then(() =>
|
|
149
|
+
void rawWriteWithType(data, 'text/plain').then(() => toaster.show({
|
|
150
|
+
message: 'Spectrum copied to clipboard',
|
|
151
|
+
intent: 'success',
|
|
152
|
+
}));
|
|
147
153
|
break;
|
|
148
154
|
}
|
|
149
155
|
default: {
|
|
150
156
|
break;
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
|
-
}, [
|
|
159
|
+
}, [dispatch, rawWriteWithType, toaster]);
|
|
154
160
|
function handleActiveRow(row) {
|
|
155
161
|
return activeSpectraObj?.[row?.original.id] || false;
|
|
156
162
|
}
|
|
@@ -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
|
}
|