nmrium 0.32.0 → 0.33.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 (116) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
  3. package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
  4. package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
  5. package/lib/component/1d/integral/IntegralIndicator.js +27 -0
  6. package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
  7. package/lib/component/1d/integral/IntegralResizable.js +69 -0
  8. package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
  9. package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
  10. package/lib/component/1d/ranges/Range.js +27 -50
  11. package/lib/component/1d/utilities/scale.js +2 -2
  12. package/lib/component/2d/Contours.js +61 -42
  13. package/lib/component/NMRium.d.ts +1 -1
  14. package/lib/component/NMRium.js +1 -1
  15. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  16. package/lib/component/elements/formik/FormikColorPicker.js +5 -8
  17. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  18. package/lib/component/elements/formik/FormikInput.js +8 -19
  19. package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
  20. package/lib/component/elements/formik/FormikOnChange.js +13 -10
  21. package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
  22. package/lib/component/elements/formik/FormikSlider.js +8 -11
  23. package/lib/component/hooks/useExport.js +1 -1
  24. package/lib/component/modal/ExportAsMatrixModal.js +1 -1
  25. package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  26. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  27. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
  28. package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
  29. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
  30. package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
  31. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
  32. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
  33. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  34. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
  35. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  36. package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  37. package/lib/component/reducer/Reducer.d.ts +18 -12
  38. package/lib/component/reducer/Reducer.js +23 -9
  39. package/lib/component/reducer/actions/PreferencesActions.js +16 -35
  40. package/lib/component/reducer/actions/RangesActions.js +6 -4
  41. package/lib/component/reducer/actions/SpectrumsActions.js +10 -4
  42. package/lib/component/reducer/actions/ToolsActions.js +7 -22
  43. package/lib/component/reducer/core/Constants.js +1 -1
  44. package/lib/component/utility/FileUtility.d.ts +1 -8
  45. package/lib/component/utility/FileUtility.js +2 -17
  46. package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
  47. package/lib/component/utility/{Export.js → export.js} +26 -49
  48. package/lib/component/utility/formatNumber.d.ts +6 -1
  49. package/lib/component/utility/formatNumber.js +4 -3
  50. package/lib/data/SpectraManager.d.ts +1 -2
  51. package/lib/data/SpectraManager.js +22 -55
  52. package/lib/data/data1d/filter1d/fft.js +21 -4
  53. package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
  54. package/lib/data/data2d/Spectrum2D/contours.js +132 -0
  55. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
  56. package/lib/data/types/common/Source.d.ts +1 -0
  57. package/lib/data/types/data2d/Data2D.d.ts +2 -0
  58. package/lib/data/types/data2d/Datum2D.d.ts +0 -1
  59. package/lib/versionInfo.js +1 -1
  60. package/lib-cjs/component/1d/Chart1D.js +1 -1
  61. package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
  62. package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
  63. package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
  64. package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
  65. package/lib-cjs/component/1d/ranges/Range.js +27 -50
  66. package/lib-cjs/component/1d/utilities/scale.js +2 -2
  67. package/lib-cjs/component/2d/Contours.js +60 -41
  68. package/lib-cjs/component/NMRium.js +2 -2
  69. package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
  70. package/lib-cjs/component/elements/formik/FormikInput.js +8 -19
  71. package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
  72. package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
  73. package/lib-cjs/component/hooks/useExport.js +6 -6
  74. package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
  75. package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
  76. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
  77. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
  78. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
  79. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
  80. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
  81. package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +2 -2
  82. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
  83. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
  84. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
  85. package/lib-cjs/component/reducer/Reducer.js +22 -8
  86. package/lib-cjs/component/reducer/actions/PreferencesActions.js +16 -35
  87. package/lib-cjs/component/reducer/actions/RangesActions.js +6 -4
  88. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +9 -3
  89. package/lib-cjs/component/reducer/actions/ToolsActions.js +7 -22
  90. package/lib-cjs/component/reducer/core/Constants.js +1 -1
  91. package/lib-cjs/component/utility/FileUtility.js +2 -18
  92. package/lib-cjs/component/utility/{Export.js → export.js} +50 -50
  93. package/lib-cjs/component/utility/formatNumber.js +4 -3
  94. package/lib-cjs/data/SpectraManager.js +23 -57
  95. package/lib-cjs/data/data1d/filter1d/fft.js +20 -3
  96. package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
  97. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
  98. package/lib-cjs/versionInfo.js +1 -1
  99. package/package.json +6 -6
  100. package/lib/component/1d/IntegralResizable.js +0 -72
  101. package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
  102. package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
  103. package/lib/data/data1d/Data1DManager.d.ts +0 -3
  104. package/lib/data/data1d/Data1DManager.js +0 -98
  105. package/lib/data/data2d/Data2DManager.d.ts +0 -3
  106. package/lib/data/data2d/Data2DManager.js +0 -34
  107. package/lib/data/types/data2d/Contour.d.ts +0 -4
  108. package/lib/data/types/data2d/Contour.js +0 -1
  109. package/lib/data/types/data2d/Contours.d.ts +0 -2
  110. package/lib/data/types/data2d/Contours.js +0 -1
  111. package/lib-cjs/component/1d/IntegralResizable.js +0 -77
  112. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
  113. package/lib-cjs/data/data1d/Data1DManager.js +0 -104
  114. package/lib-cjs/data/data2d/Data2DManager.js +0 -40
  115. package/lib-cjs/data/types/data2d/Contour.js +0 -2
  116. package/lib-cjs/data/types/data2d/Contours.js +0 -2
