nmrium 0.46.0 → 0.47.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 (65) hide show
  1. package/lib/component/1d/Chart1D.js +3 -1
  2. package/lib/component/1d/Viewer1D.js +4 -21
  3. package/lib/component/1d/integral/Integration.js +2 -1
  4. package/lib/component/1d/ranges/Range.js +3 -1
  5. package/lib/component/2d/1d-tracer/Top1DChart.js +1 -1
  6. package/lib/component/2d/zones/Signal.js +1 -1
  7. package/lib/component/2d/zones/Zone.js +1 -1
  8. package/lib/component/elements/Header.js +1 -1
  9. package/lib/component/elements/formik/FormikColorPickerDropdown.d.ts +6 -0
  10. package/lib/component/elements/formik/FormikColorPickerDropdown.js +14 -0
  11. package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js +1 -0
  12. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
  13. package/lib/component/loader/DropZone.js +4 -2
  14. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  15. package/lib/component/modal/setting/GeneralSettings.js +2 -1
  16. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  17. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.d.ts +2 -0
  18. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +131 -0
  19. package/lib/component/modal/setting/settingsValidation.js +12 -1
  20. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +16 -2
  21. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +2 -2
  22. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -1
  23. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -2
  24. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  25. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  26. package/lib/component/panels/databasePanel/DatabasePreferences.js +2 -2
  27. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
  28. package/lib/component/panels/filtersPanel/FiltersTable.js +3 -2
  29. package/lib/component/reducer/Reducer.js +2 -0
  30. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  31. package/lib/component/reducer/actions/IntegralsActions.d.ts +8 -2
  32. package/lib/component/reducer/actions/IntegralsActions.js +10 -1
  33. package/lib/component/reducer/actions/LoadActions.d.ts +3 -1
  34. package/lib/component/reducer/actions/LoadActions.js +9 -4
  35. package/lib/component/reducer/actions/PeaksActions.js +1 -1
  36. package/lib/component/reducer/actions/SpectrumsActions.js +9 -3
  37. package/lib/component/toolbar/BasicToolBar.js +4 -4
  38. package/lib/component/toolbar/FunctionToolBar.js +2 -1
  39. package/lib/component/workspaces/exercise.js +1 -0
  40. package/lib/component/workspaces/prediction.js +5 -0
  41. package/lib/component/workspaces/simulation.js +5 -0
  42. package/lib/component/workspaces/workspaceDefaultProperties.js +41 -0
  43. package/lib/data/PredictionManager.js +1 -1
  44. package/lib/data/constants/Multiplets.js +1 -1
  45. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +9 -1
  46. package/lib/data/data1d/Spectrum1D/get1DColor.js +12 -4
  47. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +2 -1
  48. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
  49. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -1
  50. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +6 -3
  51. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +7 -1
  52. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +32 -19
  53. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +10 -0
  54. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +70 -0
  55. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -0
  56. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +9 -2
  57. package/lib/data/data2d/Spectrum2D/get2DColor.js +13 -5
  58. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +7 -2
  59. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -2
  60. package/lib/data/utilities/getCustomColor.d.ts +4 -0
  61. package/lib/data/utilities/getCustomColor.js +38 -0
  62. package/lib/versionInfo.js +1 -1
  63. package/package.json +11 -11
  64. package/lib/component/elements/formik/FormikColorInput.d.ts +0 -8
  65. package/lib/component/elements/formik/FormikColorInput.js +0 -15
@@ -18,6 +18,8 @@ import RangesIntegrals from './ranges/RangesIntegrals';
18
18
  import BaseLineZones from './tool/BaseLineZones';
