nmrium 0.52.0 → 0.54.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/ranges/AssignmentLabel.d.ts +7 -0
- package/lib/component/1d/ranges/AssignmentLabel.js +10 -0
- package/lib/component/1d/ranges/Range.js +15 -6
- package/lib/component/1d/tool/XLabelPointer.js +4 -12
- package/lib/component/2d/tools/XYLabelPointer.js +3 -9
- package/lib/component/context/LoggerContext.js +11 -4
- 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 +6 -5
- package/lib/component/elements/SaveButton.d.ts +1 -1
- package/lib/component/elements/formik/FormikError.js +2 -4
- package/lib/component/elements/formik/FormikInput.js +2 -2
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
- package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
- package/lib/component/hooks/useToolsFunctions.js +7 -1
- package/lib/component/main/NMRiumStateProvider.js +12 -2
- 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.d.ts +5 -3
- package/lib/component/modal/ImportPublicationStringModal.js +18 -9
- 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/signal-tabs/SignalJCouplingsTable.js +1 -1
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +1 -1
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +12 -19
- 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 +29 -15
- package/lib/component/panels/RangesPanel/RangesPreferences.js +19 -13
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.d.ts +7 -0
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.js +16 -0
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
- 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/ZonesPanel.js +4 -4
- 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/spectrumSimulation/SpectrumSimulation.js +8 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +1 -1
- package/lib/component/reducer/Reducer.js +4 -0
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +364 -318
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +9 -5
- package/lib/component/reducer/actions/RangesActions.js +31 -21
- package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
- package/lib/component/reducer/actions/SpectraActions.js +5 -1
- package/lib/component/reducer/actions/ToolsActions.js +13 -20
- package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +6 -4
- package/lib/component/toolbar/ToolBar.js +112 -26
- package/lib/component/utility/export.js +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +7 -12
- 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 +29 -29
- package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
- package/lib/component/elements/MolecularFormulaInput.js +0 -63
- 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
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useReducer, useRef, useState, } from 'react';
|
|
3
3
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
4
4
|
import { useOnOff } from 'react-science/ui';
|
|
5
|
+
import { createRange, isSpectrum1D } from '../../data/data1d/Spectrum1D';
|
|
6
|
+
import { cutRange } from '../../data/data1d/Spectrum1D/ranges/createRange';
|
|
5
7
|
import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
|
|
6
8
|
import CrossLinePointer from '../1d-2d/tools/CrossLinePointer';
|
|
7
9
|
import { ViewerResponsiveWrapper } from '../2d/Viewer2D';
|
|
@@ -10,9 +12,11 @@ import { MouseTracker } from '../EventsTrackers/MouseTracker';
|
|
|
10
12
|
import { useChartData } from '../context/ChartContext';
|
|
11
13
|
import { useDispatch } from '../context/DispatchContext';
|
|
12
14
|
import { useMapKeyModifiers } from '../context/KeyModifierContext';
|
|
15
|
+
import { useLogger } from '../context/LoggerContext';
|
|
13
16
|
import { usePreferences } from '../context/PreferencesContext';
|
|
14
17
|
import { ScaleProvider } from '../context/ScaleContext';
|
|
15
18
|
import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
|
|
19
|
+
import useSpectrum from '../hooks/useSpectrum';
|
|
16
20
|
import { useVerticalAlign } from '../hooks/useVerticalAlign';
|
|
17
21
|
import Spinner from '../loader/Spinner';
|
|
18
22
|
import MultipletAnalysisModal from '../modal/MultipletAnalysisModal';
|
|
@@ -34,8 +38,10 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
34
38
|
const brushStartRef = useRef(null);
|
|
35
39
|
const verticalAlign = useVerticalAlign();
|
|
36
40
|
const activeSpectrum = useActiveSpectrum();
|
|
41
|
+
const spectrum = useSpectrum();
|
|
37
42
|
const dispatch = useDispatch();
|
|
38
43
|
const { dispatch: dispatchPreferences } = usePreferences();
|
|
44
|
+
const { logger } = useLogger();
|
|
39
45
|
const [scaleState, dispatchScale] = useReducer(scaleReducer, scaleInitialState);
|
|
40
46
|
useEffect(() => {
|
|
41
47
|
if (xDomain.length > 0 && yDomain.length > 0 && widthProp && heightProp) {
|
|
@@ -84,6 +90,10 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
84
90
|
brushStartRef.current = null;
|
|
85
91
|
setBrushData(brushData);
|
|
86
92
|
const keyModifiers = getModifiersKey(brushData);
|
|
93
|
+
const selectRange = getRange(state, {
|
|
94
|
+
startX: brushData.startX,
|
|
95
|
+
endX: brushData.endX,
|
|
96
|
+
});
|
|
87
97
|
if (brushData.mouseButton === 'main') {
|
|
88
98
|
const propagateEvent = () => {
|
|
89
99
|
if (!scaleState.scaleX || !scaleState.scaleY)
|
|
@@ -108,12 +118,22 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
108
118
|
});
|
|
109
119
|
break;
|
|
110
120
|
case options.rangePicking.id: {
|
|
111
|
-
if (!
|
|
121
|
+
if (!spectrum)
|
|
112
122
|
break;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
if (isSpectrum1D(spectrum)) {
|
|
124
|
+
const [from, to] = selectRange;
|
|
125
|
+
const range = createRange(spectrum, {
|
|
126
|
+
from,
|
|
127
|
+
to,
|
|
128
|
+
logger,
|
|
129
|
+
});
|
|
130
|
+
if (!range)
|
|
131
|
+
break;
|
|
132
|
+
dispatch({
|
|
133
|
+
type: 'ADD_RANGE',
|
|
134
|
+
payload: { range },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
117
137
|
break;
|
|
118
138
|
}
|
|
119
139
|
case options.multipleSpectraAnalysis.id:
|
|
@@ -153,10 +173,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
153
173
|
});
|
|
154
174
|
break;
|
|
155
175
|
case options.matrixGenerationExclusionZones.id: {
|
|
156
|
-
const [from, to] =
|
|
157
|
-
startX: brushData.startX,
|
|
158
|
-
endX: brushData.endX,
|
|
159
|
-
});
|
|
176
|
+
const [from, to] = selectRange;
|
|
160
177
|
dispatchPreferences({
|
|
161
178
|
type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
162
179
|
payload: {
|
|
@@ -202,14 +219,15 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
202
219
|
}
|
|
203
220
|
}, [
|
|
204
221
|
getModifiersKey,
|
|
222
|
+
state,
|
|
205
223
|
selectedTool,
|
|
206
224
|
scaleState,
|
|
207
225
|
primaryKeyIdentifier,
|
|
208
226
|
dispatch,
|
|
209
|
-
|
|
227
|
+
spectrum,
|
|
228
|
+
logger,
|
|
210
229
|
dispatchPreferences,
|
|
211
230
|
activeTab,
|
|
212
|
-
state,
|
|
213
231
|
xDomain,
|
|
214
232
|
openAnalysisModal,
|
|
215
233
|
]);
|
|
@@ -246,12 +264,18 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
246
264
|
payload: { cutValue: xPPM },
|
|
247
265
|
});
|
|
248
266
|
break;
|
|
249
|
-
case options.rangePicking.id:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
267
|
+
case options.rangePicking.id: {
|
|
268
|
+
if (!spectrum)
|
|
269
|
+
break;
|
|
270
|
+
if (isSpectrum1D(spectrum)) {
|
|
271
|
+
const cutRanges = cutRange(spectrum, xPPM);
|
|
272
|
+
dispatch({
|
|
273
|
+
type: 'CUT_RANGE',
|
|
274
|
+
payload: { ranges: cutRanges },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
254
277
|
break;
|
|
278
|
+
}
|
|
255
279
|
case options.phaseCorrection.id:
|
|
256
280
|
dispatch({
|
|
257
281
|
type: 'SET_ONE_DIMENSION_PIVOT_POINT',
|
|
@@ -268,7 +292,14 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
268
292
|
default:
|
|
269
293
|
break;
|
|
270
294
|
}
|
|
271
|
-
}, [
|
|
295
|
+
}, [
|
|
296
|
+
dispatch,
|
|
297
|
+
getModifiersKey,
|
|
298
|
+
primaryKeyIdentifier,
|
|
299
|
+
scaleState,
|
|
300
|
+
selectedTool,
|
|
301
|
+
spectrum,
|
|
302
|
+
]);
|
|
272
303
|
return (_jsxs(ScaleProvider, { value: scaleState, children: [_jsx(ResponsiveChart, { children: ({ height, width }) => (_jsx(ViewerResponsiveWrapper, { height: height, width: width, children: _jsxs("div", { style: { height: '100%', position: 'relative' }, children: [_jsx(Spinner, { isLoading: isLoading, emptyText: emptyText }), scaleState.scaleX &&
|
|
273
304
|
scaleState.scaleY &&
|
|
274
305
|
data &&
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
3
|
+
const marginTop = 55;
|
|
4
|
+
export function AssignmentLabel(props) {
|
|
5
|
+
const { range, x } = props;
|
|
6
|
+
const { showAssignmentsLabels } = useActiveSpectrumRangesViewState();
|
|
7
|
+
if (!range.assignment || !showAssignmentsLabels)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx("text", { x: x - 5, y: marginTop, fontSize: "12px", fill: "black", textAnchor: "end", children: range.assignment }));
|
|
10
|
+
}
|
|
@@ -1,19 +1,23 @@
|
|
|
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 { isSpectrum1D, resizeRange } from '../../../data/data1d/Spectrum1D';
|
|
4
5
|
import { isRangeAssigned } from '../../../data/data1d/Spectrum1D/isRangeAssigned';
|
|
5
6
|
import { checkRangeKind } from '../../../data/utilities/RangeUtilities';
|
|
6
7
|
import { useAssignment, useAssignmentData, } from '../../assignment/AssignmentsContext';
|
|
7
8
|
import { filterForIDsWithAssignment } from '../../assignment/utilities/filterForIDsWithAssignment';
|
|
8
9
|
import { useDispatch } from '../../context/DispatchContext';
|
|
10
|
+
import { useLogger } from '../../context/LoggerContext';
|
|
9
11
|
import { ResizerWithScale } from '../../elements/ResizerWithScale';
|
|
10
12
|
import { HighlightEventSource, useHighlight } from '../../highlight';
|
|
11
13
|
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
12
14
|
import { useResizerStatus } from '../../hooks/useResizerStatus';
|
|
15
|
+
import useSpectrum from '../../hooks/useSpectrum';
|
|
13
16
|
import { options } from '../../toolbar/ToolTypes';
|
|
14
17
|
import { IntegralIndicator } from '../integral/IntegralIndicator';
|
|
15
18
|
import { useScaleX } from '../utilities/scale';
|
|
16
19
|
import { AssignmentActionsButtons } from './AssignmentActionsButtons';
|
|
20
|
+
import { AssignmentLabel } from './AssignmentLabel';
|
|
17
21
|
import { Atoms } from './Atoms';
|
|
18
22
|
const style = css `
|
|
19
23
|
.target {
|
|
@@ -33,17 +37,22 @@ function Range({ range, selectedTool, relativeFormat }) {
|
|
|
33
37
|
const highlightRange = useHighlight([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat(filterForIDsWithAssignment(assignmentData, signals.map((_signal) => _signal.id))), { type: HighlightEventSource.RANGE, extra: { id } });
|
|
34
38
|
const scaleX = useScaleX();
|
|
35
39
|
const dispatch = useDispatch();
|
|
40
|
+
const { logger } = useLogger();
|
|
41
|
+
const spectrum = useSpectrum();
|
|
36
42
|
const { showIntegralsValues } = useActiveSpectrumRangesViewState();
|
|
37
43
|
const isBlockedByEditing = selectedTool && selectedTool === options.editRange.id;
|
|
38
44
|
function handleOnStopResizing(position) {
|
|
45
|
+
if (!spectrum || !isSpectrum1D(spectrum))
|
|
46
|
+
return;
|
|
47
|
+
const from = scaleX().invert(position.x2);
|
|
48
|
+
const to = scaleX().invert(position.x1);
|
|
49
|
+
const newRange = resizeRange(spectrum, { from, to, range, logger });
|
|
50
|
+
if (!newRange)
|
|
51
|
+
return;
|
|
39
52
|
dispatch({
|
|
40
53
|
type: 'RESIZE_RANGE',
|
|
41
54
|
payload: {
|
|
42
|
-
range:
|
|
43
|
-
...range,
|
|
44
|
-
from: scaleX().invert(position.x2),
|
|
45
|
-
to: scaleX().invert(position.x1),
|
|
46
|
-
},
|
|
55
|
+
range: newRange,
|
|
47
56
|
},
|
|
48
57
|
});
|
|
49
58
|
}
|
|
@@ -78,6 +87,6 @@ function Range({ range, selectedTool, relativeFormat }) {
|
|
|
78
87
|
return (_jsxs("g", { "data-testid": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, ...(!assignmentRange.isActive && { css: style }), children: [_jsx(ResizerWithScale, { from: from, to: to, onEnd: handleOnStopResizing, disabled: !isResizingActive, children: ({ x1, x2 }, isActive) => {
|
|
79
88
|
const width = x2 - x1;
|
|
80
89
|
return (_jsxs("g", { children: [isAssigned && !isHighlighted && !isActive && (_jsx("rect", { width: width, height: "10px", fill: "#ffd700", opacity: "0.35", "data-no-export": "true" })), _jsx("rect", { width: width, height: "100%", fill: isHighlighted || isActive ? '#ff6f0057' : 'transparent', "data-no-export": "true" }), showIntegralsValues && (_jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 }))] }));
|
|
81
|
-
} }), _jsx(Atoms, { range: range, x: startX }), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || rangeDiaIDs), x: startX, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
|
|
90
|
+
} }), _jsx(AssignmentLabel, { range: range, x: startX }), _jsx(Atoms, { range: range, x: startX }), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || rangeDiaIDs), x: startX, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
|
|
82
91
|
}
|
|
83
92
|
export default Range;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
2
|
import { useBrushTracker } from '../../EventsTrackers/BrushTracker';
|
|
4
3
|
import { useMouseTracker } from '../../EventsTrackers/MouseTracker';
|
|
5
4
|
import { useChartData } from '../../context/ChartContext';
|
|
@@ -8,10 +7,8 @@ import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
|
|
|
8
7
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
9
8
|
const style = {
|
|
10
9
|
cursor: 'crosshair',
|
|
11
|
-
transformOrigin: 'bottom right',
|
|
12
10
|
position: 'absolute',
|
|
13
|
-
|
|
14
|
-
left: '-30px',
|
|
11
|
+
paddingRight: '5px',
|
|
15
12
|
pointerEvents: 'none',
|
|
16
13
|
overflow: 'visible',
|
|
17
14
|
userSelect: 'none',
|
|
@@ -23,12 +20,6 @@ function XLabelPointer() {
|
|
|
23
20
|
const position = useMouseTracker();
|
|
24
21
|
const brushState = useBrushTracker();
|
|
25
22
|
const format = useFormatNumberByNucleus(activeSpectrum?.info.nucleus);
|
|
26
|
-
const getXValue = useCallback((xVal) => {
|
|
27
|
-
if (activeSpectrum) {
|
|
28
|
-
const xInvert = scaleX().invert(xVal);
|
|
29
|
-
return format(xInvert);
|
|
30
|
-
}
|
|
31
|
-
}, [activeSpectrum, format, scaleX]);
|
|
32
23
|
if (!activeSpectrum ||
|
|
33
24
|
brushState.step === 'brushing' ||
|
|
34
25
|
!position ||
|
|
@@ -38,9 +29,10 @@ function XLabelPointer() {
|
|
|
38
29
|
position.y > height - margin.bottom) {
|
|
39
30
|
return null;
|
|
40
31
|
}
|
|
32
|
+
const x = scaleX().invert(position.x);
|
|
41
33
|
return (_jsx("div", { style: {
|
|
42
34
|
...style,
|
|
43
|
-
transform: `translate(${position.x}px, ${position.y}px)`,
|
|
44
|
-
}, children: _jsx("span", { children:
|
|
35
|
+
transform: `translate(${position.x}px, ${position.y}px) translate(-100%,-100%)`,
|
|
36
|
+
}, children: _jsx("span", { children: format(x) }) }));
|
|
45
37
|
}
|
|
46
38
|
export default XLabelPointer;
|
|
@@ -9,17 +9,12 @@ import { getLayoutID, LAYOUT } from '../utilities/DimensionLayout';
|
|
|
9
9
|
import { get1DYScale, useScale2DX, useScale2DY } from '../utilities/scale';
|
|
10
10
|
const style = {
|
|
11
11
|
cursor: 'crosshair',
|
|
12
|
-
transformOrigin: 'bottom right',
|
|
13
12
|
position: 'absolute',
|
|
14
|
-
|
|
15
|
-
left: '-88px',
|
|
13
|
+
paddingRight: '5px',
|
|
16
14
|
fontWeight: 'bold',
|
|
17
15
|
pointerEvents: 'none',
|
|
18
16
|
overflow: 'visible',
|
|
19
17
|
userSelect: 'none',
|
|
20
|
-
width: '85px',
|
|
21
|
-
textAlign: 'right',
|
|
22
|
-
zIndex: 9,
|
|
23
18
|
};
|
|
24
19
|
function XYLabelPointer({ layout, data1D }) {
|
|
25
20
|
const position = useMouseTracker();
|
|
@@ -33,7 +28,6 @@ function XYLabelPointer({ layout, data1D }) {
|
|
|
33
28
|
});
|
|
34
29
|
const nuclei = activeTab.split(',');
|
|
35
30
|
const [formatX, formatY] = useFormatNumberByNucleus(nuclei);
|
|
36
|
-
// const spectrum = useSpectrum();
|
|
37
31
|
const scale2DX = useScale2DX();
|
|
38
32
|
const scale2DY = useScale2DY();
|
|
39
33
|
const scaleX = useMemo(() => {
|
|
@@ -118,7 +112,7 @@ function XYLabelPointer({ layout, data1D }) {
|
|
|
118
112
|
};
|
|
119
113
|
return (_jsxs("div", { style: {
|
|
120
114
|
...style,
|
|
121
|
-
transform: `translate(${position.x}px, ${position.y}px)`,
|
|
122
|
-
}, children: [_jsx("span", { children: formatY(getYValue()) }), _jsx("span", { style: { color: 'gray' }, children: ',' }), _jsx("span", { style: { color: 'red' }, children: formatX(getXValue()) })] }
|
|
115
|
+
transform: `translate(${position.x}px, ${position.y}px) translate(-100%,-100%)`,
|
|
116
|
+
}, children: [_jsx("span", { children: formatY(getYValue()) }), _jsx("span", { style: { color: 'gray' }, children: ',' }), _jsx("span", { style: { color: 'red' }, children: formatX(getXValue()) })] }));
|
|
123
117
|
}
|
|
124
118
|
export default XYLabelPointer;
|
|
@@ -26,8 +26,10 @@ export function LoggerProvider({ children }) {
|
|
|
26
26
|
const [logsHistory, setLogsHistory] = useState([]);
|
|
27
27
|
const [isLogHistoryOpened, openLogHistory] = useState(false);
|
|
28
28
|
const popupLoggingLevelRef = useRef();
|
|
29
|
-
const loggerRef = useRef(new FifoLogger(
|
|
30
|
-
|
|
29
|
+
const loggerRef = useRef(new FifoLogger());
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
function handleLogger({ detail: { logs } }) {
|
|
32
|
+
const log = logs.at(-1);
|
|
31
33
|
if (log &&
|
|
32
34
|
popupLoggingLevelRef.current &&
|
|
33
35
|
log.level === LOGGER_LEVELS[popupLoggingLevelRef.current]) {
|
|
@@ -38,8 +40,13 @@ export function LoggerProvider({ children }) {
|
|
|
38
40
|
console.error(log.error);
|
|
39
41
|
}
|
|
40
42
|
setLogsHistory(logs.slice());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
+
}
|
|
44
|
+
const loggerInstance = loggerRef.current;
|
|
45
|
+
loggerInstance.addEventListener('change', handleLogger);
|
|
46
|
+
return () => {
|
|
47
|
+
loggerInstance.removeEventListener('change', handleLogger);
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
43
50
|
useEffect(() => {
|
|
44
51
|
if (loggingLevel) {
|
|
45
52
|
loggerRef.current.setLevel(loggingLevel);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ToolbarItemProps } from 'react-science/ui';
|
|
2
|
-
export declare function CloseButton(props: Pick<ToolbarItemProps, 'onClick' | '
|
|
2
|
+
export declare function CloseButton(props: Pick<ToolbarItemProps, 'onClick' | 'tooltip' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
const styles = {
|
|
5
|
+
titleContainer: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
justifyContent: 'space-between',
|
|
8
|
+
flexWrap: 'wrap',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
},
|
|
11
|
+
title: {
|
|
12
|
+
fontSize: '0.9rem',
|
|
13
|
+
flex: 1,
|
|
14
|
+
padding: '5px 0',
|
|
15
|
+
textAlign: 'left',
|
|
16
|
+
color: 'white',
|
|
17
|
+
},
|
|
18
|
+
description: {
|
|
19
|
+
paddingTop: '1rem',
|
|
20
|
+
fontSize: '0.7rem',
|
|
21
|
+
textAlign: 'left',
|
|
22
|
+
color: 'white',
|
|
23
|
+
},
|
|
24
|
+
shortcutContainer: {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
textWrap: 'nowrap',
|
|
27
|
+
color: 'white',
|
|
28
|
+
},
|
|
29
|
+
shortcutItem: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
padding: '0.2rem',
|
|
34
|
+
border: '1px solid #ccc',
|
|
35
|
+
borderRadius: '4px',
|
|
36
|
+
height: 'calc(0.2rem + 20px)',
|
|
37
|
+
minWidth: 'calc(0.2rem + 20px)' /* Adjust padding and border width */,
|
|
38
|
+
marginLeft: '5px',
|
|
39
|
+
fontSize: '0.75rem',
|
|
40
|
+
fontWeight: 'bold',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export function CustomToolTip(props) {
|
|
44
|
+
const { title, shortcuts = [], subTitles = [], description = '', link, } = props;
|
|
45
|
+
return (_jsxs("div", { style: {
|
|
46
|
+
width: 250,
|
|
47
|
+
padding: '0.5rem',
|
|
48
|
+
}, children: [_jsxs("div", { style: styles.titleContainer, children: [_jsx("span", { style: styles.title, children: title }), _jsx(ShortCuts, { shortcuts: shortcuts })] }), _jsx(SubTitles, { items: subTitles }), (description || link) && (_jsxs("p", { style: styles.description, children: [description, link && (_jsx("a", { style: description ? { paddingLeft: '5px' } : {}, target: "_blank", href: link, rel: "noreferrer", children: "Learn more" }))] }))] }));
|
|
49
|
+
}
|
|
50
|
+
function ShortCuts({ shortcuts, style = {}, }) {
|
|
51
|
+
return (_jsx("div", { style: styles.shortcutContainer, children: shortcuts.map((key, index) => {
|
|
52
|
+
return (_jsx("div", { style: {
|
|
53
|
+
...styles.shortcutItem,
|
|
54
|
+
...(index === 0 && { margin: 0 }),
|
|
55
|
+
...style,
|
|
56
|
+
}, children: _jsx("span", { children: key }) }, key));
|
|
57
|
+
}) }));
|
|
58
|
+
}
|
|
59
|
+
const subTitleStyle = css `
|
|
60
|
+
padding-left: 5px;
|
|
61
|
+
list-style: none;
|
|
62
|
+
|
|
63
|
+
li {
|
|
64
|
+
position: relative;
|
|
65
|
+
padding-left: 15px;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
|
|
68
|
+
&::before {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 15px;
|
|
71
|
+
left: 0;
|
|
72
|
+
width: 10px;
|
|
73
|
+
height: 1px;
|
|
74
|
+
margin: auto;
|
|
75
|
+
content: '';
|
|
76
|
+
background-color: white;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&::after {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0;
|
|
82
|
+
bottom: 0;
|
|
83
|
+
left: 0;
|
|
84
|
+
width: 1px;
|
|
85
|
+
height: 100%;
|
|
86
|
+
content: '';
|
|
87
|
+
background-color: white;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:last-child::after {
|
|
91
|
+
height: 15px;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
li:first-child {
|
|
96
|
+
padding-top: 5px;
|
|
97
|
+
|
|
98
|
+
&::before {
|
|
99
|
+
top: 20px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
function SubTitles({ items }) {
|
|
104
|
+
if (!items || items.length === 0)
|
|
105
|
+
return null;
|
|
106
|
+
return (_jsx("ul", { css: subTitleStyle, children: items.map(({ shortcuts = [], title }) => (_jsx("li", { children: _jsxs("div", { style: styles.titleContainer, children: [_jsx("span", { style: { ...styles.title, fontSize: '0.7rem' }, children: title }), _jsx(ShortCuts, { style: { padding: '0.1rem' }, shortcuts: shortcuts })] }) }, title))) }));
|
|
107
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useState, } from 'react';
|
|
3
3
|
import Input from './Input';
|
|
4
4
|
function extractNumber(val, type) {
|
|
@@ -34,13 +34,14 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
34
34
|
onEditStart(true);
|
|
35
35
|
enableEdit(true);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function saveHandler(event) {
|
|
38
38
|
const valid = validate(val);
|
|
39
39
|
setValid(valid);
|
|
40
40
|
// when press Enter or Tab
|
|
41
41
|
if (valid && ['Enter', 'Tab'].includes(event.key)) {
|
|
42
42
|
onSave(event);
|
|
43
43
|
enableEdit(false);
|
|
44
|
+
window.removeEventListener('mousedown', mouseClickCallback);
|
|
44
45
|
}
|
|
45
46
|
// close edit mode if press Enter, Tab or Escape
|
|
46
47
|
if (['Escape'].includes(event.key)) {
|
|
@@ -59,14 +60,14 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
59
60
|
? { whiteSpace: 'nowrap', overflow: 'hidden', display: 'inline-flex' }
|
|
60
61
|
: {}),
|
|
61
62
|
...style,
|
|
62
|
-
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (
|
|
63
|
+
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (_jsxs("span", { style: {
|
|
63
64
|
display: 'table-cell',
|
|
64
65
|
verticalAlign: 'middle',
|
|
65
66
|
width: '100%',
|
|
66
67
|
...(textOverFlowEllipses
|
|
67
68
|
? { textOverflow: 'ellipsis', overflow: 'hidden' }
|
|
68
69
|
: {}),
|
|
69
|
-
}, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
|
|
70
|
+
}, children: [value, " \u00A0"] })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
|
|
70
71
|
inputWrapper: {
|
|
71
72
|
...(!isValid && { borderColor: 'red' }),
|
|
72
73
|
width: '100%',
|
|
@@ -76,6 +77,6 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
76
77
|
width: '100%',
|
|
77
78
|
minWidth: '60px',
|
|
78
79
|
},
|
|
79
|
-
}, autoSelect: true, className: "editable-column", value: val, type: type, onChange: handleChange,
|
|
80
|
+
}, autoSelect: true, className: "editable-column", value: val, type: type, onChange: handleChange, onKeyDown: saveHandler, onMouseDown: (e) => e.stopPropagation(), ...InputProps }) }))] }));
|
|
80
81
|
});
|
|
81
82
|
export default EditableColumn;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ToolbarItemProps } from 'react-science/ui';
|
|
2
|
-
export declare function SaveButton(props: Pick<ToolbarItemProps, 'onClick' | '
|
|
2
|
+
export declare function SaveButton(props: Pick<ToolbarItemProps, 'onClick' | 'tooltip'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,6 @@ import { useFormikContext } from 'formik';
|
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
4
|
const styles = {
|
|
5
5
|
container: {
|
|
6
|
-
padding: '0.4rem',
|
|
7
6
|
display: 'flex',
|
|
8
7
|
flexDirection: 'column',
|
|
9
8
|
},
|
|
@@ -14,9 +13,8 @@ const styles = {
|
|
|
14
13
|
},
|
|
15
14
|
};
|
|
16
15
|
function FormikError({ style, name, children }) {
|
|
17
|
-
const { errors, isValid, dirty
|
|
16
|
+
const { errors, isValid, dirty } = useFormikContext();
|
|
18
17
|
const errorText = lodashGet(errors, name);
|
|
19
|
-
|
|
20
|
-
return (_jsxs("div", { style: { ...styles.container, ...style?.container }, children: [children, !isValid && dirty && isTouched && (_jsx("span", { style: { ...styles.text, ...style?.text }, children: errorText }))] }));
|
|
18
|
+
return (_jsxs("div", { style: { ...styles.container, ...style?.container }, children: [children, !isValid && dirty && (_jsx("span", { style: { ...styles.text, ...style?.text }, children: errorText }))] }));
|
|
21
19
|
}
|
|
22
20
|
export default FormikError;
|
|
@@ -4,7 +4,7 @@ import lodashGet from 'lodash/get';
|
|
|
4
4
|
import Input from '../Input';
|
|
5
5
|
function FormikInput(props) {
|
|
6
6
|
const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
|
|
7
|
-
const { values, handleChange, errors, touched, setFieldValue } = useFormikContext();
|
|
7
|
+
const { values, handleChange, errors, touched, setFieldValue, handleBlur } = useFormikContext();
|
|
8
8
|
function changeHandler(e) {
|
|
9
9
|
onChange?.(e);
|
|
10
10
|
if (mapOnChangeValue) {
|
|
@@ -20,7 +20,7 @@ function FormikInput(props) {
|
|
|
20
20
|
}
|
|
21
21
|
let val = value || lodashGet(values, name);
|
|
22
22
|
val = mapValue ? mapValue(val) : val;
|
|
23
|
-
return (_jsx(Input, { name: name, value: val, onChange: changeHandler, type: type, style: {
|
|
23
|
+
return (_jsx(Input, { name: name, value: val, onChange: changeHandler, onBlur: handleBlur, type: type, style: {
|
|
24
24
|
...style,
|
|
25
25
|
inputWrapper: {
|
|
26
26
|
...style.inputWrapper,
|
|
@@ -105,7 +105,7 @@ function HeaderInner(props) {
|
|
|
105
105
|
alignItems: 'center',
|
|
106
106
|
}, children: [_jsx("div", { children: _jsx(Toolbar, { children: _jsx(AboutUsModal, {}) }) }), _jsx("div", { className: "toolOptionsPanel", style: { flex: 1 }, children: selectedPanel })] }), _jsxs(HeaderContainer, { style: {
|
|
107
107
|
alignItems: 'center',
|
|
108
|
-
}, children: [!hideWorkspaces && (_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem })), !hideGeneralSettings && _jsx(SaveButton, {}), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { children: [!general?.hideHelp && (_jsx(Toolbar.Item, { id: "user-manual",
|
|
108
|
+
}, children: [!hideWorkspaces && (_jsx(DropDownButton, { data: workspacesList, selectedKey: workspace.current, onSelect: changeWorkspaceHandler, renderItem: renderItem })), !hideGeneralSettings && _jsx(SaveButton, {}), !general?.hideLogs && _jsx(LogsHistoryModal, {}), _jsx("div", { children: _jsxs(Toolbar, { children: [!general?.hideHelp && (_jsx(Toolbar.Item, { id: "user-manual", tooltip: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), icon: _jsx(FaQuestionCircle, {}) })), _jsx(Toolbar.Item, { id: "user-manual", tooltip: "NMRium channel", onClick: () => window.open('https://www.youtube.com/@nmrium', '_blank'), icon: _jsx(FaFilm, {}) }), !hideGeneralSettings && (_jsx(GeneralSettingsModal, { height: height / 2 })), !fullscreen.isFullScreen && !general?.hideMaximize && (_jsx(Toolbar.Item, { id: "full-screen", onClick: fullscreen.toggle, tooltip: "Full screen", className: "windowButton", icon: _jsx(FaRegWindowMaximize, {}) }))] }) })] })] }) }));
|
|
109
109
|
}
|
|
110
110
|
function SaveButton() {
|
|
111
111
|
const { workspace, workspaces, originalWorkspaces } = usePreferences();
|