nmrium 0.45.1-pre.1701344673 → 0.46.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 (74) hide show
  1. package/lib/component/1d/tool/PeakPointer.js +6 -16
  2. package/lib/component/1d/utilities/scale.js +13 -8
  3. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +15 -4
  4. package/lib/component/elements/ContextMenuBluePrint.d.ts +16 -0
  5. package/lib/component/elements/ContextMenuBluePrint.js +20 -0
  6. package/lib/component/elements/DropdownMenu.d.ts +9 -0
  7. package/lib/component/elements/DropdownMenu.js +7 -0
  8. package/lib/component/elements/Header.d.ts +1 -1
  9. package/lib/component/elements/Header.js +4 -6
  10. package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
  11. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
  12. package/lib/component/elements/ReactTable/ReactTable.d.ts +5 -5
  13. package/lib/component/header/Header.js +3 -4
  14. package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -1
  15. package/lib/component/hooks/useToolsFunctions.js +2 -2
  16. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +0 -8
  17. package/lib/component/modal/MoleculeStructureEditorModal.js +31 -8
  18. package/lib/component/modal/PredictSpectraModal.js +3 -2
  19. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -5
  20. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
  21. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +4 -1
  22. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  23. package/lib/component/modal/setting/GeneralSettings.js +1 -1
  24. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
  25. package/lib/component/modal/setting/settingsValidation.js +3 -1
  26. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -14
  27. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  28. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -2
  29. package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
  30. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
  31. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
  32. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +12 -17
  33. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -2
  34. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  35. package/lib/component/panels/extra/preferences/ColumnsHelper.js +1 -2
  36. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  37. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +6 -2
  38. package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -1
  39. package/lib/component/reducer/actions/MoleculeActions.js +6 -2
  40. package/lib/component/reducer/actions/PeaksActions.js +4 -3
  41. package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.d.ts +3 -0
  42. package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.js +24 -0
  43. package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
  44. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -1
  45. package/lib/component/toolbar/BasicToolBar.js +53 -34
  46. package/lib/component/toolbar/FunctionToolBar.js +102 -9
  47. package/lib/component/toolbar/ToolBar.js +1 -1
  48. package/lib/component/utility/getClosePeak.d.ts +10 -0
  49. package/lib/component/utility/getClosePeak.js +15 -0
  50. package/lib/component/utility/maxAbsoluteValue.d.ts +3 -0
  51. package/lib/component/utility/maxAbsoluteValue.js +21 -0
  52. package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
  53. package/lib/data/data1d/Spectrum1D/index.js +0 -1
  54. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
  55. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
  56. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +1 -1
  57. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  58. package/lib/data/data2d/Spectrum2D/contours.js +2 -2
  59. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  60. package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
  61. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  62. package/lib/data/parseMeta/mapErrors.js +3 -1
  63. package/lib/versionInfo.js +1 -1
  64. package/package.json +39 -38
  65. package/lib/component/elements/ToolbarMenu.d.ts +0 -18
  66. package/lib/component/elements/ToolbarMenu.js +0 -102
  67. package/lib/component/elements/toggle/ToggleButton.d.ts +0 -13
  68. package/lib/component/elements/toggle/ToggleButton.js +0 -24
  69. package/lib/component/elements/toggle/ToggleButtonGroup.d.ts +0 -8
  70. package/lib/component/elements/toggle/ToggleButtonGroup.js +0 -48
  71. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.d.ts +0 -17
  72. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +0 -18
  73. package/lib/data/data2d/Processing2D.d.ts +0 -32
  74. package/lib/data/data2d/Processing2D.js +0 -130
@@ -1,13 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrZeroFilling, } from 'cheminfo-font';
3
3
  import { useState, useEffect, useCallback, memo } from 'react';
4
4
  import { FaSearchPlus, FaExpand, FaDiceFour } from 'react-icons/fa';
5
5
  import { Toolbar } from 'react-science/ui';
6
6
  import { useChartData } from '../context/ChartContext';
7
7
  import { useDispatch } from '../context/DispatchContext';
8
- import ToggleButton from '../elements/toggle/ToggleButton';
9
- import ToggleButtonGroup from '../elements/toggle/ToggleButtonGroup';
10
- import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
8
+ import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
11
9
  import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
12
10
  import useToolsFunctions from '../hooks/useToolsFunctions';
13
11
  import { options } from './ToolTypes';
