nmrium 0.52.0 → 0.54.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 (100) hide show
  1. package/lib/component/1d/Viewer1D.js +48 -17
  2. package/lib/component/1d/ranges/AssignmentLabel.d.ts +7 -0
  3. package/lib/component/1d/ranges/AssignmentLabel.js +10 -0
  4. package/lib/component/1d/ranges/Range.js +15 -6
  5. package/lib/component/1d/tool/XLabelPointer.js +4 -12
  6. package/lib/component/2d/tools/XYLabelPointer.js +3 -9
  7. package/lib/component/context/LoggerContext.js +11 -4
  8. package/lib/component/elements/CloseButton.d.ts +1 -1
  9. package/lib/component/elements/CustomToolTip.d.ts +8 -0
  10. package/lib/component/elements/CustomToolTip.js +107 -0
  11. package/lib/component/elements/EditableColumn.js +6 -5
  12. package/lib/component/elements/SaveButton.d.ts +1 -1
  13. package/lib/component/elements/formik/FormikError.js +2 -4
  14. package/lib/component/elements/formik/FormikInput.js +2 -2
  15. package/lib/component/header/Header.js +1 -1
  16. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
  17. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
  18. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  19. package/lib/component/hooks/useToolsFunctions.js +7 -1
  20. package/lib/component/main/NMRiumStateProvider.js +12 -2
  21. package/lib/component/modal/AboutPredictionModal.js +1 -1
  22. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  23. package/lib/component/modal/CopyClipboardModal.js +1 -1
  24. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  25. package/lib/component/modal/ImportPublicationStringModal.d.ts +5 -3
  26. package/lib/component/modal/ImportPublicationStringModal.js +18 -9
  27. package/lib/component/modal/PredictSpectraModal.js +1 -1
  28. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  29. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  30. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  31. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +1 -1
  32. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +1 -1
  33. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  34. package/lib/component/modal/setting/GeneralSettings.js +12 -19
  35. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
  36. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
  37. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
  38. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  39. package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
  40. package/lib/component/panels/RangesPanel/RangesHeader.js +29 -15
  41. package/lib/component/panels/RangesPanel/RangesPreferences.js +19 -13
  42. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  43. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -1
  44. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.d.ts +7 -0
  45. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.js +16 -0
  46. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
  47. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  48. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
  49. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
  50. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
  51. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
  52. package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
  53. package/lib/component/panels/ZonesPanel/ZonesPanel.js +4 -4
  54. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
  55. package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
  56. package/lib/component/panels/header/PreferencesHeader.js +1 -1
  57. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  58. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  59. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +8 -1
  60. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
  61. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +1 -1
  62. package/lib/component/reducer/Reducer.js +4 -0
  63. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
  64. package/lib/component/reducer/actions/FiltersActions.js +364 -318
  65. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  66. package/lib/component/reducer/actions/RangesActions.d.ts +9 -5
  67. package/lib/component/reducer/actions/RangesActions.js +31 -21
  68. package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
  69. package/lib/component/reducer/actions/SpectraActions.js +5 -1
  70. package/lib/component/reducer/actions/ToolsActions.js +13 -20
  71. package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
  72. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +6 -4
  73. package/lib/component/toolbar/ToolBar.js +112 -26
  74. package/lib/component/utility/export.js +1 -1
  75. package/lib/component/workspaces/workspaceDefaultProperties.js +7 -12
  76. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
  77. package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
  78. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
  79. package/lib/data/data1d/Spectrum1D/index.js +2 -2
  80. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
  81. package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
  82. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
  83. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
  84. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
  85. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
  86. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
  87. package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
  88. package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
  89. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
  90. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
  91. package/lib/data/utilities/generateColor.d.ts +7 -3
  92. package/lib/data/utilities/generateColor.js +5 -17
  93. package/lib/versionInfo.js +1 -1
  94. package/package.json +29 -29
  95. package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
  96. package/lib/component/elements/MolecularFormulaInput.js +0 -63
  97. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
  98. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
  99. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
  100. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
@@ -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);
@@ -128,24 +128,24 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
128
128
  {
129
129
  disabled: !zones.values || zones.values.length === 0,
130
130
  icon: _jsx(FaUnlink, {}),
131
- title: 'Remove all assignments',
131
+ tooltip: 'Remove all assignments',
132
132
  onClick: handleOnRemoveAssignments,
133
133
  },
134
134
  {
135
135
  icon: _jsx("span", { children: "z" }),
136
- title: 'Show/Hide zones',
136
+ tooltip: 'Show/Hide zones',
137
137
  active: showZones,
138
138
  onClick: handleSetShowZones,
139
139
  },