@@ -18,7 +18,7 @@ const styles = {
18
18
  color: 'red',
19
19
  },
20
20
  };
21
- const EDIT_SIGNAL_INFO_TEXT = `Focus on an input field and press Shift + Drag & Drop to draw a coupling constant in spectrum view.`;
21
+ const EDIT_SIGNAL_INFO_TEXT = `Focus on an input field and press Shift + Drag and Drop to draw a coupling constant in spectrum view.`;
22
22
  const ADD_SIGNAL_INFO_TEXT = `Focus on the input field and press Shift + Left mouse click to select new signal delta value in spectrum view.`;
23
23
  const InfoText = (props) => {
24
24
  const { value, type = 'info' } = props;
@@ -16,7 +16,7 @@ import { useAlert } from '../../elements/popup/Alert';
16
16
  import { positions, useModal } from '../../elements/popup/Modal';
17
17
  import PredictSpectraModal from '../../modal/PredictSpectraModal';
18
18
  import { ADD_MOLECULE, DELETE_MOLECULE, FLOAT_MOLECULE_OVER_SPECTRUM, } from '../../reducer/types/Types';
19
- import { copyPNGToClipboard, copyTextToClipboard, exportAsSVG, } from '../../utility/Export';
19
+ import { copyPNGToClipboard, copyTextToClipboard, exportAsSVG, } from '../../utility/export';
20
20
  const toolbarStyle = css `
21
21
  display: flex;
22
22
  flex-direction: row;
@@ -15,7 +15,7 @@ import { useModal } from '../../elements/popup/Modal';
15
15
  import AlignSpectraModal from '../../modal/AlignSpectraModal';
16
16
  import { RESET_SELECTED_TOOL } from '../../reducer/types/Types';
17
17
  import Events from '../../utility/Events';
18
- import { copyTextToClipboard } from '../../utility/Export';
18
+ import { copyTextToClipboard } from '../../utility/export';
19
19
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
20
20
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
21
21
  import PreferencesHeader from '../header/PreferencesHeader';
@@ -18,7 +18,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
18
18
  import CopyClipboardModal from '../../modal/CopyClipboardModal';
19
19
  import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
20
20
  import { ADD_RANGE, CHANGE_RANGES_SUM_FLAG, CHANGE_RANGE_SUM, DELETE_RANGE, SHOW_J_GRAPH, SHOW_MULTIPLICTY_TREES, SHOW_RANGES_INTEGRALS, } from '../../reducer/types/Types';
21
- import { copyHTMLToClipboard } from '../../utility/Export';
21
+ import { copyHTMLToClipboard } from '../../utility/export';
22
22
  import { getNumberOfDecimals } from '../../utility/formatNumber';
23
23
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
24
24
  import useEditRangeModal from './hooks/useEditRangeModal';
@@ -11,7 +11,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
11
11
  import useSpectrum from '../../hooks/useSpectrum';
12
12
  import { rangeStateInit } from '../../reducer/Reducer';
13
13
  import { UNLINK_RANGE } from '../../reducer/types/Types';
14
- import { copyTextToClipboard } from '../../utility/Export';
14
+ import { copyTextToClipboard } from '../../utility/export';
15
15
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
16
16
  import NoTableData from '../extra/placeholder/NoTableData';
17
17
  import PreferencesHeader from '../header/PreferencesHeader';
@@ -15,7 +15,6 @@ import RelativeColumn from './TableColumns/RelativeColumn';
15
15
  import SignalAssignmentsColumn from './TableColumns/SignalAssignmentsColumn';
16
16
  import SignalDeltaColumn from './TableColumns/SignalDeltaColumn';
17
17
  import SignalDeltaHzColumn from './TableColumns/SignalDeltaHzColumn';
18
- import useFormat from './TableColumns/format';
19
18
  const HighlightedRowStyle = css `
20
19
  background-color: #ff6f0057;
21
20
  `;
@@ -32,7 +31,6 @@ function RangesTableRow({ rowData, onUnlink, onContextMenu, preferences, info, }
32
31
  const highlightData = useHighlightData();
33
32
  const [unlinkRangeButtonVisibility, showUnlinkRangeButton] = useState(false);
34
33
  const [unlinkSignalButtonVisibility, showUnlinkSignalButton] = useState(false);
35
- const getFormat = useFormat(preferences);
36
34
  const rowSpanTags = useMemo(() => {
37
35
  return {
38
36
  rowSpan: rowData.tableMetaInfo.rowSpan,
@@ -110,6 +108,6 @@ function RangesTableRow({ rowData, onUnlink, onContextMenu, preferences, info, }
110
108
  ? ConstantlyHighlightedRowStyle
111
109
  : null;
112
110
  }, [assignmentRange.isActive, highlightRange.isActive, rowData]);
113
- return (_jsxs("tr", { onContextMenu: (e) => onContextMenu(e, rowData), css: trCss, children: [_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 }), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { rowData: rowData, onHoverSignal: onHoverSignal, deltaPPMFormat: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { rowData: rowData, onHoverSignal: onHoverSignal, deltaHzFormat: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { rowData: rowData, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { value: rowData.absolute, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: getFormat('absoluteFormat', undefined) })), _jsx("td", { ...onHoverSignal, children: lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') }), preferences.coupling.show && (_jsx(CouplingColumn, { rowData: rowData, onHoverSignal: onHoverSignal, format: preferences.coupling.format })), _jsx(SignalAssignmentsColumn, { rowData: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, unlinkVisibility: unlinkSignalButtonVisibility, onUnlinkVisibilityChange: (flag) => showUnlinkSignalButton(flag), onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { rowData: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, unlinkVisibility: unlinkRangeButtonVisibility, onUnlinkVisibilityChange: (flag) => showUnlinkRangeButton(flag), onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData }), _jsx(ActionsColumn, { rowData: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind })] }));
111
+ return (_jsxs("tr", { onContextMenu: (e) => onContextMenu(e, rowData), css: trCss, children: [_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 }), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { rowData: rowData, onHoverSignal: onHoverSignal, deltaPPMFormat: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { rowData: rowData, onHoverSignal: onHoverSignal, deltaHzFormat: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { rowData: rowData, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { value: rowData.absolute, rowSpanTags: rowSpanTags, onHoverRange: onHoverRange, format: preferences.absolute.format })), _jsx("td", { ...onHoverSignal, children: lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') }), preferences.coupling.show && (_jsx(CouplingColumn, { rowData: rowData, onHoverSignal: onHoverSignal, format: preferences.coupling.format })), _jsx(SignalAssignmentsColumn, { rowData: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, unlinkVisibility: unlinkSignalButtonVisibility, onUnlinkVisibilityChange: (flag) => showUnlinkSignalButton(flag), onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { rowData: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, unlinkVisibility: unlinkRangeButtonVisibility, onUnlinkVisibilityChange: (flag) => showUnlinkRangeButton(flag), onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData }), _jsx(ActionsColumn, { rowData: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind })] }));
114
112
  }
115
113
  export default RangesTableRow;
@@ -9,8 +9,8 @@ import Tabs from '../../elements/Tab/Tabs';
9
9
  import { useAlert } from '../../elements/popup/Alert';
10
10
  import { useActiveSpectrum } from '../../reducer/Reducer';
11
11
  import { CHANGE_PEAKS_MARKERS_VISIBILITY, SET_ACTIVE_TAB, CHANGE_VISIBILITY, CHANGE_ACTIVE_SPECTRUM, DELETE_SPECTRA, } from '../../reducer/types/Types';
12
- import { copyTextToClipboard } from '../../utility/Export';
13
12
  import groupByInfoKey from '../../utility/GroupByInfoKey';
13
+ import { copyTextToClipboard } from '../../utility/export';
14
14
  import SpectrumListItem from './SpectrumListItem';
15
15
  import SpectrumSetting from './base/setting/SpectrumSetting';
16
16
  function SpectrumsTabsInner({ data, activeSpectrum, activeTab, onTabChange, }) {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  interface Spectrum1DSettingProps {
3
3
  data: any;
4
- onSubmit: (values: any, helpers: any) => void;
4
+ onSubmit: (values: any) => void;
5
5
  }
6
6
  declare function Spectrum1DSetting({ data: SpectrumData, onSubmit, }: Spectrum1DSettingProps): JSX.Element;
7
7
  export default Spectrum1DSetting;
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import FormikColorPicker from '../../../../elements/formik/FormikColorPicker';
3
3
  import FormikForm from '../../../../elements/formik/FormikForm';
4
+ import FormikOnChange from '../../../../elements/formik/FormikOnChange';
4
5
  import Spectrum1DHistogram from './Spectrum1DHistogram';
5
6
  function Spectrum1DSetting({ data: SpectrumData, onSubmit, }) {
6
- return (_jsx(FormikForm, { initialValues: SpectrumData.display, onSubmit: onSubmit, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1.25rem' }, children: [_jsx("div", { style: { display: 'block', position: 'relative' }, children: _jsx(FormikColorPicker, { name: "color", triggerSubmit: true }) }), _jsx(Spectrum1DHistogram, { color: "red", data: SpectrumData.data })] }) }));
7
+ return (_jsxs(FormikForm, { initialValues: SpectrumData.display, onSubmit: onSubmit, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1.25rem' }, children: [_jsx("div", { style: { display: 'block', position: 'relative' }, children: _jsx(FormikColorPicker, { name: "color" }) }), _jsx(Spectrum1DHistogram, { color: "red", data: SpectrumData.data })] }), _jsx(FormikOnChange, { onChange: onSubmit })] }));
7
8
  }
8
9
  export default Spectrum1DSetting;
@@ -1,6 +1,6 @@
1
1
  interface Spectrum2DSettingProps {
2
2
  data: any;
3
- onSubmit: (values: any, helpers: any) => void;
3
+ onSubmit: (values: any) => void;
4
4
  }
5
5
  declare function Spectrum2DSetting({ data: SpectrumData, onSubmit, }: Spectrum2DSettingProps): import("@emotion/react/jsx-runtime").JSX.Element;
6
6
  export default Spectrum2DSetting;
@@ -4,6 +4,7 @@ import { css } from '@emotion/react';
4
4
  import FormikColorPicker from '../../../../elements/formik/FormikColorPicker';
5
5
  import FormikForm from '../../../../elements/formik/FormikForm';
6
6
  import FormikInput from '../../../../elements/formik/FormikInput';
7
+ import FormikOnChange from '../../../../elements/formik/FormikOnChange';
7
8
  import FormikSlider from '../../../../elements/formik/FormikSlider';
8
9
  import Spectrum2DHistogram from './Spectrum2DHistogram';
9
10
  const style = (color) => css `
@@ -14,6 +15,6 @@ const style = (color) => css `
14
15
  `;
15
16
  function Spectrum2DSetting({ data: SpectrumData, onSubmit, }) {
16
17
  const { positiveColor, negativeColor } = SpectrumData.display;
17
- return (_jsx(FormikForm, { initialValues: SpectrumData.display, onSubmit: onSubmit, children: _jsxs("div", { children: [_jsxs("div", { css: style(positiveColor), children: [_jsx("span", { style: { padding: '0 10px' }, children: "Positive" }), _jsx(FormikColorPicker, { name: "positiveColor", triggerSubmit: true }), _jsxs("div", { style: { padding: '5px' }, children: [_jsx("span", { className: "label", children: "contour Levels [ min - max ]" }), _jsx(FormikSlider, { name: "contourOptions.positive.contourLevels", triggerSubmit: true }), _jsx("span", { className: "label", children: "number of Layers " }), _jsx(FormikInput, { name: "contourOptions.positive.numberOfLayers", triggerSubmit: true, type: "number" })] })] }), _jsxs("div", { css: style(negativeColor), children: [_jsx("span", { style: { padding: '0 10px' }, children: "Negative" }), _jsx(FormikColorPicker, { name: "negativeColor", triggerSubmit: true }), _jsxs("div", { style: { padding: '5px' }, children: [_jsx("span", { className: "label", children: "contour Levels [ min - max ]" }), _jsx(FormikSlider, { name: "contourOptions.negative.contourLevels", triggerSubmit: true }), _jsx("span", { className: "label", children: "number of Layers " }), _jsx(FormikInput, { name: "contourOptions.negative.numberOfLayers", triggerSubmit: true, type: "number" })] })] }), _jsx(Spectrum2DHistogram, { data: SpectrumData.data })] }) }));
18
+ return (_jsxs(FormikForm, { initialValues: SpectrumData.display, children: [_jsxs("div", { children: [_jsxs("div", { css: style(positiveColor), children: [_jsx("span", { style: { padding: '0 10px' }, children: "Positive" }), _jsx(FormikColorPicker, { name: "positiveColor" }), _jsxs("div", { style: { padding: '5px' }, children: [_jsx("span", { className: "label", children: "contour Levels [ min - max ]" }), _jsx(FormikSlider, { name: "contourOptions.positive.contourLevels", debounceTime: 100 }), _jsx("span", { className: "label", children: "number of Layers " }), _jsx(FormikInput, { name: "contourOptions.positive.numberOfLayers", type: "number", debounceTime: 250 })] })] }), _jsxs("div", { css: style(negativeColor), children: [_jsx("span", { style: { padding: '0 10px' }, children: "Negative" }), _jsx(FormikColorPicker, { name: "negativeColor" }), _jsxs("div", { style: { padding: '5px' }, children: [_jsx("span", { className: "label", children: "contour Levels [ min - max ]" }), _jsx(FormikSlider, { name: "contourOptions.negative.contourLevels", debounceTime: 100 }), _jsx("span", { className: "label", children: "number of Layers " }), _jsx(FormikInput, { name: "contourOptions.negative.numberOfLayers", type: "number", debounceTime: 250 })] })] }), _jsx(Spectrum2DHistogram, { data: SpectrumData.data })] }), _jsx(FormikOnChange, { onChange: onSubmit })] }));
18
19
  }
19
20
  export default Spectrum2DSetting;
@@ -29,10 +29,13 @@ export default class ColumnsHelper {
29
29
  : this.defaultPreference[formatKey];
30
30
  const { formatPrefix = '', formatSuffix = '', showPrefixSuffixCallback = () => true, } = options;
31
31
  if (showPrefixSuffixCallback(row)) {
32
- return formatNumber(row.original[columnKey], format, formatPrefix, formatSuffix);
32
+ return formatNumber(row.original[columnKey], format, {
33
+ prefix: formatPrefix,
34
+ suffix: formatSuffix,
35
+ });
33
36
  }
34
37
  else {
35
- return formatNumber(row.original[columnKey], format, '', '');
38
+ return formatNumber(row.original[columnKey], format);
36
39
  }
37
40
  });
