nmrium 0.53.0 → 0.55.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 (178) hide show
  1. package/lib/component/1d/Viewer1D.js +48 -17
  2. package/lib/component/1d/XAxis.js +1 -1
  3. package/lib/component/1d/integral/IntegralsSeries.js +2 -2
  4. package/lib/component/1d/integral/Integration.d.ts +3 -1
  5. package/lib/component/1d/integral/Integration.js +3 -2
  6. package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
  7. package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
  8. package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
  9. package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
  10. package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
  11. package/lib/component/1d/ranges/Atoms.js +4 -5
  12. package/lib/component/1d/ranges/Range.js +62 -12
  13. package/lib/component/1d/ranges/Ranges.js +2 -1
  14. package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
  15. package/lib/component/1d/tool/XLabelPointer.js +4 -12
  16. package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
  17. package/lib/component/1d-2d/FieldEdition.js +42 -0
  18. package/lib/component/2d/Chart2D.js +5 -3
  19. package/lib/component/2d/tools/XYLabelPointer.js +3 -9
  20. package/lib/component/2d/zones/Zone.js +18 -2
  21. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
  22. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
  24. package/lib/component/context/LoggerContext.js +11 -4
  25. package/lib/component/context/ShareDataContext.d.ts +10 -0
  26. package/lib/component/context/ShareDataContext.js +22 -0
  27. package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
  28. package/lib/component/elements/ActionsButtonsPopover.js +22 -0
  29. package/lib/component/elements/CloseButton.d.ts +1 -1
  30. package/lib/component/elements/CustomToolTip.d.ts +8 -0
  31. package/lib/component/elements/CustomToolTip.js +107 -0
  32. package/lib/component/elements/EditableColumn.js +3 -2
  33. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  35. package/lib/component/elements/SVGButton.d.ts +14 -0
  36. package/lib/component/elements/SVGButton.js +6 -0
  37. package/lib/component/elements/SVGGroup.js +15 -13
  38. package/lib/component/elements/SVGText.d.ts +8 -0
  39. package/lib/component/elements/SVGText.js +24 -0
  40. package/lib/component/elements/SaveButton.d.ts +1 -1
  41. package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
  42. package/lib/component/elements/formik/FormikError.js +2 -4
  43. package/lib/component/elements/formik/FormikInput.d.ts +2 -1
  44. package/lib/component/elements/formik/FormikInput.js +5 -4
  45. package/lib/component/header/Header.js +8 -11
  46. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
  47. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  48. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
  49. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  50. package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
  51. package/lib/component/hooks/useIntegralPath.d.ts +2 -0
  52. package/lib/component/hooks/useIntegralPath.js +3 -1
  53. package/lib/component/hooks/usePanelPreferences.js +1 -2
  54. package/lib/component/hooks/useSaveSettings.js +7 -14
  55. package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
  56. package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
  57. package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
  58. package/lib/component/hooks/useWorkspaceAction.js +89 -0
  59. package/lib/component/loader/DropZone.js +0 -3
  60. package/lib/component/main/InnerNMRium.js +3 -1
  61. package/lib/component/main/InnerNMRiumContents.js +14 -2
  62. package/lib/component/main/NMRiumStateProvider.js +15 -3
  63. package/lib/component/modal/AboutPredictionModal.js +1 -1
  64. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  65. package/lib/component/modal/CopyClipboardModal.js +1 -1
  66. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  67. package/lib/component/modal/ImportPublicationStringModal.js +11 -5
  68. package/lib/component/modal/PredictSpectraModal.js +1 -1
  69. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  70. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  71. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  72. package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
  73. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
  74. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
  75. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
  76. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  77. package/lib/component/modal/setting/GeneralSettings.js +18 -39
  78. package/lib/component/modal/setting/WorkspaceItem.js +1 -1
  79. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
  80. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
  81. package/lib/component/modal/setting/settingsValidation.js +36 -40
  82. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
  83. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
  84. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  86. package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
  87. package/lib/component/panels/RangesPanel/RangesHeader.js +11 -11
  88. package/lib/component/panels/RangesPanel/RangesPreferences.js +16 -16
  89. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  90. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
  91. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
  92. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
  93. package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
  94. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
  95. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  96. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
  97. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
  98. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
  99. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
  100. package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
  101. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
  102. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
  103. package/lib/component/panels/ZonesPanel/ZonesPanel.js +22 -6
  104. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
  105. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
  106. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
  107. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
  108. package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
  109. package/lib/component/panels/header/PreferencesHeader.js +1 -1
  110. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  111. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  112. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
  113. package/lib/component/reducer/IgnoreActions.js +1 -0
  114. package/lib/component/reducer/Reducer.js +8 -0
  115. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  116. package/lib/component/reducer/actions/DomainActions.js +29 -1
  117. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
  118. package/lib/component/reducer/actions/FiltersActions.js +27 -1
  119. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  120. package/lib/component/reducer/actions/RangesActions.d.ts +2 -3
  121. package/lib/component/reducer/actions/RangesActions.js +28 -26
  122. package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
  123. package/lib/component/reducer/actions/SpectraActions.js +5 -1
  124. package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
  125. package/lib/component/reducer/actions/ZonesActions.js +47 -13
  126. package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
  127. package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
  128. package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
  129. package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
  130. package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
  131. package/lib/component/reducer/preferences/actions/matrixGeneration.js +3 -3
  132. package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
  133. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
  134. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  135. package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
  136. package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
  137. package/lib/component/reducer/preferences/preferencesReducer.d.ts +7 -0
  138. package/lib/component/reducer/preferences/preferencesReducer.js +21 -18
  139. package/lib/component/toolbar/ToolBar.js +115 -25
  140. package/lib/component/utility/PreferencesHelper.js +5 -4
  141. package/lib/component/utility/export.js +4 -0
  142. package/lib/component/workspaces/assignment.js +0 -1
  143. package/lib/component/workspaces/basic.js +0 -1
  144. package/lib/component/workspaces/embedded.js +0 -1
  145. package/lib/component/workspaces/exercise.js +26 -29
  146. package/lib/component/workspaces/prediction.js +171 -174
  147. package/lib/component/workspaces/process1D.js +0 -1
  148. package/lib/component/workspaces/simulation.js +35 -38
  149. package/lib/component/workspaces/workspaceDefaultProperties.js +16 -23
  150. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
  151. package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
  152. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
  153. package/lib/data/data1d/Spectrum1D/index.js +2 -2
  154. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
  155. package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
  156. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
  157. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
  158. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
  159. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
  160. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
  161. package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
  162. package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
  163. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
  164. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
  165. package/lib/data/utilities/generateColor.d.ts +7 -3
  166. package/lib/data/utilities/generateColor.js +5 -17
  167. package/lib/versionInfo.js +1 -1
  168. package/package.json +35 -35
  169. package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
  170. package/lib/component/elements/MolecularFormulaInput.js +0 -63
  171. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
  172. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
  173. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
  174. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
  175. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
  176. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
  177. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
  178. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
