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.
Files changed (178) hide show
  1. package/lib/component/1d/Viewer1D.js +48 -17
  2. package/lib/component/1d/XAxis.js +1 -1
  3. package/lib/component/1d/integral/IntegralsSeries.js +2 -2
  4. package/lib/component/1d/integral/Integration.d.ts +3 -1
  5. package/lib/component/1d/integral/Integration.js +3 -2
  6. package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
  7. package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
  8. package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
  9. package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
  10. package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
  11. package/lib/component/1d/ranges/Atoms.js +4 -5
  12. package/lib/component/1d/ranges/Range.js +62 -12
  13. package/lib/component/1d/ranges/Ranges.js +2 -1
  14. package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
  15. package/lib/component/1d/tool/XLabelPointer.js +4 -12
  16. package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
  17. package/lib/component/1d-2d/FieldEdition.js +42 -0
  18. package/lib/component/2d/Chart2D.js +5 -3
  19. package/lib/component/2d/tools/XYLabelPointer.js +3 -9
  20. package/lib/component/2d/zones/Zone.js +18 -2
  21. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
  22. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
  24. package/lib/component/context/LoggerContext.js +11 -4
  25. package/lib/component/context/ShareDataContext.d.ts +10 -0
  26. package/lib/component/context/ShareDataContext.js +22 -0
  27. package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
  28. package/lib/component/elements/ActionsButtonsPopover.js +22 -0
  29. package/lib/component/elements/CloseButton.d.ts +1 -1
  30. package/lib/component/elements/CustomToolTip.d.ts +8 -0
  31. package/lib/component/elements/CustomToolTip.js +107 -0
  32. package/lib/component/elements/EditableColumn.js +3 -2
  33. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  35. package/lib/component/elements/SVGButton.d.ts +14 -0
  36. package/lib/component/elements/SVGButton.js +6 -0
  37. package/lib/component/elements/SVGGroup.js +15 -13
  38. package/lib/component/elements/SVGText.d.ts +8 -0
  39. package/lib/component/elements/SVGText.js +24 -0
  40. package/lib/component/elements/SaveButton.d.ts +1 -1
  41. package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
  42. package/lib/component/elements/formik/FormikError.js +2 -4
  43. package/lib/component/elements/formik/FormikInput.d.ts +2 -1
  44. package/lib/component/elements/formik/FormikInput.js +5 -4
  45. package/lib/component/header/Header.js +8 -11
  46. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
  47. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  48. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
  49. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  50. package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
  51. package/lib/component/hooks/useIntegralPath.d.ts +2 -0
  52. package/lib/component/hooks/useIntegralPath.js +3 -1
  53. package/lib/component/hooks/usePanelPreferences.js +1 -2
  54. package/lib/component/hooks/useSaveSettings.js +7 -14
  55. package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
  56. package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
  57. package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
  58. package/lib/component/hooks/useWorkspaceAction.js +89 -0
  59. package/lib/component/loader/DropZone.js +0 -3
  60. package/lib/component/main/InnerNMRium.js +3 -1
  61. package/lib/component/main/InnerNMRiumContents.js +14 -2
  62. package/lib/component/main/NMRiumStateProvider.js +15 -3
  63. package/lib/component/modal/AboutPredictionModal.js +1 -1
  64. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  65. package/lib/component/modal/CopyClipboardModal.js +1 -1
  66. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  67. package/lib/component/modal/ImportPublicationStringModal.js +11 -5
  68. package/lib/component/modal/PredictSpectraModal.js +1 -1
  69. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  70. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  71. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  72. package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
  73. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
  74. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
  75. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
  76. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +18 -39
  78. package/lib/component/modal/setting/WorkspaceItem.js +1 -1
  79. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
  80. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
  81. package/lib/component/modal/setting/settingsValidation.js +36 -40
  82. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
  83. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
  84. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  86. package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
  87. package/lib/component/panels/RangesPanel/RangesHeader.js +11 -11
  88. package/lib/component/panels/RangesPanel/RangesPreferences.js +16 -16
  89. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  90. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
  91. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
  92. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
  93. package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
  94. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
  95. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  96. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
  97. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
  98. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
  99. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
  100. package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
  101. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
  102. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
  103. package/lib/component/panels/ZonesPanel/ZonesPanel.js +22 -6
  104. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
  105. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
  106. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
  107. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
  108. package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
  109. package/lib/component/panels/header/PreferencesHeader.js +1 -1
  110. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  111. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  112. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
  113. package/lib/component/reducer/IgnoreActions.js +1 -0
  114. package/lib/component/reducer/Reducer.js +8 -0
  115. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  116. package/lib/component/reducer/actions/DomainActions.js +29 -1
  117. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
  118. package/lib/component/reducer/actions/FiltersActions.js +27 -1
  119. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  120. package/lib/component/reducer/actions/RangesActions.d.ts +2 -3
  121. package/lib/component/reducer/actions/RangesActions.js +28 -26
  122. package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
  123. package/lib/component/reducer/actions/SpectraActions.js +5 -1
  124. package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
  125. package/lib/component/reducer/actions/ZonesActions.js +47 -13
  126. package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
  127. package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
  128. package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
  129. package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
  130. package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
  131. package/lib/component/reducer/preferences/actions/matrixGeneration.js +3 -3
  132. package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
  133. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
  134. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  135. package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
  136. package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
  137. package/lib/component/reducer/preferences/preferencesReducer.d.ts +7 -0
  138. package/lib/component/reducer/preferences/preferencesReducer.js +21 -18
  139. package/lib/component/toolbar/ToolBar.js +115 -25
  140. package/lib/component/utility/PreferencesHelper.js +5 -4
  141. package/lib/component/utility/export.js +4 -0
  142. package/lib/component/workspaces/assignment.js +0 -1
  143. package/lib/component/workspaces/basic.js +0 -1
  144. package/lib/component/workspaces/embedded.js +0 -1
  145. package/lib/component/workspaces/exercise.js +26 -29
  146. package/lib/component/workspaces/prediction.js +171 -174
  147. package/lib/component/workspaces/process1D.js +0 -1
  148. package/lib/component/workspaces/simulation.js +35 -38
  149. package/lib/component/workspaces/workspaceDefaultProperties.js +16 -23
  150. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
  151. package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
  152. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/index.js +2 -2
  154. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
  155. package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
  156. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
  157. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
  158. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
  159. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
  160. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
  161. package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
  162. package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
  163. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
  164. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
  165. package/lib/data/utilities/generateColor.d.ts +7 -3
  166. package/lib/data/utilities/generateColor.js +5 -17
  167. package/lib/versionInfo.js +1 -1
  168. package/package.json +35 -35
  169. package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
  170. package/lib/component/elements/MolecularFormulaInput.js +0 -63
  171. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
  172. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
  173. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
  174. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
  175. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
  176. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
  177. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
  178. 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 (!activeSpectrum)