38
41
  }
@@ -1,8 +1,8 @@
1
1
  import { CorrelationData } from 'nmr-correlation';
2
2
  import { SpectraAnalysis } from '../../data/data1d/MultipleAnalysis';
3
3
  import { ApodizationOptions } from '../../data/data1d/filter1d/apodization';
4
+ import { ContoursLevels } from '../../data/data2d/Spectrum2D/contours';
4
5
  import { FloatingMolecules, StateMoleculeExtended } from '../../data/molecules/Molecule';
5
- import { Contours } from '../../data/types/data2d/Contours';
6
6
  import { UsedColors } from '../../types/UsedColors';
7
7
  import { Spectra } from '../NMRium';
8
8
  import { DISPLAYER_MODE } from './core/Constants';
@@ -68,6 +68,9 @@ export interface ViewState {
68
68
  */
69
69
  activeTab: string;
70
70
  };
71
+ zoom: {
72
+ levels: ContoursLevels;
73
+ };
71
74
  }
72
75
  export declare const rangeStateInit: {
73
76
  showMultiplicityTrees: boolean;
@@ -102,10 +105,6 @@ export interface State {
102
105
  * spectra list (1d and 2d)
103
106
  */
104
107
  data: Spectra;
105
- /**
106
- * calculated contours for 2d spectra
107
- */
108
- contours: Contours;
109
108
  /**
110
109
  * snapshot of the spectra data once phase correction activated
111
110
  *
@@ -306,6 +305,7 @@ export declare const spectrumReducer: (base: {
306
305
  readonly data: readonly ({
307
306
  readonly id: string;
308
307
  readonly source: {
308
+ readonly jcamp: string;
309
309
  readonly jcampURL: string;
310
310
  readonly jcampSpectrumIndex: number;
311
311
  readonly file: File;
@@ -784,6 +784,7 @@ export declare const spectrumReducer: (base: {
784
784
  } | {
785
785
  readonly id: string;
786
786
  readonly source: {
787
+ readonly jcamp: string;
787
788
  readonly jcampURL: string;
788
789
  readonly jcampSpectrumIndex: number;
789
790
  readonly file: File;
@@ -827,15 +828,19 @@ export declare const spectrumReducer: (base: {
827
828
  readonly z: readonly (readonly number[])[];
828
829
  readonly minX: number;
829
830
  readonly minY: number;
831
+ readonly minZ: number;
830
832
  readonly maxX: number;
831
833
  readonly maxY: number;
834
+ readonly maxZ: number;
832
835
  };
833
836
  readonly originalData?: {
834
837
  readonly z: readonly (readonly number[])[];
835
838
  readonly minX: number;
836
839
  readonly minY: number;
840
+ readonly minZ: number;
837
841
  readonly maxX: number;
838
842
  readonly maxY: number;
843
+ readonly maxZ: number;
839
844
  } | undefined;
840
845
  readonly zones: {
841
846
  readonly values: readonly {
@@ -902,14 +907,7 @@ export declare const spectrumReducer: (base: {
902
907
  readonly flag: boolean;
903
908
  readonly value: any;
904
909
  }[];
905
- readonly processingController: any;
906
910
  })[];
907
- readonly contours: {
908
- readonly [x: string]: {
909
- readonly negative: readonly (readonly number[])[];
910
- readonly positive: readonly (readonly number[])[];
911
- };
912
- };
913
911
  readonly tempData: any;
914
912
  readonly xDomain: readonly number[];
915
913
  readonly yDomain: readonly number[];
@@ -984,6 +982,14 @@ export declare const spectrumReducer: (base: {
984
982
  };
985
983
  readonly activeTab: string;
986
984
  };
985
+ readonly zoom: {
986
+ readonly levels: {
987
+ readonly [x: string]: {
988
+ readonly positive: number;
989
+ readonly negative: number;
990
+ };
991
+ };
992
+ };
987
993
  };
988
994
  readonly verticalAlign: {
989
995
  readonly align: VerticalAlignment;
@@ -1,9 +1,10 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
2
  import { produce } from 'immer';
3
3
  import { buildCorrelationData } from 'nmr-correlation';
4
- import { read as readDropFiles, migrate } from 'nmr-load-save';
4
+ import { read as readDropFiles, readNMRiumObject } from 'nmr-load-save';
5
5
  import { predictSpectra } from '../../data/PredictionManager';
6
- import * as SpectraManager from '../../data/SpectraManager';
6
+ import { initiateDatum1D } from '../../data/data1d/Spectrum1D';
7
+ import { initiateDatum2D } from '../../data/data2d/Spectrum2D';
7
8
  import { useChartData } from '../context/ChartContext';
8
9
  import { DefaultTolerance } from '../panels/SummaryPanel/CorrelationTable/Constants';
9
10
  import { options } from '../toolbar/ToolTypes';
@@ -41,7 +42,6 @@ export const zoneStateInit = {
41
42
  export const getInitialState = () => ({
42
43
  actionType: '',
43
44
  data: [],
44
- contours: {},
45
45
  tempData: null,
46
46
  xDomain: [],
47
47
  yDomain: [],
@@ -60,7 +60,7 @@ export const getInitialState = () => ({
60
60
  margin: {
61
61
  top: 10,
62
62
  right: 20,
63
- bottom: 70,
63
+ bottom: 50,
64
64
  left: 0,
65
65
  },
66
66
  mode: 'RTL',
@@ -70,6 +70,9 @@ export const getInitialState = () => ({
70
70
  ranges: [],
71
71
  zones: [],
72
72
  spectra: { activeSpectra: {}, activeTab: '' },
73
+ zoom: {
74
+ levels: {},
75
+ },
73
76
  },
74
77
  verticalAlign: {
75
78
  align: 'bottom',
@@ -131,14 +134,25 @@ export function initState(state) {
131
134
  };
132
135
  }
133
136
  export function dispatchMiddleware(dispatch) {
134
- const usedColors = { '1d': [], '2d': [] };
137
+ let usedColors = { '1d': [], '2d': [] };
135
138
  return (action) => {
136
139
  switch (action.type) {
137
140
  case types.INITIATE: {
138
141
  if (action.payload) {
139
- const { spectra, ...res } = migrate(action.payload);
140
- void SpectraManager.fromJSON(spectra, usedColors).then((data) => {
141
- action.payload = { spectra: data, ...res, usedColors };
142
+ usedColors = { '1d': [], '2d': [] };
143
+ void readNMRiumObject(action.payload).then((data) => {
144
+ const { spectra: spectraIn } = data;
145
+ const spectra = [];
146
+ for (let spectrum of spectraIn) {
147
+ const { info } = spectrum;
148
+ if (info.dimension === 1) {
149
+ spectra.push(initiateDatum1D(spectrum, usedColors));
150
+ }
151
+ else if (info.dimension === 2) {
152
+ spectra.push(initiateDatum2D(spectrum, usedColors));
153
+ }
154
+ }
155
+ action.payload = { ...data, usedColors, spectra };
142
156
  dispatch(action);
143
157
  });
144
158
  }
@@ -147,7 +161,7 @@ export function dispatchMiddleware(dispatch) {
147
161
  case types.LOAD_DROP_FILES: {
148
162
  const { fileCollection } = action;
149
163
  action.usedColors = usedColors;
150
- readDropFiles(fileCollection, usedColors)
164
+ readDropFiles(fileCollection)
151
165
  .then((data) => {
152
166
  action.data = data;
153
167
  dispatch(action);
@@ -1,4 +1,3 @@
1
- import cloneDeep from 'lodash/cloneDeep';
2
1
  import groupByInfoKey from '../../utility/GroupByInfoKey';
3
2
  import nucleusToString from '../../utility/nucleusToString';
4
3
  import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from '../core/Constants';
@@ -55,16 +54,12 @@ function changeSpectrumVerticalAlignment(draft, options) {
55
54
  }
56
55
  function setKeyPreferencesHandler(draft, keyCode) {
57
56
  const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
57
+ const { spectra: { activeTab }, } = view;
58
58
  const activeSpectrum = getActiveSpectrum(draft);
59
- if (view.spectra.activeTab) {
59
+ if (activeTab) {
60
60
  const groupByNucleus = groupByInfoKey('nucleus');
61
61
  const spectrumsGroupsList = groupByNucleus(data);
62
- const level = displayerMode === DISPLAYER_MODE.DM_2D
63
- ? spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
64
- acc[datum.id] = datum.processingController.getLevel();
65
- return acc;
66
- }, {})
67
- : null;
62
+ const spectra = spectrumsGroupsList[activeTab];
68
63
  draft.keysPreferences[keyCode] = {
69
64
  activeSpectrum,
70
65
  displayerMode,
@@ -75,29 +70,25 @@ function setKeyPreferencesHandler(draft, keyCode) {
75
70
  yDomain,
76
71
  yDomains,
77
72
  originDomain,
78
- level,
79
73
  margin,
80
- data: spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
81
- acc[datum.id] = {
82
- display: {
83
- color: datum.display.color,
84
- isVisible: datum.display.isVisible,
85
- isPeaksMarkersVisible: datum.display.isPeaksMarkersVisible,
86
- },
87
- };
88
- return acc;
89
- }, {}),
74
+ data: spectra,
90
75
  };
91
76
  }
92
77
  }
78
+ function setSpectraDisplayPreferences(draft, preferences) {
79
+ draft.data.forEach((datum, index) => {
80
+ if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
81
+ draft.data[index].display = {
82
+ ...datum.display,
83
+ ...preferences.data[datum.id].display,
84
+ };
85
+ }
86
+ });
87
+ }
93
88
  function applyKeyPreferencesHandler(draft, keyCode) {
94
89
  const preferences = draft.keysPreferences[keyCode];
95
90
  if (preferences) {
96
- draft.data.forEach((datum, index) => {
97
- if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
98
- draft.data[index].display = Object.assign(cloneDeep(datum.display), preferences.data[datum.id].display);
99
- }
100
- });
91
+ setSpectraDisplayPreferences(draft, preferences);
101
92
  draft.view = preferences.view;
102
93
  draft.displayerMode = preferences.displayerMode;
103
94
  draft.margin = preferences.margin;
@@ -107,17 +98,7 @@ function applyKeyPreferencesHandler(draft, keyCode) {
107
98
  draft.yDomain = preferences.yDomain;
108
99
  draft.originDomain = preferences.originDomain;
109
100
  draft.yDomains = preferences.yDomains;
110
- if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
111
- for (const datumID of Object.keys(preferences.level)) {
112
- const { levelPositive, levelNegative } = preferences.level[datumID];
113
- const index = draft.data.findIndex((datum) => datum.id === datumID);
114
- const processController = draft.data[index]
115
- .processingController;
116
- processController.setLevel(levelPositive, levelNegative);
117
- draft.contours[datumID] = processController.drawContours();
118
- }
119
- }
120
- else {
101
+ if (draft.displayerMode !== DISPLAYER_MODE.DM_2D) {
121
102
  draft.zoom = preferences.zoom;
122
103
  }
123
104
  }
@@ -269,15 +269,17 @@ function handleAddRange(draft, action) {
269
269
  }
270
270
  function handleChangeRangeRelativeValue(draft, action) {
271
271
  const data = action.payload.data;
272
- if (draft.activeSpectrum?.id) {
273
- const { index } = draft.activeSpectrum;
272
+ const activeSpectrum = getActiveSpectrum(draft);
273
+ if (activeSpectrum?.id) {
274
+ const { index } = activeSpectrum;
274
275
  changeRangeRelativeValue(draft.data[index], data);
275
276
  }
276
277
  }
277
278
  function handleChangeRangeSignalValue(draft, action) {
278
279
  const { rangeID, signalID, value } = action.payload;
279
- if (draft.activeSpectrum?.id) {
280
- const { index } = draft.activeSpectrum;
280
+ const activeSpectrum = getActiveSpectrum(draft);
281
+ if (activeSpectrum?.id) {
282
+ const { index } = activeSpectrum;
281
283
  const shift = changeRangeSignal(draft.data[index], {
282
284
  rangeID,
283
285
  signalID,
@@ -2,7 +2,8 @@ import { original } from 'immer';
2
2
  import * as Filters from '../../../data/Filters';
3
3
  import { applyFilter } from '../../../data/FiltersManager';
4
4
  import { generateSpectrumFromPublicationString, getReferenceShift, } from '../../../data/data1d/Spectrum1D';
5
- import { getMissingProjection } from '../../../data/data2d/Spectrum2D';
5
+ import { getMissingProjection, isSpectrum2D, } from '../../../data/data2d/Spectrum2D';
6
+ import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
6
7
  import { options } from '../../toolbar/ToolTypes';
7
8
  import groupByInfoKey from '../../utility/GroupByInfoKey';
8
9
  import { setZoom } from '../helper/Zoom1DManager';
@@ -115,10 +116,15 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
115
116
  }
116
117
  }
117
118
  function changeSpectrumSetting(draft, { id, display }) {
118
- const state = original(draft);
119
- const index = state.data.findIndex((d) => d.id === id);
119
+ const index = draft.data.findIndex((d) => d.id === id);
120
120
  if (index !== -1) {
121
- draft.data[index].display = display;
121
+ const spectrum = draft.data[index];
122
+ spectrum.display = display;
123
+ if (isSpectrum2D(spectrum)) {
124
+ const contoursLevels = draft.view.zoom.levels;
125
+ const { checkLevel } = contoursManager(spectrum.id, contoursLevels, spectrum.display.contourOptions);
126
+ contoursLevels[spectrum.id] = checkLevel();
127
+ }
122
128
  }
123
129
  }
124
130
  function handleChangeSpectrumColor(draft, { id, color, key }) {
@@ -1,6 +1,7 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
2
  import { original } from 'immer';
3
3
  import { xFindClosestIndex } from 'ml-spectra-processing';
4
+ import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
4
5
  import { getYScale, getXScale } from '../../1d/utilities/scale';
5
6
  import { LAYOUT } from '../../2d/utilities/DimensionLayout';
6
7
  import { get2DYScale } from '../../2d/utilities/scale';
@@ -12,6 +13,7 @@ import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
12
13
  import zoomHistoryManager from '../helper/ZoomHistoryManager';
13
14
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
14
15
  import { getActiveSpectrumOrFail } from '../helper/getActiveSpectrumOrFail';
16
+ import { getSpectrum } from '../helper/getSpectrum';
15
17
  import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
16
18
  import { calculateBaseLineCorrection, resetSpectrumByFilter, setFilterChanges, } from './FiltersActions';
17
19
  import { changeSpectrumVerticalAlignment } from './PreferencesActions';
@@ -275,15 +277,6 @@ function setMargin(draft) {
275
277
  draft.margin = MARGIN['1D'];
276
278
  }
277
279
  }
278
- function processing2DData(draft, data) {
279
- if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
280
- let _data = {};
281
- for (const datum of data[draft.view.spectra.activeTab]) {
282
- _data[datum.id] = datum.processingController.drawContours();
283
- }
284
- draft.contours = _data;
285
- }
286
- }
287
280
  function setDisplayerMode(draft, data) {
288
281
  draft.displayerMode =
289
282
  data && data.some((d) => d.info.dimension === 2)
@@ -354,7 +347,6 @@ function setActiveTab(draft, options) {
354
347
  const currentTab = !tab || !tabs.includes(tab || '') ? tabs[0] : tab;
355
348
  setTab(draft, dataGroupByNucleus, currentTab, refreshActiveTab);
356
349
  resetTool(draft);
357
- processing2DData(draft, dataGroupByNucleus);
358
350
  setDomain(draft, domainOptions);
359
351
  setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
360
352
  const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
@@ -371,20 +363,13 @@ function handelSetActiveTab(draft, tab) {
371
363
  }
372
364
  }
373
365
  function levelChangeHandler(draft, { deltaY, shiftKey }) {
374
- const activeSpectrum = getActiveSpectrum(draft);
366
+ const activeSpectrum = getSpectrum(draft);
375
367
  try {
376
368
  if (activeSpectrum?.id) {
377
- const { index, id } = activeSpectrum;
378
- const processingController = draft.data[index]
379
- .processingController;
380
- if (shiftKey) {
381
- processingController.shiftWheel(deltaY);
382
- }
383
- else {
384
- processingController.wheel(deltaY);
385
- }
386
- const contours = Object.freeze(processingController.drawContours());
387
- draft.contours[id] = contours;
369
+ const { levels } = draft.view.zoom;
370
+ const contourOptions = activeSpectrum.display.contourOptions;
371
+ const zoom = contoursManager(activeSpectrum.id, levels, contourOptions);
372
+ draft.view.zoom.levels[activeSpectrum.id] = zoom.wheel(deltaY, shiftKey);
388
373
  }
389
374
  }
390
375
  catch (e) {
@@ -9,7 +9,7 @@ export const MARGIN = {
9
9
  '1D': {
10
10
  top: 10,
11
11
  right: 10,
12
- bottom: 70,
12
+ bottom: 50,
13
13
  left: 10,
14
14
  },
15
15
  };
@@ -31,11 +31,4 @@ declare function extractFileMetaFromPath(path: any): {
31
31
  declare function loadFiles<T = unknown>(acceptedFiles: any, options?: {
32
32
  asBuffer?: boolean;
33
33
  }): Promise<T[]>;
34
- declare function loadFilesFromZip(files: any, options?: {
35
- asBuffer?: boolean;
36
- }): Promise<{
37
- binary: any;
38
- name: string;
39
- extension: string;
40
- }[]>;
41
- export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
34
+ export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
@@ -12,6 +12,7 @@ export const FILES_SIGNATURES = {
12
12
  ZIP: '504b0304',
13
13
  };
14
14
  function getFileSignature(fileArrayBuffer) {
15
+ // eslint-disable-next-line no-restricted-properties
15
16
  return new Uint8Array(fileArrayBuffer)
16
17
  .slice(0, 4)
17
18
  .reduce((acc, byte) => (acc += byte.toString(16).padStart(2, '0')), '');
@@ -68,20 +69,4 @@ function loadFiles(acceptedFiles, options = {}) {
68
69
  });
69
70
  }));
70
71
  }
71
- async function loadFilesFromZip(files, options = {}) {
72
- const result = [];
73
- for (const file of files) {
74
- try {
75
- const binary = await file.async(options.asBuffer ? 'uint8array' : 'text');
76
- const name = getFileName(file.name);
77
- const extension = getFileExtension(file.name);
78
- result.push({ binary, name, extension });
79
- }
80
- catch (e) {
81
- // eslint-disable-next-line no-console
82
- console.error(e);
83
- }
84
- }
85
- return result;
86
- }
87
- export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
72
+ export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };