nmrium 0.43.0 → 0.43.1-pre.1692874523

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 (124) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  2. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  3. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
  4. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
  5. package/lib/component/2d/Viewer2D.js +1 -3
  6. package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -2
  7. package/lib/component/context/DispatchContext.d.ts +3 -1
  8. package/lib/component/elements/CounterLabel.d.ts +7 -0
  9. package/lib/component/elements/CounterLabel.js +12 -0
  10. package/lib/component/elements/EditableColumn.js +12 -6
  11. package/lib/component/elements/Input.d.ts +3 -12
  12. package/lib/component/elements/Input.js +24 -76
  13. package/lib/component/elements/Message.js +0 -1
  14. package/lib/component/elements/PreferencesButton.d.ts +4 -0
  15. package/lib/component/elements/PreferencesButton.js +6 -0
  16. package/lib/component/elements/formik/FormikInput.d.ts +2 -2
  17. package/lib/component/elements/formik/FormikInput.js +3 -6
  18. package/lib/component/header/Header.js +1 -1
  19. package/lib/component/header/ZeroFillingOptionsPanel.js +4 -4
  20. package/lib/component/main/InnerNMRiumContents.js +1 -2
  21. package/lib/component/modal/AlignSpectraModal.js +78 -29
  22. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
  23. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
  24. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  25. package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  26. package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
  27. package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
  28. package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  29. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  30. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  31. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  32. package/lib/component/modal/setting/settingsValidation.js +5 -1
  33. package/lib/component/panels/InformationPanel.js +9 -100
  34. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  35. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  36. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +10 -6
  37. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
  38. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  39. package/lib/component/panels/Panels.js +6 -7
  40. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  41. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  42. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  43. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  44. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  45. package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  46. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
  47. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
  48. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
  49. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
  50. package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
  51. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
  52. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
  53. package/lib/component/panels/header/DefaultPanelHeader.js +4 -10
  54. package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
  55. package/lib/component/reducer/IgnoreActions.js +1 -0
  56. package/lib/component/reducer/Reducer.d.ts +2 -2
  57. package/lib/component/reducer/Reducer.js +4 -2
  58. package/lib/component/reducer/actions/DomainActions.js +2 -3
  59. package/lib/component/reducer/actions/MoleculeActions.js +3 -3
  60. package/lib/component/reducer/actions/PreferencesActions.js +1 -2
  61. package/lib/component/reducer/actions/ToolsActions.js +10 -10
  62. package/lib/component/reducer/core/Constants.d.ts +0 -4
  63. package/lib/component/reducer/core/Constants.js +0 -5
  64. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
  65. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  66. package/lib/component/toolbar/ToolTypes.js +23 -24
  67. package/lib/data/constants/References.d.ts +5 -3
  68. package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
  69. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  70. package/lib/versionInfo.js +1 -1
  71. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  72. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
  73. package/lib-cjs/component/2d/Viewer2D.js +1 -3
  74. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +1 -2
  75. package/lib-cjs/component/elements/CounterLabel.js +16 -0
  76. package/lib-cjs/component/elements/EditableColumn.js +12 -6
  77. package/lib-cjs/component/elements/Input.js +23 -75
  78. package/lib-cjs/component/elements/Message.js +0 -1
  79. package/lib-cjs/component/elements/PreferencesButton.js +13 -0
  80. package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
  81. package/lib-cjs/component/header/Header.js +1 -1
  82. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +4 -4
  83. package/lib-cjs/component/main/InnerNMRiumContents.js +1 -2
  84. package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
  85. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
  86. package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
  87. package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  88. package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
  89. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  90. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  91. package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  92. package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  93. package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
  94. package/lib-cjs/component/panels/InformationPanel.js +7 -98
  95. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  96. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  97. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
  98. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  99. package/lib-cjs/component/panels/Panels.js +6 -7
  100. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  101. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  102. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  103. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  104. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  105. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  106. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
  107. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
  108. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
  109. package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
  110. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -9
  111. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +2 -2
  112. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  113. package/lib-cjs/component/reducer/Reducer.js +4 -2
  114. package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
  115. package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
  116. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
  117. package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
  118. package/lib-cjs/component/reducer/core/Constants.js +1 -6
  119. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
  120. package/lib-cjs/component/toolbar/ToolTypes.js +23 -24
  121. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  122. package/lib-cjs/versionInfo.js +1 -1
  123. package/package.json +3 -3
  124. /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { Formik } from 'formik';
4
- import { useCallback, useEffect, useMemo, useRef } from 'react';
4
+ import { useEffect, useState } from 'react';
5
5
  import { REFERENCES } from '../../data/constants/References';
