nmrium 0.48.0 → 0.49.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 (59) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/SpectraLegends.js +1 -1
  3. package/lib/component/1d/Viewer1D.js +144 -124
  4. package/lib/component/1d/jCouplingGraph/JsCoupling.js +1 -1
  5. package/lib/component/1d/ranges/Atoms.d.ts +7 -0
  6. package/lib/component/1d/ranges/Atoms.js +43 -0
  7. package/lib/component/1d/ranges/Range.js +4 -2
  8. package/lib/component/1d/tool/BaseLine.d.ts +2 -0
  9. package/lib/component/1d/tool/BaseLine.js +26 -0
  10. package/lib/component/1d/tool/BaseLineZones.js +18 -3
  11. package/lib/component/2d/Chart2D.js +6 -4
  12. package/lib/component/2d/Viewer2D.js +35 -26
  13. package/lib/component/context/KeyModifierContext.d.ts +13 -2
  14. package/lib/component/context/KeyModifierContext.js +35 -4
  15. package/lib/component/context/LoggerContext.d.ts +9 -0
  16. package/lib/component/context/LoggerContext.js +21 -7
  17. package/lib/component/context/PreferencesContext.d.ts +1 -108
  18. package/lib/component/context/TopicMoleculeContext.d.ts +8 -0
  19. package/lib/component/context/TopicMoleculeContext.js +30 -0
  20. package/lib/component/elements/Input.js +4 -1
  21. package/lib/component/elements/ResizerWithScale.js +19 -2
  22. package/lib/component/elements/SVGGroup.js +2 -2
  23. package/lib/component/elements/formik/FormikTextarea.js +8 -9
  24. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +1 -1
  25. package/lib/component/elements/resizer/SVGResizer.js +1 -1
  26. package/lib/component/header/BaseLineCorrectionPanel.js +3 -2
  27. package/lib/component/header/Header.js +2 -2
  28. package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
  29. package/lib/component/hooks/useToolsFunctions.js +4 -2
  30. package/lib/component/main/InnerNMRium.js +2 -1
  31. package/lib/component/modal/ExportAsJcampModal.js +1 -1
  32. package/lib/component/modal/ImportPublicationStringModal.d.ts +2 -1
  33. package/lib/component/modal/ImportPublicationStringModal.js +76 -32
  34. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +9 -11
  35. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  36. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +39 -5
  37. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +3 -3
  38. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +4 -2
  39. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +19 -16
  40. package/lib/component/reducer/Reducer.js +2 -0
  41. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -4
  42. package/lib/component/reducer/actions/FiltersActions.js +92 -55
  43. package/lib/component/reducer/actions/LoadActions.js +10 -8
  44. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -1
  45. package/lib/component/reducer/actions/SpectrumsActions.js +3 -3
  46. package/lib/component/reducer/actions/ToolsActions.d.ts +8 -5
  47. package/lib/component/reducer/actions/ToolsActions.js +51 -44
  48. package/lib/component/toolbar/BasicToolBar.js +11 -29
  49. package/lib/component/utility/export.js +3 -0
  50. package/lib/component/workspaces/exercise.js +1 -0
  51. package/lib/component/workspaces/prediction.js +1 -16
  52. package/lib/component/workspaces/simulation.js +1 -2
  53. package/lib/component/workspaces/workspaceDefaultProperties.js +4 -3
  54. package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
  55. package/lib/data/data1d/Spectrum1D/index.js +0 -1
  56. package/lib/versionInfo.js +1 -1
  57. package/package.json +18 -17
  58. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +0 -2
  59. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.js +0 -6
@@ -1,56 +1,100 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { FifoLogger } from 'fifo-logger';
4
3
  import { Formik } from 'formik';
5
- import { useCallback, useRef } from 'react';
4
+ import debounce from 'lodash/debounce';
5
+ import { resurrect } from 'nmr-processing';
6
+ import { useMemo, useRef, useState } from 'react';
7
+ import { Modal } from 'react-science/ui';
6
8
  import * as yup from 'yup';
7
9
  import { useDispatch } from '../context/DispatchContext';
8
10
  import Button from '../elements/Button';
9
- import CloseButton from '../elements/CloseButton';
11
+ import { GroupPane } from '../elements/GroupPane';
12
+ import ReactTable from '../elements/ReactTable/ReactTable';
10
13
  import FormikTextarea from '../elements/formik/FormikTextarea';
11
14
  import { useAlert } from '../elements/popup/Alert';
12
- import { ModalStyles } from './ModalStyle';
13
- const styles = css `
14
- width: 600px;
15
- height: 300px;
16
-
17
- .inner-content {
18
- flex: 1;
19
- border: none;
20
- overflow: hidden;
21
- padding: 0;
22
- }
23
-
24
- .text-area {
25
- width: 100%;
26
- height: 100%;
27
- outline: none;
28
- resize: none;
29
- padding: 0 0 0 15px;
30
- }
31
- `;
32
15
  const validationSchema = yup.object({
33
16
  publicationText: yup.string().required(),
34
17
  });
35
- function ImportPublicationStringModal({ onClose, }) {
18
+ function handleRowStyle(data) {
19
+ const level = (data?.original).level;
20
+ let backgroundColor = 'lightgreen';
21
+ if (level > 40) {
22
+ backgroundColor = 'pink';
23
+ }
24
+ else if (level === 40) {
25
+ backgroundColor = 'lightyellow';
26
+ }
27
+ return { base: { backgroundColor } };
28
+ }
29
+ const INITIAL_VALUES = {
30
+ publicationText: '1H NMR (CDCl3, 400MHz) δ 10.58 (b, 1H), 7.40 (d, 1H, J = 8.0 Hz), 6.19 (d, 1H, J = 7.6 Hz), 4.88 (s, 1H), 2.17 (s, 3H), 1.02 (s, 9H), 1.01 (s, 9H), 0.89 (s, 9H)',
31
+ };
32
+ function ImportPublicationStringModal(props) {
33
+ const { onClose, isOpen } = props;
36
34
  const formRef = useRef();
37
35
  const dispatch = useDispatch();
38
36
  const alert = useAlert();
39
- const publicationStringHandler = useCallback((values) => {
37
+ const [logs, setLogs] = useState([]);
38
+ const loggerRef = useRef(new FifoLogger({
39
+ onChange: (log, logs) => {
40
+ setLogs(logs.slice());
41
+ },
42
+ }));
43
+ const COLUMNS = useMemo(() => [
44
+ {
45
+ Header: '#',
46
+ accessor: (_, index) => index + 1,
47
+ style: { width: '40px' },
48
+ },
49
+ {
50
+ Header: 'Label',
51
+ accessor: 'levelLabel',
52
+ style: { width: '60px' },
53
+ },
54
+ {
55
+ Header: 'Message',
56
+ accessor: 'message',
57
+ },
58
+ ], []);
59
+ const debounceChanges = useMemo(() => debounce((value) => {
60
+ resurrect(value, { logger: loggerRef.current });
61
+ }, 250), []);
62
+ if (!isOpen)
63
+ return;
64
+ function publicationStringHandler({ publicationText }) {
40
65
  void (async () => {
41
66
  const hideLoading = await alert.showLoading('Generate spectrum from publication string in progress');
67
+ const { ranges, info: { nucleus, solvent = '', frequency }, parts, } = resurrect(publicationText, { logger: loggerRef.current });
42
68
  setTimeout(() => {
43
69
  dispatch({
44
70
  type: 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING',
45
- payload: values,
71
+ payload: {
72
+ ranges,
73
+ info: { nucleus, solvent, frequency, name: parts[0] },
74
+ },
46
75
  });
47
76
  hideLoading();
48
77
  });
49
78
  onClose();
50
79
  })();
51
- }, [alert, dispatch, onClose]);
52
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import from publication string" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { innerRef: formRef, initialValues: {
53
- publicationText: '1H NMR (CDCl3, 400MHz) δ 10.58 (b, 1H), 7.40 (d, 1H, J = 8.0 Hz), 6.19 (d, 1H, J = 7.6 Hz), 4.88 (s, 1H), 2.17 (s, 3H), 1.02 (s, 9H), 1.01 (s, 9H), 0.89 (s, 9H)',
54
- }, validationSchema: validationSchema, onSubmit: publicationStringHandler, children: _jsx(FormikTextarea, { name: "publicationText", className: "text-area", placeholder: "Enter publication string" }) }) }), _jsx("div", { className: "footer-container", children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), children: "Import" }) })] }));
80
+ }
81
+ function handleOnChange(event) {
82
+ loggerRef.current.clear();
83
+ const value = event.target.value;
84
+ if (value) {
85
+ debounceChanges(value);
86
+ }
87
+ }
88
+ const isNotValid = logs.some((log) => ['error', 'fatal'].includes(log.levelLabel));
89
+ return (_jsx(Modal, { hasCloseButton: true, isOpen: true, onRequestClose: onClose, children: _jsx(Formik, { innerRef: formRef, initialValues: INITIAL_VALUES, validationSchema: validationSchema, onSubmit: publicationStringHandler, children: ({ isValid }) => (_jsxs(_Fragment, { children: [_jsx(Modal.Header, { children: "Generate spectrum from publication string" }), _jsx(Modal.Body, { children: _jsxs("div", { style: { width: 800, minHeight: 400, padding: '10px' }, children: [_jsxs("p", { children: ["Paste a publication string in the text area below and click on the button ", _jsx("i", { children: "Generate spectrum" })] }), _jsx(FormikTextarea, { style: {
90
+ width: '100%',
91
+ height: '180px',
92
+ outline: 'none',
93
+ borderWidth: '1px',
94
+ borderColor: '#dedede',
95
+ borderRadius: '5px',
96
+ resize: 'none',
97
+ padding: '15px',
98
+ }, name: "publicationText", className: "text-area", placeholder: "Enter publication string", onChange: handleOnChange }), _jsx(GroupPane, { text: "Logs", children: _jsx(ReactTable, { columns: COLUMNS, data: logs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle }) })] }) }), _jsx(Modal.Footer, { children: _jsx("div", { style: { display: 'flex', flexDirection: 'row-reverse' }, children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), disabled: isNotValid || !isValid, children: "Generate spectrum" }) }) })] })) }) }));
55
99
  }
