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
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useDispatch } from '../../../context/DispatchContext';
3
+ import EditableColumn from '../../../elements/EditableColumn';
4
+ export function ZoneAssignmentLabelColumn({ rowData, }) {
5
+ const dispatch = useDispatch();
6
+ function saveHandler(event) {
7
+ dispatch({
8
+ type: 'CHANGE_ZONE_ASSIGNMENT_LABEL',
9
+ payload: {
10
+ value: event.target.value,
11
+ zoneID: rowData.id,
12
+ },
13
+ });
14
+ }
15
+ return (_jsx("td", { children: _jsx(EditableColumn, { value: rowData?.assignment || '', onSave: saveHandler, style: { padding: '0.1rem 0.4rem' } }) }));
16
+ }
@@ -3,18 +3,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
3
3
  import { css } from '@emotion/react';
4
4
  import { useState, useMemo, useCallback, useRef, memo } from 'react';
5
5
  import { FaUnlink } from 'react-icons/fa';
6
+ import { LuSubtitles } from 'react-icons/lu';
6
7
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
7
8
  import { useChartData } from '../../context/ChartContext';
8
9
  import { useDispatch } from '../../context/DispatchContext';
9
10
  import { useModal } from '../../elements/popup/Modal';
10
11
  import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
11
12
  import useSpectrum from '../../hooks/useSpectrum';
13
+ import { booleanToString } from '../../utility/booleanToString';
12
14
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
13
15
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
14
16
  import PreferencesHeader from '../header/PreferencesHeader';
15
17
  import ZonesPreferences from './ZonesPreferences';
16
18
  import ZonesTable from './ZonesTable';
17
- function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, }) {
19
+ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, showAssignmentsLabels, }) {
18
20
  const [filterIsActive, setFilterIsActive] = useState(false);
19
21
  const assignmentData = useAssignmentData();
20
22
  const dispatch = useDispatch();
@@ -115,7 +117,14 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
115
117
  payload: { key: 'showPeaks' },
116
118
  });
117
119
  };
120
+ function handleShowAssignmentsLabel() {
121
+ dispatch({
122
+ type: 'TOGGLE_ZONES_VIEW_PROPERTY',
123
+ payload: { key: 'showAssignmentsLabels' },
124
+ });
125
+ }
118
126
  const total = zones?.values?.length || 0;
127
+ const hasZones = zones?.values && zones.values.length > 0;
119
128
  return (_jsxs("div", { css: [
120
129
  tablePanelStyle,
121
130
  isFlipped &&
@@ -126,29 +135,36 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
126
135
  `,
127
136
  ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: tableData?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', onSettingClick: settingsPanelHandler, leftButtons: [
128
137
  {
129
- disabled: !zones.values || zones.values.length === 0,
138
+ disabled: !hasZones,
130
139
  icon: _jsx(FaUnlink, {}),
131
- title: 'Remove all assignments',
140
+ tooltip: 'Remove all assignments',
132
141
  onClick: handleOnRemoveAssignments,
133
142
  },
134
143
  {
135
144
  icon: _jsx("span", { children: "z" }),
136
- title: 'Show/Hide zones',
145
+ tooltip: 'Show/Hide zones',
137
146
  active: showZones,
138
147
  onClick: handleSetShowZones,
139
148
  },
140
149
  {
141
150
  icon: _jsx("span", { children: "s" }),
142
- title: 'Show/Hide signals',
151
+ tooltip: 'Show/Hide signals',
143
152
  active: showSignals,
144
153
  onClick: handleSetShowSignals,
145
154
  },
146
155
  {
147
156
  icon: _jsx("span", { children: "p" }),
148
- title: 'Show/Hide peaks',
157
+ tooltip: 'Show/Hide peaks',
149
158
  active: showPeaks,
150
159
  onClick: handleSetShowPeaks,
151
160
  },
161
+ {
162
+ disabled: !hasZones,
163
+ icon: _jsx(LuSubtitles, {}),
164
+ tooltip: `${booleanToString(!showAssignmentsLabels)} assignments labels`,
165
+ onClick: handleShowAssignmentsLabel,
166
+ active: showAssignmentsLabels,
167
+ },
152
168
  ] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: _jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nucleus: activeTab, info: info }) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
153
169
  }
154
170
  const MemoizedZonesPanel = memo(ZonesPanelInner);
@@ -19,36 +19,42 @@ const preferences1DFields = [
19
19
  const preferences2DFields = [
20
20
  {
21
21
  id: 1,
22
- label: 'Serial number :',
22
+ label: 'Serial number:',
23
23
  checkControllerName: 'showSerialNumber',
24
24
  hideFormatField: true,
25
25
  },
26
26
  {
27
27
  id: 2,
28
- label: 'Kind :',
29
- checkControllerName: 'showKind',
28
+ label: 'Assignment label:',
29
+ checkControllerName: 'showAssignmentLabel',
30
30
  hideFormatField: true,
31
31
  },
32
32
  {
33
33
  id: 3,
34
- label: 'Assignment :',
35
- checkControllerName: 'showAssignment',
34
+ label: 'Kind:',
35
+ checkControllerName: 'showKind',
36
36
  hideFormatField: true,
37
37
  },
38
38
  {
39
39
  id: 4,
40
- label: 'Delete action :',
41
- checkControllerName: 'showDeleteAction',
40
+ label: 'Assignment links:',
41
+ checkControllerName: 'showAssignment',
42
42
  hideFormatField: true,
43
43
  },
44
44
  {
45
45
  id: 5,
46
- label: 'Zoom action :',
47
- checkControllerName: 'showZoomAction',
46
+ label: 'Delete action:',
47
+ checkControllerName: 'showDeleteAction',
48
48
  hideFormatField: true,
49
49
  },
50
50
  {
51
51
  id: 6,
52
+ label: 'Zoom action:',
53
+ checkControllerName: 'showZoomAction',
54
+ hideFormatField: true,
55
+ },
56
+ {
57
+ id: 7,
52
58
  label: 'Edit action :',
53
59
  checkControllerName: 'showEditAction',
54
60
  hideFormatField: true,
@@ -67,7 +67,7 @@ function ZonesTable({ tableData, onUnlink, nucleus, info }) {
67
67
  const { items: sortedData, isSortedDesc, onSort } = useTableSortBy(data);
68
68
  const { deltaPPM: deltaX } = usePanelPreferences('zones', nuclei?.[0]);
69
69
  const { deltaPPM: deltaY } = usePanelPreferences('zones', nuclei?.[1]);
70
- const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, } = usePanelPreferences('zones', nucleus);
70
+ const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, showAssignmentLabel, } = usePanelPreferences('zones', nucleus);
71
71
  const showActions = showDeleteAction || showEditAction || showZoomAction;
72
72
  if (isFid) {
73
73
  return _jsx(NoDataForFid, {});
@@ -75,7 +75,7 @@ function ZonesTable({ tableData, onUnlink, nucleus, info }) {
75
75
  if (!tableData || tableData.length === 0) {
76
76
  return _jsx(NoTableData, {});
77
77
  }
78
- return (_jsx("div", { children: _jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [showSerialNumber && _jsx("th", { rowSpan: 2, children: "#" }), (deltaX.show || deltaX.show) && _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { colSpan: 2, children: _jsx(FaLink, {}) }), _jsx("th", { colSpan: 2, children: "\u03A3" })] })), showKind && _jsx("th", { rowSpan: 2, children: "Kind" }), showActions && _jsx("th", { rowSpan: 2, children: '' })] }), _jsxs("tr", { children: [deltaX.show && (_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }) })), deltaY.show && (_jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }) })), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) })] }))] })] }), _jsx("tbody", { children: sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, nucleus: nucleus }, `${rowData.tableMetaInfo.id}`))) })] }) }));
78
+ return (_jsx("div", { children: _jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [showSerialNumber && _jsx("th", { rowSpan: 2, children: "#" }), showAssignmentLabel && _jsx("th", { rowSpan: 2, children: "Assignment" }), (deltaX.show || deltaX.show) && _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { colSpan: 2, children: _jsx(FaLink, {}) }), _jsx("th", { colSpan: 2, children: "\u03A3" })] })), showKind && _jsx("th", { rowSpan: 2, children: "Kind" }), showActions && _jsx("th", { rowSpan: 2, children: '' })] }), _jsxs("tr", { children: [deltaX.show && (_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }) })), deltaY.show && (_jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }) })), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) })] }))] })] }), _jsx("tbody", { children: sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, nucleus: nucleus }, `${rowData.tableMetaInfo.id}`))) })] }) }));
79
79
  }
80
80
  function SurroundedText(props) {
81
81
  return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
@@ -10,6 +10,7 @@ import { usePanelPreferences } from '../../hooks/usePanelPreferences';
10
10
  import ActionsColumn from './TableColumns/ActionsColumn';
11
11
  import SignalAssignmentsColumns from './TableColumns/SignalAssignmentsColumns';
12
12
  import SignalDeltaColumn from './TableColumns/SignalDeltaColumn';
13
+ import { ZoneAssignmentLabelColumn } from './TableColumns/ZoneAssignmentLabelColumn';
13
14
  import ZoneAssignmentsColumns from './TableColumns/ZoneAssignmentsColumns';
14
15
  const HighlightedRowStyle = { backgroundColor: '#ff6f0057' };
15
16
  const ConstantlyHighlightedRowStyle = { backgroundColor: '#f5f5dc' };
@@ -21,7 +22,7 @@ function ZonesTableRow({ rowData, onUnlink, contextMenu = [], onContextMenuSelec
21
22
  const assignmentSignal = useAssignment(rowData.tableMetaInfo.id);
22
23
  const highlightSignalX = useHighlight([buildID(assignmentSignal.id, 'X')].concat(assignmentSignal.assigned?.x || [], buildID(assignmentSignal.id, 'Crosshair')));
23
24
  const highlightSignalY = useHighlight([buildID(assignmentSignal.id, 'Y')].concat(assignmentSignal.assigned?.y || [], buildID(assignmentSignal.id, 'Crosshair')));
24
- const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, } = usePanelPreferences('zones', nucleus);
25
+ const { showSerialNumber, showAssignment, showKind, showDeleteAction, showEditAction, showZoomAction, showAssignmentLabel, } = usePanelPreferences('zones', nucleus);
25
26
  const rowSpanTags = useMemo(() => {
26
27
  return {
27
28
  rowSpan: rowData.tableMetaInfo.rowSpan,
@@ -119,6 +120,6 @@ function ZonesTableRow({ rowData, onUnlink, contextMenu = [], onContextMenuSelec
119
120
  ? HighlightedRowStyle
120
121
  : lodashGet(rowData, 'tableMetaInfo.isConstantlyHighlighted', false)
121
122
  ? ConstantlyHighlightedRowStyle
122
- : null, ...highlightZone.onHover, children: [showSerialNumber && _jsx("td", { ...rowSpanTags, children: rowIndex + 1 }), _jsx(SignalDeltaColumn, { rowData: rowData, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, nucleus: nucleus }), showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumns, { rowData: rowData, assignmentSignal: assignmentSignal, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, onClick: clickHandler, onUnlink: unlinkHandler, highlightSignalX: highlightSignalX, highlightSignalY: highlightSignalY }), _jsx(ZoneAssignmentsColumns, { rowData: rowData, assignmentZone: assignmentZone, onHoverZoneX: onHoverZoneX, onHoverZoneY: onHoverZoneY, rowSpanTags: rowSpanTags, onClick: clickHandler, onUnlink: unlinkHandler, highlightZoneX: highlightZoneX, highlightZoneY: highlightZoneY })] })), _jsx(ActionsColumn, { rowData: rowData, rowSpanTags: rowSpanTags, showKind, showDeleteAction, showEditAction, showZoomAction })] }));
123
+ : null, ...highlightZone.onHover, children: [showSerialNumber && _jsx("td", { ...rowSpanTags, children: rowIndex + 1 }), showAssignmentLabel && _jsx(ZoneAssignmentLabelColumn, { rowData: rowData }), _jsx(SignalDeltaColumn, { rowData: rowData, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, nucleus: nucleus }), showAssignment && (_jsxs(_Fragment, { children: [_jsx(SignalAssignmentsColumns, { rowData: rowData, assignmentSignal: assignmentSignal, onHoverSignalX: onHoverSignalX, onHoverSignalY: onHoverSignalY, onClick: clickHandler, onUnlink: unlinkHandler, highlightSignalX: highlightSignalX, highlightSignalY: highlightSignalY }), _jsx(ZoneAssignmentsColumns, { rowData: rowData, assignmentZone: assignmentZone, onHoverZoneX: onHoverZoneX, onHoverZoneY: onHoverZoneY, rowSpanTags: rowSpanTags, onClick: clickHandler, onUnlink: unlinkHandler, highlightZoneX: highlightZoneX, highlightZoneY: highlightZoneY })] })), _jsx(ActionsColumn, { rowData: rowData, rowSpanTags: rowSpanTags, showKind, showDeleteAction, showEditAction, showZoomAction })] }));
123
124
  }
124
125
  export default ZonesTableRow;
@@ -43,10 +43,10 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
43
43
  display: 'flex',
44
44
  justifyContent: 'space-between',
45
45
  paddingBottom: '2px',
46
- }, children: [_jsx(ToolBarButton, { title: `${showSimilarityTree ? 'Hide' : 'Show'} similarity tree`, icon: _jsx(TbBinaryTree, {}), active: showSimilarityTree, onClick: handleShowSimilarityTree }), _jsx(Select, { style: { flex: 6, marginLeft: '5px' }, 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: {
46
+ }, children: [_jsx(ToolBarButton, { tooltip: `${showSimilarityTree ? 'Hide' : 'Show'} similarity tree`, icon: _jsx(TbBinaryTree, {}), active: showSimilarityTree, onClick: handleShowSimilarityTree }), _jsx(Select, { style: { flex: 6, marginLeft: '5px' }, 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: {
47
47
  display: 'flex',
48
48
  alignItems: 'center',
49
49
  flex: 2,
50
50
  justifyContent: 'flex-end',
51
- }, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { title: "Preferences", onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToolBarButton, { title: "Filter by select ranges", icon: _jsx(FaICursor, {}), active: selectedTool === options.databaseRangesSelection.id, onClick: enableFilterHandler }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3, margin: '0 5px' } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { title: "Search by substructure", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
51
+ }, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { tooltip: "Preferences", onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToolBarButton, { tooltip: "Filter by select ranges", icon: _jsx(FaICursor, {}), active: selectedTool === options.databaseRangesSelection.id, onClick: enableFilterHandler }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3, margin: '0 5px' } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { tooltip: "Search by substructure", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
52
52
  }
@@ -35,11 +35,11 @@ function DefaultPanelHeader(props) {
35
35
  setFilterStatus((previousValue) => !previousValue);
36
36
  onFilter?.();
37
37
  }
38
- return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [_jsxs(Toolbar, { children: [onDelete && (_jsx(Toolbar.Item, { id: "delete-button", onClick: onDelete, title: deleteToolTip, icon: _jsx(FaRegTrashAlt, {}), intent: "danger", disabled: !total || disableDelete })), onFilter && (_jsx(Toolbar.Item, { id: "filter-button", onClick: handleFilter, title: filterToolTip, active: isFiltered, icon: _jsx(FaFilter, {}) })), mapToolbarButtons(leftButtons)] }), children] }), _jsx(Toolbar, { children: mapToolbarButtons(rightButtons) }), _jsx(CounterLabel, { value: formatCounterLabel(counter, total) }), onSettingClick && (_jsx(PreferencesButton, { title: "Preferences", onClick: onSettingClick }))] }));
38
+ return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [_jsxs(Toolbar, { children: [onDelete && (_jsx(Toolbar.Item, { id: "delete-button", onClick: onDelete, tooltip: deleteToolTip, icon: _jsx(FaRegTrashAlt, {}), intent: "danger", disabled: !total || disableDelete })), onFilter && (_jsx(Toolbar.Item, { id: "filter-button", onClick: handleFilter, tooltip: filterToolTip, active: isFiltered, icon: _jsx(FaFilter, {}) })), mapToolbarButtons(leftButtons)] }), children] }), _jsx(Toolbar, { children: mapToolbarButtons(rightButtons) }), _jsx(CounterLabel, { value: formatCounterLabel(counter, total) }), onSettingClick && (_jsx(PreferencesButton, { tooltip: "Preferences", onClick: onSettingClick }))] }));
39
39
  }
40
40
  function mapToolbarButtons(buttons) {
41
41
  return buttons.map((props, index) => isCustomToolbarItem(props) ? (
42
42
  // eslint-disable-next-line react/no-array-index-key
43
- _jsx(Fragment, { children: props.component }, `${index}`)) : (_jsx(Toolbar.Item, { ...props }, props.title)));
43
+ _jsx(Fragment, { children: props.component }, `${index}`)) : (_jsx(Toolbar.Item, { ...props }, props?.id || `${index}`)));
44
44
  }
45
45
  export default DefaultPanelHeader;
@@ -6,6 +6,6 @@ function PreferencesHeader({ onClose, onSave }) {
6
6
  display: 'flex',
7
7
  flexDirection: 'row-reverse',
8
8
  borderBottom: '0.55px solid rgb(240 240 240)',
9
- }, children: [_jsx(CloseButton, { onClick: onClose, title: "Close preferences" }), _jsx(SaveButton, { onClick: onSave, title: "Save preferences" })] }));
9
+ }, children: [_jsx(CloseButton, { onClick: onClose, tooltip: "Close preferences" }), _jsx(SaveButton, { onClick: onSave, tooltip: "Save preferences" })] }));
10
10
  }
11
11
  export default PreferencesHeader;
@@ -27,5 +27,5 @@ export function SpectraAutomaticPickingButton() {
27
27
  !isToolVisible('autoRangeAndZonePicking')) {
28
28
  return null;
29
29
  }
30
- return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}), title: "Automatic ranges/zones picking for all spectra", onClick: automaticPickingHandler }));
30
+ return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}), tooltip: "Automatic ranges/zones picking for all spectra", onClick: automaticPickingHandler }));
31
31
  }
@@ -61,7 +61,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
61
61
  let lefButtons = [
62
62
  {
63
63
  icon: _jsx(FaFileExport, {}),
64
- title: 'Copy to clipboard',
64
+ tooltip: 'Copy to clipboard',
65
65
  onClick: copyToClipboardHandler,
66
66
  },
67
67
  ];
@@ -69,19 +69,19 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
69
69
  lefButtons = lefButtons.concat([
70
70
  {
71
71
  icon: _jsx(SvgNmrOverlay, {}),
72
- title: 'Spectra calibration',
72
+ tooltip: 'Spectra calibration',
73
73
  onClick: handleSpectraCalibration,
74
74
  active: calibration,
75
75
  },
76
76
  {
77
77
  icon: _jsx(IoPulseOutline, {}),
78
- title: 'Y spectra tracker',
78
+ tooltip: 'Y spectra tracker',
79
79
  onClick: showTrackerHandler,
80
80
  active: showLegend,
81
81
  },
82
82
  {
83
83
  icon: _jsx(FaChartBar, {}),
84
- title: `${booleanToString(!showAnalysisChart)} analysis chart`,
84
+ tooltip: `${booleanToString(!showAnalysisChart)} analysis chart`,
85
85
  onClick: toggleAnalysisChart,
86
86
  active: showAnalysisChart,
87
87
  },
@@ -57,7 +57,7 @@ function MultipleSpectraAnalysisPreferences({ data, activeTab, onAfterSave }, re
57
57
  }, children: _jsx(LegendsPreferences, {}) }), _jsx(GroupPane, { text: "General", style: {
58
58
  header: { color: 'black' },
59
59
  container: { padding: '5px' },
60
- }, children: _jsx(Label, { title: "Enable resort spectra", children: _jsx(FormikCheckBox, { name: "resortSpectra" }) }) }), _jsx(GroupPane, { text: "Columns Settings ", style: {
60
+ }, children: _jsx(Label, { title: "Sort spectra when sorting columns", children: _jsx(FormikCheckBox, { name: "analysisOptions.resortSpectra" }) }) }), _jsx(GroupPane, { text: "Columns Settings ", style: {
61
61
  header: { color: 'black' },
62
62
  container: { padding: '5px' },
63
63
  }, children: _jsx(AnalysisTablePreferences, {}) }), isExperimental && (_jsx(GroupPane, { text: "Execute code ", style: {
@@ -11,6 +11,7 @@ const ignoreActions = new Set([
11
11
  'SET_ONE_DIMENSION_PIVOT_POINT',
12
12
  'SET_TWO_DIMENSION_PIVOT_POINT',
13
13
  'SET_DIMENSIONS',
14
+ 'SET_AXIS_DOMAIN',
14
15
  'SET_X_DOMAIN',
15
16
  'SET_Y_DOMAIN',
16
17
  'SET_ZOOM',
@@ -180,6 +180,8 @@ function innerSpectrumReducer(draft, action) {
180
180
  return IntegralsActions.handleCutIntegral(draft, action);
181
181
  case 'TOGGLE_INTEGRALS_VIEW_PROPERTY':
182
182
  return IntegralsActions.handleToggleIntegralsViewProperty(draft, action);
183
+ case 'SET_AXIS_DOMAIN':
184
+ return DomainActions.handleSetAxisDomain(draft, action);
183
185
  case 'SET_X_DOMAIN':
184
186
  return DomainActions.handleSetXDomain(draft, action);
185
187
  case 'SET_Y_DOMAIN':
@@ -246,6 +248,8 @@ function innerSpectrumReducer(draft, action) {
246
248
  return FiltersActions.handleCalculateManualTwoDimensionPhaseCorrection(draft, action);
247
249
  case 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER':
248
250
  return FiltersActions.handleApplyManualTowDimensionsPhaseCorrectionFilter(draft);
251
+ case 'APPLY_AUTO_PHASE_CORRECTION_TOW_DIMENSION_FILTER':
252
+ return FiltersActions.handleApplyAutoPhaseCorrectionTwoDimensionsFilter(draft);
249
253
  case 'CHANGE_SPECTRUM_VISIBILITY':
250
254
  return SpectraActions.handleChangeSpectrumVisibilityById(draft, action);
251
255
  case 'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS':
@@ -400,6 +404,10 @@ function innerSpectrumReducer(draft, action) {
400
404
  return ZonesActions.handleToggleZonesViewProperty(draft, action);
401
405
  case 'SAVE_EDITED_ZONE':
402
406
  return ZonesActions.handleSaveEditedZone(draft, action);
407
+ case 'CHANGE_ZONE_ASSIGNMENT_LABEL':
408
+ return ZonesActions.handleChangeZoneAssignmentLabel(draft, action);
409
+ case 'SET_ZONE_ASSIGNMENT_LABEL_COORDINATION':
410
+ return ZonesActions.handleSetZoneAssignmentLabelCoordination(draft, action);
403
411
  case 'ORDER_MULTIPLE_SPECTRA_ANALYSIS':
404
412
  return SpectraAnalysisActions.handleOrderSpectra(draft, action);
405
413
  case 'RESURRECTING_SPECTRUM_FROM_RANGES':
@@ -1,6 +1,10 @@
1
1
  import { Draft } from 'immer';
2
+ import { NucleiPreferences } from 'nmr-load-save';
2
3
  import { State } from '../Reducer';
3
4
  import { ActionType } from '../types/ActionType';
5
+ type SetAxisDomainAction = ActionType<'SET_AXIS_DOMAIN', {
6
+ nucleiPreferences: NucleiPreferences[];
7
+ }>;
4
8
  type SetXDomainAction = ActionType<'SET_X_DOMAIN', {
5
9
  xDomain: [number, number];
6
10
  }>;
@@ -11,7 +15,7 @@ type MoveXAxisAction = ActionType<'MOVE', {
11
15
  shiftX: number;
12
16
  shiftY: number;
13
17
  }>;
14
- export type DomainActions = SetXDomainAction | SetYDomainAction | MoveXAxisAction;
18
+ export type DomainActions = SetXDomainAction | SetYDomainAction | SetAxisDomainAction | MoveXAxisAction;
15
19
  declare function getDomain(draft: Draft<State>): {
16
20
  xDomain: [number, number] | never[] | [undefined, undefined];
17
21
  yDomain: [number, number] | never[] | [undefined, undefined];
@@ -27,5 +31,6 @@ declare function setDomain(draft: Draft<State>, options?: SetDomainOptions): voi
27
31
  declare function setMode(draft: Draft<State>): void;
28
32
  declare function handleSetXDomain(draft: Draft<State>, action: SetXDomainAction): void;
29
33
  declare function handleSetYDomain(draft: Draft<State>, action: SetYDomainAction): void;
34
+ declare function handleSetAxisDomain(draft: Draft<State>, action: SetAxisDomainAction): void;
30
35
  declare function handleMoveOverXAxis(draft: Draft<State>, action: MoveXAxisAction): void;
31
- export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, };
36
+ export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, handleSetAxisDomain, };
@@ -190,6 +190,34 @@ function handleSetYDomain(draft, action) {
190
190
  draft.yDomain = yDomain;
191
191
  addToBrushHistory(draft, { xDomain: draft.xDomain, yDomain });
192
192
  }
193
+ //action
194
+ function handleSetAxisDomain(draft, action) {
195
+ const { nucleiPreferences } = action.payload;
196
+ const { originDomain: { xDomain, yDomain }, displayerMode, view: { spectra: { activeTab }, }, } = draft;
197
+ const axisDomain = {};
198
+ const [xNucleus, yNucleus] = activeTab?.split(',') || [];
199
+ for (const nuclei of nucleiPreferences) {
200
+ const { nucleus, axisFrom, axisTo } = nuclei;
201
+ if (nucleus?.toLowerCase() === xNucleus?.toLowerCase()) {
202
+ axisDomain.x = { from: axisFrom, to: axisTo };
203
+ }
204
+ if (nucleus?.toLowerCase() === yNucleus?.toLowerCase()) {
205
+ axisDomain.y = { from: axisFrom, to: axisTo };
206
+ }
207
+ }
208
+ const { x, y } = axisDomain;
209
+ const x1 = x?.from ?? xDomain[0];
210
+ const x2 = x?.to ?? xDomain[1];
211
+ const y1 = y?.from ?? yDomain[0];
212
+ const y2 = y?.to ?? yDomain[1];
213
+ if (displayerMode === '1D') {
214
+ draft.xDomain = [x1, x2];
215
+ }
216
+ else {
217
+ draft.xDomain = [x1, x2];
218
+ draft.yDomain = [y1, y2];
219
+ }
220
+ }
193
221
  function handleMoveOverXAxis(draft, action) {
194
222
  const { shiftX, shiftY } = action.payload;
195
223
  const [x1, x2] = draft.xDomain;
@@ -219,4 +247,4 @@ function handleMoveOverXAxis(draft, action) {
219
247
  draft.xDomain = [x1Domain, x2Domain];
220
248
  draft.yDomain = [y1Domain, y2Domain];
221
249
  }
222
- export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, };
250
+ export { getDomain, setDomain, setMode, handleSetXDomain, handleSetYDomain, handleMoveOverXAxis, handleSetAxisDomain, };
@@ -86,7 +86,7 @@ type SetTwoDimensionPhaseCorrectionPivotPoint = ActionType<'SET_TWO_DIMENSION_PI
86
86
  x: number;
87
87
  y: number;
88
88
  }>;
89
- export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ApodizationFilterLiveAction | ZeroFillingFilterAction | ZeroFillingFilterLiveAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | BaselineCorrectionFilterLiveAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | AddPhaseCorrectionTraceAction | ChangePhaseCorrectionDirectionAction | DeletePhaseCorrectionTrace | SetOneDimensionPhaseCorrectionPivotPoint | SetTwoDimensionPhaseCorrectionPivotPoint | ManualTwoDimensionsPhaseCorrectionFilterAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_FFT_DIMENSION_1_FILTER' | 'APPLY_FFT_DIMENSION_2_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER' | 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER' | 'TOGGLE_ADD_PHASE_CORRECTION_TRACE_TO_BOTH_DIRECTIONS'>;
89
+ export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ApodizationFilterLiveAction | ZeroFillingFilterAction | ZeroFillingFilterLiveAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | BaselineCorrectionFilterLiveAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | AddPhaseCorrectionTraceAction | ChangePhaseCorrectionDirectionAction | DeletePhaseCorrectionTrace | SetOneDimensionPhaseCorrectionPivotPoint | SetTwoDimensionPhaseCorrectionPivotPoint | ManualTwoDimensionsPhaseCorrectionFilterAction | ActionType<'APPLY_FFT_FILTER' | 'APPLY_FFT_DIMENSION_1_FILTER' | 'APPLY_FFT_DIMENSION_2_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER' | 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER' | 'TOGGLE_ADD_PHASE_CORRECTION_TRACE_TO_BOTH_DIRECTIONS' | 'APPLY_AUTO_PHASE_CORRECTION_TOW_DIMENSION_FILTER'>;
90
90
  export interface RollbackSpectrumByFilterOptions {
91
91
  applyFilter?: boolean;
92
92
  reset?: boolean;
@@ -131,4 +131,5 @@ declare function handleSetOneDimensionPhaseCorrectionPivotPoint(draft: Draft<Sta
131
131
  declare function handleSetTwoDimensionPhaseCorrectionPivotPoint(draft: Draft<State>, action: SetTwoDimensionPhaseCorrectionPivotPoint): void;
132
132
  declare function handleCalculateManualTwoDimensionPhaseCorrection(draft: Draft<State>, action: ManualTwoDimensionsPhaseCorrectionFilterAction): void;
133
133
  declare function handleApplyManualTowDimensionsPhaseCorrectionFilter(draft: Draft<State>): void;
134
- export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyManualTowDimensionsPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, handleAddPhaseCorrectionTrace, handleChangePhaseCorrectionDirection, handleDeletePhaseCorrectionTrace, handleSetOneDimensionPhaseCorrectionPivotPoint, handleSetTwoDimensionPhaseCorrectionPivotPoint, handleCalculateManualTwoDimensionPhaseCorrection, handleToggleAddTracesToBothDirections, };
134
+ declare function handleApplyAutoPhaseCorrectionTwoDimensionsFilter(draft: Draft<State>): void;
135
+ export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyManualTowDimensionsPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, handleAddPhaseCorrectionTrace, handleChangePhaseCorrectionDirection, handleDeletePhaseCorrectionTrace, handleSetOneDimensionPhaseCorrectionPivotPoint, handleSetTwoDimensionPhaseCorrectionPivotPoint, handleCalculateManualTwoDimensionPhaseCorrection, handleToggleAddTracesToBothDirections, handleApplyAutoPhaseCorrectionTwoDimensionsFilter, };
@@ -963,4 +963,30 @@ function handleApplyManualTowDimensionsPhaseCorrectionFilter(draft) {
963
963
  updateView(draft, phaseCorrectionTwoDimensions.DOMAIN_UPDATE_RULES);
964
964
  }
965
965
  }
966
- export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyManualTowDimensionsPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, handleAddPhaseCorrectionTrace, handleChangePhaseCorrectionDirection, handleDeletePhaseCorrectionTrace, handleSetOneDimensionPhaseCorrectionPivotPoint, handleSetTwoDimensionPhaseCorrectionPivotPoint, handleCalculateManualTwoDimensionPhaseCorrection, handleToggleAddTracesToBothDirections, };
966
+ //action
967
+ function handleApplyAutoPhaseCorrectionTwoDimensionsFilter(draft) {
968
+ const activeSpectrum = getActiveSpectrum(draft);
969
+ if (!activeSpectrum || !draft.tempData) {
970
+ return;
971
+ }
972
+ const { index } = activeSpectrum;
973
+ const activeFilterIndex = getActiveFilterIndex(draft);
974
+ FiltersManager.applyFilter(draft.tempData[index], [
975
+ {
976
+ name: phaseCorrectionTwoDimensions.id,
977
+ value: {},
978
+ },
979
+ ], { filterIndex: activeFilterIndex });
980
+ draft.data[index] = draft.tempData[index];
981
+ if (activeFilterIndex !== -1) {
982
+ rollbackSpectrumByFilter(draft, {
983
+ searchBy: 'name',
984
+ key: phaseCorrectionTwoDimensions.id,
985
+ triggerSource: 'Apply',
986
+ });
987
+ }
988
+ else {
989
+ updateView(draft, phaseCorrectionTwoDimensions.DOMAIN_UPDATE_RULES);
990
+ }
991
+ }
992
+ export { handleShiftSpectrumAlongXAxis, handleApplyZeroFillingFilter, handleApplyApodizationFilter, handleApplyFFTFilter, handleApplyFFtDimension1Filter, handleApplyFFtDimension2Filter, handleApplyManualPhaseCorrectionFilter, handleApplyManualTowDimensionsPhaseCorrectionFilter, handleApplyAutoPhaseCorrectionFilter, handleApplyAbsoluteFilter, handleCalculateManualPhaseCorrection, calculateBaseLineCorrection, handleCalculateBaseLineCorrection, handleCalculateApodizationFilter, handleCalculateZeroFillingFilter, handleEnableFilter, handleDeleteFilter, handleDeleteSpectraFilter, handleBaseLineCorrectionFilter, handleSetFilterSnapshotHandler, handleAddExclusionZone, handleDeleteExclusionZone, handleSignalProcessingFilter, rollbackSpectrum, rollbackSpectrumByFilter, handleAddPhaseCorrectionTrace, handleChangePhaseCorrectionDirection, handleDeletePhaseCorrectionTrace, handleSetOneDimensionPhaseCorrectionPivotPoint, handleSetTwoDimensionPhaseCorrectionPivotPoint, handleCalculateManualTwoDimensionPhaseCorrection, handleToggleAddTracesToBothDirections, handleApplyAutoPhaseCorrectionTwoDimensionsFilter, };
@@ -86,7 +86,7 @@ function handleDeleteMolecule(draft, action) {
86
86
  function handlePredictSpectraFromMolecule(draft, action) {
87
87
  const { logger, predictedSpectra, options, molecule, action: predictionAction = 'save', } = action.payload;
88
88
  checkPredictions(predictedSpectra, options, molecule.molfile, logger);
89
- const color = generateColor(false, draft.usedColors['1d']);
89
+ const color = generateColor({ usedColors: draft.usedColors['1d'] });
90
90
  const spectraIds = [];
91
91
  for (const spectrum of generateSpectra(predictedSpectra, options, color, logger)) {
92
92
  draft.data.push(spectrum);
@@ -49,8 +49,7 @@ type ChangeRangeSumAction = ActionType<'CHANGE_RANGE_SUM', {
49
49
  options: SetSumOptions;
50
50
  }>;
51
51
  type AddRangeAction = ActionType<'ADD_RANGE', {
52
- startX: number;
53
- endX: number;
52
+ range: Range;
54
53
  }>;
55
54
  type ChangeRangeRelativeValueAction = ActionType<'CHANGE_RANGE_RELATIVE', ChangeRangeRelativeValueProps>;
56
55
  type ChangeRangeSignalValueAction = ActionType<'CHANGE_RANGE_SIGNAL_VALUE', {
@@ -62,7 +61,7 @@ type UpdateRangAction = ActionType<'UPDATE_RANGE', {
62
61
  range: Range;
63
62
  }>;
64
63
  type CutRangAction = ActionType<'CUT_RANGE', {
65
- cutValue: number;
64
+ ranges: Record<string, Range[]>;
66
65
  }>;
67
66
  type ToggleRangesViewAction = ActionType<'TOGGLE_RANGES_VIEW_PROPERTY', {
68
67
  key: keyof FilterType<RangesViewState, boolean>;
@@ -4,13 +4,12 @@ import cloneDeep from 'lodash/cloneDeep';
4
4
  import { xFindClosestIndex } from 'ml-spectra-processing';
5
5
  import { Filters, FiltersManager } from 'nmr-processing';
6
6
  import { DATUM_KIND, SIGNAL_INLCUDED_KINDS, } from '../../../data/constants/signalsKinds';
7
- import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRange, changeRangeRelativeValue, isSpectrum1D, } from '../../../data/data1d/Spectrum1D';
7
+ import { changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRangeRelativeValue, isSpectrum1D, } from '../../../data/data1d/Spectrum1D';
8
8
  import { initSumOptions, setSumOptions, } from '../../../data/data1d/Spectrum1D/SumManager';
9
9
  import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
10
10
  import { getActiveSpectrum } from '../helper/getActiveSpectrum';
11
- import getRange from '../helper/getRange';
12
11
  import { getSpectrum } from '../helper/getSpectrum';
13
- import { setRangesViewProperty } from '../helper/setRangesViewProperty';
12
+ import { initializeRangeViewObject, setRangesViewProperty, } from '../helper/setRangesViewProperty';
14
13
  import { handleUpdateCorrelations } from './CorrelationsActions';
15
14
  import { setDomain } from './DomainActions';
16
15
  import { toggleDisplayingPeaks } from './PeaksActions';
@@ -232,12 +231,15 @@ function handleSetDiaIDRange(draft, action) {
232
231
  }
233
232
  //action
234
233
  function handleResizeRange(draft, action) {
235
- const activeSpectrum = getActiveSpectrum(draft);
236
- if (activeSpectrum?.id) {
237
- const { index } = activeSpectrum;
238
- const { range } = action.payload;
239
- changeRange(draft.data[index], range);
240
- }
234
+ const spectrum = getSpectrum(draft);
235
+ if (!spectrum)
236
+ return;
237
+ const { range } = action.payload;
238
+ if (!range && !isSpectrum1D(spectrum))
239
+ return;
240
+ const index = spectrum.ranges.values.findIndex((i) => i.id === range.id);
241
+ spectrum.ranges.values[index] = range;
242
+ updateRangesRelativeValues(spectrum);
241
243
  }
242
244
  //action
243
245
  function handleChangeRangeSum(draft, action) {
@@ -260,18 +262,13 @@ function initiateRangeSumOptions(datum, options) {
260
262
  }
261
263
  //action
262
264
  function handleAddRange(draft, action) {
263
- const { startX, endX } = action.payload;
264
- const range = getRange(draft, { startX, endX });
265
+ const { range } = action.payload;
265
266
  const { data, view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
266
267
  const activeSpectrum = getActiveSpectrum(draft);
267
268
  if (activeSpectrum?.id) {
268
269
  const { index } = activeSpectrum;
269
- const [from, to] = range;
270
270
  const datum = data[index];
271
- addRange(datum, {
272
- from,
273
- to,
274
- });
271
+ datum.ranges.values.push(range);
275
272
  initiateRangeSumOptions(datum, {
276
273
  nucleus,
277
274
  molecules,
@@ -335,15 +332,14 @@ function handleToggleRangesViewProperty(draft, action) {
335
332
  toggleRangesViewProperty(draft, key);
336
333
  }
337
334
  function handleCutRange(draft, action) {
338
- const { cutValue } = action.payload;
335
+ const { ranges: cutRanges } = action.payload;
339
336
  const spectrum = getSpectrum(draft);
340
337
  const ranges = spectrum.ranges.values;
341
338
  for (let i = 0; i < ranges.length; i++) {
342
- const { to, from } = ranges[i];
343
- if (cutValue > from && cutValue < to) {
339
+ const { id } = ranges[i];
340
+ if (cutRanges?.[id]) {
344
341
  ranges.splice(i, 1);
345
- addRange(spectrum, { from, to: cutValue });
346
- addRange(spectrum, { from: cutValue, to });
342
+ ranges.push(...cutRanges[id]);
347
343
  }
348
344
  }
349
345
  updateRangesRelativeValues(spectrum);
@@ -372,11 +368,17 @@ function handleChangeRangeAssignmentLabel(draft, action) {
372
368
  if (activeSpectrum?.id) {
373
369
  const { index } = activeSpectrum;
374
370
  const spectrum = draft.data[index];
375
- if (isSpectrum1D(spectrum)) {
376
- const range = spectrum.ranges.values.find((range) => range.id === rangeID);
377
- if (range) {
378
- range.assignment = value;
379
- }
371
+ if (!isSpectrum1D(spectrum)) {
372
+ return;
373
+ }
374
+ initializeRangeViewObject(draft, activeSpectrum.id);
375
+ const rangesView = draft.view.ranges[spectrum.id];
376
+ if (!rangesView.showAssignmentsLabels) {
377
+ rangesView.showAssignmentsLabels = true;
378
+ }
379
+ const range = spectrum.ranges.values.find((range) => range.id === rangeID);
380
+ if (range) {
381
+ range.assignment = value;
380
382
  }
381
383
  }
382
384
  }