nmrium 0.43.0 → 0.43.1-pre.1692874523

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  2. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  3. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
  4. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
  5. package/lib/component/2d/Viewer2D.js +1 -3
  6. package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -2
  7. package/lib/component/context/DispatchContext.d.ts +3 -1
  8. package/lib/component/elements/CounterLabel.d.ts +7 -0
  9. package/lib/component/elements/CounterLabel.js +12 -0
  10. package/lib/component/elements/EditableColumn.js +12 -6
  11. package/lib/component/elements/Input.d.ts +3 -12
  12. package/lib/component/elements/Input.js +24 -76
  13. package/lib/component/elements/Message.js +0 -1
  14. package/lib/component/elements/PreferencesButton.d.ts +4 -0
  15. package/lib/component/elements/PreferencesButton.js +6 -0
  16. package/lib/component/elements/formik/FormikInput.d.ts +2 -2
  17. package/lib/component/elements/formik/FormikInput.js +3 -6
  18. package/lib/component/header/Header.js +1 -1
  19. package/lib/component/header/ZeroFillingOptionsPanel.js +4 -4
  20. package/lib/component/main/InnerNMRiumContents.js +1 -2
  21. package/lib/component/modal/AlignSpectraModal.js +78 -29
  22. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
  23. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
  24. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  25. package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  26. package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
  27. package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
  28. package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  29. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  30. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  31. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  32. package/lib/component/modal/setting/settingsValidation.js +5 -1
  33. package/lib/component/panels/InformationPanel.js +9 -100
  34. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  35. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  36. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +10 -6
  37. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
  38. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  39. package/lib/component/panels/Panels.js +6 -7
  40. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  41. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  42. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  43. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  44. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  45. package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  46. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
  47. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
  48. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
  49. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
  50. package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
  51. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
  52. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
  53. package/lib/component/panels/header/DefaultPanelHeader.js +4 -10
  54. package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
  55. package/lib/component/reducer/IgnoreActions.js +1 -0
  56. package/lib/component/reducer/Reducer.d.ts +2 -2
  57. package/lib/component/reducer/Reducer.js +4 -2
  58. package/lib/component/reducer/actions/DomainActions.js +2 -3
  59. package/lib/component/reducer/actions/MoleculeActions.js +3 -3
  60. package/lib/component/reducer/actions/PreferencesActions.js +1 -2
  61. package/lib/component/reducer/actions/ToolsActions.js +10 -10
  62. package/lib/component/reducer/core/Constants.d.ts +0 -4
  63. package/lib/component/reducer/core/Constants.js +0 -5
  64. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
  65. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  66. package/lib/component/toolbar/ToolTypes.js +23 -24
  67. package/lib/data/constants/References.d.ts +5 -3
  68. package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
  69. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  70. package/lib/versionInfo.js +1 -1
  71. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  72. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
  73. package/lib-cjs/component/2d/Viewer2D.js +1 -3
  74. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +1 -2
  75. package/lib-cjs/component/elements/CounterLabel.js +16 -0
  76. package/lib-cjs/component/elements/EditableColumn.js +12 -6
  77. package/lib-cjs/component/elements/Input.js +23 -75
  78. package/lib-cjs/component/elements/Message.js +0 -1
  79. package/lib-cjs/component/elements/PreferencesButton.js +13 -0
  80. package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
  81. package/lib-cjs/component/header/Header.js +1 -1
  82. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +4 -4
  83. package/lib-cjs/component/main/InnerNMRiumContents.js +1 -2
  84. package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
  85. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
  86. package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
  87. package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  88. package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
  89. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  90. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  91. package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  92. package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  93. package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
  94. package/lib-cjs/component/panels/InformationPanel.js +7 -98
  95. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  96. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  97. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
  98. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  99. package/lib-cjs/component/panels/Panels.js +6 -7
  100. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  101. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  102. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  103. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  104. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  105. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  106. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
  107. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
  108. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
  109. package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
  110. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -9
  111. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +2 -2
  112. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  113. package/lib-cjs/component/reducer/Reducer.js +4 -2
  114. package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
  115. package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
  116. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
  117. package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
  118. package/lib-cjs/component/reducer/core/Constants.js +1 -6
  119. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
  120. package/lib-cjs/component/toolbar/ToolTypes.js +23 -24
  121. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  122. package/lib-cjs/versionInfo.js +1 -1
  123. package/package.json +3 -3
  124. /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
@@ -5,7 +5,6 @@ import { Accordion } from 'react-science/ui';
5
5
  import { useChartData } from '../context/ChartContext';
6
6
  import { usePreferences } from '../context/PreferencesContext';
7
7
  import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
8
- import { DISPLAYER_MODE } from '../reducer/core/Constants';
9
8
  import AutomaticAssignment from './AutomaticAssignment/AutomaticAssignment';
10
9
  import InformationPanel from './InformationPanel';
11
10
  import IntegralPanel from './IntegralsPanel/IntegralPanel';
@@ -39,7 +38,7 @@ const accordionItems = [
39
38
  title: 'Peaks',
40
39
  component: _jsx(PeaksPanel, {}),
41
40
  hidePreferenceKey: 'peaksPanel',
42
- mode: DISPLAYER_MODE.DM_1D,
41
+ mode: '1D',
43
42
  },