@@ -104,8 +104,8 @@ function RangesTableRow({ rowData, onUnlink, onContextMenuSelect, contextMenu =
104
104
  ? ConstantlyHighlightedRowStyle
105
105
  : null;
106
106
  }, [assignmentRange.isActive, highlightRange.isActive, rowData]);
107
- return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
107
+ return (_jsxs(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, rowData), as: "tr", css: trCss, children: [preferences.showSerialNumber && (_jsx("td", { ...rowSpanTags, ...onHoverRange, children: rowData.tableMetaInfo.rowIndex + 1 })), preferences.showAssignmentLabel && (_jsx(RangeAssignmentColumn, { row: rowData, onHover: onHoverRange, rowSpanTags: rowSpanTags })), preferences.from.show && (_jsx(RangeColumn, { value: rowData.from, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.from.format })), preferences.to.show && (_jsx(RangeColumn, { value: rowData.to, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.to.format })), preferences.deltaPPM.show && (_jsx(SignalDeltaColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaPPM.format })), preferences.deltaHz.show && (_jsx(SignalDeltaHzColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverSignal, format: preferences.deltaHz.format, info: info })), preferences.relative.show && (_jsx(RelativeColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.relative.format })), preferences.absolute.show && (_jsx(AbsoluteColumn, { row: rowData, rowSpanTags: rowSpanTags, onHover: onHoverRange, format: preferences.absolute.format })), preferences.showMultiplicity && (_jsx("td", { ...onHoverSignal, children: !rowData?.tableMetaInfo?.signal
108
108
  ? 'm'
109
- : lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.showAssignmentLabel && (_jsx(RangeAssignmentColumn, { row: rowData, onHover: onHoverSignal, rowSpanTags: rowSpanTags })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumn, { row: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { row: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData })] })), _jsx(ActionsColumn, { row: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind, showDeleteAction: preferences.showDeleteAction, showEditAction: preferences.showEditAction, showZoomAction: preferences.showZoomAction })] }));
109
+ : lodashGet(rowData, 'tableMetaInfo.signal.multiplicity', '') })), preferences.coupling.show && (_jsx(CouplingColumn, { row: rowData, onHover: onHoverSignal, format: preferences.coupling.format })), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumn, { row: rowData, assignment: assignmentSignal, highlight: highlightSignal, onHover: onHoverSignal, onLink: linkHandler, onUnlink: unlinkHandler }), _jsx(RangeAssignmentsColumn, { row: rowData, assignment: assignmentRange, highlight: highlightRangeAssignmentsColumn, onHover: onHoverRangeAssignmentsColumn, onLink: linkHandler, onUnlink: unlinkHandler, rowSpanTags: rowSpanTags, highlightData: highlightData })] })), _jsx(ActionsColumn, { row: rowData, onHoverSignal: onHoverSignal, onHoverRange: onHoverRange, rowSpanTags: rowSpanTags, showKind: preferences.showKind, showDeleteAction: preferences.showDeleteAction, showEditAction: preferences.showEditAction, showZoomAction: preferences.showZoomAction })] }));
110
110
  }
111
111
  export default RangesTableRow;