56
100
  export default ImportPublicationStringModal;
@@ -1,9 +1,15 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { LOGGER_LEVELS } from '../../../context/LoggerContext';
2
3
  import { GroupPane } from '../../../elements/GroupPane';
3
4
  import Label from '../../../elements/Label';
4
5
  import FormikCheckBox from '../../../elements/formik/FormikCheckBox';
5
6
  import FormikInput from '../../../elements/formik/FormikInput';
6
7
  import FormikSelect from '../../../elements/formik/FormikSelect';
8
+ const labelStyle = {
9
+ label: { flex: 6 },
10
+ wrapper: { flex: 6 },
11
+ container: { paddingBottom: '5px' },
12
+ };
7
13
  const SHAPE_RENDERING = [
8
14
  {
9
15
  label: 'Auto',
@@ -22,19 +28,11 @@ const SHAPE_RENDERING = [
22
28
  value: 'geometricPrecision',
23
29
  },
24
30
  ];
25
- const LOGS_LEVELS = [
26
- 'fatal',
27
- 'error',
28
- 'warn',
29
- 'info',
30
- 'debug',
31
- 'trace',
32
- 'silent',
33
- ].map((level) => ({
31
+ const LOGS_LEVELS = Object.keys(LOGGER_LEVELS).map((level) => ({
34
32
  label: level.replace(/^\w/, (c) => c.toUpperCase()),
35
33
  value: level,
36
34
  }));
37
35
  function GeneralTabContent() {
38
- return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Spectra", children: _jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1 }) }) }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display" }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsx(GroupPane, { text: "Logging settings", children: _jsx(Label, { title: "Level ", children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }) })] }));
36
+ return (_jsxs(_Fragment, { children: [_jsxs(GroupPane, { text: "General", children: [_jsx(Label, { title: "Opacity of dimmed spectra [ 0 - 1 ]", style: labelStyle, children: _jsx(FormikInput, { name: "general.dimmedSpectraOpacity", checkValue: (value) => Number(value) >= 0 && Number(value) <= 1, type: "number", step: 0.1, min: 0, max: 1, style: { inputWrapper: { width: 60 } } }) }), _jsx(Label, { title: "Invert actions", htmlFor: "general.invert", style: labelStyle, children: _jsx(FormikCheckBox, { name: "general.invert", style: { container: { justifyContent: 'flex-start' } } }) })] }), _jsx(GroupPane, { text: "Experimental features", children: _jsx(Label, { title: "Enable experimental features", htmlFor: "display.general.experimentalFeatures.display", style: labelStyle, children: _jsx(FormikCheckBox, { name: "display.general.experimentalFeatures.display", style: { container: { justifyContent: 'flex-start' } } }) }) }), _jsx(GroupPane, { text: "Rendering", children: _jsx(Label, { title: "Spectra rendering ", style: labelStyle, children: _jsx(FormikSelect, { items: SHAPE_RENDERING, name: "general.spectraRendering", style: { width: '150px' } }) }) }), _jsxs(GroupPane, { text: "Logging settings", children: [_jsx(Label, { title: "Level ", style: labelStyle, children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.loggingLevel", style: { width: '100px' } }) }), _jsx(Label, { title: "Popup logging level ", style: labelStyle, children: _jsx(FormikSelect, { items: LOGS_LEVELS, name: "general.popupLoggingLevel", style: { width: '100px' } }) })] })] }));
39
37
  }
40
38
  export default GeneralTabContent;
@@ -64,7 +64,7 @@ function RangesTable({ tableData, onUnlink, contextMenu = [], onContextMenuSelec
64
64
  const showActions = preferences.showDeleteAction ||
65
65
  preferences.showEditAction ||
66
66
  preferences.showZoomAction;
67
- return (_jsxs("table", { css: tableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [preferences.showSerialNumber && _jsx("th", { children: "#" }), preferences.from.show && (_jsxs("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && (_jsxs("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show && _jsx("th", { children: "\u03B4 (ppm) " }), preferences.deltaHz.show && _jsx("th", { children: "\u03B4 (Hz) " }), preferences.relative.show && (_jsxs("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })), preferences.absolute.show && _jsx("th", { children: "Absolute" }), preferences.showMultiplicity && _jsx("th", { children: "Mult." }), preferences.coupling.show && _jsx("th", { children: "J (Hz)" }), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { title: "Assign multiplets", children: _jsx(FaLink, { style: { fontSize: 10, margin: 'auto' } }) }), _jsx("th", { title: "Assign ranges", style: { minWidth: '50px' }, children: "\u03A3" })] })), preferences.showKind && _jsx("th", { children: "Kind" }), showActions && _jsx("th", { children: '' })] }) }), _jsx("tbody", { children: data?.map((range) => {
67
+ return (_jsxs("table", { css: tableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [preferences.showSerialNumber && _jsx("th", { children: "#" }), preferences.from.show && (_jsxs("th", { id: "from", ...onSort, children: ["From", isSortedDesc('from').content] })), preferences.to.show && (_jsxs("th", { id: "to", ...onSort, children: ["To ", isSortedDesc('to').content] })), preferences.deltaPPM.show && (_jsxs("th", { id: "from", ...onSort, children: ["\u03B4 (ppm) ", isSortedDesc('from').content] })), preferences.deltaHz.show && _jsx("th", { children: "\u03B4 (Hz) " }), preferences.relative.show && (_jsxs("th", { id: "integration", ...onSort, children: ["Rel. ", element, " ", isSortedDesc('integration').content] })), preferences.absolute.show && _jsx("th", { children: "Absolute" }), preferences.showMultiplicity && _jsx("th", { children: "Mult." }), preferences.coupling.show && _jsx("th", { children: "J (Hz)" }), preferences.showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { title: "Assign multiplets", children: _jsx(FaLink, { style: { fontSize: 10, margin: 'auto' } }) }), _jsx("th", { title: "Assign ranges", style: { minWidth: '50px' }, children: "\u03A3" })] })), preferences.showKind && _jsx("th", { children: "Kind" }), showActions && _jsx("th", { children: '' })] }) }), _jsx("tbody", { children: data?.map((range) => {
68
68
  return (_jsx(RangesTableRow, { rowData: range, onUnlink: onUnlink, preferences: preferences, info: info, contextMenu: contextMenu, onContextMenuSelect: onContextMenuSelect }, range.rowKey));
69
69
  }) })] }));
70
70
  }
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Formik } from 'formik';
3
3
  import { useImperativeHandle, useRef, memo, forwardRef, useCallback, useMemo, } from 'react';
4
+ import * as Yup from 'yup';
4
5
  import { useChartData } from '../../context/ChartContext';
5
6
  import { usePreferences } from '../../context/PreferencesContext';
6
7
  import { Scroller } from '../../elements/Scroller';
@@ -11,6 +12,26 @@ import { getSpectraObjectPaths } from '../../utility/getSpectraObjectPaths';
11
12
  import { NucleusGroup } from '../extra/preferences/NucleusGroup';
12
13
  import { PreferencesContainer } from '../extra/preferences/PreferencesContainer';
13
14
  import { SpectraColumnsManager } from './base/SpectraColumnsManager';
15
+ function validationColumns(obj) {
16
+ const validationObject = {};
17
+ for (const key of Object.keys(obj.nuclei)) {
18
+ validationObject[key] = Yup.object({
19
+ columns: Yup.array().of(Yup.object().shape({
20
+ jpath: Yup.array().when('jpath', {
21
+ is: (jpath) => {
22
+ return jpath !== undefined;
23
+ },
24
+ // eslint-disable-next-line unicorn/no-thenable
25
+ then: () => Yup.array().of(Yup.string()).required().min(1),
26
+ }),
27
+ }, [['jpath', 'jpath']])),
28
+ });
29
+ }
30
+ return validationObject;
31
+ }
32
+ const spectraPreferencesValidation = Yup.lazy((obj) => Yup.object().shape({
33
+ nuclei: Yup.object().shape(validationColumns(obj)),
34
+ }));
14
35
  function SpectraPreferences(props, ref) {
15
36
  const formRef = useRef(null);
16
37
  const { data, view: { spectra: { activeTab }, }, } = useChartData();
@@ -26,10 +47,15 @@ function SpectraPreferences(props, ref) {
26
47
  }
27
48
  useImperativeHandle(ref, () => ({
28
49
  saveSetting: () => {
29
- formRef.current.submitForm();
50
+ if (!formRef.current)
51
+ return;
52
+ void formRef.current.submitForm();
53
+ return formRef.current?.isValid;
30
54
  },
31
55
  }), []);
32
56
  const handleAdd = useCallback((nucleus, index) => {
57
+ if (!formRef.current)
58
+ return;
33
59
  const data = formRef.current.values;
34
60
  let columns = data.nuclei[nucleus]?.columns || [];
35
61
  columns = [
@@ -41,7 +67,7 @@ function SpectraPreferences(props, ref) {
41
67
  },
42
68
  ...columns.slice(index),
43
69
  ];
44
- formRef.current.setValues({
70
+ void formRef.current.setValues({
45
71
  ...data,
46
72
  nuclei: {
47
73
  ...data.nuclei,
@@ -53,9 +79,11 @@ function SpectraPreferences(props, ref) {
53
79
  });
54
80
  }, []);
55
81
  const handleDelete = useCallback((nucleus, index) => {
82
+ if (!formRef.current)
83
+ return;
56
84
  const data = formRef.current.values;
57
85
  const columns = data.nuclei[nucleus]?.columns.filter((_, columnIndex) => columnIndex !== index);
58
- formRef.current.setValues({
86
+ void formRef.current.setValues({
59
87
  ...data,
60
88
  nuclei: {
61
89
  ...data.nuclei,
@@ -66,8 +94,14 @@ function SpectraPreferences(props, ref) {
66
94
  },
67
95
  });
68
96
  }, []);
69
- const mapOnChangeValueHandler = useCallback((key) => paths?.[key] || key, [paths]);
97
+ const mapOnChangeValueHandler = useCallback((key) => {
98
+ const path = paths?.[key];
99
+ if (path) {
100
+ return path;
101
+ }
102
+ return key || ' ';
103
+ }, [paths]);
70
104
  const mapValue = useCallback((value) => convertPathArrayToString(value), []);
71
- return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, 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))) }) }) }));
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))) }) }) }));
72
106
  }