121
+ if (!spectrum)
112
122
  break;
113
- dispatch({
114
- type: 'ADD_RANGE',
115
- payload: brushData,
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] = getRange(state, {
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
- activeSpectrum,
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
- dispatch({
251
- type: 'CUT_RANGE',
252
- payload: { cutValue: xPPM },
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
- }, [dispatch, getModifiersKey, primaryKeyIdentifier, scaleState, selectedTool]);
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 &&
@@ -54,7 +54,7 @@ function XAxis(props) {
54
54
  .tickFormat(() => '');
55
55
  // @ts-expect-error This line of code is actually well typed ...
56
56
  d3.select(refAxis.current).call(xAxis);
57
- // @ts-expect-error ditto
57
+ // @ts-expect-error This line of code is actually well typed ...
58
58
  d3.select(refGrid.current).call(grid);
59
59
  }, [height, margin.bottom, margin.top, scaleX, show, xDomain]);
60
60
  if (!width || !height || !scaleX) {
@@ -5,11 +5,11 @@ import useSpectrum from '../../hooks/useSpectrum';
5
5
  import { Integration } from './Integration';
6
6
  const emptyData = { integrals: {}, info: {}, display: {} };
7
7
  export default function IntegralsSeries() {
8
- const { displayerKey, view: { spectra: { activeTab: nucleus }, }, } = useChartData();
8
+ const { displayerKey, view: { spectra: { activeTab: nucleus }, }, xDomain: [from, to], } = useChartData();
9
9
  const integrals = useIntegrals();
10
10
  if (!integrals)
11
11
  return null;
12
- return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "integrals", children: integrals.values.map((integral) => (_jsx(Integration, { nucleus: nucleus, integral: integral, max: integrals.max }, integral.id))) }));
12
+ return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "integrals", children: integrals.values.map((integral) => (_jsx(Integration, { nucleus: nucleus, integral: integral, max: integrals.max, from, to }, integral.id))) }));
13
13
  }