@@ -3,8 +3,10 @@ import { SvgNmrSameTop, SvgNmrResetScale } from 'cheminfo-font';
3
3
  import { memo, useCallback } from 'react';
4
4
  import { FaCreativeCommonsSamplingPlus, FaEye, FaEyeSlash, } from 'react-icons/fa';
5
5
  import { IoColorPaletteOutline } from 'react-icons/io5';
6
+ import { MdFormatColorFill } from 'react-icons/md';
6
7
  import { useChartData } from '../../context/ChartContext';
7
8
  import { useDispatch } from '../../context/DispatchContext';
9
+ import { usePreferences } from '../../context/PreferencesContext';
8
10
  import { useToaster } from '../../context/ToasterContext';
9
11
  import { useModal } from '../../elements/popup/Modal';
10
12
  import { useActiveSpectra } from '../../hooks/useActiveSpectra';
@@ -28,6 +30,7 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
28
30
  const modal = useModal();
29
31
  const toaster = useToaster();
30
32
  const dispatch = useDispatch();
33
+ const { current: { spectraColors }, } = usePreferences();
31
34
  const handleDelete = useCallback(() => {
32
35
  modal.showConfirmDialog({
33
36
  message: (_jsxs("span", { children: ["You are about to delete", _jsxs("span", { style: { color: 'black' }, children: [" ", activeSpectra?.length, " "] }), "spectra, Are you sure?"] })),
@@ -72,7 +75,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
72
75
  function resetScaleHandler() {
73
76
  dispatch({ type: 'RESET_SPECTRA_SCALE' });
74
77
  }
75
- function reColorSpectraHandler() {
78
+ function defaultReColorSpectraHandler() {
79
+ dispatch({
80
+ type: 'RECOLOR_SPECTRA_COLOR',
81
+ payload: { customColors: spectraColors },
82
+ });
83
+ }
84
+ function distinctReColorSpectraHandler() {
76
85
  dispatch({
77
86
  type: 'RECOLOR_SPECTRA_COLOR',
78
87
  payload: {},
@@ -84,31 +93,31 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
84
93
  {
85
94
  disabled: !hasActiveSpectra,
86
95
  icon: _jsx(FaEyeSlash, {}),
87
- title: 'Hide selected spectra',
96
+ tooltip: 'Hide selected spectra',
88
97
  onClick: hideAllSpectraHandler,
89
98
  },
90
99
  {
91
100
  disabled: !hasActiveSpectra,
92
101
  icon: _jsx(FaEye, {}),
93
- title: 'Show selected spectra',
102
+ tooltip: 'Show selected spectra',
94
103
  onClick: showAllSpectraHandler,
95
104
  },
96
105
  ];
97
106
  if (displayerMode === '2D' && activeSpectrum?.info.isFt) {
98
107
  leftButtons.push({
99
108
  icon: _jsx(FaCreativeCommonsSamplingPlus, {}),
100
- title: 'Add missing projection',
109
+ tooltip: 'Add missing projection',
101
110
  onClick: addMissingProjectionHandler,
102
111
  });
103
112
  }
104
113
  if (displayerMode === '1D' && spectraLengthPerTab > 1) {
105
114
  leftButtons.push({
106
115
  icon: _jsx(SvgNmrResetScale, {}),
107
- title: 'Reset scale',
116
+ tooltip: 'Reset scale',
108
117
  onClick: resetScaleHandler,
109
118
  }, {
110
119
  icon: _jsx(SvgNmrSameTop, {}),
111
- title: 'Same top',
120
+ tooltip: 'Same top',
112
121
  onClick: setSameTopHandler,
113
122
  });
114
123
  }
@@ -118,8 +127,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeSpectra, activeTa
118
127
  },
119
128
  {
120
129
  icon: _jsx(IoColorPaletteOutline, {}),
121
- title: 'Recolor spectra',
122
- onClick: reColorSpectraHandler,
130
+ tooltip: 'Default spectra recoloring',
131
+ onClick: defaultReColorSpectraHandler,
132
+ },
133
+ {
134
+ icon: _jsx(MdFormatColorFill, {}),
135
+ tooltip: 'Distinct spectra recoloring',
136
+ onClick: distinctReColorSpectraHandler,
123
137
  },
124
138
  ]);
125
139
  return (_jsx(DefaultPanelHeader, { onDelete: handleDelete, total: data?.length, counter: spectraLengthPerTab, deleteToolTip: "Delete selected spectra", disableDelete: !hasActiveSpectra, onSettingClick: onSettingClick, leftButtons: leftButtons }));
@@ -4,6 +4,7 @@ import { useImperativeHandle, useRef, memo, forwardRef, useCallback, useMemo, }
4
4
  import * as Yup from 'yup';
5
5
  import { useChartData } from '../../context/ChartContext';
6
6
  import { usePreferences } from '../../context/PreferencesContext';
7
+ import { GroupPane } from '../../elements/GroupPane';
7
8
  import { Scroller } from '../../elements/Scroller';
8
9
  import useNucleus from '../../hooks/useNucleus';
9
10
  import { usePanelPreferencesByNuclei } from '../../hooks/usePanelPreferences';
@@ -12,6 +13,17 @@ import { getSpectraObjectPaths } from '../../utility/getSpectraObjectPaths';
12
13
  import { NucleusGroup } from '../extra/preferences/NucleusGroup';
13
14
  import { PreferencesContainer } from '../extra/preferences/PreferencesContainer';
14
15
  import { SpectraColumnsManager } from './base/SpectraColumnsManager';
16
+ const groupPaneStyle = {
17
+ header: {
18
+ color: 'black',
19
+ fontSize: '12px',
20
+ padding: '5px',
21
+ backgroundColor: '#f8f8f8',
22
+ },
23
+ container: {
24
+ paddingBottom: '10px',
25
+ },
26
+ };
15
27
  function validationColumns(obj) {
16
28
  const validationObject = {};
17
29
  for (const key of Object.keys(obj.nuclei)) {
@@ -102,6 +114,6 @@ function SpectraPreferences(props, ref) {
102
114
  return key || ' ';
103
115
  }, [paths]);
104
116
  const mapValue = useCallback((value) => convertPathArrayToString(value), []);
105
- return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, validationSchema: spectraPreferencesValidation, children: _jsx(Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => (_jsx(Scroller.Item, { elementKey: n, children: _jsx(NucleusGroup, { nucleus: n, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }, n))) }) }) }));
117
+ return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, validationSchema: spectraPreferencesValidation, children: _jsx(Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => (_jsx(Scroller.Item, { elementKey: n, children: _jsx(NucleusGroup, { nucleus: n, children: _jsx(GroupPane, { text: "General", style: groupPaneStyle, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }) }, n))) }) }) }));
106
118
  }