73
107
  export default memo(forwardRef(SpectraPreferences));
@@ -55,7 +55,7 @@ const Spectra2DContextMenuOptions = [
55
55
  data: { id: SpectraContextMenuOptionsKeys.Delete },
56
56
  },
57
57
  {
58
- text: 'Export as jcamp',
58
+ text: 'Export as JCAMP-DX',
59
59
  icon: _jsx(FaFileExport, {}),
60
60
  data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
61
61
  },
@@ -63,7 +63,7 @@ const Spectra2DContextMenuOptions = [
63
63
  const Spectra1DContextMenuOptions = [
64
64
  ...Spectra2DContextMenuOptions,
65
65
  {
66
- text: 'Export as jcamp',
66
+ text: 'Export as JCAMP-DX',
67
67
  icon: _jsx(FaFileExport, {}),
68
68
  data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
69
69
  },
@@ -149,7 +149,7 @@ export function SpectraTable(props) {
149
149
  });
150
150
  }
151
151
  else {
152
- const pathString = path.join('.');
152
+ const pathString = Array.isArray(path) ? path.join('.') : '';
153
153
  let style = columnStyle;
154
154
  let cellRender = null;
155
155
  if (pathString === 'info.name') {
@@ -18,8 +18,10 @@ function SpectrumListPanel() {
18
18
  setFlipStatus(!isFlipped);
19
19
  }
20
20
  function saveSettingHandler() {
21
- settingsRef.current.saveSetting();
22
- setFlipStatus(!isFlipped);
21
+ const isValid = settingsRef.current.saveSetting();
22
+ if (isValid) {
23
+ setFlipStatus(!isFlipped);
24
+ }
23
25
  }
24
26
  return (_jsx("div", { style: styles, children: isFlipped ? (_jsxs(_Fragment, { children: [_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler }), _jsx(SpectraPreferences, { ref: settingsRef })] })) : (_jsxs(_Fragment, { children: [_jsx(SpectraPanelHeader, { onSettingClick: settingsPanelHandler }), _jsx(SpectrumsTabs, {})] })) }));