44
43
  {
45
44
  title: 'Processings',
@@ -51,13 +50,13 @@ const accordionItems = [
51
50
  title: 'Integrals',
52
51
  component: _jsx(IntegralPanel, {}),
53
52
  hidePreferenceKey: 'integralsPanel',
54
- mode: DISPLAYER_MODE.DM_1D,
53
+ mode: '1D',
55
54
  },
56
55
  {
57
56
  title: 'Ranges',
58
57
  component: _jsx(RangesPanel, {}),
59
58
  hidePreferenceKey: 'rangesPanel',
60
- mode: DISPLAYER_MODE.DM_1D,
59
+ mode: '1D',
61
60
  },
62
61
  {
63
62
  title: 'Multiple Spectra Analysis',
@@ -69,13 +68,13 @@ const accordionItems = [
69
68
  title: 'Matrix Generation',
70
69
  component: _jsx(MatrixGenerationPanel, {}),
71
70
  hidePreferenceKey: 'matrixGenerationPanel',
72
- mode: DISPLAYER_MODE.DM_1D,
71
+ mode: '1D',
73
72
  },
74
73
  {
75
74
  title: 'Zones',
76
75
  component: _jsx(ZonesPanel, {}),
77
76
  hidePreferenceKey: 'zonesPanel',
78
- mode: DISPLAYER_MODE.DM_2D,
77
+ mode: '2D',
79
78
  },
80
79
  {
81
80
  title: 'Summary',
@@ -111,7 +110,7 @@ const accordionItems = [
111
110
  title: 'Spectrum Simulation',
112
111
  component: _jsx(SpectrumSimulation, {}),
113
112
  hidePreferenceKey: 'simulationPanel',
114
- mode: DISPLAYER_MODE.DM_1D,
113
+ mode: '1D',
115
114
  },
116
115
  ];
117
116
  export const TOOLS_PANELS_ACCORDION = {
@@ -54,7 +54,7 @@ function PeaksTable({ activeTab, data }) {
54
54
  index: 3,
55
55
  Header: 'δ (ppm)',
56
56
  accessor: 'x',
57
- Cell: ({ row }) => (_jsx(EditableColumn, { value: formatNumber(row.original.x, peaksPreferences.deltaPPM.format), onSave: (event) => saveDeltaPPMRefsHandler(event, row.original), type: "number" })),
57
+ Cell: ({ row }) => (_jsx(EditableColumn, { value: formatNumber(row.original.x, peaksPreferences.deltaPPM.format), onSave: (event) => saveDeltaPPMRefsHandler(event, row.original), type: "number", validate: (val) => val !== '' })),
58
58
  },
59
59
  {
60
60
  showWhen: 'deltaHz.show',
@@ -17,6 +17,6 @@ function RelativeColumn({ row, rowSpanTags, onHover, format, }) {
17
17
  },
18
18
  });
19
19
  }
20
- return (_jsx("td", { ...rowSpanTags, ...onHover, children: _jsx(EditableColumn, { value: integralVal, onSave: saveHandler, type: "number", style: { padding: '0.1rem 0.4rem' } }) }));
20
+ return (_jsx("td", { ...rowSpanTags, ...onHover, children: _jsx(EditableColumn, { value: integralVal, onSave: saveHandler, validate: (val) => val !== '', type: "number", style: { padding: '0.1rem 0.4rem' } }) }));
21
21
  }
22
22
  export default RelativeColumn;
@@ -18,6 +18,6 @@ function SignalDeltaColumn({ row, onHover, format, rowSpanTags, }) {
18
18
  }
19
19
  if (!signal)
20
20
  return _jsx("td", { children: '' });
21
- return (_jsx("td", { ...rowSpanTags, ...onHover, children: !checkMultiplicity(signal.multiplicity, ['m']) ? (`${formatNumber(row.from, format)} - ${formatNumber(row.to, format)}`) : (_jsx(EditableColumn, { value: formatNumber(signal.delta, format), onSave: saveHandler, type: "number", style: { padding: '0.1rem 0.4rem' } })) }));
21
+ return (_jsx("td", { ...rowSpanTags, ...onHover, children: !checkMultiplicity(signal.multiplicity, ['m']) ? (`${formatNumber(row.from, format)} - ${formatNumber(row.to, format)}`) : (_jsx(EditableColumn, { value: formatNumber(signal.delta, format), onSave: saveHandler, type: "number", style: { padding: '0.1rem 0.4rem' }, validate: (val) => val !== '' })) }));
22
22
  }
23
23
  export default SignalDeltaColumn;
@@ -10,7 +10,6 @@ import { useAlert } from '../../elements/popup/Alert';
10
10
  import { useModal } from '../../elements/popup/Modal';
11
11
  import { useActiveSpectra } from '../../hooks/useActiveSpectra';
12
12
  import useSpectrum from '../../hooks/useSpectrum';
13
- import { DISPLAYER_MODE } from '../../reducer/core/Constants';
14
13
  import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
15
14
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
16
15
  import { SpectraAutomaticPickingButton } from '../header/SpectraAutomaticPickingButton';
@@ -82,7 +81,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
82
81
  });
83
82
  }
84
83
  const hasActiveSpectra = activeSpectra && activeSpectra?.length > 0;