6
6
  import { useDispatch } from '../context/DispatchContext';
7
7
  import Button from '../elements/Button';
@@ -11,6 +11,10 @@ import Select from '../elements/Select';
11
11
  import FormikInput from '../elements/formik/FormikInput';
12
12
  import Events from '../utility/Events';
13
13
  import { ModalStyles } from './ModalStyle';
14
+ import { xFindClosestIndex } from 'ml-spectra-processing';
15
+ import useSpectraByActiveNucleus from '../hooks/useSpectraPerNucleus';
16
+ import * as Yup from 'yup';
17
+ import Message from '../elements/Message';
14
18
  const labelStyle = {
15
19
  label: { flex: 4, fontWeight: '500' },
16
20
  wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
@@ -22,44 +26,89 @@ const inputStyle = {
22
26
  },
23
27
  };
24
28
  const baseList = [{ key: 1, value: 'manual', label: 'Manual' }];
29
+ const DEFAULT_OPTIONS = {
30
+ from: -1,
31
+ to: 1,
32
+ nbPeaks: 1,
33
+ targetX: 0,
34
+ };
35
+ const schemaValidation = Yup.object({
36
+ from: Yup.number().required(),
37
+ to: Yup.number().required(),
38
+ nbPeaks: Yup.number().required(),
39
+ targetX: Yup.number().required(),
40
+ });
41
+ function checkSpectra(options, spectra) {
42
+ const { from, to } = options;
43
+ for (const spectrum of spectra) {
44
+ const { data: { x }, } = spectrum;
45
+ const min = x[0];
46
+ const max = x.at(-1);
47
+ if (from < min || to > max) {
48
+ throw new Error('Some spectra do not have data in the selected range');
49
+ }
50
+ if (Math.abs(xFindClosestIndex(x, from) - xFindClosestIndex(x, to)) < 10) {
51
+ throw new Error('The selected range is too small to provide accurate results');
52
+ }
53
+ }
54
+ }
55
+ function checkOptions(options) {
56
+ const returnedOptions = { ...options };
57
+ if (options.from > options.to) {
58
+ returnedOptions.to = options.from;
59
+ returnedOptions.from = options.to;
60
+ }
61
+ return returnedOptions;
62
+ }
63
+ function getList(nucleus) {
64
+ if (!REFERENCES?.[nucleus]) {
65
+ return [];
66
+ }
67
+ const list = Object.entries(REFERENCES[nucleus]).map((item) => ({
68
+ value: item[0],
69
+ label: item[0],
70
+ }));
71
+ return baseList.concat(list);
72
+ }
25
73
  function AlignSpectraModal({ onClose = () => null, nucleus, }) {
26
- const refForm = useRef();
74
+ const spectra = useSpectraByActiveNucleus();
27
75
  const dispatch = useDispatch();
28
- const List = useMemo(() => {
29
- const list = REFERENCES[nucleus]
30
- ? Object.entries(REFERENCES[nucleus]).map((item) => ({
31
- value: item[0],
32
- label: item[0],
33
- }))
34
- : [];
35
- return baseList.concat(list);
36
- }, [nucleus]);
37
- const handleSave = useCallback(() => {
38
- refForm.current.submitForm();
39
- }, []);
40
- const submitHandler = useCallback((values) => {
41
- dispatch({ type: 'ALIGN_SPECTRA', payload: values });
42
- onClose();
43
- }, [dispatch, onClose]);
76
+ const [options, setOptions] = useState(DEFAULT_OPTIONS);
77
+ const [error, setError] = useState('');
78
+ function submitHandler(inputOptions) {
79
+ const options = checkOptions(inputOptions);
80
+ setOptions(options);
81
+ try {
82
+ checkSpectra(options, spectra);
83
+ dispatch({ type: 'ALIGN_SPECTRA', payload: options });
84
+ onClose();
85
+ }
86
+ catch (error) {
87
+ const message = error.message;
88
+ setError(message);
89
+ }
90
+ }
44
91
  useEffect(() => {
45
92
  function handler(event) {
46
93
  const [from, to] = event.range;
47
- refForm.current.setValues({ ...refForm.current.values, from, to });
94
+ setOptions((prevOptions) => ({ ...prevOptions, from, to }));
48
95
  }
49
96
  Events.on('brushEnd', handler);
50
97
  return () => {
51
98
  Events.off('brushEnd', handler);
52
99
  };
53
100
  }, []);
54
- const optionChangeHandler = useCallback((id) => {
55
- const value = REFERENCES[nucleus][id];
56
- const { delta = 0, ...resValues } = value || { delta: 0 };
57
- refForm.current.setValues({
58
- ...refForm.current.values,
59
- targetX: delta,
60
- ...resValues,
61
- });
62
- }, [nucleus]);
63
- return (_jsxs("div", { css: ModalStyles, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", style: { flex: 1 }, children: _jsx(Formik, { innerRef: refForm, initialValues: { from: -1, to: 1, nbPeaks: 1, targetX: 0 }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of Peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, children: "Done" }) })] }));
101
+ function optionChangeHandler(key) {
102
+ const { delta: targetX = 0, ...otherOptions } = REFERENCES?.[nucleus]?.[key] || {};
103
+ const value = {
104
+ ...DEFAULT_OPTIONS,
105
+ targetX,
106
+ ...otherOptions,
107
+ };
108
+ setOptions(value);
109
+ setError('');
110
+ }
111
+ const List = getList(nucleus);
112
+ return (_jsx("div", { css: ModalStyles, children: _jsx(Formik, { initialValues: options, enableReinitialize: true, onSubmit: submitHandler, validationSchema: schemaValidation, validate: () => setError(''), children: ({ submitForm }) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Spectra calibration" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "inner-content", style: { flex: 1, minHeight: '220px' }, children: [error && _jsx(Message, { type: "error", children: error }), _jsx(Label, { title: "Options", style: labelStyle, children: _jsx(Select, { items: List, style: { width: '100%', height: 30 }, onChange: optionChangeHandler }) }), _jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of Peaks", style: labelStyle, children: _jsx(FormikInput, { name: "nbPeaks", type: "number", style: inputStyle }) }), _jsx(Label, { title: "Target PPM", style: labelStyle, children: _jsx(FormikInput, { name: "targetX", type: "number", style: inputStyle }) })] }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: submitForm, children: "Done" }) })] })) }) }));
64
113
  }
