nmrium 0.53.0 → 0.55.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/Viewer1D.js +48 -17
- package/lib/component/1d/XAxis.js +1 -1
- package/lib/component/1d/integral/IntegralsSeries.js +2 -2
- package/lib/component/1d/integral/Integration.d.ts +3 -1
- package/lib/component/1d/integral/Integration.js +3 -2
- package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
- package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
- package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
- package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
- package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
- package/lib/component/1d/ranges/Atoms.js +4 -5
- package/lib/component/1d/ranges/Range.js +62 -12
- package/lib/component/1d/ranges/Ranges.js +2 -1
- package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
- package/lib/component/1d/tool/XLabelPointer.js +4 -12
- package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
- package/lib/component/1d-2d/FieldEdition.js +42 -0
- package/lib/component/2d/Chart2D.js +5 -3
- package/lib/component/2d/tools/XYLabelPointer.js +3 -9
- package/lib/component/2d/zones/Zone.js +18 -2
- package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
- package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
- package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
- package/lib/component/context/LoggerContext.js +11 -4
- package/lib/component/context/ShareDataContext.d.ts +10 -0
- package/lib/component/context/ShareDataContext.js +22 -0
- package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
- package/lib/component/elements/ActionsButtonsPopover.js +22 -0
- package/lib/component/elements/CloseButton.d.ts +1 -1
- package/lib/component/elements/CustomToolTip.d.ts +8 -0
- package/lib/component/elements/CustomToolTip.js +107 -0
- package/lib/component/elements/EditableColumn.js +3 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
- package/lib/component/elements/SVGButton.d.ts +14 -0
- package/lib/component/elements/SVGButton.js +6 -0
- package/lib/component/elements/SVGGroup.js +15 -13
- package/lib/component/elements/SVGText.d.ts +8 -0
- package/lib/component/elements/SVGText.js +24 -0
- package/lib/component/elements/SaveButton.d.ts +1 -1
- package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
- package/lib/component/elements/formik/FormikError.js +2 -4
- package/lib/component/elements/formik/FormikInput.d.ts +2 -1
- package/lib/component/elements/formik/FormikInput.js +5 -4
- package/lib/component/header/Header.js +8 -11
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
- package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
- package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
- package/lib/component/hooks/useIntegralPath.d.ts +2 -0
- package/lib/component/hooks/useIntegralPath.js +3 -1
- package/lib/component/hooks/usePanelPreferences.js +1 -2
- package/lib/component/hooks/useSaveSettings.js +7 -14
- package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
- package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
- package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
- package/lib/component/hooks/useWorkspaceAction.js +89 -0
- package/lib/component/loader/DropZone.js +0 -3
- package/lib/component/main/InnerNMRium.js +3 -1
- package/lib/component/main/InnerNMRiumContents.js +14 -2
- package/lib/component/main/NMRiumStateProvider.js +15 -3
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ImportPublicationStringModal.js +11 -5
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +18 -39
- package/lib/component/modal/setting/WorkspaceItem.js +1 -1
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
- package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
- package/lib/component/modal/setting/settingsValidation.js +36 -40
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +11 -11
- package/lib/component/panels/RangesPanel/RangesPreferences.js +16 -16
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
- package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
- package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +22 -6
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
- package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
- package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
- package/lib/component/panels/header/PreferencesHeader.js +1 -1
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.js +8 -0
- package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
- package/lib/component/reducer/actions/DomainActions.js +29 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +27 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +2 -3
- package/lib/component/reducer/actions/RangesActions.js +28 -26
- package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
- package/lib/component/reducer/actions/SpectraActions.js +5 -1
- package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
- package/lib/component/reducer/actions/ZonesActions.js +47 -13
- package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
- package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
- package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
- package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
- package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +3 -3
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
- package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
- package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +7 -0
- package/lib/component/reducer/preferences/preferencesReducer.js +21 -18
- package/lib/component/toolbar/ToolBar.js +115 -25
- package/lib/component/utility/PreferencesHelper.js +5 -4
- package/lib/component/utility/export.js +4 -0
- package/lib/component/workspaces/assignment.js +0 -1
- package/lib/component/workspaces/basic.js +0 -1
- package/lib/component/workspaces/embedded.js +0 -1
- package/lib/component/workspaces/exercise.js +26 -29
- package/lib/component/workspaces/prediction.js +171 -174
- package/lib/component/workspaces/process1D.js +0 -1
- package/lib/component/workspaces/simulation.js +35 -38
- package/lib/component/workspaces/workspaceDefaultProperties.js +16 -23
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
- package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
- package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/index.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
- package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
- package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
- package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
- package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
- package/lib/data/utilities/generateColor.d.ts +7 -3
- package/lib/data/utilities/generateColor.js +5 -17
- package/lib/versionInfo.js +1 -1
- package/package.json +35 -35
- package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
- package/lib/component/elements/MolecularFormulaInput.js +0 -63
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
|
@@ -104,8 +104,8 @@ function RangesTableRow({ rowData, onUnlink, onContextMenuSelect, contextMenu =
|
|
|
104
104
|
? ConstantlyHighlightedRowStyle
|
|
105
105
|
: null;
|
|
106
106
|
}, [assignmentRange.isActive, highlightRange.isActive, rowData]);
|
|
107
|
-
return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
|
|
107
|
+
return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.showAssignmentLabel && (_jsx(RangeAssignmentColumn, { row: rowData, onHover: onHoverRange, rowSpanTags: rowSpanTags })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
|
|
108
108
|
? 'm'
|
|
109
|
-
: lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.
|
|
109
|
+
: lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumn, { row: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { row: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData })] })), _jsx(ActionsColumn, { row: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind, showDeleteAction: preferences.showDeleteAction, showEditAction: preferences.showEditAction, showZoomAction: preferences.showZoomAction })] }));
|
|
110
110
|
}
|
|
111
111
|
export default RangesTableRow;
|
|
@@ -3,8 +3,10 @@ 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 { MdFormatColorFill } from 'react-icons/md';
|
|
6
7
|
import { useChartData } from '../../context/ChartContext';
|
|
7
8
|
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
+
import { usePreferences } from '../../context/PreferencesContext';
|
|
8
10
|
import { useToaster } from '../../context/ToasterContext';
|
|
9
11
|
import { useModal } from '../../elements/popup/Modal';
|
|
10
12
|
import { useActiveSpectra } from '../../hooks/useActiveSpectra';
|
|
@@ -28,6 +30,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
28
30
|
const modal = useModal();
|
|
29
31
|
const toaster = useToaster();
|
|
30
32
|
const dispatch = useDispatch();
|
|
33
|
+
const { current: { spectraColors }, } = usePreferences();
|
|
31
34
|
const handleDelete = useCallback(() => {
|
|
32
35
|
modal.showConfirmDialog({
|
|
33
36
|
message: (_jsxs("span", { children: ["You are about to delete", _jsxs("span", { style: { color: 'black' }, children: [" ", activeSpectra?.length, " "] }), "spectra, Are you sure?"] })),
|
|
@@ -72,7 +75,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
72
75
|
function resetScaleHandler() {
|
|
73
76
|
dispatch({ type: 'RESET_SPECTRA_SCALE' });
|
|
74
77
|
}
|
|
75
|
-
function
|
|
78
|
+
function defaultReColorSpectraHandler() {
|
|
79
|
+
dispatch({
|
|
80
|
+
type: 'RECOLOR_SPECTRA_COLOR',
|
|
81
|
+
payload: { customColors: spectraColors },
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function distinctReColorSpectraHandler() {
|
|
76
85
|
dispatch({
|
|
77
86
|
type: 'RECOLOR_SPECTRA_COLOR',
|
|
78
87
|
payload: {},
|
|
@@ -84,31 +93,31 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
84
93
|
{
|
|
85
94
|
disabled: !hasActiveSpectra,
|
|
86
95
|
icon: _jsx(FaEyeSlash, {}),
|
|
87
|
-
|
|
96
|
+
tooltip: 'Hide selected spectra',
|
|
88
97
|
onClick: hideAllSpectraHandler,
|
|
89
98
|
},
|
|
90
99
|
{
|
|
91
100
|
disabled: !hasActiveSpectra,
|
|
92
101
|
icon: _jsx(FaEye, {}),
|
|
93
|
-
|
|
102
|
+
tooltip: 'Show selected spectra',
|
|
94
103
|
onClick: showAllSpectraHandler,
|
|
95
104
|
},
|
|
96
105
|
];
|
|
97
106
|
if (displayerMode === '2D' && activeSpectrum?.info.isFt) {
|
|
98
107
|
leftButtons.push({
|
|
99
108
|
icon: _jsx(FaCreativeCommonsSamplingPlus, {}),
|
|
100
|
-
|
|
109
|
+
tooltip: 'Add missing projection',
|
|
101
110
|
onClick: addMissingProjectionHandler,
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
113
|
if (displayerMode === '1D' && spectraLengthPerTab > 1) {
|
|
105
114
|
leftButtons.push({
|
|
106
115
|
icon: _jsx(SvgNmrResetScale, {}),
|
|
107
|
-
|
|
116
|
+
tooltip: 'Reset scale',
|
|
108
117
|
onClick: resetScaleHandler,
|
|
109
118
|
}, {
|
|
110
119
|
icon: _jsx(SvgNmrSameTop, {}),
|
|
111
|
-
|
|
120
|
+
tooltip: 'Same top',
|
|
112
121
|
onClick: setSameTopHandler,
|
|
113
122
|
});
|
|
114
123
|
}
|
|
@@ -118,8 +127,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
|
|
|
118
127
|
},
|
|
119
128
|
{
|
|
120
129
|
icon: _jsx(IoColorPaletteOutline, {}),
|
|
121
|
-
|
|
122
|
-
onClick:
|
|
130
|
+
tooltip: 'Default spectra recoloring',
|
|
131
|
+
onClick: defaultReColorSpectraHandler,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
icon: _jsx(MdFormatColorFill, {}),
|
|
135
|
+
tooltip: 'Distinct spectra recoloring',
|
|
136
|
+
onClick: distinctReColorSpectraHandler,
|
|
123
137
|
},
|
|
124
138
|
]);
|
|
125
139
|
return (_jsx(DefaultPanelHeader, { onDelete: handleDelete, total: data?.length, counter: spectraLengthPerTab, deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, onSettingClick: onSettingClick, leftButtons: leftButtons }));
|
|
@@ -4,6 +4,7 @@ import { useImperativeHandle, useRef, memo, forwardRef, useCallback, useMemo, }
|
|
|
4
4
|
import * as Yup from 'yup';
|
|
5
5
|
import { useChartData } from '../../context/ChartContext';
|
|
6
6
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
7
|
+
import { GroupPane } from '../../elements/GroupPane';
|
|
7
8
|
import { Scroller } from '../../elements/Scroller';
|
|
8
9
|
import useNucleus from '../../hooks/useNucleus';
|
|
9
10
|
import { usePanelPreferencesByNuclei } from '../../hooks/usePanelPreferences';
|
|
@@ -12,6 +13,17 @@ import { getSpectraObjectPaths } from '../../utility/getSpectraObjectPaths';
|
|
|
12
13
|
import { NucleusGroup } from '../extra/preferences/NucleusGroup';
|
|
13
14
|
import { PreferencesContainer } from '../extra/preferences/PreferencesContainer';
|
|
14
15
|
import { SpectraColumnsManager } from './base/SpectraColumnsManager';
|
|
16
|
+
const groupPaneStyle = {
|
|
17
|
+
header: {
|
|
18
|
+
color: 'black',
|
|
19
|
+
fontSize: '12px',
|
|
20
|
+
padding: '5px',
|
|
21
|
+
backgroundColor: '#f8f8f8',
|
|
22
|
+
},
|
|
23
|
+
container: {
|
|
24
|
+
paddingBottom: '10px',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
15
27
|
function validationColumns(obj) {
|
|
16
28
|
const validationObject = {};
|
|
17
29
|
for (const key of Object.keys(obj.nuclei)) {
|
|
@@ -102,6 +114,6 @@ function SpectraPreferences(props, ref) {
|
|
|
102
114
|
return key || ' ';
|
|
103
115
|
}, [paths]);
|
|
104
116
|
const mapValue = useCallback((value) => convertPathArrayToString(value), []);
|
|
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))) }) }) }));
|
|
117
|
+
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(GroupPane, { text: "General", style: groupPaneStyle, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }) }, n))) }) }) }));
|
|
106
118
|
}
|
|
107
119
|
export default memo(forwardRef(SpectraPreferences));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Axis, Heading, Legend, LineSeries, Plot, } from 'react-plot';
|
|
3
3
|
export default function PlotChart({ data, sign, color, yLogBase, hideHeading = false, }) {
|
|
4
|
-
return (_jsxs(Plot, { width: 180, height: 220, children: [!hideHeading && _jsx(Heading, { title: "
|
|
4
|
+
return (_jsxs(Plot, { width: 180, height: 220, children: [!hideHeading && _jsx(Heading, { title: "SAN plot" }), _jsx(LineSeries, { data: data.sanPlot?.[sign] || [], xAxis: "x", yAxis: "y", label: sign, lineStyle: {
|
|
5
5
|
stroke: color,
|
|
6
6
|
strokeWidth: 1.2,
|
|
7
7
|
}, markerStyle: {
|
|
@@ -7,7 +7,7 @@ function Spectrum2DHistogram({ color = 'red', data, }) {
|
|
|
7
7
|
const processedData = useMemo(() => {
|
|
8
8
|
return processSnapPlot('2D', data.rr, yLogBase);
|
|
9
9
|
}, [data]);
|
|
10
|
-
return (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "
|
|
10
|
+
return (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "SAN plot" }), _jsxs("div", { style: {
|
|
11
11
|
borderTop: '1px solid #ededed',
|
|
12
12
|
marginTop: '10px',
|
|
13
13
|
paddingTop: '10px',
|
|
@@ -103,5 +103,5 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
|
|
|
103
103
|
handleOnEdit,
|
|
104
104
|
link,
|
|
105
105
|
]);
|
|
106
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, {
|
|
106
|
+
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { tooltip: "Close", onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
|
|
107
107
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface InnerMolecularFormulaModalProps {
|
|
2
2
|
onClose: () => void;
|
|
3
|
-
onSave?: (element: any) => void;
|
|
4
|
-
molecules: any;
|
|
5
|
-
previousMF: any;
|
|
6
3
|
}
|
|
7
|
-
|
|
4
|
+
interface MolecularFormulaModalProps extends InnerMolecularFormulaModalProps {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function SetMolecularFormulaModal(props: MolecularFormulaModalProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
8
8
|
export {};
|
|
@@ -1,94 +1,84 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogBody, Tab, Tabs } from '@blueprintjs/core';
|
|
3
|
+
import { Formik } from 'formik';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import * as Yup from 'yup';
|
|
6
|
+
import getAtomsFromMF from '../../../data/utilities/getAtomsFromMF';
|
|
7
|
+
import { useChartData } from '../../context/ChartContext';
|
|
8
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
+
import Button from '../../elements/Button';
|
|
7
10
|
import MoleculeSelection from '../../elements/MoleculeSelection';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
button {
|
|
15
|
-
flex: 2;
|
|
16
|
-
padding: 5px;
|
|
17
|
-
border: 1px solid gray;
|
|
18
|
-
border-radius: 5px;
|
|
19
|
-
height: 30px;
|
|
20
|
-
margin: 0 auto;
|
|
21
|
-
margin-top: 15px;
|
|
22
|
-
display: block;
|
|
23
|
-
width: 20%;
|
|
24
|
-
color: white;
|
|
25
|
-
background-color: gray;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
button:focus {
|
|
29
|
-
outline: none;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.header {
|
|
33
|
-
height: 24px;
|
|
34
|
-
border-bottom: 1px solid #f0f0f0;
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
|
|
38
|
-
button {
|
|
39
|
-
height: 36px;
|
|
40
|
-
margin: 2px;
|
|
41
|
-
background-color: transparent;
|
|
42
|
-
border: none;
|
|
43
|
-
|
|
44
|
-
svg {
|
|
45
|
-
height: 16px;
|
|
46
|
-
}
|
|
11
|
+
import FormikError from '../../elements/formik/FormikError';
|
|
12
|
+
import FormikInput from '../../elements/formik/FormikInput';
|
|
13
|
+
function isValidMf(value) {
|
|
14
|
+
try {
|
|
15
|
+
getAtomsFromMF(value);
|
|
16
|
+
return true;
|
|
47
17
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const validationSchema = Yup.object({
|
|
23
|
+
mf: Yup.string()
|
|
24
|
+
.required()
|
|
25
|
+
.test('valid-mf', 'Enter a valid molecular formula', (value) => isValidMf(value)),
|
|
26
|
+
});
|
|
27
|
+
const styles = {
|
|
28
|
+
input: {
|
|
29
|
+
padding: '0.5rem',
|
|
30
|
+
},
|
|
31
|
+
container: {
|
|
32
|
+
padding: '0.5rem',
|
|
33
|
+
},
|
|
34
|
+
error: {
|
|
35
|
+
textAlign: 'center',
|
|
36
|
+
color: 'red',
|
|
37
|
+
fontSize: '0.9em',
|
|
38
|
+
},
|
|
39
|
+
title: {
|
|
40
|
+
textAlign: 'center',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export function SetMolecularFormulaModal(props) {
|
|
44
|
+
const { isOpen, ...otherProps } = props;
|
|
45
|
+
if (!isOpen) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
return _jsx(InnerSetMolecularFormulaModal, { ...otherProps });
|
|
49
|
+
}
|
|
50
|
+
function InnerSetMolecularFormulaModal({ onClose, }) {
|
|
51
|
+
const dispatch = useDispatch();
|
|
52
|
+
function saveHandler(mf) {
|
|
53
|
+
dispatch({
|
|
54
|
+
type: 'SET_CORRELATIONS_MF',
|
|
55
|
+
payload: {
|
|
56
|
+
mf,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
88
59
|
onClose?.();
|
|
89
|
-
}
|
|
90
|
-
|
|
60
|
+
}
|
|
61
|
+
return (_jsx(Dialog, { isOpen: true, title: "Molecular formula", style: { width: 400 }, onClose: onClose, children: _jsx(DialogBody, { children: _jsxs(Tabs, { fill: true, children: [_jsx(Tab, { id: "manual", title: "Manual", panel: _jsx(ManualFormula, { onSave: saveHandler }) }), _jsx(Tab, { id: "auto", title: "Auto", panel: _jsx(AutoFormula, { onSave: saveHandler }) })] }) }) }));
|
|
62
|
+
}
|
|
63
|
+
function ManualFormula(props) {
|
|
64
|
+
const { correlations } = useChartData();
|
|
65
|
+
function saveHandler(data) {
|
|
66
|
+
props?.onSave(data.mf);
|
|
67
|
+
}
|
|
68
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("p", { children: "Please type in a molecular formula!" }), _jsx(Formik, { onSubmit: saveHandler, initialValues: { mf: correlations?.options?.mf }, validationSchema: validationSchema, children: ({ isValid, handleSubmit }) => (_jsxs(_Fragment, { children: [_jsx(FormikError, { name: "mf", children: _jsx(FormikInput, { name: "mf", placeholder: "Enter a molecular formula", style: { input: styles.input }, checkErrorAfterInputTouched: false }) }), _jsx(Button.Done, { onClick: () => handleSubmit(), disabled: !isValid, style: { marginTop: '10px' }, children: "Set molecular formula" })] })) })] }));
|
|
69
|
+
}
|
|
70
|
+
function AutoFormula(props) {
|
|
71
|
+
const { molecules } = useChartData();
|
|
72
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
73
|
+
function onChangeHandlerMoleculeSelection(index) {
|
|
91
74
|
setCurrentIndex(index);
|
|
92
|
-
}
|
|
93
|
-
|
|
75
|
+
}
|
|
76
|
+
function saveHandler() {
|
|
77
|
+
const mf = molecules?.[currentIndex]?.mf;
|
|
78
|
+
props?.onSave(mf);
|
|
79
|
+
}
|
|
80
|
+
if (!molecules || molecules?.length === 0) {
|
|
81
|
+
return (_jsx("p", { style: styles.error, children: "You have to Select a spectrum and Add a molecule from the Structure panel to select as a reference!" }));
|
|
82
|
+
}
|
|
83
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("p", { style: styles.title, children: "Select a molecule as reference!" }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx(Button.Done, { onClick: saveHandler, disabled: !molecules?.[currentIndex], style: { marginTop: '10px' }, children: "Set molecular formula" })] }));
|
|
94
84
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
interface SetShiftToleranceModalProps {
|
|
1
|
+
interface SetShiftToleranceModalProps extends InnerSetShiftToleranceModalProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
}
|
|
4
|
+
interface InnerSetShiftToleranceModalProps {
|
|
2
5
|
onClose: () => void;
|
|
3
|
-
onSave?: (element: any) => void;
|
|
4
|
-
previousTolerance: any;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
+
export declare function SetShiftToleranceModal(props: SetShiftToleranceModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
|
|
7
8
|
export {};
|
|
@@ -1,104 +1,72 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
outline: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.header {
|
|
31
|
-
height: 24px;
|
|
32
|
-
border-bottom: 1px solid #f0f0f0;
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
|
|
36
|
-
span {
|
|
37
|
-
color: #464646;
|
|
38
|
-
font-size: 15px;
|
|
39
|
-
flex: 1;
|
|
40
|
-
user-select: none;
|
|
3
|
+
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
|
+
import { Formik } from 'formik';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import * as Yup from 'yup';
|
|
7
|
+
import { useChartData } from '../../context/ChartContext';
|
|
8
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
9
|
+
import Button from '../../elements/Button';
|
|
10
|
+
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
11
|
+
import FormikInput from '../../elements/formik/FormikInput';
|
|
12
|
+
const styles = {
|
|
13
|
+
input: {
|
|
14
|
+
padding: '0.25rem 0.5rem',
|
|
15
|
+
},
|
|
16
|
+
column: {
|
|
17
|
+
padding: '2px',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const toleranceValidationSchema = Yup.array()
|
|
21
|
+
.of(Yup.object({ value: Yup.number().required() }))
|
|
22
|
+
.min(1);
|
|
23
|
+
export function SetShiftToleranceModal(props) {
|
|
24
|
+
const { isOpen, ...otherPros } = props;
|
|
25
|
+
if (!isOpen) {
|
|
26
|
+
return;
|
|
41
27
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
table {
|
|
56
|
-
margin-top: 10px;
|
|
57
|
-
width: 100%;
|
|
58
|
-
|
|
59
|
-
input::-webkit-outer-spin-button,
|
|
60
|
-
input::-webkit-inner-spin-button {
|
|
61
|
-
appearance: none;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
input {
|
|
65
|
-
width: 100px;
|
|
66
|
-
text-align: center;
|
|
67
|
-
border-radius: 5px;
|
|
68
|
-
border: 0.55px solid #c7c7c7;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
72
|
-
export default function SetShiftToleranceModal({ onClose, onSave, previousTolerance, }) {
|
|
73
|
-
const [tolerance, setTolerance] = useState();
|
|
74
|
-
const [isValid, setIsValid] = useState({});
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (previousTolerance) {
|
|
77
|
-
setTolerance(previousTolerance);
|
|
78
|
-
setIsValid(Object.fromEntries(Object.keys(previousTolerance).map((atomType) => [atomType, true])));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
setTolerance(undefined);
|
|
28
|
+
return _jsx(InnerSetShiftToleranceModal, { ...otherPros });
|
|
29
|
+
}
|
|
30
|
+
function InnerSetShiftToleranceModal(props) {
|
|
31
|
+
const { onClose } = props;
|
|
32
|
+
const { correlations } = useChartData();
|
|
33
|
+
const dispatch = useDispatch();
|
|
34
|
+
function onSaveHandler(data) {
|
|
35
|
+
const tolerance = {};
|
|
36
|
+
for (const { atom, value } of data) {
|
|
37
|
+
tolerance[atom] = value;
|
|
82
38
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
39
|
+
dispatch({
|
|
40
|
+
type: 'SET_CORRELATIONS_TOLERANCE',
|
|
41
|
+
payload: {
|
|
42
|
+
tolerance,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
86
45
|
onClose?.();
|
|
87
46
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
47
|
+
const COLUMNS = useMemo(() => [
|
|
48
|
+
{
|
|
49
|
+
Header: '#',
|
|
50
|
+
style: { width: '25px', textAlign: 'center', ...styles.column },
|
|
51
|
+
accessor: (_, index) => index + 1,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
Header: 'Atom',
|
|
55
|
+
style: { width: '25px', textAlign: 'center', ...styles.column },
|
|
56
|
+
accessor: 'atom',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
Header: 'Value',
|
|
60
|
+
style: { padding: 0, ...styles.column },
|
|
61
|
+
Cell: ({ row }) => {
|
|
62
|
+
return (_jsx(FormikInput, { name: `${row.index}.value`, style: { input: styles.input }, type: "number", checkErrorAfterInputTouched: false }));
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
], []);
|
|
66
|
+
const tolerances = correlations?.options?.tolerance || {};
|
|
67
|
+
const tolerancesData = Object.keys(tolerances).map((atom) => ({
|
|
68
|
+
atom,
|
|
69
|
+
value: tolerances[atom],
|
|
70
|
+
}));
|
|
71
|
+
return (_jsx(Dialog, { isOpen: true, title: "Shift tolerances", onClose: onClose, style: { width: 400 }, children: _jsx(Formik, { initialValues: tolerancesData, onSubmit: onSaveHandler, validationSchema: toleranceValidationSchema, children: ({ isValid, handleSubmit }) => (_jsxs(_Fragment, { children: [_jsx(DialogBody, { children: _jsx(ReactTable, { data: tolerancesData, columns: COLUMNS, emptyDataRowText: "No atoms" }) }), _jsx(DialogFooter, { children: _jsx(Button.Done, { onClick: () => handleSubmit(), disabled: !isValid, children: "Set shift tolerances" }) })] })) }) }));
|
|
104
72
|
}
|
|
@@ -9,12 +9,12 @@ import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
|
9
9
|
import { useChartData } from '../../context/ChartContext';
|
|
10
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
11
|
import Select from '../../elements/Select';
|
|
12
|
-
import {
|
|
12
|
+
import { useDialogToggle } from '../../hooks/useDialogToggle';
|
|
13
13
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
14
14
|
import CorrelationTable from './CorrelationTable/CorrelationTable';
|
|
15
15
|
import Overview from './Overview';
|
|
16
|
-
import SetMolecularFormulaModal from './SetMolecularFormulaModal';
|
|
17
|
-
import SetShiftToleranceModal from './SetShiftTolerancesModal';
|
|
16
|
+
import { SetMolecularFormulaModal } from './SetMolecularFormulaModal';
|
|
17
|
+
import { SetShiftToleranceModal } from './SetShiftTolerancesModal';
|
|
18
18
|
import { findSignalMatch1D, findSignalMatch2D, getAtomType, } from './utilities/Utilities';
|
|
19
19
|
const panelStyle = css `
|
|
20
20
|
display: flex;
|
|
@@ -50,10 +50,13 @@ const panelStyle = css `
|
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
52
52
|
function SummaryPanel() {
|
|
53
|
-
const {
|
|
53
|
+
const { correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
|
|
54
54
|
const dispatch = useDispatch();
|
|
55
|
-
const modal = useModal();
|
|
56
55
|
const assignmentData = useAssignmentData();
|
|
56
|
+
const { dialog, openDialog, closeDialog } = useDialogToggle({
|
|
57
|
+
shiftToleranceModal: false,
|
|
58
|
+
molecularFormula: false,
|
|
59
|
+
});
|
|
57
60
|
const [additionalColumnData, setAdditionalColumnData] = useState([]);
|
|
58
61
|
const [selectedAdditionalColumnsAtomType, setSelectedAdditionalColumnsAtomType,] = useState('H');
|
|
59
62
|
const [showProtonsAsRows, setShowProtonsAsRows] = useState(false);
|
|
@@ -135,28 +138,6 @@ function SummaryPanel() {
|
|
|
135
138
|
xDomain,
|
|
136
139
|
yDomain,
|
|
137
140
|
]);
|
|
138
|
-
const handleOnSetMolecularFormula = useCallback((mf) => {
|
|
139
|
-
dispatch({
|
|
140
|
-
type: 'SET_CORRELATIONS_MF',
|
|
141
|
-
payload: {
|
|
142
|
-
mf,
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
}, [dispatch]);
|
|
146
|
-
const handleOnSetShiftTolerance = useCallback((tolerance) => {
|
|
147
|
-
dispatch({
|
|
148
|
-
type: 'SET_CORRELATIONS_TOLERANCE',
|
|
149
|
-
payload: {
|
|
150
|
-
tolerance,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}, [dispatch]);
|
|
154
|
-
const showSetMolecularFormulaModal = useCallback(() => {
|
|
155
|
-
modal.show(_jsx(SetMolecularFormulaModal, { onClose: () => modal.close(), onSave: handleOnSetMolecularFormula, molecules: molecules, previousMF: correlationsData.options.mf }));
|
|
156
|
-
}, [correlationsData, handleOnSetMolecularFormula, modal, molecules]);
|
|
157
|
-
const showSetShiftToleranceModal = useCallback(() => {
|
|
158
|
-
modal.show(_jsx(SetShiftToleranceModal, { onClose: () => modal.close(), onSave: handleOnSetShiftTolerance, previousTolerance: correlationsData.options.tolerance }));
|
|
159
|
-
}, [correlationsData, handleOnSetShiftTolerance, modal]);
|
|
160
141
|
const additionalColumnTypes = useMemo(() => {
|
|
161
142
|
const columnTypes = ['H', 'H-H'].concat(correlationsData
|
|
162
143
|
? correlationsData.values
|
|
@@ -309,18 +290,18 @@ function SummaryPanel() {
|
|
|
309
290
|
setFilterIsActive(!filterIsActive);
|
|
310
291
|
}, [filterIsActive]);
|
|
311
292
|
const total = correlationsData ? correlationsData.values.length : 0;
|
|
312
|
-
return (_jsxs("div", { css: panelStyle, children: [_jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
293
|
+
return (_jsxs("div", { css: panelStyle, children: [_jsx(SetMolecularFormulaModal, { isOpen: dialog.molecularFormula, onClose: closeDialog }), _jsx(SetShiftToleranceModal, { isOpen: dialog.shiftToleranceModal, onClose: closeDialog }), _jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
313
294
|
? 'Show all correlations'
|
|
314
295
|
: 'Hide correlations out of view', leftButtons: [
|
|
315
296
|
{
|
|
316
297
|
icon: _jsx(FaFlask, {}),
|
|
317
|
-
|
|
318
|
-
onClick:
|
|
298
|
+
tooltip: `Set molecular formula (${correlationsData?.options?.mf || ''})`,
|
|
299
|
+
onClick: () => openDialog('molecularFormula'),
|
|
319
300
|
},
|
|
320
301
|
{
|
|
321
302
|
icon: _jsx(FaSlidersH, {}),
|
|
322
|
-
|
|
323
|
-
onClick:
|
|
303
|
+
tooltip: 'Set shift tolerance',
|
|
304
|
+
onClick: () => openDialog('shiftToleranceModal'),
|
|
324
305
|
},
|
|
325
306
|
], children: _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) => {
|
|
326
307
|
setSelectedAdditionalColumnsAtomType(selection);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ZoneData } from '../hooks/useMapZones';
|
|
2
|
+
interface ZoneAssignmentLabelColumnProps {
|
|
3
|
+
rowData: ZoneData;
|
|
4
|
+
}
|
|
5
|
+
export declare function ZoneAssignmentLabelColumn({ rowData, }: ZoneAssignmentLabelColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|