19
19
  function Chart1D({ mode, width, height, margin, displayerKey }) {
20
20
  const { current: { general: { spectraRendering }, }, } = usePreferences();
21
- return (_jsx(PeakEditionProvider, { children: _jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(Peaks, { peaksSource: "peaks" }), _jsx(RangesIntegrals, {}), _jsx(Ranges, {}), _jsx(Peaks, { peaksSource: "ranges" }), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) })] }) }));
21
+ const innerWidth = width - margin.left - margin.right;
22
+ const innerHeight = height - margin.bottom;
23
+ return (_jsx(PeakEditionProvider, { children: _jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", shapeRendering: spectraRendering, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-chart-1d`, children: _jsx("rect", { width: innerWidth, height: innerHeight, x: margin.left, y: "0" }) }) }), _jsx(LinesSeries, {}), _jsx(ApodizationLine, {}), _jsx(IntegralsSeries, {}), _jsx(Peaks, { peaksSource: "peaks" }), _jsx(RangesIntegrals, {}), _jsx(Ranges, {}), _jsx(Peaks, { peaksSource: "ranges" }), _jsx(JGraph, {}), _jsx(MultiAnalysisRanges, {}), _jsx(BaseLineZones, {}), _jsx(ExclusionZonesAnnotations, {}), _jsx(DatabaseElements, {}), _jsx(PeaksShapes, {}), _jsx(SpectraTracker, {}), _jsx(SpectrumInfoBlock, {}), _jsx("g", { className: "container", style: { pointerEvents: 'none' }, children: _jsx(XAxis, { showGrid: true, mode: mode }) })] }) }));
22
24
  }
23
25
  export default Chart1D;
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { xGetFromToIndex } from 'ml-spectra-processing';
3
2
  import { useCallback, useEffect, useReducer, useRef, useState, } from 'react';
4
3
  import { ResponsiveChart } from 'react-d3-utils';
5
4
  import { useOnOff } from 'react-science/ui';
6
- import { MAX_LENGTH } from '../../data/data1d/Spectrum1D/ranges/detectSignals';
7
5
  import BrushXY, { BRUSH_TYPE } from '../1d-2d/tools/BrushXY';
8
6
  import CrossLinePointer from '../1d-2d/tools/CrossLinePointer';
9
7
  import { ViewerResponsiveWrapper } from '../2d/Viewer2D';
@@ -13,7 +11,6 @@ import { useChartData } from '../context/ChartContext';
13
11
  import { useDispatch } from '../context/DispatchContext';
14
12
  import { usePreferences } from '../context/PreferencesContext';
15
13
  import { ScaleProvider } from '../context/ScaleContext';
16
- import { useAlert } from '../elements/popup/Alert';
17
14
  import { useActiveSpectrum } from '../hooks/useActiveSpectrum';
18
15
  import { useVerticalAlign } from '../hooks/useVerticalAlign';
19
16
  import Spinner from '../loader/Spinner';
@@ -37,7 +34,6 @@ function Viewer1D({ emptyText = undefined }) {
37
34
  const activeSpectrum = useActiveSpectrum();
38
35
  const dispatch = useDispatch();
39
36
  const { dispatch: dispatchPreferences } = usePreferences();
40
- const alert = useAlert();
41
37
  const [scaleState, dispatchScale] = useReducer(scaleReducer, scaleInitialState);
42
38
  useEffect(() => {
43
39
  if (xDomain.length > 0 && yDomain.length > 0 && widthProp && heightProp) {
@@ -115,23 +111,12 @@ function Viewer1D({ emptyText = undefined }) {
115
111
  });
116
112
  break;
117
113
  case options.rangePicking.id: {
118
- const [from, to] = getRange(state, {
119
- startX: brushData.startX,
120
- endX: brushData.endX,
121
- });
122
114
  if (!activeSpectrum)
123
115
  break;
124
- const { data: { x }, } = data[activeSpectrum.index];
125
- const { fromIndex, toIndex } = xGetFromToIndex(x, { from, to });
126
- if (toIndex - fromIndex <= MAX_LENGTH) {
127
- dispatch({
128
- type: 'ADD_RANGE',
129
- payload: brushData,
130
- });
131
- }
132
- else {
133
- alert.error(`Advanced peak picking only available for area up to ${MAX_LENGTH} points`);
134
- }
116
+ dispatch({
117
+ type: 'ADD_RANGE',
118
+ payload: brushData,
119
+ });
135
120
  break;
136
121
  }
137
122
  case options.multipleSpectraAnalysis.id:
@@ -203,7 +188,6 @@ function Viewer1D({ emptyText = undefined }) {
203
188
  }, [
204
189
  scaleState,
205
190
  selectedTool,
206
- data,
207
191
  openAnalysisModal,
208
192
  activeSpectrum,
209
193
  dispatch,
@@ -211,7 +195,6 @@ function Viewer1D({ emptyText = undefined }) {
211
195
  activeTab,
212
196
  xDomain,
213
197
  state,
214
- alert,
215
198
  ]);
216
199
  const handelOnDoubleClick = useCallback(() => {
217
200
  dispatch({
@@ -7,6 +7,7 @@ export function Integration({ integral, nucleus, max }) {
7
7
  const { x, y } = integral;
8
8
  const { scaleRatio } = useActiveSpectrumIntegralsViewState();
9
9
  const path = useIntegralPath({ x, y, max, scaleRatio });
10
+ const { showIntegralsValues } = useActiveSpectrumIntegralsViewState();
10
11
  const integralPreferences = usePanelPreferences('integrals', nucleus);
11
- return (_jsxs("g", { children: [_jsx("path", { className: "line", stroke: integralPreferences.color, strokeWidth: integralPreferences.strokeWidth, fill: "none", d: path }), _jsx(IntegralResizable, { integralData: integral, integralFormat: integralPreferences.relative.format })] }));
12
+ 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
13
  }
@@ -8,6 +8,7 @@ import { filterForIDsWithAssignment } from '../../assignment/utilities/filterFor
8
8
  import { useDispatch } from '../../context/DispatchContext';
9
9
  import { ResizerWithScale } from '../../elements/ResizerWithScale';
10
10
  import { HighlightEventSource, useHighlight } from '../../highlight';
11
+ import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
11
12
  import { useResizerStatus } from '../../hooks/useResizerStatus';
12
13
  import { options } from '../../toolbar/ToolTypes';
13
14
  import { IntegralIndicator } from '../integral/IntegralIndicator';
@@ -32,6 +33,7 @@ function Range({ range, showMultiplicityTrees, selectedTool, relativeFormat, })
32
33
  const highlightRange = useHighlight([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat(filterForIDsWithAssignment(assignmentData, signals.map((_signal) => _signal.id))), { type: HighlightEventSource.RANGE, extra: { id } });
33
34
  const scaleX = useScaleX();
34
35
  const dispatch = useDispatch();
36
+ const { showIntegralsValues } = useActiveSpectrumRangesViewState();
35
37
  const isBlockedByEditing = selectedTool && selectedTool === options.editRange.id;
36
38
  function handleOnStopResizing(position) {
37
39
  dispatch({
@@ -74,7 +76,7 @@ function Range({ range, showMultiplicityTrees, selectedTool, relativeFormat, })
74
76
  const isResizingActive = useResizerStatus('rangePicking');
75
77
  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) => {
76
78
  const width = x2 - x1;
77
- 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(IntegralIndicator, { value: integration, format: relativeFormat, width: width, opacity: isNotSignal ? 0.5 : 1 })] }));
79
+ 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 }))] }));
78
80
  } }), showMultiplicityTrees && (_jsx(MultiplicityTree, { range: range, onUnlink: unAssignHandler })), _jsx(AssignmentActionsButtons, { isActive: !!(assignmentRange.isActive || diaIDs), x: scaleX()(from) - 16, onAssign: assignHandler, onUnAssign: () => unAssignHandler() })] }, id));
79
81
  }
80
82
  export default Range;
@@ -26,6 +26,6 @@ function Top1DChart({ verticalMargin = 10, data: spectrum }) {
26
26
  return null;
27
27
  }
28
28
  const innerWidth = width - margin.left - margin.right;
29
- return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-top`, children: _jsx("rect", { width: innerWidth, height: height, x: margin.left, y: `${0}` }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-top)`, children: _jsx("path", { className: "line", stroke: spectrum.display.color, fill: "none", strokeWidth: "1px", d: path }) })] }));
29
+ return (_jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [_jsx("defs", { children: _jsx("clipPath", { id: `${displayerKey}clip-top`, children: _jsx("rect", { width: innerWidth, height: height, x: margin.left, y: "0" }) }) }), _jsx("g", { clipPath: `url(#${displayerKey}clip-top)`, children: _jsx("path", { className: "line", stroke: spectrum.display.color, fill: "none", strokeWidth: "1px", d: path }) })] }));
30
30
  }
31
31
  export default memo(Top1DChart);
@@ -40,6 +40,6 @@ function Signal({ signal }) {
40
40
  assignment?.hide();
41
41
  highlight.hide();
42
42
  }, cx: scaleX(signal.x.delta || 0), cy: scaleY(signal.y.delta || 0), r: isHighlighted ? 6 : 4, fill: isHighlighted ? 'green' : 'darkgreen' }, signal.id)] })), _jsx("g", { className: "zone-signal-peak", style: { pointerEvents: 'none' }, children: showPeaks &&
43
- signal?.peaks?.map((peak, i) => (_jsx("circle", { cx: scaleX(peak.x), cy: scaleY(peak.y), r: 2, fill: "black" }, `${signal.id + i}`))) })] }));
43
+ signal?.peaks?.map((peak, i) => (_jsx("circle", { cx: scaleX(peak.x), cy: scaleY(peak.y), r: 2, fill: "black" }, String(signal.id + i)))) })] }));
44
44
  }
45
45
  export default Signal;
@@ -61,6 +61,6 @@ function Zone({ zoneData }) {
61
61
  }, onMouseLeave: () => {
62
62
  assignmentZone.hide();
63
63
  highlightZone.hide();
64
- }, children: [showZones && (_jsx("g", { transform: `translate(${scaleX(x2)},${scaleY(y1)})`, children: _jsx("rect", { x: "0", width: scaleX(x1) - scaleX(x2), height: scaleY(y2) - scaleY(y1), className: "integral-area", fill: "#0000000f", stroke: reduceOpacity ? '#343a40' : 'darkgreen', strokeWidth: reduceOpacity ? '0' : '1' }) })), signals.map((_signal, i) => (_jsx(Signal, { signal: _signal }, `${id + i}`)))] }, id));
64
+ }, children: [showZones && (_jsx("g", { transform: `translate(${scaleX(x2)},${scaleY(y1)})`, children: _jsx("rect", { x: "0", width: scaleX(x1) - scaleX(x2), height: scaleY(y2) - scaleY(y1), className: "integral-area", fill: "#0000000f", stroke: reduceOpacity ? '#343a40' : 'darkgreen', strokeWidth: reduceOpacity ? '0' : '1' }) })), signals.map((_signal, i) => (_jsx(Signal, { signal: _signal }, String(id + i))))] }, id));
65
65
  }
66
66
  export default Zone;
@@ -5,7 +5,7 @@ const styles = {
5
5
  display: 'flex',
6
6
  flexDirection: 'row',
7
7
  justifyContent: 'space-between',
8
- borderBottom: '1px solid rgb(247, 247, 247);',
8
+ borderBottom: '1px solid rgb(247, 247, 247)',
9
9
  boxShadow: 'rgb(255, 255, 255) 0px 1px 0px 0px inset',
10
10
  },
11
11
  };
@@ -0,0 +1,6 @@
1
+ import { ColorPickerProps } from 'react-science/ui';
2
+ interface FormikColorPickerDropdownProps extends ColorPickerProps {
3
+ name: string;
4
+ }
5
+ declare function FormikColorPickerDropdown(props: FormikColorPickerDropdownProps): import("react/jsx-runtime").JSX.Element;
6
+ export default FormikColorPickerDropdown;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useFormikContext } from 'formik';
3
+ import lodashGet from 'lodash/get';
4
+ import { ColorPickerDropdown } from 'react-science/ui';
5
+ function FormikColorPickerDropdown(props) {
6
+ const { onChangeComplete = () => null, name, ...colorPickerProps } = props;
7
+ const { values, setFieldValue } = useFormikContext();
8
+ function colorChangeHandler(color) {
9
+ onChangeComplete(color);
10
+ void setFieldValue(name, color.hex);
11
+ }
12
+ return (_jsx(ColorPickerDropdown, { ...colorPickerProps, onChangeComplete: colorChangeHandler, color: { hex: lodashGet(values, name) } }));
13
+ }
14
+ export default FormikColorPickerDropdown;
@@ -2,6 +2,7 @@ import { useChartData } from '../context/ChartContext';
2
2
  import { useActiveSpectrum } from './useActiveSpectrum';
3
3
  export const defaultIntegralsViewState = {
4
4
  scaleRatio: 1,
5
+ showIntegralsValues: true,
5
6
  };