@@ -38,11 +36,106 @@ function FunctionToolBarInner({ defaultValue, ftCounter, }) {
38
36
  type: 'APPLY_FFT_DIMENSION_2_FILTER',
39
37
  });
40
38
  }, [dispatch]);
41
- return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('zoom') && (_jsx(ToggleButton, { value: options.zoom.id, id: options.zoom.id, title: `${options.zoom.label}`, children: _jsx(FaSearchPlus, {}) }, options.zoom.id)), isButtonVisible('zoomOut') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx(FaExpand, {}) })), isButtonVisible('peakPicking') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, id: options.peakPicking.id, children: _jsx(SvgNmrPeakPicking, {}) }, options.peakPicking.id)), isButtonVisible('integral') && (_jsx(ToggleButton, { value: options.integral.id, id: options.integral.id, title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}) }, options.integral.id)), isButtonVisible('zonePicking') && (_jsx(ToggleButton, { value: options.zonePicking.id, id: options.zonePicking.id, title: `${options.zonePicking.label} ( Press r )`, children: _jsx(FaDiceFour, {}) }, options.zonePicking.id)), isButtonVisible('slicing') && (_jsx(ToggleButton, { value: options.slicing.id, id: options.slicing.id, title: `${options.slicing.label}`, children: _jsx("p", { children: "Slic" }) }, options.slicing.id)), isButtonVisible('rangePicking') && (_jsx(ToggleButton, { value: options.rangePicking.id, title: `${options.rangePicking.label} ( Press r )`, id: options.rangePicking.id, children: _jsx(SvgNmrRangePicking, {}) }, options.rangePicking.id)), isButtonVisible('multipleSpectraAnalysis', {
42
- checkSpectrumType: false,
43
- }) &&
44
- ftCounter > 1 && (_jsx(ToggleButton, { value: options.multipleSpectraAnalysis.id, id: options.multipleSpectraAnalysis.id, title: options.multipleSpectraAnalysis.label, children: _jsx(SvgNmrMultipleAnalysis, {}) }, options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && (_jsx(ToggleButton, { value: options.apodization.id, id: options.apodization.id, title: `${options.apodization.label} (Press a)`, children: _jsx(SvgNmrApodization, {}) }, options.apodization.id)), isButtonVisible('zeroFilling') && (_jsx(ToggleButton, { value: options.zeroFilling.id, id: options.zeroFilling.id, title: `${options.zeroFilling.label} ( Press z )`, children: _jsx(SvgNmrZeroFilling, {}) }, options.zeroFilling.id)), isButtonVisible('phaseCorrection') && (_jsx(ToggleButton, { value: options.phaseCorrection.id, id: options.phaseCorrection.id, title: `${options.phaseCorrection.label} ( Press a )`, children: _jsx(SvgNmrPhaseCorrection, {}) }, options.phaseCorrection.id)), isButtonVisible('phaseCorrectionTwoDimensions') && (_jsx(ToggleButton, { value: options.phaseCorrectionTwoDimensions.id, id: options.phaseCorrectionTwoDimensions.id, title: `${options.phaseCorrectionTwoDimensions.label} ( Press a )`, children: _jsx(SvgNmrPhaseCorrection, {}) }, options.phaseCorrectionTwoDimensions.id)), isButtonVisible('baselineCorrection') && (_jsx(ToggleButton, { value: options.baselineCorrection.id, id: options.baselineCorrection.id, title: `${options.baselineCorrection.label} ( Press b )`, children: _jsx(SvgNmrBaselineCorrection, {}) }, options.baselineCorrection.id)), isButtonVisible('exclusionZones', { checkSpectrumType: false }) &&
45
- ftCounter > 0 && (_jsx(ToggleButton, { value: options.exclusionZones.id, title: `${options.exclusionZones.label} ( Press e )`, id: options.exclusionZones.id, children: _jsx("div", { style: { fontSize: 18 }, children: _jsx(SvgNmrMultipleAnalysis, {}) }) }, options.exclusionZones.id))] }), isButtonVisible('fft') && (_jsx(Toolbar.Item, { id: options.fft.id, className: "cheminfo", title: `${options.fft.label} ( Press t )`, onClick: handleOnFFTFilter, children: _jsx(SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension1') && (_jsx(Toolbar.Item, { id: options.fftDimension1.id, className: "cheminfo", title: options.fftDimension1.label, onClick: handleFFtDimension1Filter, children: _jsx(SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension2') && (_jsx(Toolbar.Item, { id: options.fftDimension2.id, className: "cheminfo", title: options.fftDimension2.label, onClick: handleFFtDimension2Filter, children: _jsx(SvgNmrFourierTransform, {}) }))] }));
39
+ const toolItems = [
40
+ {
41
+ id: 'zoom',
42
+ label: options.zoom.label,
43
+ icon: _jsx(FaSearchPlus, {}),
44
+ },
45
+ {
46
+ id: 'zoomOut',
47
+ label: 'Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )',
48
+ onClick: handleFullZoomOut,
49
+ icon: _jsx(FaExpand, {}),
50
+ },
51
+ {
52
+ id: 'peakPicking',
53
+ label: `${options.peakPicking.label} ( Press p )`,
54
+ icon: _jsx(SvgNmrPeakPicking, {}),
55
+ },
56
+ {
57
+ id: 'integral',
58
+ label: `${options.integral.label} ( Press i )`,
59
+ icon: _jsx(SvgNmrIntegrate, {}),
60
+ },
61
+ {
62
+ id: 'zonePicking',
63
+ label: `${options.zonePicking.label} ( Press r )`,
64
+ icon: _jsx(FaDiceFour, {}),
65
+ },
66
+ {
67
+ id: 'slicing',
68
+ label: options.slicing.label,
69
+ icon: _jsx("p", { children: "Slic" }),
70
+ },
71
+ {
72
+ id: 'rangePicking',
73
+ label: `${options.rangePicking.label} ( Press r )`,
74
+ icon: _jsx(SvgNmrRangePicking, {}),
75
+ },
76
+ {
77
+ id: 'multipleSpectraAnalysis',
78
+ label: options.multipleSpectraAnalysis.label,
79
+ icon: _jsx(SvgNmrMultipleAnalysis, {}),
80
+ checkOptions: { checkSpectrumType: false },
81
+ condition: ftCounter > 1,
82
+ },
83
+ {
84
+ id: 'apodization',
85
+ label: `${options.apodization.label} (Press a)`,
86
+ icon: _jsx(SvgNmrApodization, {}),
87
+ },
88
+ {
89
+ id: 'zeroFilling',
90
+ label: `${options.zeroFilling.label} ( Press z )`,
91
+ icon: _jsx(SvgNmrZeroFilling, {}),
92
+ },
93
+ {
94
+ id: 'phaseCorrection',
95
+ label: `${options.phaseCorrection.label} ( Press a )`,
96
+ icon: _jsx(SvgNmrPhaseCorrection, {}),
97
+ },
98
+ {
99
+ id: 'phaseCorrectionTwoDimensions',
100
+ label: `${options.phaseCorrectionTwoDimensions.label} ( Press a )`,
101
+ icon: _jsx(SvgNmrPhaseCorrection, {}),
102
+ },
103
+ {
104
+ id: 'baselineCorrection',
105
+ label: `${options.baselineCorrection.label} ( Press b )`,
106
+ icon: _jsx(SvgNmrBaselineCorrection, {}),
107
+ },
108
+ {
109
+ id: 'exclusionZones',
110
+ label: `${options.exclusionZones.label} ( Press e )`,
111
+ icon: _jsx(SvgNmrMultipleAnalysis, {}),
112
+ checkOptions: { checkSpectrumType: false },
113
+ condition: ftCounter > 0,
114
+ },
115
+ {
116
+ id: 'fft',
117
+ label: `${options.fft.label} ( Press t )`,
118
+ onClick: handleOnFFTFilter,
119
+ icon: _jsx(SvgNmrFourierTransform, {}),
120
+ },
121
+ {
122
+ id: 'fftDimension1',
123
+ label: options.fftDimension1.label,
124
+ onClick: handleFFtDimension1Filter,
125
+ icon: _jsx(SvgNmrFourierTransform, {}),
126
+ },
127
+ {
128
+ id: 'fftDimension2',
129
+ label: options.fftDimension2.label,
130
+ onClick: handleFFtDimension2Filter,
131
+ icon: _jsx(SvgNmrFourierTransform, {}),
132
+ },
133
+ ];
134
+ return (_jsx(_Fragment, { children: toolItems.map((item) => {
135
+ const { id, icon, label, checkOptions, onClick, condition } = item;
136
+ return (isButtonVisible(id, checkOptions) &&
137
+ (condition === undefined || condition) && (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), title: label, id: id, active: option === id, icon: icon }, id)));
138
+ }) }));
46
139
  }
47
140
  const MemoizedFunctionToolBar = memo(FunctionToolBarInner);
48
141
  export default function FunctionToolBar({ defaultValue = options.zoom.id, }) {
@@ -5,7 +5,7 @@ import { useChartData } from '../context/ChartContext';
5
5
  import BasicToolBar from './BasicToolBar';
6
6
  import FunctionToolBar from './FunctionToolBar';
7
7
  function ToolBarInner({ selectedTool }) {
8
- return (_jsxs(Toolbar, { orientation: "vertical", children: [_jsx(FunctionToolBar, { defaultValue: selectedTool }), _jsx(BasicToolBar, {})] }));
8
+ return (_jsxs(Toolbar, { vertical: true, children: [_jsx(FunctionToolBar, { defaultValue: selectedTool }), _jsx(BasicToolBar, {})] }));
9
9
  }
10
10
  const MemoizedToolBar = memo(ToolBarInner);
11
11
  export default function ToolBar() {
@@ -0,0 +1,10 @@
1
+ import { Spectrum1D } from 'nmr-load-save';
2
+ interface PeakPosition {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ export declare function getClosePeak(spectrum: Spectrum1D, lookRange: {
7
+ from: number;
8
+ to: number;
9
+ }): PeakPosition | null;
10
+ export {};
@@ -0,0 +1,15 @@
1
+ import { get1DDataXY } from '../../data/data1d/Spectrum1D';
2
+ import { maxAbsoluteValue } from './maxAbsoluteValue';
3
+ export function getClosePeak(spectrum, lookRange) {
4
+ const { from, to } = lookRange;
5
+ const datum = get1DDataXY(spectrum);
6
+ const maxIndex = datum.x.findIndex((number) => number >= to) - 1;
7
+ const minIndex = datum.x.findIndex((number) => number >= from);
8
+ const yDataRange = datum.y.slice(minIndex, maxIndex);
9
+ if (!yDataRange || yDataRange.length === 0)
10
+ return null;
11
+ const y = maxAbsoluteValue(yDataRange);
12
+ const xIndex = minIndex + yDataRange.indexOf(y);
13
+ const x = datum.x[xIndex];
14
+ return { x, y };
15
+ }
@@ -0,0 +1,3 @@
1
+ import { NumberArray } from 'cheminfo-types';
2
+ import { XGetFromToIndexOptions } from 'ml-spectra-processing';
3
+ export declare function maxAbsoluteValue(array: NumberArray, options?: XGetFromToIndexOptions): number;
@@ -0,0 +1,21 @@
1
+ import { xCheck, xGetFromToIndex, } from 'ml-spectra-processing';
2
+ //This function is an adapted version of the xMaxAbsoluteValue function from ml-spectra-processing. It identifies the maximum absolute value and returns the corresponding maximum value along with its sign
3
+ export function maxAbsoluteValue(array, options = {}) {
4
+ xCheck(array);
5
+ const { fromIndex, toIndex } = xGetFromToIndex(array, options);
6
+ let maxValue = array[fromIndex];
7
+ let sign = 1;
8
+ for (let i = fromIndex + 1; i <= toIndex; i++) {
9
+ if (array[i] >= 0) {
10
+ if (array[i] > maxValue) {
11
+ maxValue = array[i];
12
+ sign = 1;
13
+ }
14
+ }
15
+ else if (-array[i] > maxValue) {
16
+ maxValue = -array[i];
17
+ sign = Math.sign(array[i]);
18
+ }
19
+ }
20
+ return maxValue * sign;
21
+ }
@@ -5,7 +5,6 @@ export { initiateDatum1D } from './initiateDatum1D';
5
5
  export { changeIntegralsRelative } from './integrals/changeIntegralsRelative';
6
6
  export { isSpectrum1D } from './isSpectrum1D';
7
7
  export { autoPeakPicking } from './peaks/autoPeakPicking';
8
- export { lookupPeak } from './peaks/lookupPeak';
9
8
  export { optimizePeaks } from './peaks/optimizePeaks';
10
9
  export { addRange } from './ranges/addRange';
11
10
  export { changeRange } from './ranges/changeRange';
@@ -5,7 +5,6 @@ export { initiateDatum1D } from './initiateDatum1D';
5
5
  export { changeIntegralsRelative } from './integrals/changeIntegralsRelative';
6
6
  export { isSpectrum1D } from './isSpectrum1D';
7
7
  export { autoPeakPicking } from './peaks/autoPeakPicking';
8
- export { lookupPeak } from './peaks/lookupPeak';
9
8
  export { optimizePeaks } from './peaks/optimizePeaks';
10
9
  export { addRange } from './ranges/addRange';
11
10
  export { changeRange } from './ranges/changeRange';
@@ -19,9 +19,9 @@ export function initiateDatum1D(spectrum, options = {}) {
19
19
  ...get1DColor(spectrum, usedColors),
20
20
  };
21
21
  spectrumObj.info = {
22
- nucleus: '1H',
22
+ nucleus: '1H', // 1H, 13C, 19F, ...
23
23
  isFid: false,
24
- isComplex: false,
24
+ isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
25
25
  dimension: 1,
26
26
  ...spectrum.info,
27
27
  };
@@ -15,7 +15,7 @@ export function autoPeakPicking(spectrum, options) {
15
15
  direction,
16
16
  shape: { kind: 'lorentzian' },
17
17
  noiseLevel: noise * noiseFactor,
18
- minMaxRatio,
18
+ minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
19
19
  realTopDetection: true,
20
20
  smoothY: false,
21
21
  });
@@ -8,7 +8,7 @@ export function createRangeObj({ from, to, absolute, signals, }) {
8
8
  id: v4(),
9
9
  from,
10
10
  to,
11
- absolute,
11
+ absolute, // the real value,
12
12
  signals: signals.map((signal) => ({ id: v4(), ...signal })),
13
13
  kind: DATUM_KIND.signal,
14
14
  integration: 0,
@@ -14,7 +14,7 @@ export function detectRange(spectrum, options) {
14
14
  originalTo: to - shiftX,
15
15
  from,
16
16
  to,
17
- absolute,
17
+ absolute, // the real value,
18
18
  min,
19
19
  max,
20
20
  };
@@ -75,7 +75,7 @@ function getRange(min, max, length, exp) {
75
75
  const factors = [];
76
76
  factors[0] = 0;
77
77
  for (let i = 1; i <= length; i++) {
78
- factors[i] = factors[i - 1] + (exp - 1) / Math.pow(exp, i);
78
+ factors[i] = factors[i - 1] + (exp - 1) / exp ** i;
79
79
  }
80
80
  const lastFactor = factors[length];
81
81
  const result = new Array(length);
@@ -119,7 +119,7 @@ function getContours(zoomLevel, options) {
119
119
  const sanResult = calculateSanPlot('2D', data);
120
120
  const median = sanResult.positive;
121
121
  const max = Math.max(Math.abs(data.maxZ), Math.abs(data.minZ));
122
- let _range = getRange(median * 1 * Math.pow(2, zoomLevel), max, nbLevels, 2);
122
+ let _range = getRange(median * 1 * 2 ** zoomLevel, max, nbLevels, 2);
123
123
  if (negative) {
124
124
  _range = _range.map((value) => -value);
125
125
  }
@@ -33,9 +33,9 @@ export function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
33
33
  if (index === -1)
34
34
  index = 0;
35
35
  const info = {
36
- nucleus: datumInfo.nucleus[index],
36
+ nucleus: datumInfo.nucleus[index], // 1H, 13C, 19F, ...
37
37
  isFid: false,
38
- isComplex: false,
38
+ isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
39
39
  dimension: 1,
40
40
  };
41
41
  const data = getProjection(datum, index);
@@ -2,7 +2,7 @@ import { zoneToX } from 'ml-spectra-processing';
2
2
  import { initiateDatum1D } from '../../data1d/Spectrum1D';
3
3
  const BASE_INFO = {
4
4
  isFid: false,
5
- isComplex: false,
5
+ isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
6
6
  dimension: 1,
7
7
  };
8
8
  export function getSlice(spectrum, position, options = {}) {
@@ -21,11 +21,11 @@ export function getSlice(spectrum, position, options = {}) {
21
21
  if (yIndex < 0 || yIndex >= real.z.length)
22
22
  return;
23
23
  const infoX = {
24
- nucleus: info.nucleus[0],
24
+ nucleus: info.nucleus[0], // 1H, 13C, 19F, ...
25
25
  ...BASE_INFO,
26
26
  };
27
27
  const infoY = {
28
- nucleus: info.nucleus[1],
28
+ nucleus: info.nucleus[1], // 1H, 13C, 19F, ...
29
29
  ...BASE_INFO,
30
30
  };
31
31
  const dataX = initiateData(real.minX, real.maxX, xLength);
@@ -21,7 +21,7 @@ export function initiateDatum2D(spectrum, usedColors = {}) {
21
21
  nucleus: ['1H', '1H'],
22
22
  isFt: true,
23
23
  isFid: false,
24
- isComplex: false,
24
+ isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
25
25
  dimension: 2,
26
26
  ...spectrum.info,
27
27
  };
@@ -1,7 +1,9 @@
1
1
  export function mapErrors(errors) {
2
2
  const result = {};
3
3
  for (const error of errors) {
4
- result[error.row] = error.message;
4
+ if (error?.row) {
5
+ result[error.row] = error.message;
6
+ }
5
7
  }
6
8
  return result;
7
9
  }
@@ -1 +1 @@
1
- export default { version: 'v0.45.1-pre.1701344673' };
1
+ export default { version: 'v0.46.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.45.1-pre.1701344673",
4
+ "version": "0.46.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "url": "git+https://github.com/cheminfo/nmrium.git"
46
46
  },
47
47
  "volta": {
48
- "node": "20.8.1"
48
+ "node": "20.10.0"
49
49
  },
50
50
  "overrides": {
51
51
  "react": "$react",
@@ -56,7 +56,8 @@
56
56
  "react-dom": ">=18.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@blueprintjs/core": "^5.6.0",
59
+ "@blueprintjs/core": "^5.7.2",
60
+ "@blueprintjs/icons": "^5.5.0",
60
61
  "@emotion/react": "^11.11.1",
61
62
  "@emotion/styled": "^11.11.0",
62
63
  "@lukeed/uuid": "^2.0.1",
@@ -80,71 +81,71 @@
80
81
  "ml-baseline-correction-regression": "^1.0.2",
81
82
  "ml-conrec": "^5.0.2",
82
83
  "ml-gsd": "^12.1.3",
83
- "ml-matrix": "^6.10.8",
84
- "ml-spectra-processing": "^12.6.0",
84
+ "ml-matrix": "^6.11.0",
85
+ "ml-spectra-processing": "^12.8.0",
85
86
  "ml-stat": "^1.3.3",
86
87
  "multiplet-analysis": "^2.1.2",
87
88
  "nmr-correlation": "^2.3.3",
88
- "nmr-load-save": "^0.23.8",
89
- "nmr-processing": "^11.6.0",
90
- "nmredata": "^0.9.7",
89
+ "nmr-load-save": "^0.23.11",
90
+ "nmr-processing": "^11.6.1",
91
+ "nmredata": "^0.9.9",
91
92
  "numeral": "^2.0.6",
92
- "openchemlib": "^8.7.1",
93
- "openchemlib-utils": "^5.4.0",
93
+ "openchemlib": "^8.7.2",
94
+ "openchemlib-utils": "^5.6.1",
94
95
  "papaparse": "^5.4.1",
95
96
  "re-resizable": "6.9.11",
96
97
  "react-d3-utils": "^1.0.0",
97
98
  "react-dropzone": "^14.2.3",
98
99
  "react-error-boundary": "^4.0.11",
99
- "react-icons": "^4.11.0",
100
+ "react-icons": "^4.12.0",
100
101
  "react-inspector": "^6.0.2",
101
102
  "react-mf": "^2.0.2",
102
103
  "react-ocl": "^6.1.0",
103
104
  "react-ocl-nmr": "^3.0.1",
104
105
  "react-plot": "^1.4.2",
105
106
  "react-rnd": "^10.4.1",
106
- "react-science": "^0.27.0",
107
+ "react-science": "^0.32.1",
107
108
  "react-slider": "^2.0.6",
108
109
  "react-table": "^7.8.0",
109
110
  "react-transition-group": "^4.4.5",
110
- "react-use": "^17.4.0",
111
+ "react-use": "^17.4.2",
111
112
  "smart-array-filter": "^4.0.2",
112
113
  "yup": "^1.3.2"
113
114
  },
114
115
  "devDependencies": {
115
- "@babel/plugin-transform-modules-commonjs": "^7.23.0",
116
- "@babel/preset-react": "^7.22.15",
117
- "@babel/preset-typescript": "^7.23.2",
118
- "@playwright/test": "^1.39.0",
116
+ "@babel/plugin-transform-modules-commonjs": "^7.23.3",
117
+ "@babel/preset-react": "^7.23.3",
118
+ "@babel/preset-typescript": "^7.23.3",
119
+ "@playwright/test": "^1.40.1",
119
120
  "@simbathesailor/use-what-changed": "^2.0.0",
120
- "@types/d3": "^7.4.2",
121
- "@types/lodash": "^4.14.200",
122
- "@types/node": "^20.8.10",
123
- "@types/papaparse": "^5.3.10",
124
- "@types/react": "^18.2.36",
125
- "@types/react-dom": "^18.2.14",
126
- "@types/react-table": "^7.7.17",
127
- "@vitejs/plugin-react-swc": "^3.4.1",
128
- "@vitest/coverage-v8": "^0.34.6",
121
+ "@types/d3": "^7.4.3",
122
+ "@types/lodash": "^4.14.202",
123
+ "@types/node": "^20.10.4",
124
+ "@types/papaparse": "^5.3.14",
125
+ "@types/react": "^18.2.45",
126
+ "@types/react-dom": "^18.2.17",
127
+ "@types/react-table": "^7.7.18",
128
+ "@vitejs/plugin-react-swc": "^3.5.0",
129
+ "@vitest/coverage-v8": "^1.0.4",
129
130
  "cross-env": "^7.0.3",
130
- "cspell": "^7.3.8",
131
- "eslint": "^8.53.0",
132
- "eslint-config-cheminfo-react": "^10.0.0",
133
- "eslint-config-cheminfo-typescript": "^12.0.4",
131
+ "cspell": "^8.1.3",
132
+ "eslint": "^8.55.0",
133
+ "eslint-config-cheminfo-react": "^10.1.0",
134
+ "eslint-config-cheminfo-typescript": "^12.1.0",
134
135
  "modern-normalize": "^2.0.0",
135
136
  "postcss-styled-syntax": "^0.5.0",
136
- "prettier": "^3.0.3",
137
- "rc-menu": "^9.12.2",
137
+ "prettier": "^3.1.1",
138
+ "rc-menu": "^9.12.4",
138
139
  "react": "^18.2.0",
139
140
  "react-dom": "^18.2.0",
140
- "react-router-dom": "^6.18.0",
141
+ "react-router-dom": "^6.21.0",
141
142
  "rimraf": "^5.0.5",
142
143
  "rollup-plugin-analyzer": "^4.0.0",
143
144
  "serve": "^14.2.1",
144
- "stylelint": "^15.11.0",
145
- "stylelint-config-standard": "^34.0.0",
146
- "typescript": "^5.2.2",
147
- "vite": "^4.5.0",
148
- "vitest": "^0.34.6"
145
+ "stylelint": "^16.0.2",
146
+ "stylelint-config-standard": "^35.0.0",
147
+ "typescript": "^5.3.3",
148
+ "vite": "^5.0.8",
149
+ "vitest": "^1.0.4"
149
150
  }
150
151
  }
@@ -1,18 +0,0 @@
1
- import { ReactNode } from 'react';
2
- interface MenuItemProps {
3
- icon: ReactNode;
4
- label: string;
5
- onClick?: () => void;
6
- }
7
- interface MenuButtonProps {
8
- component: ReactNode;
9
- toolTip: string;
10
- items?: Array<MenuItemProps & {
11
- id: string;
12
- }>;
13
- onClick?: (element: MenuItemProps & {
14
- id: string;
15
- }) => void;
16
- }
17
- export default function ToolbarMenu({ component, toolTip, items, onClick, }: MenuButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
18
- export {};
@@ -1,102 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { useState, useCallback, useRef, useLayoutEffect, } from 'react';
5
- import { Toolbar } from 'react-science/ui';
6
- const menuStyles = css `
7
- .menu {
8
- box-shadow: 0 0 10px rgb(0 0 0 / 50%);
9
- margin: 0;
10
- border-radius: 5px;
11
- display: flex;
12
- flex-direction: column;
13
- position: absolute;
14
- z-index: 99999;
15
- padding: 2px;
16
- background-color: white;
17
-
18
- button:hover {
19
- background-color: #fafafa;
20
- }
21
- }
22
-
23
- .menu-cover {
24
- position: fixed;
25
- width: 100%;
26
- height: 100%;
27
- top: 0;
28
- left: 0;
29
- z-index: 1;
30
- }
31
-
32
- .menu-item {
33
- background-color: transparent;
34
- border: none;
35
- border-bottom: 0.55px solid whitesmoke;
36
- height: 35px;
37
- outline: outline;
38
- display: table-cell;
39
- vertical-align: middle;
40
- text-align: left;
41
- padding: 0 10px;
42
-
43
- svg {
44
- display: inline-block;
45
- }
46
-
47
- :focus {
48
- outline: none !important;
49
- }
50
-
51
- span {
52
- font-size: 10px;
53
- padding: 0 10px;
54
- }
55
- }
56
- `;
57
- function MenuItem({ icon, label, onClick }) {
58
- return (_jsxs("button", { type: "button", className: "menu-item", onClick: onClick, children: [icon, _jsx("span", { children: label })] }));
59
- }
60
- function MenuList({ items, boxBounding = { x: 0, y: 0, width: 0, height: 0 }, onClick, }) {
61
- const listRef = useRef();
62
- const [translate, setTranslate] = useState({
63
- x: boxBounding.width,
64
- y: boxBounding.height,
65
- });
66
- useLayoutEffect(() => {
67
- const boxSize = listRef.current.getBoundingClientRect();
68
- setTranslate((oldTransform) => {
69
- let y = boxBounding.height;
70
- if (boxSize.bottom > window.innerHeight) {
71
- y = boxBounding.height * 2 + (boxSize.bottom - window.innerHeight);
72
- }
73
- return {
74
- ...oldTransform,
75
- y,
76
- };
77
- });
78
- }, [boxBounding.height]);
79
- return (_jsx("div", { ref: listRef, className: "menu", style: {
80
- transform: `translate(${translate.x}px, -${translate.y}px) `,
81
- }, children: items?.map((item) => {
82
- return (_jsx(MenuItem, { ...item, onClick: () => onClick(item) }, item.id));
83
- }) }));
84
- }
85
- export default function ToolbarMenu({ component, toolTip = '', items = [], onClick = () => null, }) {
86
- const menuButtonRef = useRef(null);
87
- const [isShown, showMenu] = useState(false);
88
- const closeMenuButton = useCallback(() => {
89
- showMenu(false);
90
- }, []);
91
- const handleClick = useCallback(() => {
92
- showMenu((flag) => !flag);
93
- }, []);
94
- const clickHandler = useCallback((e) => {
95
- showMenu(false);
96
- onClick(e);
97
- }, [onClick]);
98
- const boxBounding = useCallback(() => {
99
- return menuButtonRef.current?.getBoundingClientRect();
100
- }, []);
101
- return (_jsxs("div", { style: { height: 'auto' }, css: menuStyles, children: [_jsx("div", { ref: menuButtonRef, children: _jsx(Toolbar.Item, { id: `menu-${toolTip}`, title: toolTip, active: isShown, onClick: handleClick, children: component }) }), isShown && (_jsx(MenuList, { items: items, boxBounding: boxBounding(), onClick: clickHandler })), isShown && _jsx("div", { className: "menu-cover", onClick: closeMenuButton })] }));
102
- }
@@ -1,13 +0,0 @@
1
- import { ReactElement } from 'react';
2
- interface ToggleButtonProps {
3
- isActive?: boolean;
4
- value?: any;
5
- onChange?: (value: any) => null;
6
- children: ReactElement;
7
- isVisible?: boolean;
8
- }
9
- export default function ToggleButton(props: ToggleButtonProps & {
10
- title: string;
11
- id: string;
12
- }): import("react/jsx-runtime").JSX.Element | null;
13
- export {};
@@ -1,24 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCallback, useState, useEffect } from 'react';
3
- import { Toolbar } from 'react-science/ui';
4
- export default function ToggleButton(props) {
5
- const { children, value = null, isActive = false, onChange = () => null, isVisible = true, id, title, } = props;
6
- const [active, setActive] = useState(props.isActive);
7
- const toggleButton = useCallback(() => {
8
- const _isActive = !active;
9
- setActive(_isActive);
10
- if (_isActive) {
11
- onChange(value);
12
- }
13
- else {
14
- onChange(null);
15
- }
16
- }, [active, onChange, value]);
17
- useEffect(() => {
18
- setActive(isActive);
19
- }, [isActive]);
20
- if (!isVisible) {
21
- return null;
22
- }
23
- return (_jsx(Toolbar.Item, { onClick: toggleButton, title: title, id: id, active: active, children: children }));
24
- }
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- interface ToggleButtonGroupProps {
3
- children: ReactNode;
4
- value: string;
5
- onChange?: (value: any) => void;
6
- }
7
- export default function ToggleButtonGroup({ children, value, onChange, }: ToggleButtonGroupProps): import("react/jsx-runtime").JSX.Element;
8
- export {};