140
140
  {
141
141
  icon: _jsx("span", { children: "s" }),
142
- title: 'Show/Hide signals',
142
+ tooltip: 'Show/Hide signals',
143
143
  active: showSignals,
144
144
  onClick: handleSetShowSignals,
145
145
  },
146
146
  {
147
147
  icon: _jsx("span", { children: "p" }),
148
- title: 'Show/Hide peaks',
148
+ tooltip: 'Show/Hide peaks',
149
149
  active: showPeaks,
150
150
  onClick: handleSetShowPeaks,
151
151
  },
@@ -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
  },
@@ -15,6 +15,12 @@ import PreferencesHeader from '../header/PreferencesHeader';
15
15
  import SpectrumSimulationPreferences from './SpectrumSimulationPreferences';
16
16
  import SpectrumSimulationSimpleOptions from './SpectrumSimulationSimpleOptions';
17
17
  import { SpinSystemTable } from './SpinSystemTable';
18
+ const optionsSchema = Yup.object({
19
+ lineWidth: Yup.number().min(0.1).required(),
20
+ });
21
+ const optionsValidationSchema = Yup.object({
22
+ options: optionsSchema,
23
+ });
18
24
  const validationSchema = Yup.object({
19
25
  data: Yup.array().of(Yup.array().of(Yup.lazy((value) => {
20
26
  if (value === null) {
@@ -22,6 +28,7 @@ const validationSchema = Yup.object({
22
28
  }
23
29
  return Yup.number().required();
24
30
  }))),
31
+ options: optionsSchema,
25
32
  });
26
33
  export default function SpectrumSimulation() {
27
34
  const dispatch = useDispatch();
@@ -79,7 +86,7 @@ export default function SpectrumSimulation() {
79
86
  }
80
87
  return (_jsx(Formik, { initialValues: { ...defaultSimulationOptions, data }, enableReinitialize: true,
81
88
  // eslint-disable-next-line @typescript-eslint/no-empty-function
82
- onSubmit: () => { }, innerRef: formRef, children: ({ values }) => (_jsxs(_Fragment, { children: [_jsxs("div", { css: [
89
+ onSubmit: () => { }, innerRef: formRef, validationSchema: optionsValidationSchema, children: ({ values }) => (_jsxs(_Fragment, { children: [_jsxs("div", { css: [
83
90
  tablePanelStyle,
84
91
  isFlipped &&
85
92
  css `
@@ -25,5 +25,5 @@ export default function SpectrumSimulationSimpleOptions({ onSpinSystemChange, sp
25
25
  width: '40px',
26
26
  textAlign: 'center',
27
27
  },
28
- } }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
28
+ }, step: 0.1, min: 0.1 }), _jsx("span", { style: { padding: '0 5px' }, children: "Hz" })] })] }));
29
29
  }
@@ -47,7 +47,7 @@ export function SpinSystemTable(props) {
47
47
  }
48
48
  return _jsx("div", {});
49
49
  },
50
- Header: () => (_jsxs("span", { children: ["J", _jsxs("sub", { children: [label, "-"] }), "(Hz)"] })),
50
+ Header: () => (_jsxs("span", { children: ["J", _jsxs("sub", { children: [label, "-X"] }), "(Hz)"] })),
51
51
  });
52
52
  i++;
53
53
  }
@@ -246,6 +246,8 @@ function innerSpectrumReducer(draft, action) {
246
246
  return FiltersActions.handleCalculateManualTwoDimensionPhaseCorrection(draft, action);
247
247
  case 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER':
248
248
  return FiltersActions.handleApplyManualTowDimensionsPhaseCorrectionFilter(draft);
249
+ case 'APPLY_AUTO_PHASE_CORRECTION_TOW_DIMENSION_FILTER':
250
+ return FiltersActions.handleApplyAutoPhaseCorrectionTwoDimensionsFilter(draft);
249
251
  case 'CHANGE_SPECTRUM_VISIBILITY':
250
252
  return SpectraActions.handleChangeSpectrumVisibilityById(draft, action);
251
253
  case 'CHANGE_SPECTRA_VISIBILITY_BY_NUCLEUS':
@@ -368,6 +370,8 @@ function innerSpectrumReducer(draft, action) {
368
370
  return RangesActions.handleChangePeaksDisplayingMode(draft);
369
371
  case 'DELETE_RANGE_PEAK':
370
372
  return RangesActions.handleDeleteRangePeak(draft, action);
373
+ case 'CHANGE_RANGE_ASSIGNMENT_LABEL':
374
+ return RangesActions.handleChangeRangeAssignmentLabel(draft, action);
371
375
  case 'SET_KEY_PREFERENCES':
372
376
  return PreferencesActions.handleSetKeyPreferences(draft, action);
373
377
  case 'APPLY_KEY_PREFERENCES':
@@ -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, };