6
7
  export function useActiveSpectrumIntegralsViewState() {
7
8
  const activeSpectrum = useActiveSpectrum();
@@ -4,6 +4,7 @@ export const defaultRangesViewState = {
4
4
  showPeaks: false,
5
5
  showMultiplicityTrees: false,
6
6
  showIntegrals: false,
7
+ showIntegralsValues: true,
7
8
  showJGraph: false,
8
9
  displayingMode: 'spread',
9
10
  integralsScaleRatio: 1,
@@ -50,7 +50,7 @@ const containerStyle = css `
50
50
  function DropZone(props) {
51
51
  const { width, height } = useChartData();
52
52
  const dispatch = useDispatch();
53
- const { dispatch: dispatchPreferences, current } = usePreferences();
53
+ const { dispatch: dispatchPreferences, current: workspacePreferences } = usePreferences();
54
54
  const preferences = usePreferences();
55
55
  const isToolEnabled = useCheckToolsVisibility();
56
56
  const openImportMetaInformationModal = useMetaInformationImportationModal();
@@ -70,10 +70,11 @@ function DropZone(props) {
70
70
  parseMetaFileResult = await parseMetaFile(metaFile);
71
71
  }
72
72
  const { nmrLoaders: sourceSelector } = preferences.current;
73
+ const { onLoadProcessing, spectraColors } = workspacePreferences;
73
74
  const { nmriumState, containsNmrium } = await readDropFiles(fileCollection, {
74
75
  sourceSelector,
75
76
  logger: logger.child({ context: 'nmr-processing' }),
76
- onLoadProcessing: current.onLoadProcessing,
77
+ onLoadProcessing,
77
78
  experimentalFeatures,
78
79
  });
79
80
  if (nmriumState?.settings) {
@@ -91,6 +92,7 @@ function DropZone(props) {
91
92
  nmriumState,
92
93
  containsNmrium,
93
94
  parseMetaFileResult,
95
+ spectraColors,
94
96
  },
95
97
  });
96
98
  }
@@ -114,7 +114,7 @@ function InnerMultipleAnalysis(props) {
114
114
  maxTestedJ: 17,
115
115
  takeBestPartMultiplet: true,
116
116
  correctVerticalOffset: true,
117
- symmetrizeEachStep: false,
117
+ symmetrizeEachStep: true,
118
118
  decreasingJvalues: true,
119
119
  makeShortCutForSpeed: true,
120
120
  debug: true,
@@ -26,6 +26,7 @@ import GeneralTabContent from './settings-tabs/GeneralTabContent';
26
26
  import ImportationFiltersTabContent from './settings-tabs/ImportationFiltersTabContent';
27
27
  import InfoBlockTabContent from './settings-tabs/InfoBlockTabContent';
28
28
  import OnLoadProcessingTabContent from './settings-tabs/OnLoadProcessingTabContent';
29
+ import SpectraColorsTabContent from './settings-tabs/SpectraColorsTabContent';
29
30
  import ToolsTabContent from './settings-tabs/ToolsTabContent';
30
31
  import { validation } from './settingsValidation';
31
32
  const styles = css `
@@ -235,7 +236,7 @@ function GeneralSettingsModal({ height }) {
235
236
  marginLeft: '10px',
236
237
  }, children: _jsx(FaRegCopy, {}) }), _jsx(Button.Action, { size: "xSmall", fill: "outline", onClick: handlePastWorkspaceAction, toolTip: "Past workspace preferences", tooltipOrientation: "horizontal", style: {
237
238
  marginLeft: '10px',
238
- }, children: _jsx(FaPaste, {}) })] })] }) }), _jsx(Modal.Body, { children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { title: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { title: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { title: "Panels", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { title: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { title: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), _jsx(Tab, { title: "Import filters", tabid: "importation-filters", children: _jsx("div", { className: "inner-content", children: _jsx(ImportationFiltersTabContent, {}) }) }), _jsx(Tab, { title: "Title Block", tabid: "title-block", children: _jsx("div", { className: "inner-content", children: _jsx(InfoBlockTabContent, {}) }) }), _jsx(Tab, { title: "On Load Processing", tabid: "on-load-processing", children: _jsx("div", { className: "inner-content", children: _jsx(OnLoadProcessingTabContent, {}) }) })] }) }) }) }), _jsx(Modal.Footer, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
239
+ }, children: _jsx(FaPaste, {}) })] })] }) }), _jsx(Modal.Body, { children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { title: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { title: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { title: "Panels", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { title: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { title: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), _jsx(Tab, { title: "Import filters", tabid: "importation-filters", children: _jsx("div", { className: "inner-content", children: _jsx(ImportationFiltersTabContent, {}) }) }), _jsx(Tab, { title: "Title Block", tabid: "title-block", children: _jsx("div", { className: "inner-content", children: _jsx(InfoBlockTabContent, {}) }) }), _jsx(Tab, { title: "On Load Processing", tabid: "on-load-processing", children: _jsx("div", { className: "inner-content", children: _jsx(OnLoadProcessingTabContent, {}) }) }), _jsx(Tab, { title: "Spectra colors", tabid: "spectra-colors", children: _jsx("div", { className: "inner-content", children: _jsx(SpectraColorsTabContent, {}) }) })] }) }) }) }), _jsx(Modal.Footer, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
239
240
  closeDialog?.();
240
241
  } }), _jsx(Button.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), _jsx(SaveSettingsModal, {}), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePastWorkspace, text: text, label: "Workspace" })] }));
241
242
  }