25
27
  }
@@ -6,14 +6,18 @@ import Button from '../../../elements/Button';
6
6
  import { CheckBoxCell } from '../../../elements/CheckBoxCell';
7
7
  import ReactTable from '../../../elements/ReactTable/ReactTable';
8
8
  import FormikInput from '../../../elements/formik/FormikInput';
9
- const style = {
10
- width: '100%',
11
- fontSize: '1.1em',
12
- textAlign: 'left',
13
- padding: '0.1em 0.1em',
14
- };
15
9
  const inputStyle = {
16
- border: 'none',
10
+ input: {
11
+ width: '100%',
12
+ fontSize: '1.1em',
13
+ textAlign: 'left',
14
+ backgroundColor: 'transparent',
15
+ },
16
+ inputWrapper: {
17
+ padding: '0.25rem 0.5rem',
18
+ borderRadius: 0,
19
+ borderColor: 'white',
20
+ },
17
21
  };
18
22
  export function SpectraColumnsManager({ nucleus, onAdd, onDelete, datalist, mapOnChangeValue, mapValue, }) {
19
23
  const { values: nucleiPreferences } = useFormikContext();
@@ -25,24 +29,23 @@ export function SpectraColumnsManager({ nucleus, onAdd, onDelete, datalist, mapO
25
29
  },
26
30
  {
27
31
  Header: 'Label',
32
+ style: { padding: 0 },
28
33
  Cell: ({ row }) => {
29
- return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.label`, style: {
30
- input: { ...style, ...inputStyle },
31
- inputWrapper: { border: 'none' },
32
- } }));
34
+ return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.label`, style: inputStyle }));
33
35
  },