65
114
  export default AlignSpectraModal;
@@ -3,7 +3,11 @@ interface MoleculeStructureEditorModalProps {
3
3
  onClose?: (element?: string) => void;
4
4
  selectedMolecule?: StateMoleculeExtended;
5
5
  floatMoleculeOnSave?: boolean;
6
+ isOpen?: boolean;
6
7
  }
7
8
  declare function MoleculeStructureEditorModal(props: MoleculeStructureEditorModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
- export declare function useMoleculeEditor(floatMoleculeOnSave?: boolean): (molecule?: StateMoleculeExtended) => void;
9
+ export declare function useMoleculeEditor(floatMoleculeOnSave?: boolean): {
10
+ modal: import("@emotion/react/jsx-runtime").JSX.Element;
11
+ openMoleculeEditor: (molecule?: StateMoleculeExtended) => void;
12
+ };
9
13
  export default MoleculeStructureEditorModal;
@@ -1,14 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { useState, useEffect, useCallback } from 'react';
4
4
  import { StructureEditor } from 'react-ocl/full';
5
+ import { ConfirmModal, Modal, useOnOff } from 'react-science/ui';
5
6
  import { useDispatch } from '../context/DispatchContext';
6
- import ActionButtons from '../elements/ActionButtons';
7
- import { useModal } from '../elements/popup/Modal';
8
- import { positions } from '../elements/popup/options';
9
- import { ModalStyles } from './ModalStyle';
10
7
  function MoleculeStructureEditorModal(props) {
11
- const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, } = props;
8
+ const { onClose = () => null, selectedMolecule, floatMoleculeOnSave = false, isOpen = false, } = props;
12
9
  const [molfile, setMolfile] = useState(null);
13
10
  const dispatch = useDispatch();
14
11
  useEffect(() => {
@@ -56,16 +53,16 @@ function MoleculeStructureEditorModal(props) {
56
53
  }
57
54
  }
58
55
  }, [molfile, selectedMolecule, dispatch, floatMoleculeOnSave, onClose]);
59
- return (_jsxs("div", { css: ModalStyles, children: [_jsx(StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: handleClose }) })] }));
56
+ return (_jsx(ConfirmModal, { headerColor: "transparent", isOpen: isOpen, onRequestClose: handleClose, onCancel: handleClose, onConfirm: handleSave, maxWidth: 700, children: _jsx(Modal.Body, { children: _jsx(StructureEditor, { initialMolfile: selectedMolecule?.molfile, svgMenu: true, fragment: false, onChange: cb }) }) }));
60
57
  }