107
119
  export default memo(forwardRef(SpectraPreferences));
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Axis, Heading, Legend, LineSeries, Plot, } from 'react-plot';
3
3
  export default function PlotChart({ data, sign, color, yLogBase, hideHeading = false, }) {
4
- return (_jsxs(Plot, { width: 180, height: 220, children: [!hideHeading && _jsx(Heading, { title: "Sanplot" }), _jsx(LineSeries, { data: data.sanPlot?.[sign] || [], xAxis: "x", yAxis: "y", label: sign, lineStyle: {
4
+ return (_jsxs(Plot, { width: 180, height: 220, children: [!hideHeading && _jsx(Heading, { title: "SAN plot" }), _jsx(LineSeries, { data: data.sanPlot?.[sign] || [], xAxis: "x", yAxis: "y", label: sign, lineStyle: {
5
5
  stroke: color,
6
6
  strokeWidth: 1.2,
7
7
  }, markerStyle: {
@@ -7,7 +7,7 @@ function Spectrum2DHistogram({ color = 'red', data, }) {
7
7
  const processedData = useMemo(() => {
8
8
  return processSnapPlot('2D', data.rr, yLogBase);
9
9
  }, [data]);
10
- return (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "San Plot" }), _jsxs("div", { style: {
10
+ return (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', paddingBottom: 5, paddingTop: 5 }, children: "SAN plot" }), _jsxs("div", { style: {
11
11
  borderTop: '1px solid #ededed',
12
12
  marginTop: '10px',
13
13
  paddingTop: '10px',
@@ -103,5 +103,5 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
103
103
  handleOnEdit,
104
104
  link,
105
105
  ]);
106
- return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { title: "Close", onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
106
+ return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { tooltip: "Close", onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
107
107
  }
@@ -1,8 +1,8 @@
1
- interface SetMolecularFormulaModalProps {
1
+ interface InnerMolecularFormulaModalProps {
2
2
  onClose: () => void;
3
- onSave?: (element: any) => void;
4
- molecules: any;
5
- previousMF: any;
6
3
  }
7
- export default function SetMolecularFormulaModal({ onClose, onSave, molecules, previousMF, }: SetMolecularFormulaModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
4
+ interface MolecularFormulaModalProps extends InnerMolecularFormulaModalProps {
5
+ isOpen: boolean;
6
+ }
7
+ export declare function SetMolecularFormulaModal(props: MolecularFormulaModalProps): import("react/jsx-runtime").JSX.Element | undefined;
8
8
  export {};
@@ -1,94 +1,84 @@
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 { useCallback, useEffect, useState } from 'react';
5
- import { CloseButton } from '../../elements/CloseButton';
6
- import MolecularFormulaInput from '../../elements/MolecularFormulaInput';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Dialog, DialogBody, Tab, Tabs } from '@blueprintjs/core';
3
+ import { Formik } from 'formik';
4
+ import { useState } from 'react';
5
+ import * as Yup from 'yup';
6
+ import getAtomsFromMF from '../../../data/utilities/getAtomsFromMF';
7
+ import { useChartData } from '../../context/ChartContext';
8
+ import { useDispatch } from '../../context/DispatchContext';
9
+ import Button from '../../elements/Button';
7
10
  import MoleculeSelection from '../../elements/MoleculeSelection';
8
- const modalContainer = css `
9
- overflow: auto;
10
- width: 400px;
11
- height: 550px;
12
- padding: 5px;
13
-
14
- button {
15
- flex: 2;
16
- padding: 5px;
17
- border: 1px solid gray;
18
- border-radius: 5px;
19
- height: 30px;
20
- margin: 0 auto;
21
- margin-top: 15px;
22
- display: block;
23
- width: 20%;
24
- color: white;
25
- background-color: gray;
26
- }
27
-
28
- button:focus {
29
- outline: none;
30
- }
31
-
32
- .header {
33
- height: 24px;
34
- border-bottom: 1px solid #f0f0f0;
35
- display: flex;
36
- align-items: center;
37
-
38
- button {
39
- height: 36px;
40
- margin: 2px;
41
- background-color: transparent;
42
- border: none;
43
-
44
- svg {
45
- height: 16px;
46
- }
11
+ import FormikError from '../../elements/formik/FormikError';
12
+ import FormikInput from '../../elements/formik/FormikInput';
13
+ function isValidMf(value) {
14
+ try {
15
+ getAtomsFromMF(value);
16
+ return true;
47
17
  }
48
- }
49
-
50
- .info {
51
- margin-top: 0;
52
- margin-bottom: 10px;
53
- padding: 0 10px;
54
- width: 100%;
55
- text-align: center;
56
- }
57
-
58
- .optional {
59
- margin-top: 20px;
60
- margin-bottom: 5px;
61
- padding: 0 10px;
62
- text-align: center;
63
- font-size: 18px;
64
- font-weight: bold;
65
- }
66
-
67
- .optional2 {
68
- margin-top: 5px;
69
- margin-bottom: 25px;
70
- padding: 0 10px;
71
- width: 100%;
72
- text-align: center;
73
- }
74
- `;
75
- export default function SetMolecularFormulaModal({ onClose, onSave, molecules, previousMF, }) {
76
- const [currentIndex, setCurrentIndex] = useState(0);
77
- useEffect(() => {
78
- if (molecules && molecules.length > 0) {
79
- setCurrentIndex(0);
80
- }
81
- }, [molecules]);
82
- const onSaveHandlerMolecularFormulaInput = useCallback((mf) => {
83
- onSave?.(mf);
84
- onClose?.();
85
- }, [onClose, onSave]);
86
- const onSaveHandlerMoleculeSelection = useCallback(() => {
87
- onSave?.(molecules[currentIndex].mf);
18
+ catch {
19
+ return false;
20
+ }
21
+ }
22
+ const validationSchema = Yup.object({
23
+ mf: Yup.string()
24
+ .required()
25
+ .test('valid-mf', 'Enter a valid molecular formula', (value) => isValidMf(value)),
26
+ });
27
+ const styles = {
28
+ input: {
29
+ padding: '0.5rem',
30
+ },
31
+ container: {
32
+ padding: '0.5rem',
33
+ },
34
+ error: {
35
+ textAlign: 'center',
36
+ color: 'red',
37
+ fontSize: '0.9em',
38
+ },
39
+ title: {
40
+ textAlign: 'center',
41
+ },
42
+ };
43
+ export function SetMolecularFormulaModal(props) {
44
+ const { isOpen, ...otherProps } = props;
45
+ if (!isOpen) {
46
+ return;
47
+ }
48
+ return _jsx(InnerSetMolecularFormulaModal, { ...otherProps });
49
+ }
50
+ function InnerSetMolecularFormulaModal({ onClose, }) {
51
+ const dispatch = useDispatch();
52
+ function saveHandler(mf) {
53
+ dispatch({
54
+ type: 'SET_CORRELATIONS_MF',
55
+ payload: {
56
+ mf,
57
+ },
58
+ });
88
59
  onClose?.();
89
- }, [currentIndex, molecules, onClose, onSave]);
90
- const onChangeHandlerMoleculeSelection = useCallback((index) => {
60
+ }
61
+ return (_jsx(Dialog, { isOpen: true, title: "Molecular formula", style: { width: 400 }, onClose: onClose, children: _jsx(DialogBody, { children: _jsxs(Tabs, { fill: true, children: [_jsx(Tab, { id: "manual", title: "Manual", panel: _jsx(ManualFormula, { onSave: saveHandler }) }), _jsx(Tab, { id: "auto", title: "Auto", panel: _jsx(AutoFormula, { onSave: saveHandler }) })] }) }) }));
62
+ }
63
+ function ManualFormula(props) {
64
+ const { correlations } = useChartData();
65
+ function saveHandler(data) {
66
+ props?.onSave(data.mf);
67
+ }
68
+ return (_jsxs("div", { style: styles.container, children: [_jsx("p", { children: "Please type in a molecular formula!" }), _jsx(Formik, { onSubmit: saveHandler, initialValues: { mf: correlations?.options?.mf }, validationSchema: validationSchema, children: ({ isValid, handleSubmit }) => (_jsxs(_Fragment, { children: [_jsx(FormikError, { name: "mf", children: _jsx(FormikInput, { name: "mf", placeholder: "Enter a molecular formula", style: { input: styles.input }, checkErrorAfterInputTouched: false }) }), _jsx(Button.Done, { onClick: () => handleSubmit(), disabled: !isValid, style: { marginTop: '10px' }, children: "Set molecular formula" })] })) })] }));
69
+ }
70
+ function AutoFormula(props) {
71
+ const { molecules } = useChartData();
72
+ const [currentIndex, setCurrentIndex] = useState(0);
73
+ function onChangeHandlerMoleculeSelection(index) {
91
74
  setCurrentIndex(index);
92
- }, []);
93
- return (_jsxs("div", { css: modalContainer, children: [_jsx("div", { className: "header handle", children: _jsx(CloseButton, { title: "Close", onClick: onClose }) }), _jsx("div", { children: _jsx("p", { className: "info", children: "Please type in a molecular formula!" }) }), _jsx(MolecularFormulaInput, { onSave: onSaveHandlerMolecularFormulaInput, previousMF: previousMF }), _jsxs("div", { children: [_jsx("p", { className: "optional", children: "OR" }), _jsx("p", { className: "optional2", children: "Select a molecule as reference!" })] }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx("button", { type: "button", onClick: onSaveHandlerMoleculeSelection, children: "Set" })] }));
75
+ }
76
+ function saveHandler() {
77
+ const mf = molecules?.[currentIndex]?.mf;
78
+ props?.onSave(mf);
79
+ }
80
+ if (!molecules || molecules?.length === 0) {
81
+ return (_jsx("p", { style: styles.error, children: "You have to Select a spectrum and Add a molecule from the Structure panel to select as a reference!" }));
82
+ }
83
+ return (_jsxs("div", { style: styles.container, children: [_jsx("p", { style: styles.title, children: "Select a molecule as reference!" }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx(Button.Done, { onClick: saveHandler, disabled: !molecules?.[currentIndex], style: { marginTop: '10px' }, children: "Set molecular formula" })] }));
94
84
  }
@@ -1,7 +1,8 @@
1
- interface SetShiftToleranceModalProps {
1
+ interface SetShiftToleranceModalProps extends InnerSetShiftToleranceModalProps {
2
+ isOpen: boolean;
3
+ }
4
+ interface InnerSetShiftToleranceModalProps {
2
5
  onClose: () => void;
3
- onSave?: (element: any) => void;
4
- previousTolerance: any;
5
6
  }
6
- export default function SetShiftToleranceModal({ onClose, onSave, previousTolerance, }: SetShiftToleranceModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
+ export declare function SetShiftToleranceModal(props: SetShiftToleranceModalProps): import("@emotion/react/jsx-runtime").JSX.Element | undefined;
7
8
  export {};
@@ -1,104 +1,72 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { useEffect, useState } from 'react';
5
- import { CloseButton } from '../../elements/CloseButton';
6
- const modalContainer = css `
7
- width: 220px;
8
- height: 270px;
9
- padding: 5px;
10
- text-align: center;
11
-
12
- button {
13
- flex: 2;
14
- padding: 5px;
15
- border: 1px solid gray;
16
- border-radius: 5px;
17
- height: 30px;
18
- margin: 0 auto;
19
- margin-top: 15px;
20
- display: block;
21
- width: 20%;
22
- color: white;
23
- background-color: gray;
24
- }
25
-
26
- button:focus {
27
- outline: none;
28
- }
29
-
30
- .header {
31
- height: 24px;
32
- border-bottom: 1px solid #f0f0f0;
33
- display: flex;
34
- align-items: center;
35
-
36
- span {
37
- color: #464646;
38
- font-size: 15px;
39
- flex: 1;
40
- user-select: none;
3
+ import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
4
+ import { Formik } from 'formik';
5
+ import { useMemo } from 'react';
6
+ import * as Yup from 'yup';
7
+ import { useChartData } from '../../context/ChartContext';
8
+ import { useDispatch } from '../../context/DispatchContext';
9
+ import Button from '../../elements/Button';
10
+ import ReactTable from '../../elements/ReactTable/ReactTable';
11
+ import FormikInput from '../../elements/formik/FormikInput';
12
+ const styles = {
13
+ input: {
14
+ padding: '0.25rem 0.5rem',
15
+ },
16
+ column: {
17
+ padding: '2px',
18
+ },
19
+ };
20
+ const toleranceValidationSchema = Yup.array()
21
+ .of(Yup.object({ value: Yup.number().required() }))
22
+ .min(1);
23
+ export function SetShiftToleranceModal(props) {
24
+ const { isOpen, ...otherPros } = props;
25
+ if (!isOpen) {
26
+ return;
41
27
  }
42
-
43
- button {
44
- height: 36px;
45
- margin: 2px;
46
- background-color: transparent;
47
- border: none;
48
-
49
- svg {
50
- height: 16px;
51
- }
52
- }
53
- }
54
-
55
- table {
56
- margin-top: 10px;
57
- width: 100%;
58
-
59
- input::-webkit-outer-spin-button,
60
- input::-webkit-inner-spin-button {
61
- appearance: none;
62
- }
63
-
64
- input {
65
- width: 100px;
66
- text-align: center;
67
- border-radius: 5px;
68
- border: 0.55px solid #c7c7c7;
69
- }
70
- }
71
- `;
72
- export default function SetShiftToleranceModal({ onClose, onSave, previousTolerance, }) {
73
- const [tolerance, setTolerance] = useState();
74
- const [isValid, setIsValid] = useState({});
75
- useEffect(() => {
76
- if (previousTolerance) {
77
- setTolerance(previousTolerance);
78
- setIsValid(Object.fromEntries(Object.keys(previousTolerance).map((atomType) => [atomType, true])));
79
- }
80
- else {
81
- setTolerance(undefined);
28
+ return _jsx(InnerSetShiftToleranceModal, { ...otherPros });
29
+ }
30
+ function InnerSetShiftToleranceModal(props) {
31
+ const { onClose } = props;
32
+ const { correlations } = useChartData();
33
+ const dispatch = useDispatch();
34
+ function onSaveHandler(data) {
35
+ const tolerance = {};
36
+ for (const { atom, value } of data) {
37
+ tolerance[atom] = value;
82
38
  }
83
- }, [previousTolerance]);
84
- function onSaveHandler() {
85
- onSave?.(tolerance);
39
+ dispatch({
40
+ type: 'SET_CORRELATIONS_TOLERANCE',
41
+ payload: {
42
+ tolerance,
43
+ },
44
+ });
86
45
  onClose?.();
87
46
  }
88
- function onChangeHandler(e, atomType) {
89
- const value = e.target.value;
90
- if (value.trim().length > 0) {
91
- setTolerance({ ...tolerance, [atomType]: Number(value) });
92
- setIsValid({ ...isValid, [atomType]: true });
93
- }
94
- else {
95
- setIsValid({ ...isValid, [atomType]: false });
96
- }
97
- }
98
- return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Set Shift Tolerances" }), _jsx(CloseButton, { title: "Close", onClick: onClose })] }), _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Atom" }), _jsx("th", { children: "Value" })] }) }), _jsx("tbody", { children: _jsx(Rows, { onChange: onChangeHandler, isValid: isValid, tolerance: tolerance }) })] }), _jsx("button", { type: "button", onClick: onSaveHandler, disabled: Object.keys(isValid).some((atomType) => !isValid[atomType]), children: "Set" })] }));
99
- }
100
- function Rows({ tolerance, onChange, isValid }) {
101
- return Object.keys(tolerance).map((atomType) => {
102
- return (_jsxs("tr", { children: [_jsx("td", { children: atomType }), _jsx("td", { children: _jsx("input", { type: "number", onChange: (e) => onChange(e, atomType), defaultValue: tolerance[atomType], style: !isValid[atomType] ? { backgroundColor: 'orange' } : {} }) })] }, `tolerance_${atomType}`));
103
- });
47
+ const COLUMNS = useMemo(() => [
48
+ {
49
+ Header: '#',
50
+ style: { width: '25px', textAlign: 'center', ...styles.column },
51
+ accessor: (_, index) => index + 1,
52
+ },
53
+ {
54
+ Header: 'Atom',
55
+ style: { width: '25px', textAlign: 'center', ...styles.column },
56
+ accessor: 'atom',
57
+ },
58
+ {
59
+ Header: 'Value',
60
+ style: { padding: 0, ...styles.column },
61
+ Cell: ({ row }) => {
62
+ return (_jsx(FormikInput, { name: `${row.index}.value`, style: { input: styles.input }, type: "number", checkErrorAfterInputTouched: false }));
63
+ },
64
+ },
65
+ ], []);
66
+ const tolerances = correlations?.options?.tolerance || {};
67
+ const tolerancesData = Object.keys(tolerances).map((atom) => ({
68
+ atom,
69
+ value: tolerances[atom],
70
+ }));
71
+ return (_jsx(Dialog, { isOpen: true, title: "Shift tolerances", onClose: onClose, style: { width: 400 }, children: _jsx(Formik, { initialValues: tolerancesData, onSubmit: onSaveHandler, validationSchema: toleranceValidationSchema, children: ({ isValid, handleSubmit }) => (_jsxs(_Fragment, { children: [_jsx(DialogBody, { children: _jsx(ReactTable, { data: tolerancesData, columns: COLUMNS, emptyDataRowText: "No atoms" }) }), _jsx(DialogFooter, { children: _jsx(Button.Done, { onClick: () => handleSubmit(), disabled: !isValid, children: "Set shift tolerances" }) })] })) }) }));
104
72
  }
@@ -9,12 +9,12 @@ import { useAssignmentData } from '../../assignment/AssignmentsContext';
9
9
  import { useChartData } from '../../context/ChartContext';
10
10
  import { useDispatch } from '../../context/DispatchContext';
11
11
  import Select from '../../elements/Select';
12
- import { useModal } from '../../elements/popup/Modal';
12
+ import { useDialogToggle } from '../../hooks/useDialogToggle';
13
13
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
14
14
  import CorrelationTable from './CorrelationTable/CorrelationTable';
15
15
  import Overview from './Overview';
16
- import SetMolecularFormulaModal from './SetMolecularFormulaModal';
17
- import SetShiftToleranceModal from './SetShiftTolerancesModal';
16
+ import { SetMolecularFormulaModal } from './SetMolecularFormulaModal';
17
+ import { SetShiftToleranceModal } from './SetShiftTolerancesModal';
18
18
  import { findSignalMatch1D, findSignalMatch2D, getAtomType, } from './utilities/Utilities';
19
19
  const panelStyle = css `
20
20
  display: flex;
@@ -50,10 +50,13 @@ const panelStyle = css `
50
50
  }
51
51
  `;
52
52
  function SummaryPanel() {
53
- const { molecules, correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
53
+ const { correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
54
54
  const dispatch = useDispatch();
55
- const modal = useModal();
56
55
  const assignmentData = useAssignmentData();
56
+ const { dialog, openDialog, closeDialog } = useDialogToggle({
57
+ shiftToleranceModal: false,
58
+ molecularFormula: false,
59
+ });
57
60
  const [additionalColumnData, setAdditionalColumnData] = useState([]);
58
61
  const [selectedAdditionalColumnsAtomType, setSelectedAdditionalColumnsAtomType,] = useState('H');
59
62
  const [showProtonsAsRows, setShowProtonsAsRows] = useState(false);
@@ -135,28 +138,6 @@ function SummaryPanel() {
135
138
  xDomain,
136
139
  yDomain,
137
140
  ]);
138
- const handleOnSetMolecularFormula = useCallback((mf) => {
139
- dispatch({
140
- type: 'SET_CORRELATIONS_MF',
141
- payload: {
142
- mf,
143
- },
144
- });
145
- }, [dispatch]);
146
- const handleOnSetShiftTolerance = useCallback((tolerance) => {
147
- dispatch({
148
- type: 'SET_CORRELATIONS_TOLERANCE',
149
- payload: {
150
- tolerance,
151
- },
152
- });
153
- }, [dispatch]);
154
- const showSetMolecularFormulaModal = useCallback(() => {
155
- modal.show(_jsx(SetMolecularFormulaModal, { onClose: () => modal.close(), onSave: handleOnSetMolecularFormula, molecules: molecules, previousMF: correlationsData.options.mf }));
156
- }, [correlationsData, handleOnSetMolecularFormula, modal, molecules]);
157
- const showSetShiftToleranceModal = useCallback(() => {
158
- modal.show(_jsx(SetShiftToleranceModal, { onClose: () => modal.close(), onSave: handleOnSetShiftTolerance, previousTolerance: correlationsData.options.tolerance }));
159
- }, [correlationsData, handleOnSetShiftTolerance, modal]);
160
141
  const additionalColumnTypes = useMemo(() => {
161
142
  const columnTypes = ['H', 'H-H'].concat(correlationsData
162
143
  ? correlationsData.values
@@ -309,18 +290,18 @@ function SummaryPanel() {
309
290
  setFilterIsActive(!filterIsActive);
310
291
  }, [filterIsActive]);
311
292
  const total = correlationsData ? correlationsData.values.length : 0;
312
- return (_jsxs("div", { css: panelStyle, children: [_jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
293
+ return (_jsxs("div", { css: panelStyle, children: [_jsx(SetMolecularFormulaModal, { isOpen: dialog.molecularFormula, onClose: closeDialog }), _jsx(SetShiftToleranceModal, { isOpen: dialog.shiftToleranceModal, onClose: closeDialog }), _jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
313
294
  ? 'Show all correlations'
314
295
  : 'Hide correlations out of view', leftButtons: [
315
296
  {
316
297
  icon: _jsx(FaFlask, {}),
317
- title: `Set molecular formula (${correlationsData.options.mf})`,
318
- onClick: showSetMolecularFormulaModal,
298
+ tooltip: `Set molecular formula (${correlationsData?.options?.mf || ''})`,
299
+ onClick: () => openDialog('molecularFormula'),
319
300
  },
320
301
  {
321
302
  icon: _jsx(FaSlidersH, {}),
322
- title: 'Set shift tolerance',
323
- onClick: showSetShiftToleranceModal,
303
+ tooltip: 'Set shift tolerance',
304
+ onClick: () => openDialog('shiftToleranceModal'),
324
305
  },
325
306
  ], children: _jsxs("div", { className: "extra-header-content", children: [_jsx("div", { className: "overview-container", children: _jsx(Overview, { correlationsData: correlationsData }) }), _jsx("div", { className: "table-view-selection", children: _jsxs("span", { children: [_jsx("label", { children: "View:" }), _jsx(Select, { onChange: (selection) => {
326
307
  setSelectedAdditionalColumnsAtomType(selection);
@@ -0,0 +1,6 @@
1
+ import { ZoneData } from '../hooks/useMapZones';
2
+ interface ZoneAssignmentLabelColumnProps {
3
+ rowData: ZoneData;
4
+ }
5
+ export declare function ZoneAssignmentLabelColumn({ rowData, }: ZoneAssignmentLabelColumnProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};