nmrium 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +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.js +0 -1
- package/lib/component/elements/DeleteButton.d.ts +5 -7
- package/lib/component/elements/DeleteButton.js +7 -5
- package/lib/component/elements/FilterButton.d.ts +6 -0
- package/lib/component/elements/FilterButton.js +8 -0
- package/lib/component/elements/PreferencesButton.d.ts +2 -4
- package/lib/component/elements/PreferencesButton.js +5 -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 +9 -0
- package/lib/component/elements/ToolBarButton.js +14 -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 +1 -1
- 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 +1 -1
- 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 +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -23
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +7 -8
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +8 -6
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +3 -6
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +8 -31
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +2 -2
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +40 -9
- 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 +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +2 -26
- 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 +12 -13
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -4
- 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 +9 -9
- 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/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
|
@@ -1,15 +1,15 @@
|
|
|
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
|
+
import { Toolbar } from 'react-science/ui';
|
|
8
9
|
import { useChartData } from '../../context/ChartContext';
|
|
9
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
10
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
11
|
-
import ToolTip from '../../elements/ToolTip/ToolTip';
|
|
12
11
|
import { useModal } from '../../elements/popup/Modal';
|
|
12
|
+
import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectrumIntegralsViewState';
|
|
13
13
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
14
14
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
|
|
15
15
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
@@ -17,20 +17,6 @@ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHe
|
|
|
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();
|
|
@@ -96,18 +82,15 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
|
|
|
96
82
|
const counter = 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
|
-
? 'Hide integrals values'
|
|
110
|
-
: 'Show integrals values', popupPlacement: "right", onClick: handleShowIntegralsValues, value: showIntegralsValues, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) })] })), 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 })) })] }));
|
|
91
|
+
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: _jsxs(Toolbar, { children: [_jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integration", currentSum: currentSum, sumOptions: integrals?.options }), _jsx(Toolbar.Item, { icon: _jsx(ImLink, {}), title: 'Fixed integration values', onClick: toggleConstantSumHandler, active: integrals?.options?.isSumConstant || false }), _jsx(Toolbar.Item, { icon: _jsx(SvgNmrIntegrate, {}), title: showIntegralsValues
|
|
92
|
+
? 'Hide integrals values'
|
|
93
|
+
: 'Show integrals values', onClick: handleShowIntegralsValues, active: showIntegralsValues })] }) })), 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
94
|
}
|
|
112
95
|
const MemoizedIntegralPanel = memo(IntegralPanelInner);
|
|
113
96
|
const emptyData = { integrals: {}, info: {} };
|
|
@@ -3,16 +3,16 @@ 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 { Toolbar } from 'react-science/ui';
|
|
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';
|
|
15
|
+
import { SaveButton } from '../../elements/SaveButton';
|
|
16
16
|
import ToggleButton from '../../elements/ToggleButton';
|
|
17
17
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
18
18
|
import FormikOnChange from '../../elements/formik/FormikOnChange';
|
|
@@ -83,7 +83,7 @@ function MatrixGenerationPanel() {
|
|
|
83
83
|
if (xDomain[0] === undefined || xDomain[1] === undefined) {
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
|
-
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { canDelete: false, renderRightButtons: () => (_jsx(SaveButton, { onClick: () => formRef.current?.submitForm(),
|
|
86
|
+
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { canDelete: false, renderRightButtons: () => (_jsx(SaveButton, { onClick: () => formRef.current?.submitForm(), title: "Signal processing" })), children: _jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(SvgNmrExportAsMatrix, {}), title: "Export spectra as a matrix", onClick: handleExportAsMatrix }) }) }), _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
87
|
...labelStyle,
|
|
88
88
|
wrapper: {},
|
|
89
89
|
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 ActiveButton from '../../elements/ActiveButton';
|
|
13
|
-
import Button from '../../elements/Button';
|
|
14
13
|
import { DropdownMenu } from '../../elements/DropdownMenu';
|
|
14
|
+
import { PreferencesButton } from '../../elements/PreferencesButton';
|
|
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,7 @@ 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, {}),
|
|
157
|
+
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), _jsxs(Toolbar, { children: [renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [' ', _jsx(DropdownMenu, { onSelect: (data) => {
|
|
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" })] }));
|
|
158
160
|
}
|
|
@@ -5,12 +5,11 @@ import { SvgNmrFt } 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';
|
|
8
9
|
import isInRange from '../../../data/utilities/isInRange';
|
|
9
10
|
import { useChartData } from '../../context/ChartContext';
|
|
10
11
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
12
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
12
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
13
|
-
import Button from '../../elements/Button';
|
|
14
13
|
import { useAlert } from '../../elements/popup/Alert';
|
|
15
14
|
import { useModal } from '../../elements/popup/Modal';
|
|
16
15
|
import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
|
|
@@ -91,7 +90,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
91
90
|
dispatch({ type: 'TOGGLE_PEAKS_DISPLAYING_MODE' });
|
|
92
91
|
}
|
|
93
92
|
const counter = peaks?.values?.length || 0;
|
|
94
|
-
const
|
|
93
|
+
const disabled = !peaks?.values || peaks.values.length === 0;
|
|
95
94
|
return (_jsxs("div", { css: [
|
|
96
95
|
tablePanelStyle,
|
|
97
96
|
isFlipped &&
|
|
@@ -103,11 +102,11 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
|
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
`,
|
|
106
|
-
], children: [!isFlipped && (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredPeaks?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Peaks", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all peaks' : 'Hide peaks out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: _jsxs(Toolbar, { children: [isExperimental && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgPeaks, {}), title: peaksViewState.showPeaksShapes
|
|
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 })) })] }));
|
|
111
110
|
}
|
|
112
111
|
const MemoizedPeaksPanel = memo(PeaksPanelInner);
|
|
113
112
|
const emptyData = { peaks: null, info: {} };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ToolbarItemProps } from 'react-science/ui';
|
|
2
2
|
interface PeaksToggleProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
toggleDisplayingMode: 'single' | 'spread';
|
|
5
|
+
toggleDisplayingModeId?: string;
|
|
6
|
+
togglePeaks: boolean;
|
|
7
|
+
togglePeaksId?: string;
|
|
8
|
+
onShowToggle: ToolbarItemProps['onClick'];
|
|
9
|
+
onDisplayingModeToggle: ToolbarItemProps['onClick'];
|
|
8
10
|
}
|
|
9
11
|
export declare function PeaksToggleActions(props: PeaksToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SvgNmrPeaks, SvgNmrPeaksTopLabels } from 'cheminfo-font';
|
|
3
|
-
import
|
|
4
|
-
const style = {
|
|
5
|
-
margin: '0 2px',
|
|
6
|
-
};
|
|
3
|
+
import { Toolbar } from 'react-science/ui';
|
|
7
4
|
export function PeaksToggleActions(props) {
|
|
8
|
-
const {
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
5
|
+
const { disabled, togglePeaks, togglePeaksId, toggleDisplayingMode, toggleDisplayingModeId, onShowToggle, onDisplayingModeToggle, } = props;
|
|
6
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: togglePeaksId, disabled: disabled, icon: _jsx(SvgNmrPeaks, {}), title: `${togglePeaks ? 'Hide' : 'Show'} peaks`, onClick: onShowToggle, active: togglePeaks }), _jsx(Toolbar.Item, { id: toggleDisplayingModeId, disabled: disabled, icon: _jsx(SvgNmrPeaksTopLabels, {}), title: toggleDisplayingMode === 'spread' ? 'Single Mode' : 'Spread mode', onClick: onDisplayingModeToggle, active: toggleDisplayingMode === 'spread' })] }));
|
|
10
7
|
}
|
|
@@ -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,17 +1,14 @@
|
|
|
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 } 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';
|
|
8
6
|
import { ImLink } from 'react-icons/im';
|
|
7
|
+
import { Toolbar } from 'react-science/ui';
|
|
9
8
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
10
9
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
11
10
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
12
11
|
import { useDispatch } from '../../context/DispatchContext';
|
|
13
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
14
|
-
import Button from '../../elements/ButtonToolTip';
|
|
15
12
|
import { useAlert } from '../../elements/popup/Alert';
|
|
16
13
|
import { useModal } from '../../elements/popup/Modal';
|
|
17
14
|
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
@@ -20,24 +17,6 @@ import CopyClipboardModal from '../../modal/CopyClipboardModal';
|
|
|
20
17
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
|
|
21
18
|
import { PeaksToggleActions } from '../PeaksPanel/PeaksToggleActions';
|
|
22
19
|
import DefaultPanelHeader, { createFilterLabel, } from '../header/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
|
-
`;
|
|
41
20
|
function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClick, isFilterActive, filterCounter, activeTab, }) {
|
|
42
21
|
const dispatch = useDispatch();
|
|
43
22
|
const modal = useModal();
|
|
@@ -129,12 +108,10 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
|
|
|
129
108
|
}
|
|
130
109
|
const hasRanges = Array.isArray(ranges?.values) && ranges.values.length > 0;
|
|
131
110
|
const counter = ranges?.values?.length || 0;
|
|
132
|
-
return (_jsxs("div", {
|
|
133
|
-
?
|
|
134
|
-
: '
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
? 'Hide integrals values'
|
|
138
|
-
: 'Show integrals values', popupPlacement: "right", onClick: handleShowIntegralsValues, value: showIntegralsValues, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration sum", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: _jsx(ImLink, {}) }), _jsx(PeaksToggleActions, { disbale: !hasRanges, showPeaks: showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), displayingMode: displayingMode, onDisplayingModeToggle: toggleDisplayingMode })] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
|
|
111
|
+
return (_jsxs("div", { children: [_jsx(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, isFilterActive && filterCounter), onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', showSettingButton: true, onSettingClick: onSettingClick, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { disabled: !hasRanges, icon: _jsx(FaFileExport, {}), title: "Preview publication string", onClick: saveAsHTMLHandler }), _jsx(ChangeSumModal, { onSave: changeRangesSumHandler, sumType: "ranges", currentSum: currentSum, sumOptions: ranges?.options }), _jsx(Toolbar.Item, { disabled: !hasRanges, icon: _jsx(FaUnlink, {}), title: "Remove all assignments", onClick: handleOnRemoveAssignments }), _jsx(Toolbar.Item, { disabled: !hasRanges, icon: _jsx(FaSitemap, {}), title: showMultiplicityTrees
|
|
112
|
+
? 'Hide multiplicity trees in spectrum'
|
|
113
|
+
: 'Show multiplicity trees in spectrum', onClick: handleSetShowMultiplicityTrees, active: showMultiplicityTrees }), _jsx(Toolbar.Item, { disabled: !hasRanges, icon: _jsx(FaChartBar, {}), title: showJGraph ? 'Hide J Graph' : 'Show J Graph', onClick: handleShowJGraph, active: showJGraph }), _jsx(Toolbar.Item, { disabled: !hasRanges, icon: _jsx(SvgNmrIntegrate, {}), title: showIntegrals ? 'Hide integrals' : 'Show integrals', onClick: handleShowIntegrals, active: showIntegrals }), _jsx(Toolbar.Item, { disabled: !hasRanges, icon: _jsx(SvgNmrIntegrate, {}), title: showIntegralsValues
|
|
114
|
+
? 'Hide integrals values'
|
|
115
|
+
: 'Show integrals values', onClick: handleShowIntegralsValues, active: showIntegralsValues }), _jsx(Toolbar.Item, { icon: _jsx(ImLink, {}), title: "Fixed integration sum", onClick: changeSumConstantFlagHandler, active: ranges?.options?.isSumConstant }), _jsx(PeaksToggleActions, { disabled: !hasRanges, togglePeaksId: "ranges-toggle-peaks", togglePeaks: showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), toggleDisplayingMode: displayingMode, onDisplayingModeToggle: toggleDisplayingMode })] }) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
|
|
139
116
|
}
|
|
140
117
|
export default RangesHeader;
|
|
@@ -3,9 +3,9 @@ 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';
|
|
6
7
|
import { useChartData } from '../../context/ChartContext';
|
|
7
8
|
import { useDispatch } from '../../context/DispatchContext';
|
|
8
|
-
import Button from '../../elements/Button';
|
|
9
9
|
import { useAlert } from '../../elements/popup/Alert';
|
|
10
10
|
import { useModal } from '../../elements/popup/Modal';
|
|
11
11
|
import { useActiveSpectra } from '../../hooks/useActiveSpectra';
|
|
@@ -81,7 +81,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
81
81
|
}
|
|
82
82
|
const hasActiveSpectra = activeSpectra && activeSpectra?.length > 0;
|
|
83
83
|
const spectraLengthPerTab = getSpectraByNucleus(activeTab, data)?.length;
|
|
84
|
-
return (
|
|
84
|
+
return (_jsx(DefaultPanelHeader, { onDelete: handleDelete, counter: data?.length, counterLabel: createFilterLabel(data?.length, spectraLengthPerTab), deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, showSettingButton: true, onSettingClick: onSettingClick, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { disabled: !hasActiveSpectra, icon: _jsx(FaEyeSlash, {}), title: "Hide selected spectra", onClick: hideAllSpectrumsHandler }), _jsx(Toolbar.Item, { disabled: !hasActiveSpectra, icon: _jsx(FaEye, {}), title: "Show selected spectra", onClick: showAllSpectrumsHandler }), displayerMode === '2D' && activeSpectrum?.info.isFt && (_jsx(Toolbar.Item, { icon: _jsx(FaCreativeCommonsSamplingPlus, {}), title: "Add missing projection", onClick: addMissingProjectionHandler })), displayerMode === '1D' && spectraLengthPerTab > 1 && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { icon: _jsx(SvgNmrResetScale, {}), title: "Reset scale", onClick: resetScaleHandler }), _jsx(Toolbar.Item, { icon: _jsx(SvgNmrSameTop, {}), title: "Same top", onClick: setSameTopHandler })] })), _jsx(SpectraAutomaticPickingButton, {}), _jsx(Toolbar.Item, { icon: _jsx(IoColorPaletteOutline, {}), title: "Recolor spectra", onClick: recolorSpectraHandler })] }) }));
|
|
85
85
|
}
|
|
86
86
|
const MemoizedSpectraPanelHeader = memo(SpectraPanelHeaderInner);
|
|
87
87
|
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';
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
-
import CloseButton from '../../elements/CloseButton';
|
|
5
|
+
import { CloseButton } from '../../elements/CloseButton';
|
|
6
6
|
import MolecularFormulaInput from '../../elements/MolecularFormulaInput';
|
|
7
7
|
import MoleculeSelection from '../../elements/MoleculeSelection';
|
|
8
8
|
const modalContainer = css `
|
|
@@ -2,7 +2,7 @@ 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
4
|
import { useEffect, useState } from 'react';
|
|
5
|
-
import CloseButton from '../../elements/CloseButton';
|
|
5
|
+
import { CloseButton } from '../../elements/CloseButton';
|
|
6
6
|
const modalContainer = css `
|
|
7
7
|
width: 220px;
|
|
8
8
|
height: 270px;
|
|
@@ -4,12 +4,12 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { getLinkDelta, getLinkDim, } from 'nmr-correlation';
|
|
5
5
|
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
6
|
import { FaFlask, FaSlidersH } from 'react-icons/fa';
|
|
7
|
+
import { Toolbar } from 'react-science/ui';
|
|
7
8
|
import { findRange, findSignal1D, findSignal2D, findSpectrum, findZone, } from '../../../data/utilities/FindUtilities';
|
|
8
9
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
9
10
|
import { useChartData } from '../../context/ChartContext';
|
|
10
11
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
12
|
import Select from '../../elements/Select';
|
|
12
|
-
import ToolTip from '../../elements/ToolTip/ToolTip';
|
|
13
13
|
import { useModal } from '../../elements/popup/Modal';
|
|
14
14
|
import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
|
|
15
15
|
import CorrelationTable from './CorrelationTable/CorrelationTable';
|
|
@@ -26,7 +26,8 @@ const panelStyle = css `
|
|
|
26
26
|
|
|
27
27
|
.extra-header-content {
|
|
28
28
|
display: flex;
|
|
29
|
-
|
|
29
|
+
flex: 1;
|
|
30
|
+
justify-content: center;
|
|
30
31
|
|
|
31
32
|
.overview-container {
|
|
32
33
|
width: 100%;
|
|
@@ -311,7 +312,7 @@ function SummaryPanel() {
|
|
|
311
312
|
const counter = correlationsData ? correlationsData.values.length : 0;
|
|
312
313
|
return (_jsxs("div", { css: panelStyle, children: [_jsxs(DefaultPanelHeader, { canDelete: false, counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredCorrelationsData?.values.length), onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
313
314
|
? 'Show all correlations'
|
|
314
|
-
: 'Hide correlations out of view', children: [_jsx(
|
|
315
|
+
: 'Hide correlations out of view', children: [_jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaFlask, {}), title: `Set molecular formula (${correlationsData.options.mf})`, onClick: showSetMolecularFormulaModal }), _jsx(Toolbar.Item, { icon: _jsx(FaSlidersH, {}), title: "Set shift tolerance", onClick: showSetShiftToleranceModal })] }), _jsxs("div", { className: "extra-header-content", children: [_jsx("div", { className: "overview-container", children: _jsx(Overview, { correlationsData: correlationsData }) }), _jsx("div", { className: "table-view-selection", children: _jsxs("span", { children: [_jsx("label", { children: "View:" }), _jsx(Select, { onChange: (selection) => {
|
|
315
316
|
setSelectedAdditionalColumnsAtomType(selection);
|
|
316
317
|
if (selection === 'H-H') {
|
|
317
318
|
setShowProtonsAsRows(true);
|
|
@@ -3,11 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useState, useMemo, useCallback, useRef, memo } from 'react';
|
|
5
5
|
import { FaUnlink } from 'react-icons/fa';
|
|
6
|
+
import { Toolbar } from 'react-science/ui';
|
|
6
7
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
7
8
|
import { useChartData } from '../../context/ChartContext';
|
|
8
9
|
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
-
import ActiveButton from '../../elements/ActiveButton';
|
|
10
|
-
import ToolTip from '../../elements/ToolTip/ToolTip';
|
|
11
10
|
import { useModal } from '../../elements/popup/Modal';
|
|
12
11
|
import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
|
|
13
12
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
@@ -16,28 +15,6 @@ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHe
|
|
|
16
15
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
17
16
|
import ZonesPreferences from './ZonesPreferences';
|
|
18
17
|
import ZonesTable from './ZonesTable';
|
|
19
|
-
const style = css `
|
|
20
|
-
.remove-assignments-btn {
|
|
21
|
-
border-radius: 5px;
|
|
22
|
-
margin-top: 3px;
|
|
23
|
-
margin-left: 2px;
|
|
24
|
-
border: none;
|
|
25
|
-
height: 16px;
|
|
26
|
-
width: 18px;
|
|
27
|
-
font-size: 12px;
|
|
28
|
-
padding: 0;
|
|
29
|
-
background-color: transparent;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.toggle {
|
|
33
|
-
width: 22px;
|
|
34
|
-
height: 22px;
|
|
35
|
-
margin-left: 2px;
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
18
|
function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, }) {
|
|
42
19
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
43
20
|
const assignmentData = useAssignmentData();
|
|
@@ -142,14 +119,13 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
142
119
|
const counter = zones?.values?.length || 0;
|
|
143
120
|
return (_jsxs("div", { css: [
|
|
144
121
|
tablePanelStyle,
|
|
145
|
-
style,
|
|
146
122
|
isFlipped &&
|
|
147
123
|
css `
|
|
148
124
|
th {
|
|
149
125
|
position: relative;
|
|
150
126
|
}
|
|
151
127
|
`,
|
|
152
|
-
], children: [!isFlipped && (
|
|
128
|
+
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && tableData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { disabled: !zones.values || zones.values.length === 0, icon: _jsx(FaUnlink, {}), title: "Remove all assignments", onClick: handleOnRemoveAssignments }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "z" }), title: "Show/Hide zones", active: showZones, onClick: handleSetShowZones }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "s" }), title: "Show/Hide signals", active: showSignals, onClick: handleSetShowSignals }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "p" }), title: "Show/Hide peaks", active: showPeaks, onClick: handleSetShowPeaks })] }) })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: _jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nucleus: activeTab, info: info }) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
|
|
153
129
|
}
|
|
154
130
|
const MemoizedZonesPanel = memo(ZonesPanelInner);
|
|
155
131
|
const emptyData = { zones: {}, info: {} };
|
|
@@ -59,13 +59,13 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
59
59
|
solvents: [],
|
|
60
60
|
});
|
|
61
61
|
const [idCode, setIdCode] = useState();
|
|
62
|
-
|
|
63
|
-
setFlipStatus(!
|
|
64
|
-
}
|
|
65
|
-
|
|
62
|
+
function settingsPanelHandler() {
|
|
63
|
+
setFlipStatus((flag) => !flag);
|
|
64
|
+
}
|
|
65
|
+
function saveSettingHandler() {
|
|
66
66
|
settingRef.current.saveSetting();
|
|
67
67
|
setFlipStatus(false);
|
|
68
|
-
}
|
|
68
|
+
}
|
|
69
69
|
const search = useCallback((solvents) => {
|
|
70
70
|
const { solvent, searchKeywords } = keywords;
|
|
71
71
|
if (databaseInstance.current) {
|
|
@@ -232,7 +232,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
`,
|
|
235
|
-
], children: [!isFlipped && (_jsxs(_Fragment, { children: [_jsx(DatabaseSearchOptions, { databases: databases, defaultDatabase: defaultDatabase, idCode: idCode, keywords: keywords, result: result,
|
|
235
|
+
], children: [!isFlipped && (_jsxs(_Fragment, { children: [_jsx(DatabaseSearchOptions, { databases: databases, defaultDatabase: defaultDatabase, idCode: idCode, keywords: keywords, result: result, total: databaseInstance.current?.data.length || 0, onKeywordsChange: (options) => setKeywords((prevKeywords) => ({ ...prevKeywords, ...options })), onSettingClick: settingsPanelHandler, onStructureClick: openSearchByStructure, onDatabaseChange: handleChangeDatabase }), _jsx(DatabaseStructureSearchModal, { isOpen: isOpenSearchByStructure, onClose: closeSearchByStructure, onChange: searchByStructureHandler, idCode: idCode })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
|
|
236
236
|
? 'Please select a database'
|
|
237
237
|
: 'Please add databases URL in the general preferences' }))) : (_jsx(DatabasePreferences, { ref: settingRef })) })] }));
|
|
238
238
|
}
|