85
- return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectra?.length, deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, showSettingButton: true, onSettingClick: onSettingClick, children: [_jsx(Button.BarButton, { toolTip: "Hide selected spectra", onClick: hideAllSpectrumsHandler, tooltipOrientation: "horizontal", disabled: !hasActiveSpectra, children: _jsx(FaEyeSlash, {}) }), _jsx(Button.BarButton, { onClick: showAllSpectrumsHandler, toolTip: "Show selected spectra", tooltipOrientation: "horizontal", disabled: !hasActiveSpectra, children: _jsx(FaEye, {}) }), displayerMode === DISPLAYER_MODE.DM_2D && activeSpectrum?.info.isFt && (_jsx(Button.BarButton, { toolTip: "Add missing projection", tooltipOrientation: "horizontal", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}) })), displayerMode === DISPLAYER_MODE.DM_1D && spectra.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Reset scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}) }), _jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Same top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}) })] })), _jsx(SpectraAutomaticPickingButton, {}), _jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Recolor spectra", onClick: recolorSpectraHandler, children: _jsx(IoColorPaletteOutline, {}) })] }));
84
+ return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectra?.length, deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, showSettingButton: true, onSettingClick: onSettingClick, children: [_jsx(Button.BarButton, { toolTip: "Hide selected spectra", onClick: hideAllSpectrumsHandler, tooltipOrientation: "horizontal", disabled: !hasActiveSpectra, children: _jsx(FaEyeSlash, {}) }), _jsx(Button.BarButton, { onClick: showAllSpectrumsHandler, toolTip: "Show selected spectra", tooltipOrientation: "horizontal", disabled: !hasActiveSpectra, children: _jsx(FaEye, {}) }), displayerMode === '2D' && activeSpectrum?.info.isFt && (_jsx(Button.BarButton, { toolTip: "Add missing projection", tooltipOrientation: "horizontal", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}) })), displayerMode === '1D' && spectra.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Reset scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}) }), _jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Same top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}) })] })), _jsx(SpectraAutomaticPickingButton, {}), _jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Recolor spectra", onClick: recolorSpectraHandler, children: _jsx(IoColorPaletteOutline, {}) })] }));
86
85
  }
87
86
  const MemoizedSpectraPanelHeader = memo(SpectraPanelHeaderInner);
88
87
  export default function SpectrumsTabs({ onSettingClick, }) {
@@ -178,9 +178,9 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
178
178
  }
179
179
  }, children: [getLabel(correlations, correlation), _jsx(ContextMenu, { ref: contextRef, context: contextMenu })] }), _jsx("td", { title: t, ...otherTableDataProps, children: getCorrelationDelta(correlation)
180
180
  ? getCorrelationDelta(correlation)?.toFixed(2)
181
- : '' }), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler })) : (_jsx("span", { style: equivalenceCellStyle, children: correlation.equivalence })) }), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount') })) : ('') }), _jsx("td", { title: t, ...otherTableDataProps,
181
+ : '' }), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler, validate: (val) => val !== '' })) : (_jsx("span", { style: equivalenceCellStyle, children: correlation.equivalence })) }), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount'), validate: (val) => val !== '' })) : ('') }), _jsx("td", { title: t, ...otherTableDataProps,
182
182
  style: { ...tableDataProps.style, borderRight: '1px solid' }, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.hybridization
183
183
  .map((hybrid) => `sp${hybrid}`)
184
- .join(','), style: correlation.edited.hybridization ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'hybridization') })) : ('') }), additionalColumnFields] }));
184
+ .join(','), style: correlation.edited.hybridization ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'hybridization'), validate: (val) => val !== '' })) : ('') }), additionalColumnFields] }));
185
185
  }
186
186
  export default CorrelationTableRow;
@@ -11,7 +11,6 @@ import { useDispatch } from '../../context/DispatchContext';
11
11
  import Select from '../../elements/Select';
12
12
  import ToolTip from '../../elements/ToolTip/ToolTip';
13
13
  import { useModal } from '../../elements/popup/Modal';
14
- import { DISPLAYER_MODE } from '../../reducer/core/Constants';
15
14
  import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
16
15
  import CorrelationTable from './CorrelationTable/CorrelationTable';
17
16
  import Overview from './Overview';
