nmrium 0.45.1-pre.1701344673 → 0.46.1

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 (91) 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/tool/PeakPointer.js +6 -16
  4. package/lib/component/1d/utilities/scale.js +13 -8
  5. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +15 -4
  6. package/lib/component/2d/1d-tracer/Top1DChart.js +1 -1
  7. package/lib/component/2d/zones/Signal.js +1 -1
  8. package/lib/component/2d/zones/Zone.js +1 -1
  9. package/lib/component/elements/ContextMenuBluePrint.d.ts +16 -0
  10. package/lib/component/elements/ContextMenuBluePrint.js +20 -0
  11. package/lib/component/elements/DropdownMenu.d.ts +9 -0
  12. package/lib/component/elements/DropdownMenu.js +7 -0
  13. package/lib/component/elements/Header.d.ts +1 -1
  14. package/lib/component/elements/Header.js +5 -7
  15. package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
  16. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
  17. package/lib/component/elements/ReactTable/ReactTable.d.ts +5 -5
  18. package/lib/component/header/Header.js +3 -4
  19. package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -1
  20. package/lib/component/hooks/useToolsFunctions.js +2 -2
  21. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +0 -8
  22. package/lib/component/modal/MoleculeStructureEditorModal.js +31 -8
  23. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  24. package/lib/component/modal/PredictSpectraModal.js +3 -2
  25. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -5
  26. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
  27. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +4 -1
  28. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  29. package/lib/component/modal/setting/GeneralSettings.js +1 -1
  30. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  31. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
  32. package/lib/component/modal/setting/settingsValidation.js +3 -1
  33. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +1 -1
  34. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -14
  35. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  36. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -2
  37. package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
  38. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
  39. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
  40. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +12 -17
  41. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  42. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  43. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -2
  44. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  45. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
  46. package/lib/component/panels/extra/preferences/ColumnsHelper.js +1 -2
  47. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  48. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +6 -2
  49. package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -1
  50. package/lib/component/reducer/actions/MoleculeActions.js +6 -2
  51. package/lib/component/reducer/actions/PeaksActions.js +4 -3
  52. package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.d.ts +3 -0
  53. package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.js +24 -0
  54. package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
  55. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -1
  56. package/lib/component/toolbar/BasicToolBar.js +54 -35
  57. package/lib/component/toolbar/FunctionToolBar.js +102 -9
  58. package/lib/component/toolbar/ToolBar.js +1 -1
  59. package/lib/component/utility/getClosePeak.d.ts +10 -0
  60. package/lib/component/utility/getClosePeak.js +15 -0
  61. package/lib/component/utility/maxAbsoluteValue.d.ts +3 -0
  62. package/lib/component/utility/maxAbsoluteValue.js +21 -0
  63. package/lib/data/constants/Multiplets.js +1 -1
  64. package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
  65. package/lib/data/data1d/Spectrum1D/index.js +0 -1
  66. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
  67. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
  68. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -1
  69. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +1 -1
  70. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +6 -3
  71. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  72. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +6 -1
  73. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +106 -19
  74. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -0
  75. package/lib/data/data2d/Spectrum2D/contours.js +2 -2
  76. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  77. package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
  78. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  79. package/lib/data/parseMeta/mapErrors.js +3 -1
  80. package/lib/versionInfo.js +1 -1
  81. package/package.json +41 -40
  82. package/lib/component/elements/ToolbarMenu.d.ts +0 -18
  83. package/lib/component/elements/ToolbarMenu.js +0 -102
  84. package/lib/component/elements/toggle/ToggleButton.d.ts +0 -13
  85. package/lib/component/elements/toggle/ToggleButton.js +0 -24
  86. package/lib/component/elements/toggle/ToggleButtonGroup.d.ts +0 -8
  87. package/lib/component/elements/toggle/ToggleButtonGroup.js +0 -48
  88. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.d.ts +0 -17
  89. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +0 -18
  90. package/lib/data/data2d/Processing2D.d.ts +0 -32
  91. package/lib/data/data2d/Processing2D.js +0 -130
@@ -168,7 +168,7 @@ function MetaImportationModal({ onClose, file }) {
168
168
  });
169
169
  onClose?.();
170
170
  }
171
- return (_jsxs("div", { css: ModalStyles, style: { overflow: 'hidden' }, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import Meta Information" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { style: styles.container, children: _jsx("div", { style: { flex: 1, width: '100%' }, children: !parseResult ? (_jsx(DropZone, { fileValidator: fileValidator, color: "gray", emptyText: "Drag and Drop CSV or tab-delimited file (.csv, .txt or .tsv)", onDrop: handleDrop })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { height: '130px' }, children: [_jsx(Formik, { innerRef: formRef, initialValues: {
171
+ return (_jsxs("div", { css: ModalStyles, style: { overflow: 'hidden' }, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import Meta Information" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { style: styles.container, children: _jsx("div", { style: { flex: 1, width: '100%' }, children: !parseResult ? (_jsx(DropZone, { fileValidator: fileValidator, emptyDescription: "Drag and Drop CSV or tab-delimited file (.csv, .txt or .tsv)", onDrop: handleDrop })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { height: '130px' }, children: [_jsx(Formik, { innerRef: formRef, initialValues: {
172
172
  source: null,
173
173
  target: '',
174
174
  }, onSubmit: handleLinkSpectra, validationSchema: validationSchema, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Source field", style: { label: { width: '100px' } }, children: _jsx(FormikSelect, { name: "source", items: mapColumnToSelectItems(parseResult?.meta.fields || []), style: {
@@ -221,7 +221,7 @@ function GeneralSettingsModal({ height }) {
221
221
  function handlePastWorkspaceAction() {
222
222
  void readText().then(handlePastWorkspace);
223
223
  }
224
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", children: _jsx(FaWrench, {}) }), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: [_jsx(Modal.Header, { children: _jsxs("div", { style: {
224
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", icon: _jsx(FaWrench, {}) }), _jsxs(Modal, { hasCloseButton: true, isOpen: isOpenDialog, onRequestClose: closeDialog, maxWidth: 1000, children: [_jsx(Modal.Header, { children: _jsxs("div", { style: {
225
225
  display: 'flex',
226
226
  flexDirection: 'column',
227
227
  }, children: [_jsx("span", { children: "General Settings" }), _jsxs("div", { style: {
@@ -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;
@@ -61,7 +61,7 @@ function InfoBlockTabContent() {
61
61
  Header: 'Field',
62
62
  style: { padding: 0, ...styles.column },
63
63
  Cell: ({ row }) => {
64
- return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] || null, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
64
+ return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] || key, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
65
65
  },
66
66
  },
67
67
  {
@@ -31,7 +31,9 @@ const formattingValidation = (obj) => object().shape({
31
31
  const { value, fields } = nucleusFrequencies[key];
32
32
  if (value > 1) {
33
33
  for (const field of fields) {
34
- errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
34
+ errors.push(new ValidationError(`${key} nucleus must te be unique`, nuclei[key].name,
35
+ // eslint-disable-next-line no-invalid-this
36
+ `${this.path}.${field}.name`));
35
37
  }
36
38
  }
37
39
  }
@@ -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;
@@ -3,7 +3,6 @@ import { Molecule as OCLMolecule } from 'openchemlib/full';
3
3
  import { useCallback } from 'react';
4
4
  import { FaCog, FaCopy, FaDownload, FaFileExport, FaFileImage, FaPaste, FaPlus, FaRegTrashAlt, } from 'react-icons/fa';
5
5
  import { IoOpenOutline } from 'react-icons/io5';
6
- import { DropdownMenu } from 'react-science/ui';
7
6
  import { getMolecules } from '../../../data/molecules/MoleculeManager';
8
7
  import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
9
8
  import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
@@ -12,6 +11,7 @@ import { useDispatch } from '../../context/DispatchContext';
12
11
  import { useGlobal } from '../../context/GlobalContext';
13
12
  import ActiveButton from '../../elements/ActiveButton';
14
13
  import Button from '../../elements/Button';
14
+ import { DropdownMenu } from '../../elements/DropdownMenu';
15
15
  import { useAlert } from '../../elements/popup/Alert';
16
16
  import AboutPredictionModal from '../../modal/AboutPredictionModal';
17
17
  import PredictSpectraModal from '../../modal/PredictSpectraModal';
@@ -34,38 +34,31 @@ const styles = {
34
34
  lineHeight: 1,
35
35
  },
36
36
  };
37
- const LabelWrapper = ({ children }) => {
38
- return _jsx("p", { style: { padding: '0.4em' }, children: children });
39
- };
40
37
  const MOL_EXPORT_MENU = [
41
38
  {
42
- type: 'option',
43
39
  icon: _jsx(FaCopy, {}),
44
- label: _jsx(LabelWrapper, { children: "Copy as molfile V3" }),
40
+ text: 'Copy as molfile V3',
45
41
  data: {
46
42
  id: 'molfileV3',
47
43
  },
48
44
  },
49
45
  {
50
- type: 'option',
51
46
  icon: _jsx(FaCopy, {}),
52
- label: _jsx(LabelWrapper, { children: "Copy as molfile V2" }),
47
+ text: 'Copy as molfile V2',
53
48
  data: {
54
49
  id: 'molfileV2',
55
50
  },
56
51
  },
57
52
  {
58
- type: 'option',
59
53
  icon: _jsx(FaFileImage, {}),
60
- label: _jsx(LabelWrapper, { children: "Copy as PNG" }),
54
+ text: 'Copy as PNG',
61
55
  data: {
62
56
  id: 'png',
63
57
  },
64
58
  },
65
59
  {
66
- type: 'option',
67
60
  icon: _jsx(FaDownload, {}),
68
- label: _jsx(LabelWrapper, { children: "Export as SVG" }),
61
+ text: 'Export as SVG',
69
62
  data: {
70
63
  id: 'svg',
71
64
  },
@@ -97,7 +90,7 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
97
90
  const exportHandler = useCallback((selected) => {
98
91
  const molecule = molecules?.[currentIndex];
99
92
  if (molecule) {
100
- switch (selected?.data.id) {
93
+ switch (selected?.id) {
101
94
  case 'molfileV3':
102
95
  saveAsMolHandler(molecule.molfile);
103
96
  break;
@@ -160,5 +153,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
160
153
  });
161
154
  }
162
155
  const hasMolecules = molecules && molecules.length > 0;
163
- return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
156
+ return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
164
157
  }
@@ -102,7 +102,7 @@ function RangesHeader({ ranges, info, onUnlink, onFilterActivated, onSettingClic
102
102
  if (Array.isArray(ranges?.values) && ranges.values.length > 0) {
103
103
  const { originFrequency: observedFrequency, nucleus } = info;
104
104
  const result = rangesToACS(ranges.values, {
105
- nucleus,
105
+ nucleus, // '19f'
106
106
  deltaFormat: rangesPreferences.deltaPPM.format,
107
107
  couplingFormat: rangesPreferences.coupling.format,
108
108
  observedFrequency, //400
@@ -19,8 +19,7 @@ import RangesPreferences from './RangesPreferences';
19
19
  import RangesTable from './RangesTable';
20
20
  const rangesContextMenuOptions = [
21
21
  {
22
- label: 'Copy to Clipboard',
23
- type: 'option',
22
+ text: 'Copy to Clipboard',
24
23
  icon: _jsx(FaCopy, {}),
25
24
  },
26
25
  ];
@@ -1,7 +1,7 @@
1
1
  import { WorkSpacePanelPreferences } from 'nmr-load-save';
2
2
  import { Info1D } from 'nmr-processing';
3
- import { ContextMenuProps } from '../../elements/ReactTable/ReactTable';
4
- interface RangesTableProps extends ContextMenuProps {
3
+ import { TableContextMenuProps } from '../../elements/ReactTable/ReactTable';
4
+ interface RangesTableProps extends TableContextMenuProps {
5
5
  onUnlink: (a: any, b?: any) => void;
6
6
  preferences: WorkSpacePanelPreferences['ranges'];
7
7
  tableData: any;
@@ -1,9 +1,9 @@
1
1
  import { WorkSpacePanelPreferences } from 'nmr-load-save';
2
2
  import { Info1D } from 'nmr-processing';
3
3
  import { CSSProperties } from 'react';
4
- import { ContextMenuProps } from '../../elements/ReactTable/ReactTable';
4
+ import { TableContextMenuProps } from '../../elements/ReactTable/ReactTable';
5
5
  import { RangeData } from './hooks/useMapRanges';
6
- interface RangesTableRowProps extends ContextMenuProps {
6
+ interface RangesTableRowProps extends TableContextMenuProps {
7
7
  rowData: any;
8
8
  onUnlink: (a: any, b?: any) => void;
9
9
  preferences: WorkSpacePanelPreferences['ranges'];
@@ -3,9 +3,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/reac
3
3
  import { css } from '@emotion/react';
4
4
  import lodashGet from 'lodash/get';
5
5
  import { useMemo, useCallback } from 'react';
6
- import { DropdownMenu } from 'react-science/ui';
7
6
  import { useAssignment, useAssignmentData, } from '../../assignment/AssignmentsContext';
8
7
  import { filterForIDsWithAssignment } from '../../assignment/utilities/filterForIDsWithAssignment';
8
+ import { ContextMenu } from '../../elements/ContextMenuBluePrint';
9
9
  import { HighlightEventSource, useHighlight, useHighlightData, } from '../../highlight';
10
10
  import AbsoluteColumn from './TableColumns/AbsoluteColumn';
11
11
  import ActionsColumn from './TableColumns/ActionsColumn';
@@ -103,7 +103,7 @@ function RangesTableRow({ rowData, onUnlink, onContextMenuSelect, contextMenu =
103
103
  ? ConstantlyHighlightedRowStyle
104
104
  : null;
105
105
  }, [assignmentRange.isActive, highlightRange.isActive, rowData]);
106
- return (_jsxs(DropdownMenu, { trigger: "contextMenu", options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
106
+ return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
107
107
  ? 'm'
108
108
  : lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumn, { row: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { row: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData })] })), _jsx(ActionsColumn, { row: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind, showDeleteAction: preferences.showDeleteAction, showEditAction: preferences.showEditAction, showZoomAction: preferences.showZoomAction })] }));
109
109
  }
@@ -3,10 +3,10 @@ import lodashGet from 'lodash/get';
3
3
  import { useMemo, useCallback, useState } from 'react';
4
4
  import { FaCopy, FaRegTrashAlt, FaFileExport } from 'react-icons/fa';
5
5
  import { IoColorPaletteOutline } from 'react-icons/io5';
6
- import { DropdownMenu } from 'react-science/ui';
7
6
  import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
8
7
  import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
9
8
  import { useDispatch } from '../../context/DispatchContext';
9
+ import { ContextMenu, } from '../../elements/ContextMenuBluePrint';
10
10
  import ReactTable from '../../elements/ReactTable/ReactTable';
11
11
  import { useAlert } from '../../elements/popup/Alert';
12
12
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
@@ -37,8 +37,7 @@ const columnStyle = {
37
37
  };
38
38
  const options = [
39
39
  {
40
- label: 'Recolor based on distinct value',
41
- type: 'option',
40
+ text: 'Recolor based on distinct value',
42
41
  icon: _jsx(IoColorPaletteOutline, {}),
43
42
  },
44
43
  ];
@@ -50,20 +49,17 @@ var SpectraContextMenuOptionsKeys;
50
49
  })(SpectraContextMenuOptionsKeys || (SpectraContextMenuOptionsKeys = {}));
51
50
  const Spectra2DContextMenuOptions = [
52
51
  {
53
- label: 'Copy to Clipboard',
54
- type: 'option',
52
+ text: 'Copy to Clipboard',
55
53
  icon: _jsx(FaCopy, {}),
56
54
  data: { id: SpectraContextMenuOptionsKeys.CopyToClipboard },
57
55
  },
58
56
  {
59
- label: 'Delete',
60
- type: 'option',
57
+ text: 'Delete',
61
58
  icon: _jsx(FaRegTrashAlt, {}),
62
59
  data: { id: SpectraContextMenuOptionsKeys.Delete },
63
60
  },
64
61
  {
65
- label: 'Export as jcamp',
66
- type: 'option',
62
+ text: 'Export as jcamp',
67
63
  icon: _jsx(FaFileExport, {}),
68
64
  data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
69
65
  },
@@ -71,8 +67,7 @@ const Spectra2DContextMenuOptions = [
71
67
  const Spectra1DContextMenuOptions = [
72
68
  ...Spectra2DContextMenuOptions,
73
69
  {
74
- label: 'Export as jcamp',
75
- type: 'option',
70
+ text: 'Export as jcamp',
76
71
  icon: _jsx(FaFileExport, {}),
77
72
  data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
78
73
  },
@@ -135,7 +130,7 @@ export function SpectraTable(props) {
135
130
  }), [onChangeVisibility, onOpenSettingModal]);
136
131
  const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = useClipboard();
137
132
  const selectContextMenuHandler = useCallback((option, spectrum) => {
138
- const { id } = option.data;
133
+ const { id } = option;
139
134
  switch (id) {
140
135
  case SpectraContextMenuOptionsKeys.CopyToClipboard: {
141
136
  void (async () => {
@@ -225,9 +220,9 @@ const ColumnHeader = ({ label, col, }) => {
225
220
  });
226
221
  }
227
222
  }
228
- return (_jsx(DropdownMenu, { trigger: "contextMenu", options: options, onSelect: selectHandler, children: _jsx("div", { style: {
229
- whiteSpace: 'nowrap',
230
- overflow: 'hidden',
231
- textOverflow: 'ellipsis',
232
- }, children: label }) }));
223
+ return (_jsx(ContextMenu, { options: options, onSelect: selectHandler, style: {
224
+ whiteSpace: 'nowrap',
225
+ overflow: 'hidden',
226
+ textOverflow: 'ellipsis',
227
+ }, children: label }));
233
228
  };
@@ -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
  }
@@ -1,8 +1,8 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import { Axis } from '../../assignment/AssignmentsContext';
3
- import { ContextMenuProps } from '../../elements/ReactTable/ReactTable';
3
+ import { TableContextMenuProps } from '../../elements/ReactTable/ReactTable';
4
4
  import { ZoneData } from './hooks/useMapZones';
5
- interface ZonesTableRowProps extends ContextMenuProps {
5
+ interface ZonesTableRowProps extends TableContextMenuProps {
6
6
  rowData: ZoneData;
7
7
  onUnlink: (rowData: ZoneData, isOnZoneLevel: boolean, signalIndex: any, axis: Axis) => void;
8
8
  rowIndex: number;
@@ -2,9 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/reac
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import lodashGet from 'lodash/get';
4
4
  import { useMemo, useCallback } from 'react';
5
- import { DropdownMenu } from 'react-science/ui';
6
5
  import { buildID } from '../../../data/utilities/Concatenation';
7
6
  import { useAssignment, } from '../../assignment/AssignmentsContext';
7
+ import { ContextMenu } from '../../elements/ContextMenuBluePrint';
8
8
  import { useHighlight } from '../../highlight';
9
9
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
10
10
  import ActionsColumn from './TableColumns/ActionsColumn';
@@ -115,7 +115,7 @@ function ZonesTableRow({ rowData, onUnlink, contextMenu = [], onContextMenuSelec
115
115
  },
116
116
  };
117
117
  }, [assignmentSignal, highlightSignalY]);
118
- return (_jsxs(DropdownMenu, { trigger: "contextMenu", options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", style: highlightZone.isActive || assignmentZone.isActive
118
+ return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", style: highlightZone.isActive || assignmentZone.isActive
119
119
  ? HighlightedRowStyle
120
120
  : lodashGet(rowData, 'tableMetaInfo.isConstantlyHighlighted', false)
121
121
  ? ConstantlyHighlightedRowStyle
@@ -45,7 +45,7 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
45
45
  pointerEvents: 'none',
46
46
  fontSize: '12px',
47
47
  transform: 'rotate(90deg)',
48
- } }) }, `${selectedTool}`), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(Button.Done, { fill: "clear", onClick: onStructureClick, style: { padding: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
48
+ } }) }, selectedTool), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(Button.Done, { fill: "clear", onClick: onStructureClick, style: { padding: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
49
49
  fontSize: '12px',
50
50
  } })) : (_jsx(BsHexagonFill, { style: {
51
51
  fontSize: '12px',
@@ -23,8 +23,7 @@ export default class ColumnsHelper {
23
23
  const preferences = this.preferences || this.defaultPreference;
24
24
  if (this.checkPreferences(preferences, flagKey)) {
25
25
  this.setCustomColumn(columns, columnIndex, columnLabel, (row) => {
26
- const format = preferences &&
27
- Object.prototype.hasOwnProperty.call(preferences, formatKey)
26
+ const format = preferences && Object.hasOwn(preferences, formatKey)
28
27
  ? preferences[formatKey]
29
28
  : this.defaultPreference[formatKey];
30
29
  const { formatPrefix = '', formatSuffix = '', showPrefixSuffixCallback = () => true, } = options;
@@ -1,8 +1,8 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Checkbox } from '@blueprintjs/core';
2
3
  import { useMemo, useCallback, memo, useRef } from 'react';
3
4
  import { FaRegTrashAlt } from 'react-icons/fa';
4
5
  import { ObjectInspector } from 'react-inspector';
5
- import { Checkbox } from 'react-science/ui';
6
6
  import { useChartData } from '../../context/ChartContext';
7
7
  import { useDispatch } from '../../context/DispatchContext';
8
8
  import Button from '../../elements/Button';
@@ -85,7 +85,9 @@ function columnSchema(columns) {
85
85
  for (const key in colsFrequency) {
86
86
  const indexes = colsFrequency[key];
87
87
  if (indexes.length > 1) {
88
- errors.push(new Yup.ValidationError(`${key} nucleus must te be unique`, key, this.path));
88
+ errors.push(new Yup.ValidationError(`${key} nucleus must te be unique`, key,
89
+ // eslint-disable-next-line no-invalid-this
90
+ this.path));
89
91
  }
90
92
  }
91
93
  return new Yup.ValidationError(errors);
@@ -95,7 +97,9 @@ function columnSchema(columns) {
95
97
  for (const column of columns) {
96
98
  if (column?.type === AnalysisColumnsTypes.FORMULA &&
97
99
  (!column.formula || column.formula === '')) {
98
- errors.push(new Yup.ValidationError(`${column.tempKey} formula value is required`, column.formula, this.path));
100
+ errors.push(new Yup.ValidationError(`${column.tempKey} formula value is required`, column.formula,
101
+ // eslint-disable-next-line no-invalid-this
102
+ this.path));
99
103
  }
100
104
  }
101
105
  return new Yup.ValidationError(errors);
@@ -1,5 +1,6 @@
1
1
  import { FifoLogger } from 'fifo-logger';
2
2
  import { Draft } from 'immer';
3
+ import { TopicMolecule } from 'openchemlib-utils';
3
4
  import { PredictedSpectraResult, PredictionOptions } from '../../../data/PredictionManager';
4
5
  import { MoleculeBoundingRect, StateMolecule } from '../../../data/molecules/Molecule';
5
6
  import { AssignmentContext } from '../../assignment/AssignmentsContext';
@@ -13,7 +14,9 @@ type AddMoleculeAction = ActionType<'ADD_MOLECULE', AddMoleculeProps>;
13
14
  type AddMoleculesAction = ActionType<'ADD_MOLECULES', {
14
15
  molecules: StateMolecule[];
15
16
  }>;
16
- type SetMoleculeAction = ActionType<'SET_MOLECULE', Required<StateMolecule>>;
17
+ type SetMoleculeAction = ActionType<'SET_MOLECULE', Required<StateMolecule> & {
18
+ mappings?: ReturnType<TopicMolecule['getDiaIDsMapping']>;
19
+ }>;
17
20
  type DeleteMoleculeAction = ActionType<'DELETE_MOLECULE', {
18
21
  id: string;
19
22
  assignmentData: AssignmentContext;
@@ -9,6 +9,7 @@ import { MARGIN } from '../core/Constants';
9
9
  import { unlinkRange } from './RangesActions';
10
10
  import { setActiveTab } from './ToolsActions';
11
11
  import { unlinkZone } from './ZonesActions';
12
+ import { deepReplaceDiaIDs } from './utilities/deepReplaceDiaIDs';
12
13
  function addMolecule(draft, props) {
13
14
  const { molfile, floatMoleculeOnSave } = props;
14
15
  const isEmpty = draft.molecules.length === 0;
@@ -38,7 +39,7 @@ function handleAddMolecules(draft, action) {
38
39
  }
39
40
  }
40
41
  function setMolecule(draft, props) {
41
- const { id, label, molfile } = props;
42
+ const { id, label, molfile, mappings } = props;
42
43
  MoleculeManager.setMolfile(draft.molecules, {
43
44
  id,
44
45
  label,
@@ -48,6 +49,9 @@ function setMolecule(draft, props) {
48
49
  * update all spectra that its sum was based on this molecule with the new molecule
49
50
  */
50
51
  const index = draft.molecules.findIndex((molecule) => molecule.id === id);
52
+ if (mappings) {
53
+ deepReplaceDiaIDs(draft, mappings);
54
+ }
51
55
  changeSpectraRelativeSum(draft, id, index !== -1 ? draft.molecules[index] : draft.molecules[0] || null);
52
56
  }
53
57
  //action
@@ -193,7 +197,7 @@ function getFloatingMoleculeInitialPosition(id, draft) {
193
197
  const columns = Math.floor(width / baseWidth);
194
198
  const rows = Math.floor(height / baseHeight);
195
199
  const moleculeKeys = Object.keys(molecules);
196
- let index = 0;
200
+ let index;
197
201
  if (!molecules[id]) {
198
202
  index = moleculeKeys.length - 1;
199
203
  }
@@ -1,9 +1,10 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
2
  import { original } from 'immer';
3
3
  import { xFindClosestIndex } from 'ml-spectra-processing';
4
- import { getShiftX, lookupPeak, autoPeakPicking, optimizePeaks, } from '../../../data/data1d/Spectrum1D';
4
+ import { getShiftX, autoPeakPicking, optimizePeaks, } from '../../../data/data1d/Spectrum1D';
5
5
  import { defaultPeaksViewState } from '../../hooks/useActiveSpectrumPeaksViewState';
6
6
  import { defaultRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
7
+ import { getClosePeak } from '../../utility/getClosePeak';
7
8
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
8
9
  import getRange from '../helper/getRange';
9
10
  //action
@@ -17,7 +18,7 @@ function handleAddPeak(draft, action) {
17
18
  const startX = mouseXPosition - xShift;
18
19
  const endX = mouseXPosition + xShift;
19
20
  const [from, to] = getRange(draft, { startX, endX });
20
- const candidatePeak = lookupPeak(state.data[index].data, {
21
+ const candidatePeak = getClosePeak(state.data[index], {
21
22
  from,
22
23
  to,
23
24
  });
@@ -44,7 +45,7 @@ function handleAddPeaks(draft, action) {
44
45
  const { startX, endX } = action.payload;
45
46
  const [from, to] = getRange(draft, { startX, endX });
46
47
  if (from !== to) {
47
- const peak = lookupPeak(datumOriginal.data, { from, to });
48
+ const peak = getClosePeak(datumOriginal, { from, to });
48
49
  const shiftX = getShiftX(draft.data[index]);
49
50
  if (peak && !datumOriginal.peaks.values.some((p) => p.x === peak.x)) {
50
51
  const newPeak = {
@@ -0,0 +1,3 @@
1
+ import { Draft } from 'immer';
2
+ import { TopicMolecule } from 'openchemlib-utils';
3
+ export declare function deepReplaceDiaIDs(data: Draft<object>, mappings: ReturnType<TopicMolecule['getDiaIDsMapping']>): void;
@@ -0,0 +1,24 @@
1
+ export function deepReplaceDiaIDs(data, mappings) {
2
+ for (const key in data) {
3
+ if (key !== 'diaIDs') {
4
+ if (typeof data[key] === 'object' && !ArrayBuffer.isView(data[key])) {
5
+ deepReplaceDiaIDs(data[key], mappings);
6
+ }
7
+ continue;
8
+ }
9
+ if (!Array.isArray(data[key])) {
10
+ throw new Error('diaIDs must be an array');
11
+ }
12
+ const diaIDs = data[key];
13
+ for (let i = 0; i < diaIDs.length; i++) {
14
+ const diaID = diaIDs[i];
15
+ if (typeof diaID !== 'string') {
16
+ throw new Error('diaID must be a string');
17
+ }
18
+ const newDiaID = mappings[diaID];
19
+ if (newDiaID) {
20
+ diaIDs[i] = newDiaID;
21
+ }
22
+ }
23
+ }
24
+ }
@@ -31,7 +31,7 @@ function setZoom(draft, options = {}) {
31
31
  ]);
32
32
  const [min, max] = shareYDomain ? yDomain : yDomains[id];
33
33
  const maxPoint = Math.max(Math.abs(max), Math.abs(min));
34
- const scalePoint = maxPoint === max ? 0 : min;
34
+ const scalePoint = maxPoint === Math.abs(max) ? 0 : min;
35
35
  const t = zoomIdentity
36
36
  .translate(0, Math.sign(scalePoint) >= 0
37
37
  ? _scale(scalePoint)
@@ -95,7 +95,7 @@ const getRangeDefaultValues = (nucleus) => {
95
95
  deltaPPM: { show: true, format: '0.00' },
96
96
  deltaHz: { show: false, format: '0.00' },
97
97
  coupling: { show: true, format: '0.00' },
98
- jGraphTolerance: nucleus === '1H' ? 0.2 : nucleus === '13C' ? 2 : 0,
98
+ jGraphTolerance: nucleus === '1H' ? 0.2 : nucleus === '13C' ? 2 : 0, //J Graph tolerance for: 1H: 0.2Hz 13C: 2Hz
99
99
  showKind: true,
100
100
  showMultiplicity: true,
101
101
  showAssignment: true,