nmrium 0.54.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/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 +48 -6
- package/lib/component/1d/ranges/Ranges.js +2 -1
- package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
- 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/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/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/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/draggable/SVGDraggable.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.d.ts +2 -1
- package/lib/component/elements/formik/FormikInput.js +4 -3
- package/lib/component/header/Header.js +7 -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 +4 -2
- 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/setting/GeneralSettings.js +7 -21
- 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/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/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +18 -2
- 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/multipleAnalysisPanel/preferences/index.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.js +6 -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/RangesActions.js +12 -6
- 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/preferencesReducer.d.ts +7 -0
- package/lib/component/reducer/preferences/preferencesReducer.js +21 -18
- package/lib/component/toolbar/ToolBar.js +18 -14
- 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 +9 -11
- package/lib/versionInfo.js +1 -1
- package/package.json +31 -31
- 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
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { PiTextTSlash } from 'react-icons/pi';
|
|
5
|
+
import { FieldEdition } from '../../1d-2d/FieldEdition';
|
|
6
|
+
import { useChartData } from '../../context/ChartContext';
|
|
7
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
8
|
+
import { useGlobal } from '../../context/GlobalContext';
|
|
9
|
+
import { useShareData } from '../../context/ShareDataContext';
|
|
10
|
+
import { SVGButton } from '../../elements/SVGButton';
|
|
11
|
+
import { SVGGroup } from '../../elements/SVGGroup';
|
|
12
|
+
import useDraggable from '../../elements/draggable/useDraggable';
|
|
13
|
+
import { useHighlight } from '../../highlight';
|
|
14
|
+
import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
|
|
15
|
+
import useSpectrum from '../../hooks/useSpectrum';
|
|
16
|
+
import { useScale2DX, useScale2DY } from '../utilities/scale';
|
|
17
|
+
const distance = 30;
|
|
18
|
+
const iconSize = 16;
|
|
19
|
+
const LabelBoxPadding = { left: 35, right: 0, top: 15, bottom: 15 };
|
|
20
|
+
function getDistance(x1, y1, x2, y2) {
|
|
21
|
+
const deltaX = x2 - x1;
|
|
22
|
+
const deltaY = y2 - y1;
|
|
23
|
+
return Math.hypot(deltaX, deltaY);
|
|
24
|
+
}
|
|
25
|
+
function radiansToDegrees(radians) {
|
|
26
|
+
return radians * (180 / Math.PI);
|
|
27
|
+
}
|
|
28
|
+
function getAngleFromSides(a, b, c) {
|
|
29
|
+
const radians = Math.acos((b ** 2 + c ** 2 - a ** 2) / (2 * b * c));
|
|
30
|
+
return radiansToDegrees(radians);
|
|
31
|
+
}
|
|
32
|
+
function findBestLink(sourcePoints, targetPoints) {
|
|
33
|
+
const result = [];
|
|
34
|
+
for (const sourcePoint of sourcePoints) {
|
|
35
|
+
const { a, b } = sourcePoint;
|
|
36
|
+
for (const targetPoint of targetPoints) {
|
|
37
|
+
const { x, y } = targetPoint;
|
|
38
|
+
const aLength = getDistance(a.x, a.y, x, y);
|
|
39
|
+
const bLength = getDistance(b.x, b.y, x, y);
|
|
40
|
+
const deltaLength = getDistance(a.x, a.y, b.x, b.y);
|
|
41
|
+
const distance = Math.min(aLength, bLength);
|
|
42
|
+
const angle = Number(getAngleFromSides(deltaLength, aLength, bLength).toFixed(1));
|
|
43
|
+
result.push({ distance, angle, targetPoint, sourcePoint });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
result.sort((a, b) => {
|
|
47
|
+
if (a.angle !== b.angle) {
|
|
48
|
+
return b.angle - a.angle;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return a.distance - b.distance;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return result[0];
|
|
55
|
+
}
|
|
56
|
+
function useLinkPath(currentPosition, targetBoundary, sourceElementBoundary, options = {}) {
|
|
57
|
+
const { sideLength = 6, shift = 5 } = options;
|
|
58
|
+
const { x1, x2, y1, y2 } = targetBoundary;
|
|
59
|
+
const { x, y } = currentPosition;
|
|
60
|
+
const scaleX = useScale2DX();
|
|
61
|
+
const scaleY = useScale2DY();
|
|
62
|
+
const { width, height } = sourceElementBoundary;
|
|
63
|
+
const centerX = width / 2;
|
|
64
|
+
const centerY = height / 2;
|
|
65
|
+
const leftX = x - centerX - shift;
|
|
66
|
+
const rightX = x + centerX + shift;
|
|
67
|
+
const topY = y - height;
|
|
68
|
+
const bottomY = y + shift;
|
|
69
|
+
const targetWidth = scaleX(x2) - scaleX(x1);
|
|
70
|
+
const targetHeight = scaleY(y2) - scaleY(y1);
|
|
71
|
+
const targetXCenter = scaleX(x1) + targetWidth / 2;
|
|
72
|
+
const targetYCenter = scaleY(y1) + targetHeight / 2;
|
|
73
|
+
const sourcePoints = [
|
|
74
|
+
{
|
|
75
|
+
a: { x, y: bottomY },
|
|
76
|
+
b: { x: x + sideLength, y: bottomY },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
a: { x, y: topY },
|
|
80
|
+
b: { x: x + sideLength, y: topY },
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
a: { x: leftX, y: y - centerY - sideLength / 2 },
|
|
84
|
+
b: { x: leftX, y: y - centerY + sideLength / 2 },
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
a: { x: rightX, y: y - centerY - sideLength / 2 },
|
|
88
|
+
b: { x: rightX, y: y - centerY + sideLength / 2 },
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
/**
|
|
92
|
+
* Zone coordination
|
|
93
|
+
* xMid= x2-x1/2;
|
|
94
|
+
* yMid= y2-y1/2;
|
|
95
|
+
* (x1,y1) ---------- (xMid,y1) ---------- (x2,y1)
|
|
96
|
+
* | |
|
|
97
|
+
* | |
|
|
98
|
+
* (x1,yMid) (x2,yMid)
|
|
99
|
+
* | |
|
|
100
|
+
* | |
|
|
101
|
+
* (x1,y2) ---------- (xMid,y2) ---------- (x2,y2)
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
const targetPoints = [
|
|
105
|
+
{
|
|
106
|
+
//Left Top
|
|
107
|
+
x: scaleX(x1),
|
|
108
|
+
y: scaleY(y1),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
//Center Top
|
|
112
|
+
x: targetXCenter,
|
|
113
|
+
y: scaleY(y1),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
//Right Top
|
|
117
|
+
x: scaleX(x2),
|
|
118
|
+
y: scaleY(y1),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
//Right Center
|
|
122
|
+
x: scaleX(x2),
|
|
123
|
+
y: targetYCenter,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
//Right Bottom
|
|
127
|
+
x: scaleX(x2),
|
|
128
|
+
y: scaleY(y2),
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
//Center Bottom
|
|
132
|
+
x: targetXCenter,
|
|
133
|
+
y: scaleY(y2),
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
//Left Bottom
|
|
137
|
+
x: scaleX(x1),
|
|
138
|
+
y: scaleY(y2),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
//Left Center
|
|
142
|
+
x: scaleX(x1),
|
|
143
|
+
y: targetYCenter,
|
|
144
|
+
},
|
|
145
|
+
];
|
|
146
|
+
const link = findBestLink(sourcePoints, targetPoints);
|
|
147
|
+
return `${link.sourcePoint.a.x},${link.sourcePoint.a.y} ${link.sourcePoint.b.x},${link.sourcePoint.b.y} ${link.targetPoint.x},${link.targetPoint.y}`;
|
|
148
|
+
}
|
|
149
|
+
const GroupContainer = styled.g(({ isMoveActive }) => !isMoveActive
|
|
150
|
+
? `
|
|
151
|
+
|
|
152
|
+
pointer-events: bounding-box;
|
|
153
|
+
|
|
154
|
+
.target {
|
|
155
|
+
visibility: hidden;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:hover {
|
|
159
|
+
.target {
|
|
160
|
+
visibility: visible;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`
|
|
164
|
+
: ``);
|
|
165
|
+
export function AssignmentLabel(props) {
|
|
166
|
+
const { zone } = props;
|
|
167
|
+
const { id, x, y, assignment } = zone;
|
|
168
|
+
const dispatch = useDispatch();
|
|
169
|
+
const { isActive } = useHighlight([zone.id]);
|
|
170
|
+
const { assignmentsLabelsCoordinates } = useActiveSpectrumZonesViewState();
|
|
171
|
+
const scaleX = useScale2DX();
|
|
172
|
+
const scaleY = useScale2DY();
|
|
173
|
+
const { viewerRef } = useGlobal();
|
|
174
|
+
const textRef = useRef(null);
|
|
175
|
+
const [labelBoundary, setLabelBoundary] = useState({
|
|
176
|
+
width: 0,
|
|
177
|
+
height: 0,
|
|
178
|
+
});
|
|
179
|
+
const [isMoveActive, setIsMoveActive] = useState(false);
|
|
180
|
+
const { data: newAssignmentLabelState, setData: updateNewAssignmentLabelState, } = useShareData();
|
|
181
|
+
function dismissNewLabel() {
|
|
182
|
+
if (newAssignmentLabelState) {
|
|
183
|
+
updateNewAssignmentLabelState(null);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
let coordinate = {
|
|
187
|
+
x: scaleX(x.to),
|
|
188
|
+
y: scaleY(y.from) - distance,
|
|
189
|
+
};
|
|
190
|
+
if (assignmentsLabelsCoordinates?.[id]) {
|
|
191
|
+
coordinate = {
|
|
192
|
+
x: scaleX(assignmentsLabelsCoordinates[id].x),
|
|
193
|
+
y: scaleY(assignmentsLabelsCoordinates[id].y),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
const [currentPosition, setCurrentPosition] = useState(coordinate);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
setCurrentPosition({ x: coordinate.x, y: coordinate.y });
|
|
199
|
+
}, [coordinate.x, coordinate.y]);
|
|
200
|
+
useLayoutEffect(() => {
|
|
201
|
+
if (textRef.current) {
|
|
202
|
+
const { width, height } = textRef.current.getBBox();
|
|
203
|
+
setLabelBoundary({ width, height });
|
|
204
|
+
}
|
|
205
|
+
}, [assignment]);
|
|
206
|
+
const { onPointerDown } = useDraggable({
|
|
207
|
+
position: coordinate,
|
|
208
|
+
onChange: (dragEvent) => {
|
|
209
|
+
const { action, position } = dragEvent;
|
|
210
|
+
const boundary = textRef.current?.getBBox();
|
|
211
|
+
if (!boundary)
|
|
212
|
+
return;
|
|
213
|
+
const centerX = width / 2 + LabelBoxPadding.left;
|
|
214
|
+
const centerY = height + iconSize;
|
|
215
|
+
switch (action) {
|
|
216
|
+
case 'start': {
|
|
217
|
+
setCurrentPosition({ x: position.x, y: position.y });
|
|
218
|
+
setIsMoveActive(true);
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case 'move': {
|
|
222
|
+
setCurrentPosition({
|
|
223
|
+
x: position.x + centerX,
|
|
224
|
+
y: position.y + centerY,
|
|
225
|
+
});
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case 'end':
|
|
229
|
+
dispatch({
|
|
230
|
+
type: 'SET_ZONE_ASSIGNMENT_LABEL_COORDINATION',
|
|
231
|
+
payload: {
|
|
232
|
+
zoneID: zone.id,
|
|
233
|
+
coordination: {
|
|
234
|
+
x: scaleX.invert(position.x + centerX),
|
|
235
|
+
y: scaleY.invert(position.y + centerY),
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
setIsMoveActive(false);
|
|
240
|
+
break;
|
|
241
|
+
default:
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
parentElement: viewerRef,
|
|
246
|
+
});
|
|
247
|
+
const path = useLinkPath(currentPosition, { x1: x.to, x2: x.from, y1: y.from, y2: y.to }, labelBoundary);
|
|
248
|
+
if (!assignment && newAssignmentLabelState?.id !== id) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
function handleChange(value) {
|
|
252
|
+
dismissNewLabel();
|
|
253
|
+
dispatch({
|
|
254
|
+
type: 'CHANGE_ZONE_ASSIGNMENT_LABEL',
|
|
255
|
+
payload: {
|
|
256
|
+
value,
|
|
257
|
+
zoneID: id,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
const { width, height } = labelBoundary;
|
|
262
|
+
return (_jsxs(GroupContainer, { isMoveActive: isMoveActive, children: [_jsx("polygon", { points: path, fill: isActive ? '#ff6f0091' : 'black' }), _jsxs("g", { style: {
|
|
263
|
+
transform: `translate(${currentPosition.x}px,${currentPosition.y}px)`,
|
|
264
|
+
}, children: [_jsx("rect", { "data-no-export": "true", fill: "transparent", x: -(width / 2 + LabelBoxPadding.left), width: width + LabelBoxPadding.left + LabelBoxPadding.right, height: height + LabelBoxPadding.top + LabelBoxPadding.bottom, y: -(height + LabelBoxPadding.top) }), _jsx(FieldEdition, { onChange: handleChange, inputType: "text", value: assignment || '', PopoverProps: {
|
|
265
|
+
position: 'top',
|
|
266
|
+
targetTagName: 'g',
|
|
267
|
+
...(newAssignmentLabelState?.id === id
|
|
268
|
+
? { isOpen: true, onClose: () => dismissNewLabel() }
|
|
269
|
+
: {}),
|
|
270
|
+
}, children: _jsx("text", { fontWeight: isActive ? 'bold' : 'normal', ref: textRef, textAnchor: "middle", fill: "black", style: { cursor: 'hand' }, children: assignment }) }), _jsxs(SVGGroup, { space: 2, "data-no-export": "true", transform: `translate(-${width / 2 + iconSize * 2 + 2} -${height + iconSize})`, className: "target", children: [_jsx(SVGButton, { title: "Move label", size: iconSize, icon: "move", onPointerDown: onPointerDown, style: { cursor: 'move' } }), _jsx(SVGButton, { size: iconSize, title: "Remove label", renderIcon: (props) => _jsx(PiTextTSlash, { ...props }), backgroundColor: "red", style: { cursor: 'hand' }, onClick: () => handleChange('') })] })] })] }));
|
|
271
|
+
}
|
|
272
|
+
function ZonesAssignmentsLabelsInner({ zones, displayerKey }) {
|
|
273
|
+
return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "2d-zones-assignments-labels", children: zones.values.map((zone) => (_jsx(AssignmentLabel, { zone: zone }, zone.id))) }));
|
|
274
|
+
}
|
|
275
|
+
const emptyData = { zones: {}, display: {} };
|
|
276
|
+
export default function ZonesAssignmentsLabels() {
|
|
277
|
+
const { displayerKey } = useChartData();
|
|
278
|
+
const { zones, display } = useSpectrum(emptyData);
|
|
279
|
+
const { showAssignmentsLabels } = useActiveSpectrumZonesViewState();
|
|
280
|
+
const { data: NewAssignmentLabelState } = useShareData();
|
|
281
|
+
if ((!display.isVisible || !showAssignmentsLabels) &&
|
|
282
|
+
!NewAssignmentLabelState) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return _jsx(ZonesAssignmentsLabelsInner, { zones, displayerKey });
|
|
286
|
+
}
|
|
@@ -19,7 +19,7 @@ function KeysListenerTracker(props) {
|
|
|
19
19
|
const { mainDivRef } = props;
|
|
20
20
|
const { keysPreferences, displayerMode, data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
21
21
|
const dispatch = useDispatch();
|
|
22
|
-
const { dispatch: dispatchPreferences } = usePreferences();
|
|
22
|
+
const { dispatch: dispatchPreferences, current: { nuclei }, } = usePreferences();
|
|
23
23
|
const toaster = useToaster();
|
|
24
24
|
const modal = useModal();
|
|
25
25
|
const openLoader = useLoader();
|
|
@@ -394,6 +394,18 @@ function KeysListenerTracker(props) {
|
|
|
394
394
|
default:
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
+
if (e.shiftKey) {
|
|
398
|
+
switch (e.key) {
|
|
399
|
+
case 'F': {
|
|
400
|
+
dispatch({
|
|
401
|
+
type: 'SET_AXIS_DOMAIN',
|
|
402
|
+
payload: { nucleiPreferences: nuclei },
|
|
403
|
+
});
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
default:
|
|
407
|
+
}
|
|
408
|
+
}
|
|
397
409
|
if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
398
410
|
switch (e.key) {
|
|
399
411
|
case 's':
|
|
@@ -417,6 +429,7 @@ function KeysListenerTracker(props) {
|
|
|
417
429
|
handleChangeOption,
|
|
418
430
|
handleFullZoomOut,
|
|
419
431
|
isToolVisible,
|
|
432
|
+
nuclei,
|
|
420
433
|
openLoader,
|
|
421
434
|
openSaveAsDialog,
|
|
422
435
|
saveAsJSONHandler,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ShareDataState<T> {
|
|
3
|
+
data: T | null;
|
|
4
|
+
setData: (data: T) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function useShareData<T>(): ShareDataState<T>;
|
|
7
|
+
export declare function ShareDataProvider<T>({ children, }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo, useState } from 'react';
|
|
3
|
+
const ShareDataContext = createContext(null);
|
|
4
|
+
export function useShareData() {
|
|
5
|
+
const context = useContext(ShareDataContext);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error('useShareData must be used within an ShareDataProvider');
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
}
|
|
11
|
+
export function ShareDataProvider({ children, }) {
|
|
12
|
+
const [data, setData] = useState(null);
|
|
13
|
+
const state = useMemo(() => {
|
|
14
|
+
return {
|
|
15
|
+
data,
|
|
16
|
+
setData: (newData) => {
|
|
17
|
+
setData(newData);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}, [data]);
|
|
21
|
+
return (_jsx(ShareDataContext.Provider, { value: state, children: children }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { PopoverProps } from '@blueprintjs/core';
|
|
3
|
+
import { ButtonProps } from 'react-science/ui';
|
|
4
|
+
export interface ActionsButtonsPopoverProps extends Omit<PopoverProps, 'interactionKind' | 'content'> {
|
|
5
|
+
buttons: Array<Pick<ButtonProps, 'icon' | 'onClick' | 'intent' | 'disabled'> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export declare function ActionsButtonsPopover(props: ActionsButtonsPopoverProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Popover } from '@blueprintjs/core';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import { Button } from 'react-science/ui';
|
|
6
|
+
export function ActionsButtonsPopover(props) {
|
|
7
|
+
const { buttons, children, ...otherProps } = props;
|
|
8
|
+
return (_jsx(Popover, { minimal: true, position: "auto-start", popoverClassName: "actions-buttons-popover", interactionKind: "hover", enforceFocus: false, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column' }, css: css `
|
|
9
|
+
button,
|
|
10
|
+
a[role='button'] {
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
min-width: 16px;
|
|
13
|
+
min-height: 16px;
|
|
14
|
+
font-size: 10px;
|
|
15
|
+
padding: 5px;
|
|
16
|
+
}
|
|
17
|
+
`, children: buttons
|
|
18
|
+
.filter((button) => button?.visible !== false)
|
|
19
|
+
.map(({ icon, onClick, intent, title, disabled }, index) => {
|
|
20
|
+
return (_jsx(Button, { disabled: disabled, icon: icon, onClick: onClick, tooltipProps: { content: title || '', compact: true }, intent: intent }, title || index));
|
|
21
|
+
}) }), ...otherProps, children: children }));
|
|
22
|
+
}
|
|
@@ -51,17 +51,19 @@ function ReactTableRow(props) {
|
|
|
51
51
|
const clickHandler = useCallback((event) => {
|
|
52
52
|
onClick?.(event, row);
|
|
53
53
|
}, [onClick, row]);
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const { key: rowKey, ...otherKeyProps } = row.getRowProps();
|
|
55
|
+
return (_jsx(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, row.original), as: "tr", style: { position: 'static' }, css: getRowStyle(highlight.isActive || isRowActive, rowStyle, disableDefaultRowStyle), ...otherKeyProps, ...highlight.onHover, children: row.cells.map((cell) => {
|
|
56
|
+
const { style, padding } = cell;
|
|
56
57
|
if (cell.isRowSpanned) {
|
|
57
58
|
return null;
|
|
58
59
|
}
|
|
59
60
|
else {
|
|
60
|
-
|
|
61
|
+
const { key: columnKey, ...otherColumnProps } = cell.getCellProps();
|
|
62
|
+
return (_jsx("td", { rowSpan: cell.rowSpan, ...otherColumnProps, onContextMenu: (e) => {
|
|
61
63
|
e.preventDefault();
|
|
62
64
|
return false;
|
|
63
|
-
}, style: { padding, ...style }, onClick: clickHandler, children: cell.render('Cell') },
|
|
65
|
+
}, style: { padding, ...style }, onClick: clickHandler, children: cell.render('Cell') }, columnKey));
|
|
64
66
|
}
|
|
65
|
-
}) },
|
|
67
|
+
}) }, rowKey));
|
|
66
68
|
}
|
|
67
69
|
export default ReactTableRow;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
3
|
-
import { CSSProperties } from 'react';
|
|
3
|
+
import { CSSProperties, ReactElement } from 'react';
|
|
4
4
|
import { CellProps, Column as ReactColumn, UseSortByColumnOptions } from 'react-table';
|
|
5
5
|
import { HighlightEventSource } from '../../highlight';
|
|
6
6
|
import { BaseContextMenuProps } from '../ContextMenuBluePrint';
|
|
@@ -8,7 +8,7 @@ import { ClickEvent } from './Elements/ReactTableRow';
|
|
|
8
8
|
interface ExtraColumn<T extends object> {
|
|
9
9
|
enableRowSpan?: boolean;
|
|
10
10
|
style?: CSSProperties;
|
|
11
|
-
Cell?: (cell: CellProps<T>) =>
|
|
11
|
+
Cell?: (cell: CellProps<T>) => ReactElement | string;
|
|
12
12
|
}
|
|
13
13
|
export type Column<T extends object> = ReactColumn<T> & ExtraColumn<T> & UseSortByColumnOptions<T>;
|
|
14
14
|
interface SortEvent {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconName, TooltipProps } from '@blueprintjs/core';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
interface IconButtonProps extends React.SVGAttributes<SVGElement> {
|
|
4
|
+
size?: number;
|
|
5
|
+
padding?: number;
|
|
6
|
+
icon?: IconName;
|
|
7
|
+
backgroundColor?: CSSProperties['backgroundColor'];
|
|
8
|
+
color?: CSSProperties['color'];
|
|
9
|
+
title?: string;
|
|
10
|
+
tooltipProps?: TooltipProps;
|
|
11
|
+
renderIcon?: (props: Pick<IconButtonProps, 'color' | 'size'>) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function SVGButton(props: IconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, Tooltip } from '@blueprintjs/core';
|
|
3
|
+
export function SVGButton(props) {
|
|
4
|
+
const { size = 16, padding = 5, className, icon, renderIcon, backgroundColor = 'gray', color = 'white', title, tooltipProps, ...otherProps } = props;
|
|
5
|
+
return (_jsx(Tooltip, { content: title, compact: true, targetTagName: "g", placement: "auto-end", ...tooltipProps, children: _jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, ...otherProps, children: [_jsx("circle", { cx: size / 2, cy: size / 2, r: size / 2, fill: backgroundColor }), _jsx("g", { transform: `translate(${padding / 2} ${padding / 2})`, children: typeof renderIcon === 'function' ? (renderIcon({ size: size - padding, color })) : (_jsx(Icon, { tagName: "g", icon: icon, size: size - padding, color: color })) })] }) }));
|
|
6
|
+
}
|
|
@@ -5,18 +5,20 @@ export function SVGGroup(props) {
|
|
|
5
5
|
const { children, direction = 'row', space = 0, ...resProps } = props;
|
|
6
6
|
useLayoutEffect(() => {
|
|
7
7
|
let shift = 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
const elements = elementsRefs.current;
|
|
9
|
+
if (!elements) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (const element of elements) {
|
|
13
|
+
if (element) {
|
|
14
|
+
const boundary = element.getBoundingClientRect();
|
|
15
|
+
if (direction === 'row') {
|
|
16
|
+
element.setAttribute('transform', `translate(${shift} 0)`);
|
|
17
|
+
shift += boundary.width + space;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
element.setAttribute('transform', `translate(0 ${shift})`);
|
|
21
|
+
shift += boundary.height + space;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -27,6 +29,6 @@ export function SVGGroup(props) {
|
|
|
27
29
|
if (ref) {
|
|
28
30
|
elementsRefs.current[index] = ref;
|
|
29
31
|
}
|
|
30
|
-
}, children: child },
|
|
32
|
+
}, children: child }, `${index}`));
|
|
31
33
|
}) }));
|
|
32
34
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SVGAttributes } from 'react';
|
|
2
|
+
interface SVGTextProps extends SVGAttributes<SVGTextElement> {
|
|
3
|
+
rectProps?: SVGAttributes<SVGRectElement>;
|
|
4
|
+
padding?: number;
|
|
5
|
+
borderRadius?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function SVGText(props: SVGTextProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
const defaultTextBBox = {
|
|
4
|
+
width: 0,
|
|
5
|
+
height: 0,
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
};
|
|
9
|
+
export function SVGText(props) {
|
|
10
|
+
const textRef = useRef(null);
|
|
11
|
+
const [boxSize, setBoxSize] = useState(defaultTextBBox);
|
|
12
|
+
const { rectProps = {}, padding = 0, borderRadius = 0, children, ...otherProps } = props;
|
|
13
|
+
const { ...otherRectProps } = rectProps;
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
const boundary = textRef?.current?.getBBox();
|
|
16
|
+
if (boundary) {
|
|
17
|
+
setBoxSize(boundary);
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
20
|
+
const { width: textWidth, height: textHeight, x, y } = boxSize;
|
|
21
|
+
const width = textWidth + padding * 2;
|
|
22
|
+
const height = textHeight + padding * 2;
|
|
23
|
+
return (_jsxs("g", { children: [_jsx("rect", { width: width, height: height, x: x - padding, y: y - padding, fill: "transparent", ...(borderRadius && { rx: borderRadius, ry: borderRadius }), ...otherRectProps }), _jsx("text", { ref: textRef, fill: "black", textAnchor: "middle", ...otherProps, children: children })] }));
|
|
24
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
2
|
import { Position } from './useDraggable';
|
|
3
|
-
type ChildType =
|
|
3
|
+
type ChildType = ReactElement[] | ReactElement | boolean | null;
|
|
4
4
|
type PositionChangeHandler = (data: Position) => void;
|
|
5
5
|
export interface DraggableProps {
|
|
6
6
|
children?: ChildType | ((x1: number, x2: number) => ChildType);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { InputProps } from '../Input';
|
|
2
3
|
export interface InputMapValueFunctions {
|
|
3
4
|
mapOnChangeValue?: (value: string | number) => any;
|
|
@@ -7,5 +8,5 @@ interface FormikInputProps extends InputMapValueFunctions {
|
|
|
7
8
|
name: string;
|
|
8
9
|
checkErrorAfterInputTouched?: boolean;
|
|
9
10
|
}
|
|
10
|
-
declare
|
|
11
|
+
declare const FormikInput: import("react").ForwardRefExoticComponent<FormikInputProps & InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
12
|
export default FormikInput;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useFormikContext } from 'formik';
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
4
5
|
import Input from '../Input';
|
|
5
|
-
function FormikInput(props) {
|
|
6
|
+
const FormikInput = forwardRef(function FormikInput(props, ref) {
|
|
6
7
|
const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
|
|
7
8
|
const { values, handleChange, errors, touched, setFieldValue, handleBlur } = useFormikContext();
|
|
8
9
|
function changeHandler(e) {
|
|
@@ -20,7 +21,7 @@ function FormikInput(props) {
|
|
|
20
21
|
}
|
|
21
22
|
let val = value || lodashGet(values, name);
|
|
22
23
|
val = mapValue ? mapValue(val) : val;
|
|
23
|
-
return (_jsx(Input, { name: name, value: val, onChange: changeHandler, onBlur: handleBlur, type: type, style: {
|
|
24
|
+
return (_jsx(Input, { ref: ref, name: name, value: val, onChange: changeHandler, onBlur: handleBlur, type: type, style: {
|
|
24
25
|
...style,
|
|
25
26
|
inputWrapper: {
|
|
26
27
|
...style.inputWrapper,
|
|
@@ -34,5 +35,5 @@ function FormikInput(props) {
|
|
|
34
35
|
: {}),
|
|
35
36
|
},
|
|
36
37
|
}, className: className, ...resProps }));
|
|
37
|
-
}
|
|
38
|
+
});
|
|
38
39
|
export default FormikInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { useMemo,
|
|
4
|
+
import { useMemo, memo } from 'react';
|
|
5
5
|
import { FaRegWindowMaximize, FaQuestionCircle, FaRegSave, FaFilm, } from 'react-icons/fa';
|
|
6
6
|
import { Toolbar, useFullscreen } from 'react-science/ui';
|
|
7
7
|
import { docsBaseUrl } from '../../constants';
|
|
@@ -11,6 +11,7 @@ import Button from '../elements/Button';
|
|
|
11
11
|
import { Header } from '../elements/Header';
|
|
12
12
|
import DropDownButton from '../elements/dropDownButton/DropDownButton';
|
|
13
13
|
import { useSaveSettings } from '../hooks/useSaveSettings';
|
|
14
|
+
import { useWorkspaceAction } from '../hooks/useWorkspaceAction';
|
|
14
15
|
import { LogsHistoryModal } from '../modal/LogsHistoryModal';
|
|
15
16
|
import AboutUsModal from '../modal/aboutUs/AboutUsModal';
|
|
16
17
|
import GeneralSettingsModal from '../modal/setting/GeneralSettings';
|
|
@@ -63,7 +64,8 @@ const styles = css `
|
|
|
63
64
|
`;
|
|
64
65
|
function HeaderInner(props) {
|
|
65
66
|
const { selectedOptionPanel, height } = props;
|
|
66
|
-
const { current: { display: { general }, }, workspace,
|
|
67
|
+
const { current: { display: { general }, }, workspace, } = usePreferences();
|
|
68
|
+
const { setActiveWorkspace } = useWorkspaceAction();
|
|
67
69
|
const fullscreen = useFullscreen();
|
|
68
70
|
const workspacesList = useWorkspacesList();
|
|
69
71
|
const hideGeneralSettings = !!(general?.hideGeneralSettings && workspace.base);
|
|
@@ -90,14 +92,9 @@ function HeaderInner(props) {
|
|
|
90
92
|
return null;
|
|
91
93
|
}
|
|
92
94
|
}, [selectedOptionPanel]);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
payload: {
|
|
97
|
-
workspace: option.key,
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
}, [dispatch]);
|
|
95
|
+
function changeWorkspaceHandler(option) {
|
|
96
|
+
setActiveWorkspace(option.key);
|
|
97
|
+
}
|
|
101
98
|
function renderItem(item) {
|
|
102
99
|
return _jsx(WorkspaceItem, { item: item });
|
|
103
100
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MIN_AREA_POINTS
|
|
1
|
+
export declare const MIN_AREA_POINTS = 5;
|
|
2
2
|
export declare function useCheckPointsNumberInWindowArea(): number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type ReturnFunction = (value?: number | string, formatKey?: string, prefix?: string, suffix?: string) => string;
|
|
1
|
+
export type ReturnFunction = (value?: number | string, formatKey?: 'ppmFormat' | 'hzFormat' | (string & {}), prefix?: string, suffix?: string) => string;
|
|
2
2
|
export declare function useFormatNumberByNucleus(nucleus?: string[]): ReturnFunction[];
|
|
3
3
|
export declare function useFormatNumberByNucleus(nucleus?: string): ReturnFunction;
|