@@ -74,7 +74,7 @@ function FormattingTabContent() {
74
74
  const nucleiList = Object.keys(nuclei);
75
75
  return (_jsx(GroupPane, { text: "Number formatting for crosshair and info line", children: _jsx("div", { css: styles, children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "counter-col", children: "#" }), _jsx("th", { className: "nucleus-label-col", children: "Nucleus " }), _jsx("th", { className: "nucleus-format-input-col", children: "\u03B4 (ppm)" }), _jsx("th", { className: "nucleus-format-input-col", children: "Coupling (Hz)" }), _jsx("th", { className: "nucleus-format-input-col" })] }) }), _jsx("tbody", { children: nucleiList?.map((key, index) => {
76
76
  const num = index + 1;
77
- return (_jsxs("tr", { children: [_jsxs("td", { className: "counter-col", children: [_jsxs("span", { children: [num, " - "] }), ' '] }), _jsx("td", { className: "nucleus-label-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.name`, className: "input", checkErrorAfterInputTouched: false }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.ppm`, className: "input" }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.hz`, className: "input" }) }), _jsxs("td", { className: "operation-container", children: [_jsx(Button.Danger, { style: { fontSize: '14px' }, fill: "clear", onClick: () => deleteHandler(key), children: _jsx(FaTimes, {}) }), nucleiList.length === index + 1 && (_jsx(Button.Done, { fill: "clear", style: { fontSize: '14px' }, onClick: addHandler, children: _jsx(FaPlus, {}) }))] })] }, `${key}`));
77
+ return (_jsxs("tr", { children: [_jsxs("td", { className: "counter-col", children: [_jsxs("span", { children: [num, " - "] }), ' '] }), _jsx("td", { className: "nucleus-label-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.name`, className: "input", checkErrorAfterInputTouched: false }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.ppm`, className: "input" }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.hz`, className: "input" }) }), _jsxs("td", { className: "operation-container", children: [_jsx(Button.Danger, { style: { fontSize: '14px' }, fill: "clear", onClick: () => deleteHandler(key), children: _jsx(FaTimes, {}) }), nucleiList.length === index + 1 && (_jsx(Button.Done, { fill: "clear", style: { fontSize: '14px' }, onClick: addHandler, children: _jsx(FaPlus, {}) }))] })] }, key));
78
78
  }) })] }) }) }));
79
79
  }
80
80
  export default FormattingTabContent;
@@ -0,0 +1,2 @@
1
+ declare function SpectraColorsTabContent(): import("react/jsx-runtime").JSX.Element;
2
+ export default SpectraColorsTabContent;
@@ -0,0 +1,131 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFormikContext } from 'formik';
3
+ import { useCallback, useMemo } from 'react';
4
+ import { FaPlus, FaTimes } from 'react-icons/fa';
5
+ import { useChartData } from '../../../context/ChartContext';
6
+ import Button from '../../../elements/Button';
7
+ import { GroupPane } from '../../../elements/GroupPane';
8
+ import ReactTable from '../../../elements/ReactTable/ReactTable';
9
+ import FormikColorPickerDropdown from '../../../elements/formik/FormikColorPickerDropdown';
10
+ import FormikInput from '../../../elements/formik/FormikInput';
11
+ import { convertPathArrayToString } from '../../../utility/convertPathArrayToString';
12
+ import { getSpectraObjectPaths } from '../../../utility/getSpectraObjectPaths';
13
+ const styles = {
14
+ input: {
15
+ width: '100%',
16
+ },
17
+ column: {
18
+ padding: '2px',
19
+ },
20
+ };
21
+ const colorInputStyle = {
22
+ padding: 0,
23
+ minWidth: '80px',
24
+ width: '80px',
25
+ ...styles.column,
26
+ };
27
+ function getObjectKey(key) {
28
+ return `spectraColors.${key}`;
29
+ }
30
+ function SpectraColorsTabContent() {
31
+ const { values, setFieldValue } = useFormikContext();
32
+ const { data } = useChartData();
33
+ const { datalist, paths } = useMemo(() => getSpectraObjectPaths(data), [data]);
34
+ const { oneDimension = [], twoDimensions = [] } = values?.spectraColors || {};
35
+ const addHandler = useCallback((data, index, key) => {
36
+ let columns = [];
37
+ const emptyField = key === 'oneDimension'
38
+ ? {
39
+ value: null,
40
+ jpath: ['info', 'experiment'],
41
+ color: 'red',
42
+ }
43
+ : {
44
+ value: null,
45
+ jpath: ['info', 'experiment'],
46
+ positiveColor: 'red',
47
+ negativeColor: 'blue',
48
+ };
49
+ if (data && Array.isArray(data)) {
50
+ columns = [...data.slice(0, index), emptyField, ...data.slice(index)];
51
+ }
52
+ else {
53
+ columns.push(emptyField);
54
+ }
55
+ void setFieldValue(getObjectKey(key), columns);
56
+ }, [setFieldValue]);
57
+ const deleteHandler = useCallback((data, index, key) => {
58
+ const _fields = data.filter((_, columnIndex) => columnIndex !== index);
59
+ void setFieldValue(getObjectKey(key), _fields);
60
+ }, [setFieldValue]);
61
+ return (_jsxs("div", { children: [_jsx(SpectraColorsFields, { groupLabel: "One dimension", baseObjectPath: "oneDimension", data: oneDimension, datalist: datalist, paths: paths, onAdd: addHandler, onDelete: deleteHandler }), _jsx(SpectraColorsFields, { groupLabel: "Two dimensions", baseObjectPath: "twoDimensions", data: twoDimensions, datalist: datalist, paths: paths, onAdd: addHandler, onDelete: deleteHandler })] }));
62
+ }
63
+ function SpectraColorsFields(props) {
64
+ const { onAdd, onDelete, datalist, paths, data, baseObjectPath, groupLabel } = props;
65
+ const COLUMNS = useMemo(() => {
66
+ const objectPath = getObjectKey(baseObjectPath);
67
+ const baseColumns = [
68
+ {
69
+ Header: '#',
70
+ style: { width: '25px', ...styles.column },
71
+ accessor: (_, index) => index + 1,
72
+ },
73
+ {
74
+ Header: 'Field',
75
+ style: { padding: 0, ...styles.column },
76
+ Cell: ({ row }) => {
77
+ return (_jsx(FormikInput, { name: `${objectPath}.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => {
78
+ return paths?.[key.toString().trim()] || key;
79
+ }, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
80
+ },
81
+ },
82
+ {
83
+ Header: 'Value',
84
+ style: { padding: 0, ...styles.column },
85
+ Cell: ({ row }) => {
86
+ return (_jsx(FormikInput, { name: `${objectPath}.${row.index}.value`, style: { input: styles.input } }));
87
+ },
88
+ },
89
+ ];
90
+ const operationsField = {
91
+ Header: '',
92
+ style: { width: '70px', ...styles.column },
93
+ id: 'operation-button',
94
+ Cell: ({ data, row }) => {
95
+ const record = row.original;
96
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => onAdd(data, row.index + 1, baseObjectPath), children: _jsx(FaPlus, {}) }), !record?.name && (_jsx(Button.Danger, { fill: "outline", onClick: () => onDelete(data, row.index, baseObjectPath), children: _jsx(FaTimes, {}) }))] }));
97
+ },
98
+ };
99
+ if (baseObjectPath === 'oneDimension') {
100
+ const colorField = {
101
+ Header: 'Color',
102
+ style: colorInputStyle,
103
+ Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.color` })),
104
+ };
105
+ return [...baseColumns, colorField, operationsField];
106
+ }
107
+ const colorFields = [
108
+ {
109
+ Header: 'Positive color',
110
+ style: colorInputStyle,
111
+ Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.positiveColor` })),
112
+ },
113
+ {
114
+ Header: 'Negative color',
115
+ style: colorInputStyle,
116
+ Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.negativeColor` })),
117
+ },
118
+ ];
119
+ return [...baseColumns, ...colorFields, operationsField];
120
+ }, [baseObjectPath, datalist, onAdd, onDelete, paths]);
121
+ return (_jsx(GroupPane, { text: groupLabel, renderHeader: (text) => {
122
+ return (_jsx(FieldsBlockHeader, { text: text, onAdd: () => onAdd(data, 0, baseObjectPath) }));
123
+ }, children: _jsx(ReactTable, { style: {
124
+ 'table, table td, table th': { border: 'none' },
125
+ 'table thead': { borderBottom: '1px solid #f9f9f9' },
126
+ }, data: data, columns: COLUMNS, emptyDataRowText: "No Fields" }) }));
127
+ }
128
+ function FieldsBlockHeader({ onAdd, text }) {
129
+ return (_jsxs("div", { className: "section-header", style: { display: 'flex' }, children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button.Done, { fill: "outline", size: "xSmall", onClick: onAdd, children: "Add custom color" })] }));
130
+ }
131
+ export default SpectraColorsTabContent;
@@ -49,7 +49,17 @@ const databasesValidation = object().shape({
49
49
  const infoBlockValidation = object({
50
50
  fields: array().of(object({
51
51
  label: string().required(),
52
- jpath: array().of(string()).min(1),
52
+ jpath: array().of(string()).required().min(1),
53
+ })),
54
+ });
55
+ const spectraColorsSchemaValidation = object({
56
+ oneDimension: array().of(object({
57
+ value: string().required(),
58
+ jpath: array().of(string()).required().min(1),
59
+ })),
60
+ twoDimensions: array().of(object({
61
+ value: string().required(),
62
+ jpath: array().of(string()).required().min(1),
53
63
  })),
54
64
  });
55
65
  const generalValidation = object({
@@ -60,4 +70,5 @@ export const validation = lazy((obj) => object().shape({
60
70
  databases: databasesValidation,
61
71
  infoBlock: infoBlockValidation,
62
72
  general: generalValidation,
73
+ spectraColors: spectraColorsSchemaValidation,
63
74
  }));
@@ -1,7 +1,7 @@
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 { SvgNmrSum } from 'cheminfo-font';
4
+ import { SvgNmrIntegrate, SvgNmrSum } from 'cheminfo-font';
5
5
  import lodashGet from 'lodash/get';
6
6
  import { useCallback, useMemo, useState, useRef, memo } from 'react';
7
7
  import { ImLink } from 'react-icons/im';
@@ -17,6 +17,7 @@ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHe
17
17
  import PreferencesHeader from '../header/PreferencesHeader';
18
18
  import IntegralTable from './IntegralTable';
19
19
  import IntegralsPreferences from './IntegralsPreferences';
20
+ import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectrumIntegralsViewState';
20
21
  const style = css `
21
22
  .sum-button {
22
23
  width: 22px;
@@ -25,13 +26,24 @@ const style = css `
25
26
  align-items: center;
26
27
  justify-content: center;
27
28
  }
29
+
30
+ button {
31
+ margin-right: 2px;
32
+ }
28
33
  `;
29
34
  function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
30
35
  const [filterIsActive, setFilterIsActive] = useState(false);
31
36
  const dispatch = useDispatch();
37
+ const { showIntegralsValues } = useActiveSpectrumIntegralsViewState();
32
38
  const modal = useModal();
33
39
  const [isFlipped, setFlipStatus] = useState(false);
34
40
  const settingRef = useRef();
41
+ function handleShowIntegralsValues() {
42
+ dispatch({
43
+ type: 'TOGGLE_INTEGRALS_VIEW_PROPERTY',
44
+ payload: { key: 'showIntegralsValues' },
45
+ });
46
+ }
35
47
  const yesHandler = useCallback(() => {
36
48
  dispatch({ type: 'DELETE_INTEGRAL', payload: {} });
37
49
  }, [dispatch]);
@@ -93,7 +105,9 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
93
105
  `,
94
106
  ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: currentSum
95
107
  ? `Change integration sum (${currentSum.toFixed(2)})`
96
- : 'Change integration sum', popupPlacement: "right", children: _jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integrals", currentSum: currentSum, sumOptions: integrals?.options, renderButton: (onClick) => (_jsx("button", { className: "sum-button", type: "button", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration values", popupPlacement: "right", onClick: toggleConstantSumHandler, value: integrals?.options?.isSumConstant || false, children: _jsx(ImLink, {}) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, info: info, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
108
+ : 'Change integration sum', popupPlacement: "right", children: _jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integrals", currentSum: currentSum, sumOptions: integrals?.options, renderButton: (onClick) => (_jsx("button", { className: "sum-button", type: "button", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration values", popupPlacement: "right", onClick: toggleConstantSumHandler, value: integrals?.options?.isSumConstant || false, children: _jsx(ImLink, {}) }), _jsx(ActiveButton, { popupTitle: showIntegralsValues
109
+ ? 'Hide integrals values'
110
+ : 'Show integrals values', popupPlacement: "right", onClick: handleShowIntegralsValues, value: showIntegralsValues, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, info: info, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
97
111
  }
98
112
  const MemoizedIntegralPanel = memo(IntegralPanelInner);
99
113
  const emptyData = { integrals: {}, info: {} };
@@ -3,7 +3,7 @@ import { Formik } from 'formik';
3
3
  import { useCallback, useImperativeHandle, useRef, memo, forwardRef, useMemo, } from 'react';
4
4
  import { usePreferences } from '../../context/PreferencesContext';
5
5
  import Label from '../../elements/Label';
6
- import FormikColorInput from '../../elements/formik/FormikColorInput';
6
+ import FormikColorPickerDropdown from '../../elements/formik/FormikColorPickerDropdown';
7
7
  import { formatFieldLabelStyle } from '../../elements/formik/FormikColumnFormatField';
8
8
  import FormikInput from '../../elements/formik/FormikInput';
9
9
  import useNucleus from '../../hooks/useNucleus';
@@ -72,7 +72,7 @@ function IntegralsPreferences(props, ref) {
72
72
  formRef.current.submitForm();
73
73
  },
74
74
  }));