61
58
  export function useMoleculeEditor(floatMoleculeOnSave = false) {
62
- const modal = useModal();
63
- return useCallback((molecule) => {
64
- modal.show(_jsx(MoleculeStructureEditorModal, { selectedMolecule: molecule, floatMoleculeOnSave: floatMoleculeOnSave }), {
65
- position: positions.TOP_CENTER,
66
- width: 700,
67
- height: 500,
68
- });
69
- }, [floatMoleculeOnSave, modal]);
59
+ const [isOpen, openModal, closeModal] = useOnOff(false);
60
+ const [molecule, setMolecule] = useState();
61
+ const modal = (_jsx(MoleculeStructureEditorModal, { selectedMolecule: molecule, floatMoleculeOnSave: floatMoleculeOnSave, onClose: closeModal, isOpen: isOpen }));
62
+ const openMoleculeEditor = useCallback((molecule) => {
63
+ setMolecule(molecule);
64
+ openModal();
65
+ }, [openModal]);
66
+ return { modal, openMoleculeEditor };
70
67
  }
71
68
  export default MoleculeStructureEditorModal;
@@ -126,7 +126,7 @@ export default function MultipletAnalysisModal({ data, activeSpectrum, scaleX, s
126
126
  try {
127
127
  const result = analyseMultiplet(analysesProps, {
128
128
  frequency: info.originFrequency,
129
- minimalResolution: 0.3,
129
+ minimalResolution: 0.1,
130
130
  maxTestedJ: 17,
131
131
  takeBestPartMultiplet: true,
132
132
  correctVerticalOffset: true,
@@ -3,8 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
3
3
  import { css } from '@emotion/react';
4
4
  import { SvgLogoNmrium } from 'cheminfo-font';
5
5
  import { Modal, Toolbar, useOnOff } from 'react-science/ui';
6
- import versionInfo from '../../versionInfo';
7
- import Logo from '../elements/Logo';
6
+ import versionInfo from '../../../versionInfo';
7
+ import Logo from '../../elements/Logo';
8
+ import AboutUsZakodium from './AboutUsZakodium';
8
9
  const styles = css `
9
10
  width: 40vw;
10
11
  min-width: 500px;
@@ -92,7 +93,7 @@ function AboutUsModal() {
92
93
  display: 'flex',
93
94
  alignItems: 'center',
94
95
  justifyContent: 'center',
95
- }, children: _jsx(SvgLogoNmrium, {}) }) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: "Zakodium S\u00E0rl (Switzerland)." }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
96
+ }, children: _jsx(SvgLogoNmrium, {}) }) }), _jsx(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: _jsxs("div", { css: styles, children: [_jsx(Modal.Header, { children: _jsx("div", { className: "header", children: _jsx("span", { children: "About NMRium" }) }) }), _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: _jsx(AboutUsZakodium, {}) }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] })] }) })] }));
96
97
  }
97
98
  export default AboutUsModal;
98
99
  function VersionInfo() {
@@ -0,0 +1 @@
1
+ export default function AboutUsZakodium(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import styled from '@emotion/styled';
3
+ import { Button, useOnOff } from 'react-science/ui';
4
+ import { useDispatch } from '../../context/DispatchContext';
5
+ export default function AboutUsZakodium() {
6
+ const [isSecretOpen, openSecret] = useOnOff();
7
+ function handleClick(event) {
8
+ if (event.shiftKey && event.altKey) {
9
+ openSecret();
10
+ }
11
+ }
12
+ return (_jsxs(_Fragment, { children: [_jsx("span", { onClick: handleClick, children: "Zakodium" }), ` Sàrl (Switzerland).`, isSecretOpen && _jsx(SecretThrower, {})] }));
13
+ }
14
+ const ThrowerDiv = styled.div `
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: 1rem;
18
+ `;
19
+ /**
20
+ * This component is here for us so we can test the impact of thrown exceptions
21
+ * in the deployed application.
22
+ */
23
+ function SecretThrower() {
24
+ const [shouldThrow, setShouldThrow] = useOnOff();
25
+ const dispatch = useDispatch();
26
+ if (shouldThrow) {
27
+ throw new Error('Error thrown in React render');
28
+ }
29
+ return (_jsxs(ThrowerDiv, { children: [_jsx(Button, { onClick: setShouldThrow, children: "Throw in React render" }), _jsx(Button, { onClick: () => dispatch({
30
+ type: 'SECRET_THROW_ERROR',
31
+ payload: { randomNumber: Math.random() },
32
+ }), children: "Throw in main reducer" })] }));
33
+ }
@@ -90,5 +90,5 @@ export function ChangeSumModalContents(props) {
90
90
  const isStructurePanelVisible = panels?.structuresPanel?.display || false;
91
91
  return (_jsxs(_Fragment, { children: [_jsx(Modal.Header, { children: currentSum
92
92
  ? `Set new ${sumType} sum (Current: ${currentSum.toFixed(2)})`
93
- : `Set new ${sumType} Sum` }), _jsx(Modal.Body, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: _jsxs(Tabs, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && (_jsx(Tab, { title: "Auto", tabid: "auto", children: _jsx(SelectMolecule, { name: "molecule" }) })), _jsx(Tab, { title: "Manual", tabid: "manual", children: _jsx(ManualContainer, { children: _jsx(FormikInput, { name: "sum", type: "number", nullable: true, placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), _jsx(Modal.Footer, { children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), style: { width: 80 }, children: "Set" }) })] }));
93
+ : `Set new ${sumType} Sum` }), _jsx(Modal.Body, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: { sum: '', molecule: null }, validationSchema: getValidationSchema(setOption), children: _jsxs(Tabs, { activeTab: setOption, onClick: onTabChangeHandler, children: [isStructurePanelVisible && (_jsx(Tab, { title: "Auto", tabid: "auto", children: _jsx(SelectMolecule, { name: "molecule" }) })), _jsx(Tab, { title: "Manual", tabid: "manual", children: _jsx(ManualContainer, { children: _jsx(FormikInput, { name: "sum", type: "number", placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), _jsx(Modal.Footer, { children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), style: { width: 80 }, children: "Set" }) })] }));
94
94
  }
@@ -184,7 +184,7 @@ function MetaImportationModal({ onClose, file }) {
184
184
  padding: '5px',
185
185
  fontSize: '14px',
186
186
  },
187
- }, placeholder: "Example: info.plus", datalist: datalist, nullable: true, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => convertPathArrayToString(paths) }) })] }) }), _jsx(Button.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), _jsx("div", { style: { height: 'calc(100% - 160px)' }, children: _jsx(ReactTable, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
187
+ }, placeholder: "Example: info.plus", datalist: datalist, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => convertPathArrayToString(paths) }) })] }) }), _jsx(Button.Done, { onClick: () => formRef.current?.submitForm(), children: "Link Spectra" })] }), _jsx("div", { style: { height: 'calc(100% - 160px)' }, children: _jsx(ReactTable, { columns: columns, data: metaData, approxItemHeight: 25, approxColumnWidth: 100, enableVirtualScroll: true, enableColumnsVirtualScroll: true, activeRow: handleActiveRow, rowStyle: handleRowStyle }) })] })) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: handleImport, disabled: Object.keys(matches).length === 0, children: "Import" }) })] }));
188
188
  }
189
189
  function fileValidator(file) {
190
190
  if (!isMetaFile(file)) {
@@ -35,6 +35,6 @@ const LOGS_LEVELS = [
35
35
  value: level,
36
36
  }));
37
37
  function GeneralTabContent() {
38
- return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Spectra", children: _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number" }) }) }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display" }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsx(GroupPane, { text: "Logging settings", children: _jsx(Label, { title: "Level ", children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
38
+ return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Spectra", children: _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1 }) }) }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display" }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsx(GroupPane, { text: "Logging settings", children: _jsx(Label, { title: "Level ", children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
39
39
  }
40
40
  export default GeneralTabContent;
@@ -70,7 +70,7 @@ const COLUMNS = [
70
70
  case 'checkbox':
71
71
  return (_jsx(CheckBoxCell, { name: `nmrLoaders.${row.original.name}`, defaultValue: false }));
72
72
  case 'input':
73
- return (_jsx(FormikInput, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } }, nullable: true }));
73
+ return (_jsx(FormikInput, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } } }));
74
74
  case 'select':
75
75
  return (_jsx(FormikSelect, { name: `nmrLoaders.${row.original.name}`, style: { width: '100%' }, items: row.original.options }));
76
76
  default:
@@ -1,4 +1,4 @@
1
- import { array, lazy, object, string, ValidationError, } from 'yup';
1
+ import { array, lazy, object, string, ValidationError, number, } from 'yup';
2
2
  const formattingElementValidation = (obj) => {
3
3
  return Object.fromEntries(Object.keys(obj.formatting.nuclei).map((key) => [
4
4
  key,
@@ -50,8 +50,12 @@ const infoBlockValidation = object({
50
50
  jpath: array().of(string()).min(1),
51
51
  })),
52
52
  });
53
+ const generalValidation = object({
54
+ dimmedSpectraOpacity: number().required(),
55
+ });
53
56
  export const validation = lazy((obj) => object().shape({
54
57
  formatting: formattingValidation(obj),
55
58
  databases: databasesValidation,
56
59
  infoBlock: infoBlockValidation,
60
+ general: generalValidation,
57
61
  }));
@@ -1,105 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, memo } from 'react';
3
- import Input from '../elements/Input';
4
- import ReactTableFlexLayout from '../elements/ReactTable/ReactTableFlexLayout';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { InfoPanel } from 'react-science/ui';
5
4
  import useSpectrum from '../hooks/useSpectrum';
6
- const styles = {
7
- container: {
8
- height: '100%',
9
- flexDirection: 'column',
10
- display: 'flex',
11
- width: '100%',
12
- },
13
- tableContainer: {
14
- overflow: 'auto',
15
- display: 'block',
16
- },
17
- tableHeader: {
18
- padding: ' 5px 10px',
19
- backgroundColor: ' #f8f8f8',
20
- borderBottom: '1px solid gray',
21
- fontSize: '1em',
22
- cursor: 'pointer',
23
- },
24
- };
25
- function Arrow(props) {
26
- const { isOpen = true } = props;
27
- return (_jsx("div", { style: {
28
- fontSize: '1.3em',
29
- transform: `rotate(${isOpen ? 90 : 0}deg)`,
30
- transformOrigin: '50% 50%',
31
- display: 'inline-block',
32
- lineHeight: 1,
33
- padding: isOpen ? '5px 0 0 0' : '0 5px 0 0',
34
- verticalAlign: 'middle',
35
- }, children: "\u2023" }));
36
- }
37
- function InformationTable(props) {
38
- const { data, columns, title, onClick, isOpen = true } = props;
39
- return (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.tableHeader, onClick: onClick, children: [_jsx(Arrow, { isOpen: isOpen }), _jsx("span", { style: { verticalAlign: 'middle', display: 'inline-block' }, children: title })] }), isOpen && (_jsx(ReactTableFlexLayout, { data: data, columns: columns, style: { height: 'auto' } }))] }));
40
- }
41
- function filter(searchKey, data) {
42
- const result = [];
43
- for (const key in data) {
44
- if (!searchKey || key.toLowerCase().includes(searchKey)) {
45
- result.push({ key, value: data[key] });
46
- }
47
- }
48
- return result;
49
- }
50
- const columns = [
51
- {
52
- Header: 'Parameter',
53
- sortType: 'basic',
54
- minWidth: 100,
55
- width: 20,
56
- maxWidth: 20,
57
- accessor: 'key',
58
- Cell: ({ row }) => (_jsx("p", { style: { padding: '5px', backgroundColor: 'white' }, children: row.original.key })),
59
- },
60
- {
61
- Header: 'Value',
62
- sortType: 'basic',
63
- resizable: true,
64
- accessor: 'value',
65
- Cell: ({ row }) => (_jsx("p", { style: {
66
- backgroundColor: '#efefef',
67
- height: '100%',
68
- padding: '5px',
69
- fontFamily: 'monospace',
70
- whiteSpace: 'pre',
71
- overflow: 'hidden',
72
- }, children: `${row.original.value}` })),
73
- },
74
- ];
75
- function InformationPanelInner({ info, meta, customInfo, }) {
76
- const [searchKey, setSearchKey] = useState();
77
- const [panelsStatus, openPanel] = useState({
78
- info: true,
79
- meta: true,
80
- customInfo: true,
81
- });
82
- function handleSearch(e) {
83
- const searchKey = e.target.value.toLowerCase();
84
- setSearchKey(searchKey);
85
- }
86
- const matchesInfo = filter(searchKey, info);
87
- const matchesMeta = filter(searchKey, meta);
88
- const matchesMetaInfo = filter(searchKey, customInfo);
89
- function handleOpen(key) {
90
- openPanel((prevPanelsStatus) => ({
91
- ...prevPanelsStatus,
92
- [key]: !prevPanelsStatus[key],
93
- }));
94
- }
95
- return (_jsxs("div", { style: styles.container, children: [_jsx("div", { children: _jsx(Input, { placeholder: "Search for parameter...", onChange: handleSearch, debounceTime: 250, style: {
96
- inputWrapper: { width: '100%' },
97
- input: { textAlign: 'left', padding: '5px' },
98
- } }) }), _jsxs("div", { style: styles.tableContainer, children: [_jsx(InformationTable, { data: matchesMetaInfo, columns: columns, title: "Custom information", onClick: () => handleOpen('customInfo'), isOpen: panelsStatus.customInfo }), _jsx(InformationTable, { data: matchesInfo, columns: columns, title: "Spectrum information", onClick: () => handleOpen('info'), isOpen: panelsStatus.info }), _jsx(InformationTable, { data: matchesMeta, columns: columns, title: "Other spectrum parameters", onClick: () => handleOpen('meta'), isOpen: panelsStatus.meta })] })] }));
99
- }
100
- const MemoizedInformationPanel = memo(InformationPanelInner);
101
5
  const emptyData = { info: {}, meta: {} };
102
6
  export default function InformationPanel() {
103
7
  const { info, meta, customInfo } = useSpectrum(emptyData);
104
- return _jsx(MemoizedInformationPanel, { info, meta, customInfo });
8
+ const data = useMemo(() => [
9
+ { description: 'Custom information', data: customInfo || {} },
10
+ { description: 'Spectrum information', data: info || {} },
11
+ { description: 'Other spectrum parameters', data: meta || {} },
12
+ ], [customInfo, info, meta]);
13
+ return _jsx(InfoPanel, { data: data, title: "" });
105
14
  }
@@ -87,7 +87,7 @@ function IntegralTable({ activeTab, data }) {
87
87
  const value = formatNumber(row.original.integral || 0, integralsPreferences.relative.format);
88
88
  const flag = checkIntegralKind(row.original);
89
89
  const integral = flag ? value : `[ ${value} ]`;
90
- return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
90
+ return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number", validate: (val) => val !== '' }));
91
91
  },
92
92
  },
93
93
  {
@@ -47,7 +47,7 @@ function MoleculePanelInner(props) {
47
47
  const [currentIndex, setCurrentIndex] = useState(0);
48
48
  const [molecules, setMolecules] = useState([]);
49
49
  const dispatch = useDispatch();
50
- const openMoleculeEditor = useMoleculeEditor();
50
+ const { modal, openMoleculeEditor } = useMoleculeEditor();
51
51
  const { currentDiaIDsToHighlight, handleOnAtomHover, handleOnClickAtom, assignedDiaIDsMerged, } = useAtomAssignment({ zones, ranges, activeTab, displayerMode });
52
52
  useEffect(() => {
53
53
  if (moleculesProp) {
@@ -79,7 +79,7 @@ function MoleculePanelInner(props) {
79
79
  currentDiaIDsToHighlight.length > 0
80
80
  ? currentDiaIDsToHighlight
81
81
  : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, showAtomNumber: moleculesView?.[mol.id]?.showAtomNumber || false }) })] }, mol.id)))) : (_jsx("div", { css: styles.slider, style: { height: '100%' }, onClick: () => openMoleculeEditor(), children: _jsx("span", { children: "Click to draw molecule" }) })) }));
82
- } }) }) })] }));
82
+ } }) }) }), modal] }));
83
83
  }
84
84
  const MemoizedMoleculePanel = memo(MoleculePanelInner);
85
85
  const emptyData = { ranges: {}, zones: {} };
@@ -1,13 +1,17 @@
1
+ import { Ranges, Zones } from 'nmr-processing';
1
2
  import { DiaIDAndInfo } from 'openchemlib-utils';
2
3
  import { MouseEvent } from 'react';
3
- export default function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }: {
4
- displayerMode: any;
5
- activeTab: any;
6
- zones: any;
7
- ranges: any;
8
- }): {
4
+ import { DisplayerMode } from '../../reducer/Reducer';
5
+ interface UseAtomAssignmentProps {
6
+ displayerMode: DisplayerMode;
7
+ activeTab: string;
8
+ zones: Zones;
9
+ ranges: Ranges;
10
+ }
11
+ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }: UseAtomAssignmentProps): {
9
12
  handleOnAtomHover: (diaIDAndInfo: DiaIDAndInfo | undefined) => void;
10
13
  handleOnClickAtom: (diaIDAndInfo: DiaIDAndInfo | undefined, event: MouseEvent) => void;
11
14
  currentDiaIDsToHighlight: string[];
12
15
  assignedDiaIDsMerged: string[];
13
16
  };
17
+ export {};
@@ -6,7 +6,6 @@ import { filterForIDsWithAssignment } from '../../assignment/utilities/filterFor
6
6
  import { useDispatch } from '../../context/DispatchContext';
7
7
  import { useAlert } from '../../elements/popup/Alert';
8
8
  import { HighlightEventSource, useHighlightData } from '../../highlight';
9
- import { DISPLAYER_MODE } from '../../reducer/core/Constants';
10
9
  import { extractFromAtom, findDatumAndSignalIndex, getCurrentDiaIDsToHighlight, getHighlightsOnHover, toggleDiaIDs, } from './Utilities';
11
10
  export default function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }) {
12
11
  const alert = useAlert();
@@ -41,10 +40,10 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
41
40
  }, [onAtomHoverAction, onAtomHoverHighlights, highlightData]);
42
41
  const data = useMemo(() => {
43
42
  if (zones || ranges) {
44
- if (displayerMode === DISPLAYER_MODE.DM_1D && ranges?.values) {
43
+ if (displayerMode === '1D' && ranges?.values) {
45
44
  return ranges.values;
46
45
  }
47
- else if (displayerMode === DISPLAYER_MODE.DM_2D && zones?.values) {
46
+ else if (displayerMode === '2D' && zones?.values) {
48
47
  return zones.values;
49
48
  }
50
49
  }
@@ -107,7 +106,7 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
107
106
  const atomInformation = extractFromAtom(diaIDAndInfo, nucleus, axis);
108
107
  if (atomInformation.nbAtoms > 0) {
109
108
  // save assignment in assignment hook
110
- const dimension = displayerMode === DISPLAYER_MODE.DM_1D ? '1D' : '2D';
109
+ const dimension = displayerMode === '1D' ? '1D' : '2D';
111
110
  activeAssignment.toggle(atomInformation.oclIDs, dimension);
112
111
  // save assignment (diaIDs) in range/zone data
113
112
  const { datum, signalIndex } = findDatumAndSignalIndex(data, activeAssignment.id);
@@ -115,7 +114,7 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
115
114
  // determine the level of setting the diaIDs array (range vs. signal level) and save there
116
115
  // let nbAtoms = 0;
117
116
  // on range/zone level
118
- if (displayerMode === DISPLAYER_MODE.DM_1D) {
117
+ if (displayerMode === '1D') {
119
118
  const range = datum;
120
119
  let _diaIDs = [];
121
120
  if (signalIndex === undefined) {
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { SvgNmrOverlay } from 'cheminfo-font';
@@ -22,7 +22,7 @@ import DefaultPanelHeader from '../header/DefaultPanelHeader';
22
22
  import PreferencesHeader from '../header/PreferencesHeader';
23
23
  import MultipleSpectraAnalysisTable from './MultipleSpectraAnalysisTable';
24
24
  import MultipleSpectraAnalysisPreferences from './preferences';
25
- function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, }) {
25
+ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, displayerMode, }) {
26
26
  const [isFlipped, setFlipStatus] = useState(false);
27
27
  const spectraPreferences = usePanelPreferences('spectra', activeTab);
28
28
  const preferences = usePanelPreferences('multipleSpectraAnalysis', activeTab);
@@ -66,14 +66,14 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, })
66
66
  position: relative;
67
67
  }
68
68
  `,
69
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [_jsx(Button, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: _jsx(FaFileExport, {}) }), _jsx(Button, { popupTitle: "Spectra calibration", onClick: openAlignSpectra, children: _jsx(SvgNmrOverlay, { style: { fontSize: '18px' } }) }), _jsx(ToggleButton, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, defaultValue: showLegend, children: _jsx(IoPulseOutline, {}) }, `${showLegend}`)] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(MultipleSpectraAnalysisTable, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })) : (_jsx(MultipleSpectraAnalysisPreferences, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra Analysis" })] }));
69
+ ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [_jsx(Button, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: _jsx(FaFileExport, {}) }), displayerMode === '1D' && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Spectra calibration", onClick: openAlignSpectra, children: _jsx(SvgNmrOverlay, { style: { fontSize: '18px' } }) }), _jsx(ToggleButton, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, defaultValue: showLegend, children: _jsx(IoPulseOutline, {}) }, `${showLegend}`)] }))] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(MultipleSpectraAnalysisTable, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })) : (_jsx(MultipleSpectraAnalysisPreferences, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra Analysis" })] }));
70
70
  }
71
71
  const MemoizedMultipleSpectraAnalysisPanel = memo(MultipleSpectraAnalysisPanelInner);
72
72
  export default function MultipleSpectraAnalysisPanel() {
73
- const { data, view: { spectra: { activeTab, showLegend }, }, displayerKey, } = useChartData();
73
+ const { data, view: { spectra: { activeTab, showLegend }, }, displayerKey, displayerMode, } = useChartData();
74
74
  const spectra = getSpectraByNucleus(activeTab, data);
75
75
  if (!activeTab) {
76
76
  return _jsx("div", {});
77
77
  }
78
- return (_jsx(MemoizedMultipleSpectraAnalysisPanel, { activeTab, displayerKey, spectra, showLegend }));
78
+ return (_jsx(MemoizedMultipleSpectraAnalysisPanel, { activeTab, displayerMode, displayerKey, spectra, showLegend }));
79
79
  }