14
14
  function useIntegrals() {
15
15
  const spectrum = useSpectrum(emptyData);
@@ -3,6 +3,8 @@ interface IntegralProps {
3
3
  integral: IntegralData;
4
4
  nucleus: string;
5
5
  max: number;
6
+ from: number;
7
+ to: number;
6
8
  }
7
- export declare function Integration({ integral, nucleus, max }: IntegralProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function Integration(props: IntegralProps): import("react/jsx-runtime").JSX.Element;
8
10
  export {};
@@ -3,10 +3,11 @@ import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectr
3
3
  import useIntegralPath from '../../hooks/useIntegralPath';
4
4
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
5
5
  import IntegralResizable from './IntegralResizable';
6
- export function Integration({ integral, nucleus, max }) {
6
+ export function Integration(props) {
7
+ const { integral, nucleus, max, from, to } = props;
7
8
  const { x, y } = integral;
8
9
  const { scaleRatio } = useActiveSpectrumIntegralsViewState();
9
- const path = useIntegralPath({ x, y, max, scaleRatio });
10
+ const path = useIntegralPath({ x, y, max, scaleRatio, from, to });
10
11
  const { showIntegralsValues } = useActiveSpectrumIntegralsViewState();
11
12
  const integralPreferences = usePanelPreferences('integrals', nucleus);
12
13
  return (_jsxs("g", { children: [_jsx("path", { className: "line", stroke: integralPreferences.color, strokeWidth: integralPreferences.strokeWidth, fill: "none", d: path }), showIntegralsValues && (_jsx(IntegralResizable, { integralData: integral, integralFormat: integralPreferences.relative.format }))] }));
@@ -12,7 +12,9 @@ const validationSchema = Yup.object({
12
12
  });
13
13
  const InputDimension = { height: 28, width: 100 };
14
14
  const peaksEditionContext = {
15
- onEdit: () => { },
15
+ onEdit: () => {
16
+ // Empty default.
17
+ },
16
18
  };
17
19
  const PeaksEditionContext = createContext(peaksEditionContext);
18
20
  function usePeaksEditionManager() {
@@ -59,9 +61,9 @@ export function PeakEditionProvider({ children }) {
59
61
  setPeak(null);
60
62
  }
61
63
  }, []);
62
- const editiionManagerState = useMemo(() => ({ onEdit: handleOnEdit, id: peak?.id }), [peak?.id, handleOnEdit]);
64
+ const editionManagerState = useMemo(() => ({ onEdit: handleOnEdit, id: peak?.id }), [peak?.id, handleOnEdit]);
63
65
  const { x, y } = getPosition();
64
- return (_jsx(PeaksEditionContext.Provider, { value: editiionManagerState, children: _jsxs("div", { onClick: () => setPeak(null), onContextMenu: () => setPeak(null), style: { position: 'relative' }, children: [peak && (_jsx("div", { style: {
66
+ return (_jsx(PeaksEditionContext.Provider, { value: editionManagerState, children: _jsxs("div", { onClick: () => setPeak(null), onContextMenu: () => setPeak(null), style: { position: 'relative' }, children: [peak && (_jsx("div", { style: {
65
67
  position: 'absolute',
66
68
  display: 'block',
67
69
  transform: `translate(${x}px,${y}px)`,
@@ -6,5 +6,6 @@ export interface AssignmentActionsButtonsProps extends Omit<ButtonProps, 'childr
6
6
  className?: string;
7
7
  onAssign: ButtonProps['onClick'];
8
8
  onUnAssign: ButtonProps['onClick'];
9
+ onAddAssignmentLabel?: ButtonProps['onClick'];
9
10
  }
10
11
  export declare function AssignmentActionsButtons(props: AssignmentActionsButtonsProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FaLink, FaMinus } from 'react-icons/fa';
2
+ import { LuLink, LuUnlink } from 'react-icons/lu';
3
3
  import Button from '../../elements/Button';
4
4
  const styles = {
5
5
  button: { width: '16px', height: '16px', padding: 0 },
6
6
  icon: { fontSize: 9, margin: 'auto' },
7
7
  };
8
8
  export function AssignmentActionsButtons(props) {
9
- const { isActive, onAssign, onUnAssign, x = 0, y = 5, className = 'target', ...otherProps } = props;
10
- return (_jsxs("foreignObject", { width: "16px", height: "34px", x: x, y: y, className: className, "data-no-export": "true", children: [_jsx(Button, { theme: "success", style: styles.button, onClick: onAssign, ...otherProps, children: _jsx(FaLink, { style: styles.icon }) }), isActive && (_jsx(Button, { theme: "danger", style: { ...styles.button, marginTop: '2px' }, onClick: onUnAssign, ...otherProps, children: _jsx(FaMinus, { style: styles.icon }) }))] }));
9
+ const { isActive, onAssign, onUnAssign, onAddAssignmentLabel, x = 0, y = 5, className = 'target', ...otherProps } = props;
10
+ return (_jsxs("foreignObject", { width: "16px", height: "52px", x: x - 16, y: y, className: className, "data-no-export": "true", children: [_jsx(Button, { theme: "success", style: styles.button, onClick: onAssign, ...otherProps, children: _jsx(LuLink, { style: styles.icon }) }), isActive && (_jsx(Button, { theme: "danger", style: { ...styles.button, marginTop: '2px' }, onClick: onUnAssign, ...otherProps, children: _jsx(LuUnlink, { style: styles.icon }) }))] }));
11
11
  }
@@ -1,7 +1,7 @@
1
1
  import { Range } from 'nmr-processing';
2
2
  interface AssignmentLabelProps {
3
3
  range: Range;
4
- x: number;
4
+ width: number;
5
5
  }
6
6
  export declare function AssignmentLabel(props: AssignmentLabelProps): import("react/jsx-runtime").JSX.Element | null;
7
7
  export {};
@@ -1,10 +1,37 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { FieldEdition } from '../../1d-2d/FieldEdition';
4
+ import { useChartData } from '../../context/ChartContext';
5
+ import { useDispatch } from '../../context/DispatchContext';
2
6
  import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
3
- const marginTop = 55;
7
+ import { useTriggerNewAssignmentLabel } from '../../hooks/useTriggerNewAssignmentLabel';
8
+ const marginTop = 15;
4
9
  export function AssignmentLabel(props) {
5
- const { range, x } = props;
10
+ const { range, width } = props;
11
+ const { id, assignment } = range;
6
12
  const { showAssignmentsLabels } = useActiveSpectrumRangesViewState();
7
- if (!range.assignment || !showAssignmentsLabels)
13
+ const dispatch = useDispatch();
14
+ const textRef = useRef(null);
15
+ const { margin } = useChartData();
16
+ const { isNewAssignment, dismissNewLabel } = useTriggerNewAssignmentLabel(id);
17
+ if ((!range.assignment || !showAssignmentsLabels) && !isNewAssignment) {
8
18
  return null;
9
- return (_jsx("text", { x: x - 5, y: marginTop, fontSize: "12px", fill: "black", textAnchor: "end", children: range.assignment }));
19
+ }
20
+ function handleChange(value) {
21
+ dismissNewLabel();
22
+ dispatch({
23
+ type: 'CHANGE_RANGE_ASSIGNMENT_LABEL',
24
+ payload: {
25
+ value,
26
+ rangeID: id,
27
+ },
28
+ });
29
+ }
30
+ return (_jsx("g", { transform: `translate(${width / 2} ${margin?.top + marginTop})`, children: _jsx(FieldEdition, { onChange: handleChange, inputType: "text", value: assignment || '', PopoverProps: {
31
+ position: 'bottom',
32
+ targetTagName: 'g',
33
+ ...(isNewAssignment
34
+ ? { isOpen: true, onClose: () => dismissNewLabel() }
35
+ : {}),
36
+ }, children: _jsx("text", { ref: textRef, textAnchor: "middle", fill: "black", style: { cursor: 'hand' }, width: width, children: assignment }) }) }));
10
37
  }
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useChartData } from '../../context/ChartContext';
3
3
  import { useTopicMolecule } from '../../context/TopicMoleculeContext';
4
+ import { SVGGroup } from '../../elements/SVGGroup';
5
+ import { SVGText } from '../../elements/SVGText';
4
6
  const fontSize = 12;
5
- const lineHeight = fontSize * 1.1;
6
- const marginTop = 55;
7
+ const marginTop = 45;
7
8
  function getDiaIds(range) {
8
9
  const { diaIDs = [], signals } = range;
9
10
  const ids = diaIDs.slice();
@@ -37,7 +38,5 @@ export function Atoms(props) {
37
38
  const { range, x } = props;
38
39
  const { view: { molecules }, } = useChartData();
39
40
  const atomsList = useAtoms(range).filter((atomsList) => molecules?.[atomsList.id]?.showAtomNumber);
40
- return (_jsx("g", { transform: `translate(${x},${marginTop})`, children: atomsList.map((row, rowIndex) => (
41
- // eslint-disable-next-line react/no-array-index-key
42
- _jsx("g", { transform: `translate(${rowIndex * lineHeight}, 0)`, children: row.atoms.map((item, colIndex) => (_jsx("text", { x: 0, y: colIndex * lineHeight, fontSize: fontSize, fill: "black", children: item }, colIndex))) }, rowIndex))) }));
41
+ return (_jsx(SVGGroup, { direction: "column", transform: `translate(${x},${marginTop})`, space: 5, children: atomsList.map((row) => (_jsx(SVGText, { x: 0, fontSize: fontSize, borderRadius: 5, padding: 2, rectProps: { fill: 'white', stroke: 'black', strokeWidth: 0.5 }, children: row.atoms.join(',') }, range.id + row.atoms.join(',')))) }));
43
42
  }
@@ -1,21 +1,27 @@
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 { LuUnlink, LuLink } from 'react-icons/lu';
5
+ import { PiTextTBold, PiTextTSlashBold } from 'react-icons/pi';
6
+ import { isSpectrum1D, resizeRange } from '../../../data/data1d/Spectrum1D';
4
7
  import { isRangeAssigned } from '../../../data/data1d/Spectrum1D/isRangeAssigned';
5
8
  import { checkRangeKind } from '../../../data/utilities/RangeUtilities';
6
9
  import { useAssignment, useAssignmentData, } from '../../assignment/AssignmentsContext';
7
10
  import { filterForIDsWithAssignment } from '../../assignment/utilities/filterForIDsWithAssignment';
8
11
  import { useDispatch } from '../../context/DispatchContext';
12
+ import { useLogger } from '../../context/LoggerContext';
13
+ import { useShareData } from '../../context/ShareDataContext';
14
+ import { ActionsButtonsPopover, } from '../../elements/ActionsButtonsPopover';
9
15
  import { ResizerWithScale } from '../../elements/ResizerWithScale';
10
16
  import { HighlightEventSource, useHighlight } from '../../highlight';
11
17
  import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
12
18
  import { useResizerStatus } from '../../hooks/useResizerStatus';
19
+ import useSpectrum from '../../hooks/useSpectrum';
13
20
  import { options } from '../../toolbar/ToolTypes';
14
21
  import { IntegralIndicator } from '../integral/IntegralIndicator';
15
22
  import { useScaleX } from '../utilities/scale';
16
- import { AssignmentActionsButtons } from './AssignmentActionsButtons';
17
- import { Atoms } from './Atoms';
18
23
  import { AssignmentLabel } from './AssignmentLabel';
24
+ import { Atoms } from './Atoms';
19
25
  const style = css `
20
26
  .target {
21
27
  visibility: hidden;
@@ -28,23 +34,28 @@ const style = css `
28
34
  }
29
35
  `;
30
36
  function Range({ range, selectedTool, relativeFormat }) {
31
- const { id, integration, signals, from, to, diaIDs: rangeDiaIDs } = range;
37
+ const { id, integration, signals, from, to, diaIDs: rangeDiaIDs, assignment, } = range;
32
38
  const assignmentData = useAssignmentData();
33
39
  const assignmentRange = useAssignment(id);
34
40
  const highlightRange = useHighlight([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat(filterForIDsWithAssignment(assignmentData, signals.map((_signal) => _signal.id))), { type: HighlightEventSource.RANGE, extra: { id } });
35
41
  const scaleX = useScaleX();
36
42
  const dispatch = useDispatch();
43
+ const { logger } = useLogger();
44
+ const spectrum = useSpectrum();
37
45
  const { showIntegralsValues } = useActiveSpectrumRangesViewState();
38
46
  const isBlockedByEditing = selectedTool && selectedTool === options.editRange.id;
39
47
  function handleOnStopResizing(position) {
48
+ if (!spectrum || !isSpectrum1D(spectrum))
49
+ return;
50
+ const from = scaleX().invert(position.x2);
51
+ const to = scaleX().invert(position.x1);
52
+ const newRange = resizeRange(spectrum, { from, to, range, logger });
53
+ if (!newRange)
54
+ return;
40
55
  dispatch({
41
56
  type: 'RESIZE_RANGE',
42
57
  payload: {
43
- range: {
44
- ...range,
45
- from: scaleX().invert(position.x2),
46
- to: scaleX().invert(position.x1),
47
- },
58
+ range: newRange,
48
59
  },
49
60
  });
50
61
  }
@@ -75,10 +86,49 @@ function Range({ range, selectedTool, relativeFormat }) {
75
86
  const isHighlighted = isBlockedByEditing || highlightRange.isActive || assignmentRange.isActive;
76
87
  const isAssigned = isRangeAssigned(range);
77
88
  const isResizingActive = useResizerStatus('rangePicking');
78
- const startX = scaleX()(from) - 16;
79
- 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) => {
89
+ const { setData: addNewAssignmentLabel } = useShareData();
90
+ const isAssignmentActive = !!(assignmentRange.isActive || rangeDiaIDs);
91
+ function removeAssignemntlabel() {
92
+ dispatch({
93
+ type: 'CHANGE_RANGE_ASSIGNMENT_LABEL',
94
+ payload: {
95
+ value: '',
96
+ rangeID: id,
97
+ },
98
+ });
99
+ }
100
+ const actionsButtons = [
101
+ {
102
+ icon: _jsx(LuLink, {}),
103
+ onClick: assignHandler,
104
+ intent: 'success',
105
+ title: 'Assign range',
106
+ },
107
+ {
108
+ icon: _jsx(LuUnlink, {}),
109
+ onClick: () => unAssignHandler(),
110
+ intent: 'danger',
111
+ title: 'Unassign range',
112
+ visible: isAssignmentActive,
113
+ },
114
+ {
115
+ icon: _jsx(PiTextTBold, {}),
116
+ onClick: () => addNewAssignmentLabel(range.id),
117
+ intent: 'success',
118
+ title: 'Add assignment label',
119
+ visible: !assignment,
120
+ },
121
+ {
122
+ icon: _jsx(PiTextTSlashBold, {}),
123
+ onClick: removeAssignemntlabel,
124
+ intent: 'danger',
125
+ title: 'Remove assignment label',
126
+ visible: !!assignment,
127
+ },
128
+ ];
129
+ return (_jsx("g", { "data-testid": "range", style: { outline: 'none' }, onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, ...(!assignmentRange.isActive && { css: style }), children: _jsx(ActionsButtonsPopover, { targetTagName: "g", ...(assignmentRange.isActive && { isOpen: true }), buttons: actionsButtons, children: _jsx(ResizerWithScale, { from: from, to: to, onEnd: handleOnStopResizing, disabled: !isResizingActive, children: ({ x1, x2 }, isActive) => {
80
130
  const width = x2 - x1;
81
- 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 }))] }));
82
- } }), _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));
131
+ 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" }), _jsx(AssignmentLabel, { range: range, width: width }), _jsx(Atoms, { range: range, x: width / 2 }), showIntegralsValues && (_jsx(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 }))] }));
132
+ } }) }) }, id));
83
133
  }
84
134
  export default Range;
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { useChartData } from '../../context/ChartContext';
4
+ import { ShareDataProvider } from '../../context/ShareDataContext';
4
5
  import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
5
6
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
6
7
  import useSpectrum from '../../hooks/useSpectrum';
7
8
  import Range from './Range';
8
9
  function RangesInner({ ranges, displayerKey, selectedTool, showMultiplicityTrees, relativeFormat, }) {
9
- return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, children: ranges?.values?.map((range) => (_jsx(Range, { range: range, selectedTool: selectedTool, showMultiplicityTrees: showMultiplicityTrees, relativeFormat: relativeFormat }, range.id))) }));
10
+ return (_jsx(ShareDataProvider, { children: _jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, children: ranges?.values?.map((range) => (_jsx(Range, { range: range, selectedTool: selectedTool, showMultiplicityTrees: showMultiplicityTrees, relativeFormat: relativeFormat }, range.id))) }) }));
10
11
  }
11
12
  const MemoizedRanges = memo(RangesInner);
12
13
  const emptyData = { ranges: {}, info: {}, display: {} };
@@ -5,14 +5,21 @@ import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumR
5
5
  import useIntegralPath from '../../hooks/useIntegralPath';
6
6
  import useSpectrum from '../../hooks/useSpectrum';
7
7
  function Integral(props) {
8
- const { x, y, max } = props;
8
+ const { x, y, max, from, to } = props;
9
9
  const { integralsScaleRatio } = useActiveSpectrumRangesViewState();
10
- const path = useIntegralPath({ x, y, max, scaleRatio: integralsScaleRatio });
10
+ const path = useIntegralPath({
11
+ x,
12
+ y,
13
+ max,
14
+ scaleRatio: integralsScaleRatio,
15
+ from,
16
+ to,
17
+ });
11
18
  return (_jsx("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", d: path }));
12
19
  }
13
20
  const emptyData = { ranges: {}, info: {}, display: {} };
14
21
  function RangesIntegrals() {
15
- const { displayerKey } = useChartData();
22
+ const { displayerKey, xDomain: [from, to], } = useChartData();
16
23
  const spectrum = useSpectrum(emptyData);
17
24
  const integrals = useIntegrals();
18
25
  if (!spectrum.ranges?.values ||
@@ -22,7 +29,7 @@ function RangesIntegrals() {
22
29
  return null;
23
30
  }
24
31
  return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, children: integrals.values.map((integral) => {
25
- return _jsx(Integral, { ...integral, max: integrals.max }, integral.id);
32
+ return (_jsx(Integral, { ...integral, max: integrals.max, from, to }, integral.id));
26
33
  }) }));
27
34
  }
28
35
  function useIntegrals() {
@@ -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
- top: '-18px',
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: getXValue(position.x) }) }, "xLabelPointer"));
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;
@@ -0,0 +1,13 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { PopoverProps } from '@blueprintjs/core';
3
+ import { ReactNode } from 'react';
4
+ type InputType = 'number' | 'text';
5
+ interface FieldEditionsProps {
6
+ value: number | string;
7
+ inputType?: InputType;
8
+ onChange: (value: any) => void;
9
+ children: ReactNode;
10
+ PopoverProps?: PopoverProps;
11
+ }
12
+ export declare function FieldEdition(props: FieldEditionsProps): import("@emotion/react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,42 @@
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 { Formik } from 'formik';
6
+ import { useState } from 'react';
7
+ import * as Yup from 'yup';
8
+ import FormikInput from '../elements/formik/FormikInput';
9
+ const InputDimension = { height: 28, width: 100 };
10
+ const validationSchema = (inputType) => Yup.object({
11
+ value: (inputType === 'number' ? Yup.number() : Yup.string()).required(),
12
+ });
13
+ function stopPropagation(e) {
14
+ e.stopPropagation();
15
+ }
16
+ function keyDownCheck(event) {
17
+ if (event.key === 'Enter') {
18
+ return true;
19
+ }
20
+ else if (event.key === 'Escape') {
21
+ return false;
22
+ }
23
+ }
24
+ export function FieldEdition(props) {
25
+ const { value, inputType = 'text', onChange, children, PopoverProps } = props;
26
+ const [isOpen, setIsOpen] = useState(false);
27
+ function handleOnSubmit({ value: newValue }) {
28
+ onChange(newValue);
29
+ setIsOpen(false);
30
+ }
31
+ return (_jsx(Popover, { css: css `
32
+ .field-edition-popover {
33
+ border-radius: 5px;
34
+ }
35
+ `, popoverClassName: "field-edition-popover", isOpen: isOpen, onClose: () => setIsOpen(false), onInteraction: () => setIsOpen(true), content: _jsx(Formik, { initialValues: { value }, onSubmit: handleOnSubmit, validationSchema: validationSchema(inputType), children: ({ submitForm }) => (_jsx(FormikInput, { type: inputType, style: {
36
+ input: {
37
+ height: `${InputDimension.height}px`,
38
+ padding: '5px',
39
+ outline: 'none',
40
+ },
41
+ }, name: "value", autoSelect: true, onKeyDown: (e) => keyDownCheck(e) && submitForm(), onClick: stopPropagation, onMouseDown: stopPropagation })) }), ...PopoverProps, children: children }));
42
+ }
@@ -3,18 +3,20 @@ import { memo } from 'react';
3
3
  import SpectrumInfoBlock from '../1d-2d/components/SpectrumInfoBlock';
4
4
  import { useChartData } from '../context/ChartContext';
5
5
  import { usePreferences } from '../context/PreferencesContext';
6
+ import { ShareDataProvider } from '../context/ShareDataContext';
6
7
  import XAxis from './XAxis';
7
8
  import YAxis from './YAxis';
8
9
  import { FidContainer } from './fid/FidContainer';
9
10
  import { FTContainer } from './ft/FTContainer';
10
11
  import IndicationLines from './zones/IndicationLines';
11
12
  import Zones from './zones/Zones';
12
- function chart2DInner({ spectra, width, height, margin, displayerKey, spectraRendering, }) {
13
+ import ZonesAssignmentsLabels from './zones/ZonesAssignmentsLabels';
14
+ function Chart2DInner({ spectra, width, height, margin, displayerKey, spectraRendering, }) {
13
15
  return (_jsxs("svg", { id: "nmrSVG", viewBox: `0 0 ${width} ${height}`, width: width, height: height, fontFamily: "Arial, Helvetica, sans-serif", shapeRendering: spectraRendering, style: {
14
16
  position: 'absolute',
15
- }, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-2d`, children: _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top }) }) }), _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top, stroke: "black", strokeWidth: "1", fill: "transparent" }), _jsx(FTContainer, { spectra: spectra }), _jsx(FidContainer, {}), _jsx(Zones, {}), _jsx(IndicationLines, { axis: "X", show: true }), _jsx(IndicationLines, { axis: "Y", show: true }), _jsx(SpectrumInfoBlock, {}), _jsxs("g", { className: "container", style: { pointerEvents: 'none' }, children: [_jsx(XAxis, {}), _jsx(YAxis, {})] })] }));
17
+ }, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-2d`, children: _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top }) }) }), _jsx("rect", { width: width - margin.left - margin.right, height: height - margin.top - margin.bottom, x: margin.left, y: margin.top, stroke: "black", strokeWidth: "1", fill: "transparent" }), _jsx(FTContainer, { spectra: spectra }), _jsx(FidContainer, {}), _jsxs(ShareDataProvider, { children: [_jsx(Zones, {}), _jsx(ZonesAssignmentsLabels, {})] }), _jsx(IndicationLines, { axis: "X", show: true }), _jsx(IndicationLines, { axis: "Y", show: true }), _jsx(SpectrumInfoBlock, {}), _jsxs("g", { className: "container", style: { pointerEvents: 'none' }, children: [_jsx(XAxis, {}), _jsx(YAxis, {})] })] }));
16
18
  }
17
- const MemoizedChart2D = memo(chart2DInner);
19
+ const MemoizedChart2D = memo(Chart2DInner);
18
20
  export default function Chart2D({ spectra }) {
19
21
  const { width, height, margin, displayerKey } = useChartData();
20
22
  const { current: { general: { spectraRendering }, }, } = usePreferences();