75
- return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: preferencesByNuclei, onSubmit: saveHandler, innerRef: formRef, children: _jsx(_Fragment, { children: nuclei?.map((n) => (_jsx(NucleusPreferences, { nucleus: n, fields: formatFields, renderTop: () => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(FormikColorInput, { name: `nuclei.${n}.color` })] }) }), _jsx(Label, { title: "stroke width :", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(FormikInput, { name: `nuclei.${n}.strokeWidth`, type: "number", style: {
75
+ return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: preferencesByNuclei, onSubmit: saveHandler, innerRef: formRef, children: _jsx(_Fragment, { children: nuclei?.map((n) => (_jsx(NucleusPreferences, { nucleus: n, fields: formatFields, renderTop: () => (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(FormikColorPickerDropdown, { name: `nuclei.${n}.color` })] }) }), _jsx(Label, { title: "stroke width :", style: formatFieldLabelStyle, children: _jsxs("div", { style: { display: 'flex', padding: '2px 0' }, children: [_jsx("div", { style: { width: '23px' } }), _jsx(FormikInput, { name: `nuclei.${n}.strokeWidth`, type: "number", style: {
76
76
  input: {
77
77
  textAlign: 'center',
78
78
  padding: '2px',
@@ -97,6 +97,6 @@ function ExclusionZonesGroupHeader({ text }) {
97
97
  return (_jsxs("div", { className: "section-header", style: { display: 'flex', padding: '5px 0px' }, children: [_jsx("p", { style: { flex: 1, ...GroupPanelStyle.header }, children: text }), _jsx(ToggleButton, { defaultValue: selectedTool === options.matrixGenerationExclusionZones.id, popupTitle: "Select exclusions zones", popupPlacement: "left", onClick: () => handleChangeOption(options.matrixGenerationExclusionZones.id), children: _jsx(SvgNmrMultipleAnalysis, { style: {
98
98
  pointerEvents: 'none',
99
99
  fontSize: '12px',
100
- } }) }, `${selectedTool}`)] }));
100
+ } }) }, selectedTool)] }));
101
101
  }
102
102
  export default MatrixGenerationPanel;
@@ -45,7 +45,7 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
45
45
  const assignmentData = useAssignmentData();
46
46
  const currentSum = lodashGet(ranges, 'options.sum', null);
47
47
  const rangesPreferences = usePanelPreferences('ranges', activeTab);
48
- const { showMultiplicityTrees, showJGraph, showIntegrals, showPeaks, displayingMode, } = useActiveSpectrumRangesViewState();
48
+ const { showMultiplicityTrees, showJGraph, showIntegrals, showIntegralsValues, showPeaks, displayingMode, } = useActiveSpectrumRangesViewState();
49
49
  function changeRangesSumHandler(options) {
50
50
  dispatch({ type: 'CHANGE_RANGE_SUM', payload: { options } });
51
51
  modal.close();
@@ -82,6 +82,12 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
82
82
  payload: { key: 'showMultiplicityTrees' },
83
83
  });
84
84
  }
85
+ function handleShowIntegralsValues() {
86
+ dispatch({
87
+ type: 'TOGGLE_RANGES_VIEW_PROPERTY',
88
+ payload: { key: 'showIntegralsValues' },
89
+ });
90
+ }
85
91
  function handleShowIntegrals() {
86
92
  dispatch({
87
93
  type: 'TOGGLE_RANGES_VIEW_PROPERTY',
@@ -127,6 +133,8 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
127
133
  ? `Change ranges sum (${currentSum.toFixed(2)})`
128
134
  : 'Change ranges sum', popupPlacement: "right", className: "btn icon", onClick: onClick, children: _jsx(SvgNmrSum, {}) })) }), _jsx(Button, { popupTitle: "Remove all assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !hasRanges, className: "btn icon", children: _jsx(FaUnlink, {}) }), _jsx(ActiveButton, { popupTitle: showMultiplicityTrees
129
135
  ? 'Hide multiplicity trees in spectrum'
130
- : 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: _jsx(FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: _jsx(FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showIntegrals, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration sum", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: _jsx(ImLink, {}) }), _jsx(PeaksToggleActions, { disbale: !hasRanges, showPeaks: showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), displayingMode: displayingMode, onDisplayingModeToggle: toggleDisplayingMode })] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
136
+ : 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: _jsx(FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: _jsx(FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showIntegrals, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { popupTitle: showIntegralsValues
137
+ ? 'Hide integrals values'
138
+ : 'Show integrals values', popupPlacement: "right", onClick: handleShowIntegralsValues, value: showIntegralsValues, disabled: !hasRanges, children: _jsx(SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { className: "icon", popupTitle: "Fixed integration sum", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: _jsx(ImLink, {}) }), _jsx(PeaksToggleActions, { disbale: !hasRanges, showPeaks: showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), displayingMode: displayingMode, onDisplayingModeToggle: toggleDisplayingMode })] }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
131
139
  }
132
140
  export default RangesHeader;
@@ -36,7 +36,7 @@ const moveLinkStyles = css `
36
36
  `;
37
37
  function getCorrelationLabel(correlation) {
38
38
  const delta = getCorrelationDelta(correlation);
39
- return `${delta ? delta.toFixed(2) : '?'}`;
39
+ return delta ? delta.toFixed(2) : '?';
40
40
  }
41
41
  function MoveLink({ correlationDim1, correlationDim2, link, correlations, onEdit, }) {
42
42
  const [selectedCorrelationIdDim1, setSelectedCorrelationIdDim1] = useState(correlationDim1.id);
@@ -14,7 +14,7 @@ function getLabelColor(correlationData, correlation) {
14
14
  for (const { key, color } of ErrorColors) {
15
15
  if (key !== 'incomplete' && // do not consider this for a single atom type
16
16
  (key === 'notAttached' || key === 'ambiguousAttachment') &&
17
- lodashGet(error, `${key}`, []).some((index) => correlationData.values[index].id === correlation.id)) {
17
+ lodashGet(error, key, []).some((index) => correlationData.values[index].id === correlation.id)) {
18
18
  return color;
19
19
  }
20
20
  }
@@ -3,7 +3,7 @@ import { Formik } from 'formik';
3
3
  import { useEffect, useCallback, useImperativeHandle, useRef, forwardRef, } from 'react';
4
4
  import { usePreferences } from '../../context/PreferencesContext';
5
5
  import Label from '../../elements/Label';
6
- import FormikColorInput from '../../elements/formik/FormikColorInput';
6
+ import FormikColorPickerDropdown from '../../elements/formik/FormikColorPickerDropdown';
7
7
  import FormikColumnFormatField, { formatFieldInputStyle, formatFieldLabelStyle, } from '../../elements/formik/FormikColumnFormatField';
8
8
  import FormikInput from '../../elements/formik/FormikInput';
9
9
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
@@ -27,6 +27,6 @@ function DatabasePreferences(props, ref) {
27
27
  formRef.current.submitForm();
28
28
  },
29
29
  }));
30
- return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: {}, onSubmit: saveHandler, innerRef: formRef, children: _jsxs(_Fragment, { children: [_jsxs(PreferencesGroup, { children: [_jsx(FormikColumnFormatField, { label: "Preview jcamp", checkControllerName: "previewJcamp", hideFormatField: true }), _jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsx(FormikColorInput, { name: "color" }) }), _jsx(Label, { title: "Margin bottom (px) :", style: formatFieldLabelStyle, children: _jsx(FormikInput, { name: "marginBottom", type: "number", style: formatFieldInputStyle }) })] }), _jsxs(PreferencesGroup, { header: "Table Preferences", children: [_jsx(FormikColumnFormatField, { label: "Structure", checkControllerName: "showSmiles", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "range.show", formatControllerName: "range.format" }), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "delta.show", formatControllerName: "delta.format" }), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "coupling.show", formatControllerName: "coupling.format" }), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Save as nmrium", checkControllerName: "allowSaveAsNMRium", hideFormatField: true })] })] }) }) }));
30
+ return (_jsx(PreferencesContainer, { children: _jsx(Formik, { initialValues: {}, onSubmit: saveHandler, innerRef: formRef, children: _jsxs(_Fragment, { children: [_jsxs(PreferencesGroup, { children: [_jsx(FormikColumnFormatField, { label: "Preview jcamp", checkControllerName: "previewJcamp", hideFormatField: true }), _jsx(Label, { title: "Color", style: formatFieldLabelStyle, children: _jsx(FormikColorPickerDropdown, { name: "color" }) }), _jsx(Label, { title: "Margin bottom (px) :", style: formatFieldLabelStyle, children: _jsx(FormikInput, { name: "marginBottom", type: "number", style: formatFieldInputStyle }) })] }), _jsxs(PreferencesGroup, { header: "Table Preferences", children: [_jsx(FormikColumnFormatField, { label: "Structure", checkControllerName: "showSmiles", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Solvent", checkControllerName: "showSolvent", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Names", checkControllerName: "showNames", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Range", checkControllerName: "range.show", formatControllerName: "range.format" }), _jsx(FormikColumnFormatField, { label: "\u03B4 (ppm)", checkControllerName: "delta.show", formatControllerName: "delta.format" }), _jsx(FormikColumnFormatField, { label: "Assignment", checkControllerName: "showAssignment", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "J (Hz)", checkControllerName: "coupling.show", formatControllerName: "coupling.format" }), _jsx(FormikColumnFormatField, { label: "Multiplicity", checkControllerName: "showMultiplicity", hideFormatField: true }), _jsx(FormikColumnFormatField, { label: "Save as nmrium", checkControllerName: "allowSaveAsNMRium", hideFormatField: true })] })] }) }) }));
31
31
  }
32
32
  export default forwardRef(DatabasePreferences);