34
36
  },
35
37
  {
36
38
  Header: 'Column',
39
+ style: { padding: 0 },
37
40
  Cell: ({ row }) => {
38
41
  const column = row.original;
39
42
  if (column?.name) {
40
- return (_jsx("span", { style: style, children: column?.jpath?.join('.') || column.description }));
43
+ return (_jsx("span", { style: {
44
+ ...inputStyle.input,
45
+ padding: '0.25rem 0.5rem',
46
+ }, children: column?.jpath?.join('.') || column.description }));
41
47
  }
42
- return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.jpath`, style: {
43
- input: { ...style, ...inputStyle },
44
- inputWrapper: { border: 'none' },
45
- }, datalist: datalist, mapOnChangeValue: mapOnChangeValue, mapValue: mapValue }));
48
+ return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.jpath`, style: inputStyle, datalist: datalist, mapOnChangeValue: mapOnChangeValue, mapValue: mapValue }));
46
49
  },
47
50
  },
48
51
  {
@@ -289,6 +289,8 @@ function innerSpectrumReducer(draft, action) {
289
289
  return ToolsActions.handleAddBaseLineZone(draft, action);
290
290
  case 'DELETE_BASE_LINE_ZONE':
291
291
  return ToolsActions.handleDeleteBaseLineZone(draft, action);
292
+ case 'RESIZE_BASE_LINE_ZONE':
293
+ return ToolsActions.handleResizeBaseLineZone(draft, action);
292
294
  case 'SET_2D_LEVEL':
293
295
  return ToolsActions.levelChangeHandler(draft, action);
294
296
  case 'ADD_MOLECULE':
@@ -82,7 +82,7 @@ type SetTwoDimensionPhaseCorrectionPivotPoint = ActionType<'SET_TWO_DIMENSION_PI
82
82
  y: number;
83
83
  }>;
84
84
  export type FiltersActions = ShiftSpectrumAlongXAxisAction | ApodizationFilterAction | ApodizationFilterLiveAction | ZeroFillingFilterAction | ZeroFillingFilterLiveAction | ManualPhaseCorrectionFilterAction | BaselineCorrectionFilterAction | BaselineCorrectionFilterLiveAction | EnableFilterAction | DeleteFilterAction | DeleteSpectraFilterAction | SetFilterSnapshotAction | AddExclusionZoneAction | DeleteExclusionZoneAction | ApplySignalProcessingAction | AddPhaseCorrectionTraceAction | ChangePhaseCorrectionDirectionAction | DeletePhaseCorrectionTrace | SetOneDimensionPhaseCorrectionPivotPoint | SetTwoDimensionPhaseCorrectionPivotPoint | ActionType<'APPLY_FFT_FILTER' | 'APPLY_FFT_DIMENSION_1_FILTER' | 'APPLY_FFT_DIMENSION_2_FILTER' | 'APPLY_AUTO_PHASE_CORRECTION_FILTER' | 'APPLY_ABSOLUTE_FILTER'>;
85
- interface RollbackSpectrumByFilterOptions {
85
+ export interface RollbackSpectrumByFilterOptions {
86
86
  applyFilter?: boolean;
87
87
  reset?: boolean;
88
88
  searchBy?: 'id' | 'name';
@@ -91,9 +91,8 @@ interface RollbackSpectrumByFilterOptions {
91
91
  triggerSource?: 'Apply' | 'none';
92
92
  }
93
93
  declare function rollbackSpectrumByFilter(draft: Draft<State>, options?: RollbackSpectrumByFilterOptions): void;
94
- interface RollbackSpectrumOptions {
95
- updateFilterViewOptions?: boolean;
96
- filterKey: string;
94
+ export interface RollbackSpectrumOptions {
95
+ filterKey?: string;
97
96
  reset?: boolean;
98
97
  }
99
98
  declare function rollbackSpectrum(draft: Draft<State>, options: RollbackSpectrumOptions): void;