@@ -72,7 +71,7 @@ function SummaryPanel() {
72
71
  const xDomain1 = xDomain[1] * factor;
73
72
  const yDomain0 = yDomain[0] * factor;
74
73
  const yDomain1 = yDomain[1] * factor;
75
- if (displayerMode === DISPLAYER_MODE.DM_1D) {
74
+ if (displayerMode === '1D') {
76
75
  const firstLink1D = correlation.link.find((link) => getLinkDim(link) === 1);
77
76
  if (!firstLink1D) {
78
77
  return false;
@@ -97,7 +96,7 @@ function SummaryPanel() {
97
96
  return true;
98
97
  }
99
98
  }
100
- else if (displayerMode === DISPLAYER_MODE.DM_2D) {
99
+ else if (displayerMode === '2D') {
101
100
  if (!atomTypesInView.includes(correlation.atomType)) {
102
101
  return false;
103
102
  }
@@ -1,7 +1,6 @@
1
1
  import { Correlation, Link } from 'nmr-correlation';
2
2
  import { Spectrum2D, Spectrum } from 'nmr-load-save';
3
- import { ActiveSpectrum } from '../../../reducer/Reducer';
4
- import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
3
+ import { ActiveSpectrum, DisplayerMode } from '../../../reducer/Reducer';
5
4
  declare function getAtomType(nucleus: string): string;
6
5
  declare function getLabelColor(correlationData: any, correlation: any): string | null;
7
6
  declare function findSignalMatch1D(spectrum: Spectrum2D, link: Link, factor: number, xDomain0: number, xDomain1: number): boolean;
@@ -25,5 +24,5 @@ declare function getEditedCorrelations({ correlationDim1, correlationDim2, selec
25
24
  };
26
25
  };
27
26
  declare function convertValuesString(valuesString: string, key: 'protonsCount' | 'hybridization'): number[];
28
- declare function isInView(spectraData: Spectrum[], activeTab: string, activeSpectrum: ActiveSpectrum | null, xDomain: number[], yDomain: number[], displayerMode: DISPLAYER_MODE, correlation: Correlation): boolean;
27
+ declare function isInView(spectraData: Spectrum[], activeTab: string, activeSpectrum: ActiveSpectrum | null, xDomain: number[], yDomain: number[], displayerMode: DisplayerMode, correlation: Correlation): boolean;
29
28
  export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
@@ -4,7 +4,6 @@ import { addLink, buildCorrelation, buildLink, getLinkDelta, getLinkDim, removeL
4
4
  import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
5
5
  import { findSignal2D, findSpectrum, } from '../../../../data/utilities/FindUtilities';
6
6
  import isDefaultPathLength from '../../../modal/editZone/validation/isDefaultPathLength';
7
- import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
8
7
  import { ErrorColors } from '../CorrelationTable/Constants';
9
8
  function getAtomType(nucleus) {
10
9
  return nucleus.split(/\d+/)[1];
@@ -287,7 +286,7 @@ function isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, disp
287
286
  const xDomain1 = xDomain[1] * factor;
288
287
  const yDomain0 = yDomain[0] * factor;
289
288
  const yDomain1 = yDomain[1] * factor;
290
- if (displayerMode === DISPLAYER_MODE.DM_1D) {
289
+ if (displayerMode === '1D') {
291
290
  const firstLink1D = correlation.link.find((link) => getLinkDim(link) === 1);
292
291
  if (!firstLink1D) {
293
292
  return false;
@@ -312,7 +311,7 @@ function isInView(spectraData, activeTab, activeSpectrum, xDomain, yDomain, disp
312
311
  return true;
313
312
  }
314
313
  }
315
- else if (displayerMode === DISPLAYER_MODE.DM_2D) {
314
+ else if (displayerMode === '2D') {
316
315
  if (!atomTypesInView.includes(correlation.atomType)) {
317
316
  return false;
318
317
  }
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import lodashGet from 'lodash/get';
3
- import { Fragment, useCallback } from 'react';
4
3
  import { useDispatch } from '../../../context/DispatchContext';
5
4
  import EditableColumn from '../../../elements/EditableColumn';
6
5
  import { formatNumber } from '../../../utility/formatNumber';
@@ -9,8 +8,8 @@ function SignalDeltaColumn({ rowData, onHoverSignalX, onHoverSignalY, format, })
9
8
  const signalDeltaX = lodashGet(rowData, 'tableMetaInfo.signal.x.delta', null);
10
9
  const signalDeltaY = lodashGet(rowData, 'tableMetaInfo.signal.y.delta', null);
11
10
  const id = lodashGet(rowData, 'tableMetaInfo.signal.id', undefined);
12
- const saveXHandler = useCallback((event) => {
13
- const value = event.target.value;
11
+ function saveXHandler(event) {
12
+ const value = Number(event.target.value);
14
13
  dispatch({
15
14
  type: 'CHANGE_ZONE_SIGNAL_VALUE',
16
15
  payload: {
@@ -18,9 +17,9 @@ function SignalDeltaColumn({ rowData, onHoverSignalX, onHoverSignalY, format, })
18
17
  signal: { id, deltaX: value },
19
18
  },
20
19
  });
21
- }, [dispatch, id, rowData.id]);
22
- const saveYHandler = useCallback((event) => {
23
- const value = event.target.value;
20
+ }
21
+ function saveYHandler(event) {
22
+ const value = Number(event.target.value);
24
23
  dispatch({
25
24
  type: 'CHANGE_ZONE_SIGNAL_VALUE',
26
25
  payload: {
@@ -28,7 +27,7 @@ function SignalDeltaColumn({ rowData, onHoverSignalX, onHoverSignalY, format, })
28
27
  signal: { id, deltaY: value },
29
28
  },
30
29
  });
31
- }, [dispatch, id, rowData.id]);
32
- return (_jsxs(Fragment, { children: [_jsx("td", { ...onHoverSignalX, children: signalDeltaX !== null ? (_jsx(EditableColumn, { value: formatNumber(signalDeltaX, format.x), onSave: saveXHandler, type: "number", style: { padding: '0.1rem 0.4rem' } })) : ('') }), _jsx("td", { ...onHoverSignalY, children: signalDeltaY !== null ? (_jsx(EditableColumn, { value: formatNumber(signalDeltaY, format.y), onSave: saveYHandler, type: "number", style: { padding: '0.1rem 0.4rem' } })) : ('') })] }));
30
+ }
31
+ return (_jsxs(_Fragment, { children: [_jsx("td", { ...onHoverSignalX, children: signalDeltaX !== null ? (_jsx(EditableColumn, { value: formatNumber(signalDeltaX, format.x), onSave: saveXHandler, type: "number", style: { padding: '0.1rem 0.4rem' }, validate: (val) => val !== '' })) : ('') }), _jsx("td", { ...onHoverSignalY, children: signalDeltaY !== null ? (_jsx(EditableColumn, { value: formatNumber(signalDeltaY, format.y), onSave: saveYHandler, type: "number", style: { padding: '0.1rem 0.4rem' }, validate: (val) => val !== '' })) : ('') })] }));
33
32
  }
34
33
  export default SignalDeltaColumn;
@@ -1,9 +1,26 @@
1
1
  import { Database } from 'nmr-load-save';
2
+ import { DatabaseNMREntry } from 'nmr-processing';
2
3
  import { LocalDatabase } from '../../../data/data1d/database';
4
+ export type Databases = Array<LocalDatabase | Database>;
3
5
  export interface DatabaseInnerProps {
4
6
  nucleus: string;
5
7
  selectedTool: string;
6
- databases: Array<LocalDatabase | Database>;
8
+ databases: Databases;
7
9
  defaultDatabase: string;
8
10
  }
11
+ export interface DatabaseSearchKeywords {
12
+ solvent: string;
13
+ searchKeywords: string;
14
+ }
15
+ export interface DataBaseSearchResultEntry {
16
+ data: DatabaseNMREntry[];
17
+ databases: Array<{
18
+ key: string;
19
+ value: string;
20
+ }>;
21
+ solvents: Array<{
22
+ label: string;
23
+ value: string;
24
+ }>;
25
+ }
9
26
  export default function PeaksPanel(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -5,9 +5,6 @@ import { readFromWebSource, serializeNmriumState, } from 'nmr-load-save';
5
5
  import { mapRanges } from 'nmr-processing';
6
6
  import OCL from 'openchemlib/full';
7
7
  import { useCallback, useState, useRef, memo, useEffect, useMemo } from 'react';
8
- import { BsHexagon, BsHexagonFill } from 'react-icons/bs';
9
- import { FaICursor } from 'react-icons/fa';
10
- import { IoSearchOutline } from 'react-icons/io5';
11
8
  import { useAccordionContext } from 'react-science/ui';
12
9
  import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
13
10
  import { getSum } from '../../../data/data1d/Spectrum1D/SumManager';
@@ -15,15 +12,9 @@ import { initiateDatabase, prepareData, DATA_BASES, } from '../../../data/data1d
15
12
  import { useChartData } from '../../context/ChartContext';
16
13
  import { useDispatch } from '../../context/DispatchContext';
17
14
  import { usePreferences } from '../../context/PreferencesContext';
18
- import Button from '../../elements/Button';
19
- import Input from '../../elements/Input';
20
- import Select from '../../elements/Select';
21
- import ToggleButton from '../../elements/ToggleButton';
22
15
  import { useAlert } from '../../elements/popup/Alert';
23
16
  import { positions, transitions, useModal } from '../../elements/popup/Modal';
24
17
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
25
- import useToolsFunctions from '../../hooks/useToolsFunctions';
26
- import { DISPLAYER_MODE } from '../../reducer/core/Constants';
27
18
  import { options } from '../../toolbar/ToolTypes';
28
19
  import Events from '../../utility/Events';
29
20
  import { exportAsJSON } from '../../utility/export';
@@ -31,11 +22,11 @@ import nucleusToString from '../../utility/nucleusToString';
31
22
  import { PanelNoData } from '../PanelNoData';
32
23
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
33
24
  import NoTableData from '../extra/placeholder/NoTableData';
34
- import DefaultPanelHeader from '../header/DefaultPanelHeader';
35
25
  import PreferencesHeader from '../header/PreferencesHeader';
36
26
  import DatabasePreferences from './DatabasePreferences';
37
27
  import { DatabaseStructureSearchModal } from './DatabaseStructureSearchModal';
38
28
  import DatabaseTable from './DatabaseTable';
29
+ import { DatabaseSearchOptions } from './DatabaseSearchOptions';
39
30
  const emptyKeywords = {
40
31
  solvent: '-1',
41
32
  searchKeywords: '',
@@ -52,7 +43,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
52
43
  const alert = useAlert();
53
44
  const modal = useModal();
54
45
  const { item } = useAccordionContext('Databases');
55
- const { handleChangeOption } = useToolsFunctions();
56
46
  const format = useFormatNumberByNucleus(nucleus);
57
47
  const [isFlipped, setFlipStatus] = useState(false);
58
48
  const settingRef = useRef();
@@ -72,18 +62,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
72
62
  settingRef.current.saveSetting();
73
63
  setFlipStatus(false);
74
64
  }, []);
75
- const handleSearch = useCallback((input) => {
76
- if (typeof input === 'string' || input === -1) {
77
- const solvent = String(input);
78
- setKeywords((prevState) => ({ ...prevState, solvent }));
79
- }
80
- else {
81
- setKeywords((prevState) => ({
82
- ...prevState,
83
- searchKeywords: input.target.value,
84
- }));
85
- }
86
- }, []);
87
65
  const search = useCallback((solvents) => {
88
66
  const { solvent, searchKeywords } = keywords;
89
67
  if (databaseInstance.current) {
@@ -236,13 +214,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
236
214
  alert.error(`No jcamp file to save`);
237
215
  }
238
216
  }, [alert, result]);
239
- const clearHandler = useCallback(() => {
240
- setKeywords((prevState) => ({ ...prevState, searchKeywords: '' }));
241
- }, []);
242
- const enableFilterHandler = useCallback((flag) => {
243
- const tool = !flag ? options.zoom.id : options.databaseRangesSelection.id;
244
- handleChangeOption(tool);
245
- }, [handleChangeOption]);
246
217
  const searchByStructureHandler = (idCodeValue) => {
247
218
  setIdCode(idCodeValue);
248
219
  };
@@ -264,15 +235,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
264
235
  }
265
236
  }
266
237
  `,
267
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { showSettingButton: true, onSettingClick: settingsPanelHandler, canDelete: false, children: [_jsx(ToggleButton, { defaultValue: selectedTool === options.databaseRangesSelection.id, popupTitle: "Filter by select ranges", popupPlacement: "right", onClick: enableFilterHandler, children: _jsx(FaICursor, { style: {
268
- pointerEvents: 'none',
269
- fontSize: '12px',
270
- transform: 'rotate(90deg)',
271
- } }) }, `${selectedTool}`), _jsx(Select, { style: { flex: 2, marginLeft: '5px' }, items: databases, itemTextField: "label", itemValueField: "key", onChange: handleChangeDatabase, placeholder: "Select database", defaultValue: defaultDatabase }), _jsx(Select, { style: { flex: 1, margin: '0px 5px' }, items: result.solvents, placeholder: "Solvent", onChange: handleSearch, value: keywords.solvent }), _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: openSearchByStructure, style: { marginLeft: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
272
- fontSize: '14px',
273
- } })) : (_jsx(BsHexagonFill, { style: {
274
- fontSize: '14px',
275
- } })) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
238
+ ], children: [!isFlipped && (_jsx(DatabaseSearchOptions, { databases: databases, defaultDatabase: defaultDatabase, idCode: idCode, keywords: keywords, result: result, selectedTool: selectedTool, total: databaseInstance.current?.data.length || 0, onKeywordsChange: (options) => setKeywords((prevKeywords) => ({ ...prevKeywords, ...options })), onSettingClick: settingsPanelHandler, onStructureClick: openSearchByStructure, onDatabaseChange: handleChangeDatabase })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
276
239
  ? 'Please select a database'
277
240
  : 'Please add databases URL in the general preferences' }))) : (_jsx(DatabasePreferences, { ref: settingRef })) })] }));
278
241
  }
@@ -282,7 +245,7 @@ export default function PeaksPanel() {
282
245
  const { current } = usePreferences();
283
246
  const { data, defaultDatabase } = current.databases;
284
247
  const databases = DATA_BASES.concat(data.filter((datum) => datum.enabled));
285
- if (!activeTab || displayerMode !== DISPLAYER_MODE.DM_1D) {
248
+ if (!activeTab || displayerMode !== '1D') {
286
249
  return (_jsx(PanelNoData, { children: "Databases are only available when 1D experimental spectrum is displayed. It will automatically select the corresponding nucleus" }));
287
250
  }
288
251
  return (_jsx(MemoizedDatabasePanel, { nucleus: activeTab, selectedTool: selectedTool, databases: databases, defaultDatabase: defaultDatabase }));
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { DataBaseSearchResultEntry, DatabaseSearchKeywords, Databases } from './DatabasePanel';
3
+ type OnClick = React.ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
4
+ interface DatabaseSearchOptionsProps {
5
+ databases: Databases;
6
+ defaultDatabase: string;
7
+ keywords: DatabaseSearchKeywords;
8
+ result: DataBaseSearchResultEntry;
9
+ selectedTool: string;
10
+ idCode?: string;
11
+ total: number;
12
+ onKeywordsChange: (k: Partial<DatabaseSearchKeywords>) => void;
13
+ onSettingClick: OnClick;
14
+ onStructureClick: OnClick;
15
+ onDatabaseChange: (databaseKey: string) => void;
16
+ }
17
+ export declare function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, selectedTool, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }: DatabaseSearchOptionsProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BsHexagon, BsHexagonFill } from 'react-icons/bs';
3
+ import Button from '../../elements/Button';
4
+ import { CounterLabel } from '../../elements/CounterLabel';
5
+ import Input from '../../elements/Input';
6
+ import { PreferencesButton } from '../../elements/PreferencesButton';
7
+ import Select from '../../elements/Select';
8
+ import PanelHeader from '../header/PanelHeader';
9
+ import useToolsFunctions from '../../hooks/useToolsFunctions';
10
+ import { options } from '../../toolbar/ToolTypes';
11
+ import { createFilterLabel } from '../header/DefaultPanelHeader';
12
+ import { FaICursor } from 'react-icons/fa';
13
+ import { IoSearchOutline } from 'react-icons/io5';
14
+ import ToggleButton from '../../elements/ToggleButton';
15
+ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, selectedTool, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }) {
16
+ const { handleChangeOption } = useToolsFunctions();
17
+ function enableFilterHandler(flag) {
18
+ const tool = !flag ? options.zoom.id : options.databaseRangesSelection.id;
19
+ handleChangeOption(tool);
20
+ }
21
+ function handleSearch(input) {
22
+ if (typeof input === 'string' || input === -1) {
23
+ const solvent = String(input);
24
+ onKeywordsChange({ solvent });
25
+ }
26
+ else {
27
+ onKeywordsChange({
28
+ searchKeywords: input.target.value,
29
+ });
30
+ }
31
+ }
32
+ function clearHandler() {
33
+ onKeywordsChange({ searchKeywords: '' });
34
+ }
35
+ return (_jsxs(PanelHeader, { style: { flexDirection: 'column', alignItems: 'normal' }, children: [_jsxs("div", { style: {
36
+ display: 'flex',
37
+ justifyContent: 'space-between',
38
+ paddingBottom: '2px',
39
+ }, children: [_jsx(Select, { style: { flex: 6 }, items: databases, itemTextField: "label", itemValueField: "key", onChange: onDatabaseChange, placeholder: "Select database", defaultValue: defaultDatabase }), _jsx(Select, { style: { flex: 4, margin: '0px 5px' }, items: result.solvents, placeholder: "Solvent", onChange: handleSearch, value: keywords.solvent }), _jsxs("div", { style: {
40
+ display: 'flex',
41
+ alignItems: 'center',
42
+ flex: 2,
43
+ justifyContent: 'flex-end',
44
+ }, children: [_jsx(CounterLabel, { children: createFilterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToggleButton, { defaultValue: selectedTool === options.databaseRangesSelection.id, popupTitle: "Filter by select ranges", popupPlacement: "right", onClick: enableFilterHandler, children: _jsx(FaICursor, { style: {
45
+ pointerEvents: 'none',
46
+ fontSize: '12px',
47
+ transform: 'rotate(90deg)',
48
+ } }) }, `${selectedTool}`), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { margin: '0 5px', flex: 1 } }, 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
+ fontSize: '12px',
50
+ } })) : (_jsx(BsHexagonFill, { style: {
51
+ fontSize: '12px',
52
+ } })) })] })] }));
53
+ }
@@ -1,22 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FaRegTrashAlt, FaCog, FaFilter } from 'react-icons/fa';
2
+ import { FaRegTrashAlt, FaFilter } from 'react-icons/fa';
3
3
  import Button from '../../elements/Button';
4
4
  import ToggleButton from '../../elements/ToggleButton';
5
- import ToolTip from '../../elements/ToolTip/ToolTip';
6
5
  import PanelHeader from './PanelHeader';
6
+ import { PreferencesButton } from '../../elements/PreferencesButton';
7
+ import { CounterLabel } from '../../elements/CounterLabel';
7
8
  const styles = {
8
9
  leftContainer: {
9
10
  display: 'flex',
10
11
  flexDirection: 'row',
11
12
  flex: 1,
12
13
  },
13
- counterLabel: {
14
- margin: 0,
15
- textAlign: 'right',
16
- lineHeight: '22px',
17
- padding: '0 5px',
18
- whiteSpace: 'nowrap',
19
- },
20
14
  };
21
15
  export function createFilterLabel(total, counter) {
22
16
  if (typeof counter === 'boolean') {
@@ -25,6 +19,6 @@ export function createFilterLabel(total, counter) {
25
19
  return `[ ${counter}/${total} ]`;
26
20
  }
27
21
  function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
28
- return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && _jsx("p", { style: styles.counterLabel, children: counterLabel }), showSettingButton && (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onSettingClick, children: _jsx(FaCog, {}) }) }))] }));
22
+ return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && _jsx(CounterLabel, { children: counterLabel }), showSettingButton && _jsx(PreferencesButton, { onClick: onSettingClick })] }));
29
23
  }
30
24
  export default DefaultPanelHeader;
@@ -39,7 +39,7 @@ export default function PredictionPanel() {
39
39
  const settingRef = useRef();
40
40
  const { item: spectraPanelState, utils: { toggle: openSpectraPanel }, } = useAccordionContext('Spectra');
41
41
  const predictionPreferences = usePanelPreferences('prediction');
42
- const openMoleculeEditor = useMoleculeEditor(true);
42
+ const { modal, openMoleculeEditor } = useMoleculeEditor(true);
43
43
  const refreshSlider = useRef(false);
44
44
  useEffect(() => {
45
45
  if (Array.isArray(molecules) &&
@@ -120,5 +120,5 @@ export default function PredictionPanel() {
120
120
  ...styles.slider,
121
121
  height: height - 31,
122
122
  }, children: molIndex === currentIndex && (_jsx(StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : (_jsx(StructureEditor, { initialMolfile: molfile || '', width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
123
- } }) }), _jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Button.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && (_jsx(Button.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] }))] }));
123
+ } }) }), _jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Button.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && (_jsx(Button.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] })), modal] }));
124
124
  }
@@ -1,5 +1,6 @@
1
1
  const ignoreActions = new Set([
2
2
  'INITIALIZE_NMRIUM',
3
+ 'SECRET_THROW_ERROR',
3
4
  'APPLY_KEY_PREFERENCES',
4
5
  'BRUSH_END',
5
6
  'RESET_SELECTED_TOOL',
@@ -7,7 +7,6 @@ import { StateMoleculeExtended } from '../../data/molecules/Molecule';
7
7
  import { UsedColors } from '../../types/UsedColors';
8
8
  import { Action } from '../context/DispatchContext';
9
9
  import { Tool } from '../toolbar/ToolTypes';
10
- import { DISPLAYER_MODE } from './core/Constants';
11
10
  import { ZoomHistory } from './helper/ZoomHistoryManager';
12
11
  export interface ActiveSpectrum {
13
12
  id: string;
@@ -23,6 +22,7 @@ export declare const zoneStateInit: {
23
22
  showSignals: boolean;
24
23
  showPeaks: boolean;
25
24
  };
25
+ export type DisplayerMode = '1D' | '2D';
26
26
  export interface Margin {
27
27
  top: number;
28
28
  right: number;
@@ -146,7 +146,7 @@ export interface State {
146
146
  * displayer mode '1D' or '2D'
147
147
  * @default '1D'
148
148
  */
149
- displayerMode: DISPLAYER_MODE;
149
+ displayerMode: DisplayerMode;
150
150
  /**
151
151
  * unique key identifier per Displayer instance
152
152
  */
@@ -18,7 +18,6 @@ import * as SpectraAnalysisActions from './actions/SpectraAnalysisAction';
18
18
  import * as SpectrumsActions from './actions/SpectrumsActions';
19
19
  import * as ToolsActions from './actions/ToolsActions';
20
20
  import * as ZonesActions from './actions/ZonesActions';
21
- import { DISPLAYER_MODE } from './core/Constants';
22
21
  export const rangeStateInit = {
23
22
  showMultiplicityTrees: false,
24
23
  showRangesIntegrals: true,
@@ -85,7 +84,7 @@ export const getInitialState = () => ({
85
84
  },
86
85
  isLoading: false,
87
86
  keysPreferences: {},
88
- displayerMode: DISPLAYER_MODE.DM_1D,
87
+ displayerMode: '1D',
89
88
  correlations: {},
90
89
  displayerKey: '',
91
90
  zoom: {
@@ -379,6 +378,9 @@ function innerSpectrumReducer(draft, action) {
379
378
  return DatabaseActions.handleResurrectSpectrumFromJcamp(draft, action);
380
379
  case 'SET_AUTOMATIC_ASSIGNMENTS':
381
380
  return AssignmentsActions.handleSetAutomaticAssignments(draft, action);
381
+ case 'SECRET_THROW_ERROR': {
382
+ throw new Error('Error thrown in main reducer');
383
+ }
382
384
  default:
383
385
  }
384
386
  }
@@ -2,7 +2,6 @@ import { extent } from 'd3';
2
2
  import { get1DDataXY } from '../../../data/data1d/Spectrum1D/get1DDataXY';
3
3
  import { isSpectrum2D } from '../../../data/data2d/Spectrum2D';
4
4
  import nucleusToString from '../../utility/nucleusToString';
5
- import { DISPLAYER_MODE } from '../core/Constants';
6
5
  import { addToBrushHistory } from '../helper/ZoomHistoryManager';
7
6
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
8
7
  function getActiveData(draft) {
@@ -123,7 +122,7 @@ function setDomain(draft, options) {
123
122
  const { updateYDomain = true, isYDomainShared = true, updateXDomain = true, } = options || {};
124
123
  let domain;
125
124
  if (draft.view.spectra.activeTab) {
126
- if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
125
+ if (draft.displayerMode === '1D') {
127
126
  domain = getDomain(draft);
128
127
  }
129
128
  else {
@@ -136,7 +135,7 @@ function setDomain(draft, options) {
136
135
  // draft.originDomain = domain;
137
136
  if (updateYDomain) {
138
137
  draft.yDomain = domain.yDomain;
139
- if (draft.displayerMode === DISPLAYER_MODE.DM_1D && isYDomainShared) {
138
+ if (draft.displayerMode === '1D' && isYDomainShared) {
140
139
  draft.yDomains = Object.fromEntries(Object.keys(domain.yDomains).map((key) => {
141
140
  return [key, domain.yDomain];
142
141
  }));
@@ -5,7 +5,7 @@ import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumMan
5
5
  import { DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT, } from '../../../data/molecules/Molecule';
6
6
  import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
7
7
  import { generateColor } from '../../../data/utilities/generateColor';
8
- import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
8
+ import { MARGIN } from '../core/Constants';
9
9
  import { unlinkRange } from './RangesActions';
10
10
  import { setActiveTab } from './ToolsActions';
11
11
  import { unlinkZone } from './ZonesActions';
@@ -55,10 +55,10 @@ function handleSetMolecule(draft, action) {
55
55
  setMolecule(draft, action.payload);
56
56
  }
57
57
  function removeAssignments(draft, assignmentData) {
58
- if (draft.displayerMode === DISPLAYER_MODE.DM_1D) {
58
+ if (draft.displayerMode === '1D') {
59
59
  unlinkRange(draft, { assignmentData });
60
60
  }
61
- if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
61
+ if (draft.displayerMode === '2D') {
62
62
  unlinkZone(draft, { assignmentData });
63
63
  }
64
64
  }