nmrium 0.48.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/SpectraLegends.js +1 -1
- package/lib/component/1d/Viewer1D.js +142 -124
- package/lib/component/1d/jCouplingGraph/JsCoupling.js +1 -1
- 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/Atoms.d.ts +7 -0
- package/lib/component/1d/ranges/Atoms.js +43 -0
- package/lib/component/1d/ranges/Range.d.ts +1 -1
- package/lib/component/1d/ranges/Range.js +10 -9
- package/lib/component/1d/tool/BaseLine.d.ts +2 -0
- package/lib/component/1d/tool/BaseLine.js +26 -0
- package/lib/component/1d/tool/BaseLineZones.js +18 -3
- package/lib/component/2d/Chart2D.js +6 -4
- package/lib/component/2d/Viewer2D.js +35 -26
- package/lib/component/context/KeyModifierContext.d.ts +13 -2
- package/lib/component/context/KeyModifierContext.js +35 -4
- package/lib/component/context/LoggerContext.d.ts +9 -0
- package/lib/component/context/LoggerContext.js +21 -7
- package/lib/component/context/PreferencesContext.d.ts +1 -108
- package/lib/component/context/TopicMoleculeContext.d.ts +8 -0
- package/lib/component/context/TopicMoleculeContext.js +30 -0
- 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/Input.js +4 -1
- 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/ResizerWithScale.js +19 -2
- package/lib/component/elements/SVGGroup.js +2 -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/formik/FormikTextarea.js +8 -9
- package/lib/component/elements/linearAxis/LinearVerticalAxis.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
- package/lib/component/elements/resizer/SVGResizer.js +1 -1
- package/lib/component/header/BaseLineCorrectionPanel.js +3 -2
- package/lib/component/header/Header.js +2 -2
- package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
- package/lib/component/hooks/useSaveSettings.js +3 -2
- package/lib/component/hooks/useToolsFunctions.js +4 -2
- package/lib/component/main/InnerNMRium.js +2 -1
- 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 +8 -4
- package/lib/component/modal/ImportPublicationStringModal.d.ts +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +80 -32
- 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/GeneralTabContent.js +9 -11
- 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/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +2 -2
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +39 -5
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +42 -11
- package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +4 -2
- package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +19 -16
- 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 +5 -0
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +5 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -4
- package/lib/component/reducer/actions/FiltersActions.js +92 -55
- package/lib/component/reducer/actions/LoadActions.js +10 -8
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +3 -3
- package/lib/component/reducer/actions/ToolsActions.d.ts +8 -5
- package/lib/component/reducer/actions/ToolsActions.js +51 -44
- package/lib/component/toolbar/BasicToolBar.js +11 -29
- package/lib/component/utility/export.js +3 -0
- package/lib/component/workspaces/exercise.js +1 -0
- package/lib/component/workspaces/prediction.js +1 -16
- package/lib/component/workspaces/simulation.js +1 -2
- package/lib/component/workspaces/workspaceDefaultProperties.js +4 -3
- package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/index.js +0 -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 +25 -23
- package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
- package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
- package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
- package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
- package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
- package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +0 -2
- package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.js +0 -6
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { LOGGER_LEVELS } from '../../../context/LoggerContext';
|
|
2
3
|
import { GroupPane } from '../../../elements/GroupPane';
|
|
3
4
|
import Label from '../../../elements/Label';
|
|
4
5
|
import FormikCheckBox from '../../../elements/formik/FormikCheckBox';
|
|
5
6
|
import FormikInput from '../../../elements/formik/FormikInput';
|
|
6
7
|
import FormikSelect from '../../../elements/formik/FormikSelect';
|
|
8
|
+
const labelStyle = {
|
|
9
|
+
label: { flex: 6 },
|
|
10
|
+
wrapper: { flex: 6 },
|
|
11
|
+
container: { paddingBottom: '5px' },
|
|
12
|
+
};
|
|
7
13
|
const SHAPE_RENDERING = [
|
|
8
14
|
{
|
|
9
15
|
label: 'Auto',
|
|
@@ -22,19 +28,11 @@ const SHAPE_RENDERING = [
|
|
|
22
28
|
value: 'geometricPrecision',
|
|
23
29
|
},
|
|
24
30
|
];
|
|
25
|
-
const LOGS_LEVELS =
|
|
26
|
-
'fatal',
|
|
27
|
-
'error',
|
|
28
|
-
'warn',
|
|
29
|
-
'info',
|
|
30
|
-
'debug',
|
|
31
|
-
'trace',
|
|
32
|
-
'silent',
|
|
33
|
-
].map((level) => ({
|
|
31
|
+
const LOGS_LEVELS = Object.keys(LOGGER_LEVELS).map((level) => ({
|
|
34
32
|
label: level.replace(/^\w/, (c) => c.toUpperCase()),
|
|
35
33
|
value: level,
|
|
36
34
|
}));
|
|
37
35
|
function GeneralTabContent() {
|
|
38
|
-
return (_jsxs(_Fragment, { children: [
|
|
36
|
+
return (_jsxs(_Fragment, { children: [_jsxs(GroupPane, { text: "General", children: [_jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", style: labelStyle, children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1, style: { inputWrapper: { width: 60 } } }) }), _jsx(Label, { title: "Invert actions", htmlFor: "general.invert", style: labelStyle, children: _jsx(FormikCheckBox, { name: "general.invert", style: { container: { justifyContent: 'flex-start' } } }) })] }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", style: labelStyle, children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display", style: { container: { justifyContent: 'flex-start' } } }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", style: labelStyle, children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsxs(GroupPane, { text: "Logging settings", children: [_jsx(Label, { title: "Level ", style: labelStyle, children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }), _jsx(Label, { title: "Popup logging level ", style: labelStyle, children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.popupLoggingLevel", style: { width: '100px' } }) })] })] }));
|
|
39
37
|
}
|
|
40
38
|
export default GeneralTabContent;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tab, Tabs } from '@blueprintjs/core';
|
|
2
3
|
import { useFormikContext } from 'formik';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { Tabs } from 'react-science/ui';
|
|
5
4
|
import { CheckBoxCell } from '../../../elements/CheckBoxCell';
|
|
6
5
|
import IsotopesViewer from '../../../elements/IsotopesViewer';
|
|
7
6
|
import Label from '../../../elements/Label';
|
|
@@ -14,14 +13,13 @@ function OnLoadProcessingTabContent() {
|
|
|
14
13
|
}
|
|
15
14
|
function AutoProcessingFilters() {
|
|
16
15
|
const { values } = useFormikContext();
|
|
17
|
-
const [activeTab, setActiveTab] = useState('1H');
|
|
18
16
|
const autoProcessingFilters = values?.onLoadProcessing?.filters || {};
|
|
19
17
|
const tabItems = Object.keys(autoProcessingFilters).map((nucleus) => ({
|
|
20
18
|
id: nucleus,
|
|
21
19
|
title: _jsx(IsotopesViewer, { value: nucleus }),
|
|
22
20
|
content: (_jsx(FiltersTable, { data: autoProcessingFilters[nucleus], nucleus: nucleus })),
|
|
23
21
|
}));
|
|
24
|
-
return (_jsx("div", { style: { width: '100%', overflow: 'hidden' }, children: _jsx(Tabs, {
|
|
22
|
+
return (_jsx("div", { style: { width: '100%', overflow: 'hidden' }, children: _jsx(Tabs, { children: tabItems.map((item) => (_jsx(Tab, { id: item.id, title: item.title, panel: item.content }, item.id))) }) }));
|
|
25
23
|
}
|
|
26
24
|
function FiltersTable({ data, nucleus }) {
|
|
27
25
|
const COLUMNS = [
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { SvgNmrAssignment2 } from 'cheminfo-font';
|
|
4
4
|
import { FaBolt } from 'react-icons/fa';
|
|
5
|
+
import { Toolbar } from 'react-science/ui';
|
|
5
6
|
import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D';
|
|
6
7
|
import { useChartData } from '../../context/ChartContext';
|
|
7
|
-
import Button from '../../elements/Button';
|
|
8
8
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
9
9
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
10
10
|
import { SpectraAutomaticPickingButton } from '../header/SpectraAutomaticPickingButton';
|
|
@@ -22,6 +22,6 @@ function useCheckEnableAutomaticAssignments() {
|
|
|
22
22
|
function AutomaticAssignment() {
|
|
23
23
|
const { getAssignments, assignments, restAssignments } = useAutoAssignments();
|
|
24
24
|
const enabled = useCheckEnableAutomaticAssignments();
|
|
25
|
-
return (_jsxs("div", { css: tablePanelStyle, children: [
|
|
25
|
+
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { showSettingButton: false, canDelete: false, children: _jsxs(Toolbar, { children: [_jsx(SpectraAutomaticPickingButton, {}), _jsx(Toolbar.Item, { icon: _jsx(SvgNmrAssignment2, {}), title: "Automatic assignment", onClick: getAssignments, disabled: !enabled }), _jsx(Toolbar.Item, { icon: _jsx(FaBolt, {}), title: "Reset assignment", onClick: restAssignments })] }) }), _jsx("div", { className: "inner-container", children: _jsx(AutomaticAssignmentTable, { data: assignments }) })] }));
|
|
26
26
|
}
|
|
27
27
|
export default AutomaticAssignment;
|
|
@@ -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;
|
|
@@ -64,7 +64,7 @@ function RangesTable({ tableData, onUnlink, contextMenu = [], onContextMenuSelec
|
|
|
64
64
|
const showActions = preferences.showDeleteAction ||
|
|
65
65
|
preferences.showEditAction ||
|
|
66
66
|
preferences.showZoomAction;
|
|
67
|
-
return (_jsxs("table", { css: tableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [preferences.showSerialNumber && _jsx("th", { children: "#" }), preferences.from.show && (_jsxs("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && (_jsxs("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show &&
|
|
67
|
+
return (_jsxs("table", { css: tableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [preferences.showSerialNumber && _jsx("th", { children: "#" }), preferences.from.show && (_jsxs("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && (_jsxs("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show && (_jsxs("th", { id: "from", ...onSort, children: ["\u03B4 (ppm) ", isSortedDesc('from').content] })), preferences.deltaHz.show && _jsx("th", { children: "\u03B4 (Hz) " }), preferences.relative.show && (_jsxs("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })), preferences.absolute.show && _jsx("th", { children: "Absolute" }), preferences.showMultiplicity && _jsx("th", { children: "Mult." }), preferences.coupling.show && _jsx("th", { children: "J (Hz)" }), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { title: "Assign multiplets", children: _jsx(FaLink, { style: { fontSize: 10, margin: 'auto' } }) }), _jsx("th", { title: "Assign ranges", style: { minWidth: '50px' }, children: "\u03A3" })] })), preferences.showKind && _jsx("th", { children: "Kind" }), showActions && _jsx("th", { children: '' })] }) }), _jsx("tbody", { children: data?.map((range) => {
|
|
68
68
|
return (_jsx(RangesTableRow, { rowData: range, onUnlink: onUnlink, preferences: preferences, info: info, contextMenu: contextMenu, onContextMenuSelect: onContextMenuSelect }, range.rowKey));
|
|
69
69
|
}) })] }));
|
|
70
70
|
}
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Formik } from 'formik';
|
|
3
3
|
import { useImperativeHandle, useRef, memo, forwardRef, useCallback, useMemo, } from 'react';
|
|
4
|
+
import * as Yup from 'yup';
|
|
4
5
|
import { useChartData } from '../../context/ChartContext';
|
|
5
6
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
6
7
|
import { Scroller } from '../../elements/Scroller';
|
|
@@ -11,6 +12,26 @@ import { getSpectraObjectPaths } from '../../utility/getSpectraObjectPaths';
|
|
|
11
12
|
import { NucleusGroup } from '../extra/preferences/NucleusGroup';
|
|
12
13
|
import { PreferencesContainer } from '../extra/preferences/PreferencesContainer';
|
|
13
14
|
import { SpectraColumnsManager } from './base/SpectraColumnsManager';
|
|
15
|
+
function validationColumns(obj) {
|
|
16
|
+
const validationObject = {};
|
|
17
|
+
for (const key of Object.keys(obj.nuclei)) {
|
|
18
|
+
validationObject[key] = Yup.object({
|
|
19
|
+
columns: Yup.array().of(Yup.object().shape({
|
|
20
|
+
jpath: Yup.array().when('jpath', {
|
|
21
|
+
is: (jpath) => {
|
|
22
|
+
return jpath !== undefined;
|
|
23
|
+
},
|
|
24
|
+
// eslint-disable-next-line unicorn/no-thenable
|
|
25
|
+
then: () => Yup.array().of(Yup.string()).required().min(1),
|
|
26
|
+
}),
|
|
27
|
+
}, [['jpath', 'jpath']])),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return validationObject;
|
|
31
|
+
}
|
|
32
|
+
const spectraPreferencesValidation = Yup.lazy((obj) => Yup.object().shape({
|
|
33
|
+
nuclei: Yup.object().shape(validationColumns(obj)),
|
|
34
|
+
}));
|
|
14
35
|
function SpectraPreferences(props, ref) {
|
|
15
36
|
const formRef = useRef(null);
|
|
16
37
|
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
@@ -26,10 +47,15 @@ function SpectraPreferences(props, ref) {
|
|
|
26
47
|
}
|
|
27
48
|
useImperativeHandle(ref, () => ({
|
|
28
49
|
saveSetting: () => {
|
|
29
|
-
formRef.current
|
|
50
|
+
if (!formRef.current)
|
|
51
|
+
return;
|
|
52
|
+
void formRef.current.submitForm();
|
|
53
|
+
return formRef.current?.isValid;
|
|
30
54
|
},
|
|
31
55
|
}), []);
|
|
32
56
|
const handleAdd = useCallback((nucleus, index) => {
|
|
57
|
+
if (!formRef.current)
|
|
58
|
+
return;
|
|
33
59
|
const data = formRef.current.values;
|
|
34
60
|
let columns = data.nuclei[nucleus]?.columns || [];
|
|
35
61
|
columns = [
|
|
@@ -41,7 +67,7 @@ function SpectraPreferences(props, ref) {
|
|
|
41
67
|
},
|
|
42
68
|
...columns.slice(index),
|
|
43
69
|
];
|
|
44
|
-
formRef.current.setValues({
|
|
70
|
+
void formRef.current.setValues({
|
|
45
71
|
...data,
|
|
46
72
|
nuclei: {
|
|
47
73
|
...data.nuclei,
|
|
@@ -53,9 +79,11 @@ function SpectraPreferences(props, ref) {
|
|
|
53
79
|
});
|
|
54
80
|
}, []);
|
|
55
81
|
const handleDelete = useCallback((nucleus, index) => {
|
|
82
|
+
if (!formRef.current)
|
|
83
|
+
return;
|
|
56
84
|
const data = formRef.current.values;
|
|
57
85
|
const columns = data.nuclei[nucleus]?.columns.filter((_, columnIndex) => columnIndex !== index);
|
|
58
|
-
formRef.current.setValues({
|
|
86
|
+
void formRef.current.setValues({
|
|
59
87
|
...data,
|
|
60
88
|
nuclei: {
|
|
61
89
|
...data.nuclei,
|
|
@@ -66,8 +94,14 @@ function SpectraPreferences(props, ref) {
|
|
|
66
94
|
},
|
|
67
95
|
});
|
|
68
96
|
}, []);
|
|
69
|
-
const mapOnChangeValueHandler = useCallback((key) =>
|
|
97
|
+
const mapOnChangeValueHandler = useCallback((key) => {
|
|
98
|
+
const path = paths?.[key];
|
|
99
|
+
if (path) {
|
|
100
|
+
return path;
|
|
101
|
+
}
|
|
102
|
+
return key || ' ';
|
|
103
|
+
}, [paths]);
|
|
70
104
|
const mapValue = useCallback((value) => convertPathArrayToString(value), []);
|
|
71
|
-
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: _jsx(Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => (_jsx(Scroller.Item, { elementKey: n, children: _jsx(NucleusGroup, { nucleus: n, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }, n))) }) }) }));
|
|
105
|
+
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, validationSchema: spectraPreferencesValidation, children: _jsx(Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => (_jsx(Scroller.Item, { elementKey: n, children: _jsx(NucleusGroup, { nucleus: n, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }, n))) }) }) }));
|
|
72
106
|
}
|
|
73
107
|
export default memo(forwardRef(SpectraPreferences));
|