nmrium 0.50.0 → 0.50.1

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/README.md +7 -7
  2. package/lib/component/elements/CloseButton.d.ts +2 -2
  3. package/lib/component/elements/CloseButton.js +1 -1
  4. package/lib/component/elements/CounterLabel.d.ts +3 -3
  5. package/lib/component/elements/CounterLabel.js +3 -3
  6. package/lib/component/elements/PreferencesButton.d.ts +2 -2
  7. package/lib/component/elements/PreferencesButton.js +2 -4
  8. package/lib/component/elements/SaveButton.d.ts +2 -2
  9. package/lib/component/elements/SaveButton.js +1 -1
  10. package/lib/component/elements/ToolBarButton.d.ts +1 -8
  11. package/lib/component/elements/ToolBarButton.js +2 -11
  12. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  13. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  14. package/lib/component/modal/CopyClipboardModal.js +1 -1
  15. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  16. package/lib/component/modal/SaveAsModal.js +1 -1
  17. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  18. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  19. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  20. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  21. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  22. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
  23. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  24. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  25. package/lib/component/panels/PeaksPanel/PeaksPanel.js +42 -11
  26. package/lib/component/panels/RangesPanel/RangesHeader.js +70 -10
  27. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +46 -5
  28. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  29. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
  30. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
  31. package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
  32. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
  33. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
  34. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
  35. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
  36. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  37. package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
  38. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +32 -3
  39. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  40. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  41. package/lib/component/toolbar/ToolBar.js +237 -9
  42. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  43. package/lib/component/toolbar/toolbarMenu.js +77 -0
  44. package/lib/component/utility/booleanToString.d.ts +6 -0
  45. package/lib/component/utility/booleanToString.js +4 -0
  46. package/lib/versionInfo.js +1 -1
  47. package/package.json +3 -3
  48. package/lib/component/elements/DeleteButton.d.ts +0 -6
  49. package/lib/component/elements/DeleteButton.js +0 -8
  50. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  51. package/lib/component/elements/DropdownMenu.js +0 -7
  52. package/lib/component/elements/FilterButton.d.ts +0 -6
  53. package/lib/component/elements/FilterButton.js +0 -8
  54. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
  55. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
  56. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  57. package/lib/component/toolbar/BasicToolBar.js +0 -165
  58. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  59. package/lib/component/toolbar/FunctionToolBar.js +0 -148
package/README.md CHANGED
@@ -92,13 +92,13 @@ npm start
92
92
 
93
93
  ## Funding
94
94
 
95
- | | |
96
- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
97
- | <img src="images/zakodium.svg" width="200"> | [Zakodium sàrl](https://www.zakodium.com) |
98
- | <img src="images/idnmr.png" height="80"> | [Initiative zur Verbesserung der NMR-Datenqualität (IDNMR)](https://idnmr.uni-koeln.de/) |
99
- | <img src="images/nfdi4chem.png" width="200"> | [NFDI4Chem Chemistry Consortium in the NFDI](https://www.nfdi4chem.de/) |
100
- | <img src="images/univalle.svg" height="100"> | [Universidad del Valle / Cali, Colombia](https://darmn.correounivalle.edu.co/) |
101
- | <img src="images/bigmap.jpg" height="100"> | [Union’s Horizon 2020 research and innovation programme under grant agreement No 957189](https://www.big-map.eu/European) |
95
+ | | |
96
+ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
97
+ | <img src="images/zakodium.svg" width="200"> | [Zakodium sàrl](https://www.zakodium.com) |
98
+ | <img src="images/idnmr.png" height="80"> | [Initiative zur Verbesserung der NMR-Datenqualität (IDNMR)](https://idnmr.uni-koeln.de/) |
99
+ | <img src="images/nfdi4chem.png" width="200"> | [NFDI4Chem Chemistry Consortium in the NFDI](https://www.nfdi4chem.de/) |
100
+ | <img src="images/univalle.svg" height="100"> | [Universidad del Valle / Cali, Colombia](https://darmn.correounivalle.edu.co/) |
101
+ | <img src="images/bigmap.jpg" height="100"> | This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 957189. The project is part of BATTERY 2030+, the large-scale European research initiative for inventing the sustainable batteries of the future. |
102
102
 
103
103
  ## License
104
104
 
@@ -1,2 +1,2 @@
1
- import { ToolBarButtonProps } from './ToolBarButton';
2
- export declare function CloseButton(props: Pick<ToolBarButtonProps, 'onClick' | 'title' | 'className'>): import("react/jsx-runtime").JSX.Element;
1
+ import { ToolbarItemProps } from 'react-science/ui';
2
+ export declare function CloseButton(props: Pick<ToolbarItemProps, 'onClick' | 'title' | 'className'>): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { FaTimes } from 'react-icons/fa';
3
3
  import { ToolBarButton } from './ToolBarButton';
4
4
  export function CloseButton(props) {
5
- return (_jsx(ToolBarButton, { id: "close-button", ...props, intent: "danger", icon: _jsx(FaTimes, {}), placement: "bottom-start" }));
5
+ return (_jsx(ToolBarButton, { id: "close-button", ...props, intent: "danger", icon: _jsx(FaTimes, {}) }));
6
6
  }
@@ -1,7 +1,7 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties } from 'react';
2
2
  interface CounterLabelProps {
3
- children: ReactNode;
4
3
  style?: CSSProperties;
4
+ value?: string;
5
5
  }
6
- export declare function CounterLabel(props: CounterLabelProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function CounterLabel(props: CounterLabelProps): "" | import("react/jsx-runtime").JSX.Element | undefined;
7
7
  export {};
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
2
  const labelStyle = {
3
3
  margin: 0,
4
4
  textAlign: 'right',
@@ -6,6 +6,6 @@ const labelStyle = {
6
6
  whiteSpace: 'nowrap',
7
7
  };
8
8
  export function CounterLabel(props) {
9
- const { children, style = {} } = props;
10
- return _jsx("p", { style: { ...labelStyle, ...style }, children: children });
9
+ const { style = {}, value } = props;
10
+ return value && _jsxs("p", { style: { ...labelStyle, ...style }, children: [value, " "] });
11
11
  }
@@ -1,2 +1,2 @@
1
- import { ToolBarButtonProps } from './ToolBarButton';
2
- export declare function PreferencesButton({ onClick, }: Pick<ToolBarButtonProps, 'onClick'>): import("react/jsx-runtime").JSX.Element;
1
+ import { ToolbarItemProps } from 'react-science/ui';
2
+ export declare function PreferencesButton(props: Omit<ToolbarItemProps, 'icon'>): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { FaCog } from 'react-icons/fa';
3
3
  import { ToolBarButton } from './ToolBarButton';
4
- export function PreferencesButton({ onClick, }) {
5
- return (_jsx(ToolBarButton, { style: {
6
- fontSize: '1.125em',
7
- }, id: "preferences-button", icon: _jsx(FaCog, {}), onClick: onClick }));
4
+ export function PreferencesButton(props) {
5
+ return _jsx(ToolBarButton, { id: "preferences-button", icon: _jsx(FaCog, {}), ...props });
8
6
  }
@@ -1,2 +1,2 @@
1
- import { ToolBarButtonProps } from './ToolBarButton';
2
- export declare function SaveButton(props: Pick<ToolBarButtonProps, 'onClick' | 'title'>): import("react/jsx-runtime").JSX.Element;
1
+ import { ToolbarItemProps } from 'react-science/ui';
2
+ export declare function SaveButton(props: Pick<ToolbarItemProps, 'onClick' | 'title'>): import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { FaCheck } from 'react-icons/fa';
3
3
  import { ToolBarButton } from './ToolBarButton';
4
4
  export function SaveButton(props) {
5
- return (_jsx(ToolBarButton, { id: "save-button", ...props, intent: "success", icon: _jsx(FaCheck, {}), placement: "bottom-start" }));
5
+ return (_jsx(ToolBarButton, { id: "save-button", ...props, intent: "success", icon: _jsx(FaCheck, {}) }));
6
6
  }
@@ -1,9 +1,2 @@
1
- import { ButtonProps, Placement } from '@blueprintjs/core';
2
- import { CSSProperties } from 'react';
3
1
  import { ToolbarItemProps } from 'react-science/ui';
4
- export interface ToolBarButtonProps extends Omit<ToolbarItemProps, 'onClick' | 'title'>, Pick<ButtonProps, 'onClick' | 'title'> {
5
- disabled?: boolean;
6
- placement?: Placement;
7
- style?: CSSProperties;
8
- }
9
- export declare function ToolBarButton(props: ToolBarButtonProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ToolBarButton(props: ToolbarItemProps): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button } from 'react-science/ui';
2
+ import { Toolbar } from 'react-science/ui';
3
3
  export function ToolBarButton(props) {
4
- const { intent, title = '', placement = 'bottom', style = {}, ...other } = props;
5
- return (_jsx(Button, { ...other, intent: intent, minimal: true, tooltipProps: {
6
- content: title,
7
- placement,
8
- intent,
9
- compact: true,
10
- }, style: {
11
- fontSize: '1.25em',
12
- ...style,
13
- } }));
4
+ return (_jsx(Toolbar, { children: _jsx(Toolbar.Item, { ...props }) }));
14
5
  }
@@ -0,0 +1,11 @@
1
+ import { MenuItemProps } from '@blueprintjs/core';
2
+ import { ToolbarPopoverItemProps as BaseToolbarPopoverItemProps, ToolbarItemProps } from 'react-science/ui';
3
+ export interface ToolbarPopoverMenuItem extends MenuItemProps {
4
+ data?: object;
5
+ }
6
+ interface ToolbarPopoverItemProps extends Omit<BaseToolbarPopoverItemProps, 'onClick' | 'content' | 'itemProps'>, ToolbarItemProps {
7
+ options: ToolbarPopoverMenuItem[];
8
+ onClick: (data?: object) => void;
9
+ }
10
+ export declare function ToolbarPopoverItem(props: ToolbarPopoverItemProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Menu, MenuItem } from '@blueprintjs/core';
3
+ import { Toolbar, } from 'react-science/ui';
4
+ export function ToolbarPopoverItem(props) {
5
+ const { options, onClick, ...itemProps } = props;
6
+ return (_jsx(Toolbar.PopoverItem, { content: _jsx(Menu, { children: options.map((option) => {
7
+ const { data, ...otherOptions } = option;
8
+ return (_jsx(MenuItem, { ...otherOptions, onClick: () => onClick(data) }, JSON.stringify(options)));
9
+ }) }), itemProps: itemProps }));
10
+ }
@@ -32,7 +32,7 @@ const styles = css `
32
32
  }
33
33
  `;
34
34
  function CopyClipboardModal({ text, onClose, onCopyClick, }) {
35
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "main-buttons-container handle", children: [_jsx("button", { type: "button", onClick: () => onCopyClick(text), children: _jsx(FaCopy, {}) }), _jsx(CloseButton, { onClick: onClose })] }), _jsx("div", { className: "inner-container",
35
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "main-buttons-container handle", children: [_jsx("button", { type: "button", onClick: () => onCopyClick(text), children: _jsx(FaCopy, {}) }), _jsx(CloseButton, { title: "Close", onClick: onClose })] }), _jsx("div", { className: "inner-container",
36
36
  // eslint-disable-next-line react/no-danger
37
37
  dangerouslySetInnerHTML: { __html: text } })] }));
38
38
  }
@@ -79,6 +79,6 @@ function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
79
79
  }, [dispatch, onClose, peak.id]);
80
80
  const values = getValues(peak, kind);
81
81
  const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
82
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
82
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "kind : ", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "fwhm: ", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "mu: ", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
83
83
  }
84
84
  export default EditPeakShapeModal;
@@ -61,7 +61,7 @@ function SaveAsModal({ onClose, onSave, name }) {
61
61
  onSave(values);
62
62
  onClose?.();
63
63
  }, [onClose, onSave]);
64
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Save as ... " }), _jsx(CloseButton, { onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { innerRef: refForm, initialValues: { ...INITIAL_VALUE, name }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { style: labelStyle, title: "Name", children: _jsx(FormikInput, { name: "name", className: "name", style: {
64
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Save as ... " }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { innerRef: refForm, initialValues: { ...INITIAL_VALUE, name }, onSubmit: submitHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { style: labelStyle, title: "Name", children: _jsx(FormikInput, { name: "name", className: "name", style: {
65
65
  inputWrapper: { width: '100%' },
66
66
  input: { padding: '5px', textAlign: 'left' },
67
67
  } }) }), _jsx(Label, { style: labelStyle, title: "Compressed", children: _jsx(FormikCheckBox, { name: "compressed" }) }), _jsx(Label, { style: labelStyle, title: "Pretty Format", children: _jsx(FormikCheckBox, { name: "pretty" }) }), _jsx(Label, { style: labelStyle, title: "Include view", children: _jsx(FormikCheckBox, { name: "include.view" }) }), _jsx(Label, { style: labelStyle, title: "Include settings", children: _jsx(FormikCheckBox, { name: "include.settings" }) }), _jsx(Label, { style: labelStyle, title: "Include Data", children: _jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsxs("div", { className: "data-export-group", children: [_jsxs("label", { children: [_jsx(Field, { type: "radio", name: "include.dataType", value: DataExportOptions.ROW_DATA }), "Raw Data"] }), _jsxs("label", { style: {
@@ -74,7 +74,7 @@ function AboutUsModal() {
74
74
  maxWidth: 1000,
75
75
  width: '40vw',
76
76
  minWidth: '500px',
77
- }, title: "About NMRium", children: _jsx(DialogBody, { css: styles, children: _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: _jsx(AboutUsZakodium, {}) }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." })] }) })] }) }) })] }));
77
+ }, title: "About NMRium", children: _jsx(DialogBody, { css: styles, children: _jsxs("div", { className: "container", children: [_jsxs("div", { className: "center-container", children: [_jsx(Logo, { width: 160, height: 50 }), "Version ", _jsx(VersionInfo, {}), _jsx("span", { className: "separator" }), _jsx("a", { href: "https://git.nmrium.org", target: "_blank", rel: "noreferrer", children: "GitHub ( https://git.nmrium.org )" })] }), _jsx("div", { className: "center-container", children: _jsx("span", { className: "separator" }) }), _jsx("span", { className: "content", children: "This project is developed by Zakodium S\u00E0rl (Switzerland), the University of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and Universidad del Valle (Colombia)." }), _jsxs("div", { className: "center-container", children: [_jsx("span", { className: "separator" }), _jsx("span", { className: "title", children: "Funding is provided by" }), _jsx("span", { className: "separator" })] }), _jsx("div", { className: "content", children: _jsxs("ul", { children: [_jsx("li", { children: "IDNMR grant, which part of the Scientific Library Services and Information Systems (LIS) initiative of the DFG." }), _jsx("li", { children: _jsx(AboutUsZakodium, {}) }), _jsx("li", { children: "Universidad del Valle (Cali, Colombia)." }), _jsx("li", { children: "This project has received funding from the European Union\u2019s Horizon 2020 research and innovation programme under grant agreement No 957189. The project is part of BATTERY 2030+, the large-scale European research initiative for inventing the sustainable batteries of the future." })] }) }), _jsx("span", { className: "separator" })] }) }) })] }));
78
78
  }
79
79
  export default AboutUsModal;
80
80
  function VersionInfo() {
@@ -154,7 +154,7 @@ function EditRangeModal({ onSave, onClose, onZoom, onRest, rangeId, }) {
154
154
  if (!rangesPreferences || !range) {
155
155
  return;
156
156
  }
157
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsForm, { range: range, preferences: rangesPreferences }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
157
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsForm, { range: range, preferences: rangesPreferences }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
158
158
  }
159
159
  function useRange(rangeId) {
160
160
  const { ranges } = useSpectrum({
@@ -96,6 +96,6 @@ function EditZoneModal({ onSaveEditZoneModal = () => null, onCloseEditZoneModal
96
96
  }),
97
97
  };
98
98
  }, [rowData.signals, rowData.tableMetaInfo.experiment]);
99
- return (_jsx("div", { css: styles, children: _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: zoneFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "header handle", children: [_jsx(Button, { onClick: handleOnZoom, className: "zoom-button", children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { children: `Zone and Signal edition` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { onClick: handleOnClose })] }), _jsx(SignalsForm, {})] }) }) }));
99
+ return (_jsx("div", { css: styles, children: _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: zoneFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "header handle", children: [_jsx(Button, { onClick: handleOnZoom, className: "zoom-button", children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { children: `Zone and Signal edition` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(SignalsForm, {})] }) }) }));
100
100
  }
101
101
  export default EditZoneModal;
@@ -168,7 +168,7 @@ function MetaImportationModal({ onClose, file }) {
168
168
  });
169
169
  onClose?.();
170
170
  }
171
- return (_jsxs("div", { css: ModalStyles, style: { overflow: 'hidden' }, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import Meta Information" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsx("div", { style: styles.container, children: _jsx("div", { style: { flex: 1, width: '100%' }, children: !parseResult ? (_jsx(DropZone, { fileValidator: fileValidator, emptyDescription: "Drag and Drop CSV or tab-delimited file (.csv, .txt or .tsv)", onDrop: handleDrop })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { height: '130px' }, children: [_jsx(Formik, { innerRef: formRef, initialValues: {
171
+ return (_jsxs("div", { css: ModalStyles, style: { overflow: 'hidden' }, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Import Meta Information" }), _jsx(CloseButton, { title: "Close", onClick: onClose, className: "close-bt" })] }), _jsx("div", { style: styles.container, children: _jsx("div", { style: { flex: 1, width: '100%' }, children: !parseResult ? (_jsx(DropZone, { fileValidator: fileValidator, emptyDescription: "Drag and Drop CSV or tab-delimited file (.csv, .txt or .tsv)", onDrop: handleDrop })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { height: '130px' }, children: [_jsx(Formik, { innerRef: formRef, initialValues: {
172
172
  source: null,
173
173
  target: '',
174
174
  }, onSubmit: handleLinkSpectra, validationSchema: validationSchema, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Source field", style: { label: { width: '100px' } }, children: _jsx(FormikSelect, { name: "source", items: mapColumnToSelectItems(parseResult?.meta.fields || []), style: {
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { SvgNmrAssignment2 } from 'cheminfo-font';
4
4
  import { FaBolt } from 'react-icons/fa';
5
- import { Toolbar } from 'react-science/ui';
6
5
  import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D';
7
6
  import { useChartData } from '../../context/ChartContext';
8
7
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
@@ -22,6 +21,21 @@ function useCheckEnableAutomaticAssignments() {
22
21
  function AutomaticAssignment() {
23
22
  const { getAssignments, assignments, restAssignments } = useAutoAssignments();
24
23
  const enabled = useCheckEnableAutomaticAssignments();
25
- return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { showSettingButton: false, canDelete: false, children: _jsxs(Toolbar, { children: [_jsx(SpectraAutomaticPickingButton, {}), _jsx(Toolbar.Item, { icon: _jsx(SvgNmrAssignment2, {}), title: "Automatic assignment", onClick: getAssignments, disabled: !enabled }), _jsx(Toolbar.Item, { icon: _jsx(FaBolt, {}), title: "Reset assignment", onClick: restAssignments })] }) }), _jsx("div", { className: "inner-container", children: _jsx(AutomaticAssignmentTable, { data: assignments }) })] }));
24
+ return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { leftButtons: [
25
+ {
26
+ component: _jsx(SpectraAutomaticPickingButton, {}),
27
+ },
28
+ {
29
+ icon: _jsx(SvgNmrAssignment2, {}),
30
+ title: 'Automatic assignment',
31
+ onClick: getAssignments,
32
+ disabled: !enabled,
33
+ },
34
+ {
35
+ icon: _jsx(FaBolt, {}),
36
+ title: 'Reset assignment',
37
+ onClick: restAssignments,
38
+ },
39
+ ] }), _jsx("div", { className: "inner-container", children: _jsx(AutomaticAssignmentTable, { data: assignments }) })] }));
26
40
  }
27
41
  export default AutomaticAssignment;
@@ -5,15 +5,15 @@ import { SvgNmrIntegrate } from 'cheminfo-font';
5
5
  import lodashGet from 'lodash/get';
6
6
  import { useCallback, useMemo, useState, useRef, memo } from 'react';
7
7
  import { ImLink } from 'react-icons/im';
8
- import { Toolbar } from 'react-science/ui';
9
8
  import { useChartData } from '../../context/ChartContext';
10
9
  import { useDispatch } from '../../context/DispatchContext';
11
10
  import { useModal } from '../../elements/popup/Modal';
12
11
  import { useActiveSpectrumIntegralsViewState } from '../../hooks/useActiveSpectrumIntegralsViewState';
13
12
  import useSpectrum from '../../hooks/useSpectrum';
14
13
  import ChangeSumModal from '../../modal/changeSum/ChangeSumModal';
14
+ import { booleanToString } from '../../utility/booleanToString';
15
15
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
16
- import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
16
+ import DefaultPanelHeader from '../header/DefaultPanelHeader';
17
17
  import PreferencesHeader from '../header/PreferencesHeader';
18
18
  import IntegralTable from './IntegralTable';
19
19
  import IntegralsPreferences from './IntegralsPreferences';
@@ -79,7 +79,7 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
79
79
  }
80
80
  return [];
81
81
  }, [filterIsActive, info.dimension, integrals, xDomain]);
82
- const counter = integrals?.values?.length || 0;
82
+ const total = integrals?.values?.length || 0;
83
83
  return (_jsxs("div", { css: [
84
84
  tablePanelStyle,
85
85
  isFlipped &&
@@ -88,9 +88,23 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
88
88
  position: relative;
89
89
  }
90
90
  `,
91
- ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: _jsxs(Toolbar, { children: [_jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integration", currentSum: currentSum, sumOptions: integrals?.options }), _jsx(Toolbar.Item, { icon: _jsx(ImLink, {}), title: 'Fixed integration values', onClick: toggleConstantSumHandler, active: integrals?.options?.isSumConstant || false }), _jsx(Toolbar.Item, { icon: _jsx(SvgNmrIntegrate, {}), title: showIntegralsValues
92
- ? 'Hide integrals values'
93
- : 'Show integrals values', onClick: handleShowIntegralsValues, active: showIntegralsValues })] }) })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, info: info, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
91
+ ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: filteredData?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Integrals", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all integrals' : 'Hide integrals out of view', onSettingClick: settingsPanelHandler, leftButtons: [
92
+ {
93
+ component: (_jsx(ChangeSumModal, { onSave: changeIntegralSumHandler, sumType: "integration", currentSum: currentSum, sumOptions: integrals?.options })),
94
+ },
95
+ {
96
+ icon: _jsx(ImLink, {}),
97
+ title: 'Fixed integration values',
98
+ onClick: toggleConstantSumHandler,
99
+ active: integrals?.options?.isSumConstant || false,
100
+ },
101
+ {
102
+ icon: _jsx(SvgNmrIntegrate, {}),
103
+ title: `${booleanToString(!showIntegralsValues)} integrals values`,
104
+ onClick: handleShowIntegralsValues,
105
+ active: showIntegralsValues,
106
+ },
107
+ ] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(IntegralTable, { data: filteredData, info: info, activeTab: activeTab })) : (_jsx(IntegralsPreferences, { ref: settingRef })) })] }));
94
108
  }
95
109
  const MemoizedIntegralPanel = memo(IntegralPanelInner);
96
110
  const emptyData = { integrals: {}, info: {} };
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
3
3
  import { SvgNmrExportAsMatrix, SvgNmrMultipleAnalysis } from 'cheminfo-font';
4
4
  import { Formik } from 'formik';
5
5
  import { useRef } from 'react';
6
- import { Toolbar } from 'react-science/ui';
6
+ import { FaCheck } from 'react-icons/fa';
7
7
  import * as yup from 'yup';
8
8
  import { getMatrixFilters } from '../../../data/matrixGeneration';
9
9
  import { useChartData } from '../../context/ChartContext';
@@ -12,7 +12,6 @@ import { usePreferences } from '../../context/PreferencesContext';
12
12
  import StyledButton from '../../elements/Button';
13
13
  import { GroupPane } from '../../elements/GroupPane';
14
14
  import Label from '../../elements/Label';
15
- import { SaveButton } from '../../elements/SaveButton';
16
15
  import ToggleButton from '../../elements/ToggleButton';
17
16
  import FormikInput from '../../elements/formik/FormikInput';
18
17
  import FormikOnChange from '../../elements/formik/FormikOnChange';
@@ -83,7 +82,21 @@ function MatrixGenerationPanel() {
83
82
  if (xDomain[0] === undefined || xDomain[1] === undefined) {
84
83
  return null;
85
84
  }
86
- return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { canDelete: false, renderRightButtons: () => (_jsx(SaveButton, { onClick: () => formRef.current?.submitForm(), title: "Signal processing" })), children: _jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(SvgNmrExportAsMatrix, {}), title: "Export spectra as a matrix", onClick: handleExportAsMatrix }) }) }), _jsx("div", { className: "inner-container", children: _jsx(PreferencesContainer, { style: { backgroundColor: 'white' }, children: _jsx(Formik, { innerRef: formRef, onSubmit: handleSave, initialValues: matrixOptions, enableReinitialize: true, validationSchema: schema, children: _jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Filters", style: GroupPanelStyle, renderHeader: (text) => (_jsx(FiltersPanelGroupHeader, { text: text, onAdd: handleAddFilter })), children: _jsx(FiltersOptions, {}) }), _jsx(GroupPane, { style: GroupPanelStyle, text: "Exclusions zones", renderHeader: (text) => (_jsx(ExclusionZonesGroupHeader, { text: text })), children: _jsx(ExclusionsZonesTable, {}) }), _jsxs(GroupPane, { text: "More options", style: GroupPanelStyle, children: [_jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "range.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { container: { paddingLeft: '10px' } }, children: _jsx(FormikInput, { name: "range.to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of points", style: {
85
+ return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { leftButtons: [
86
+ {
87
+ icon: _jsx(SvgNmrExportAsMatrix, {}),
88
+ title: 'Export spectra as a matrix',
89
+ onClick: handleExportAsMatrix,
90
+ },
91
+ ], rightButtons: [
92
+ {
93
+ onClick: () => formRef.current?.submitForm(),
94
+ title: 'Signal processing',
95
+ id: 'save-button',
96
+ intent: 'success',
97
+ icon: _jsx(FaCheck, {}),
98
+ },
99
+ ] }), _jsx("div", { className: "inner-container", children: _jsx(PreferencesContainer, { style: { backgroundColor: 'white' }, children: _jsx(Formik, { innerRef: formRef, onSubmit: handleSave, initialValues: matrixOptions, enableReinitialize: true, validationSchema: schema, children: _jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "Filters", style: GroupPanelStyle, renderHeader: (text) => (_jsx(FiltersPanelGroupHeader, { text: text, onAdd: handleAddFilter })), children: _jsx(FiltersOptions, {}) }), _jsx(GroupPane, { style: GroupPanelStyle, text: "Exclusions zones", renderHeader: (text) => (_jsx(ExclusionZonesGroupHeader, { text: text })), children: _jsx(ExclusionsZonesTable, {}) }), _jsxs(GroupPane, { text: "More options", style: GroupPanelStyle, children: [_jsxs(Label, { title: "Range", style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "range.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { container: { paddingLeft: '10px' } }, children: _jsx(FormikInput, { name: "range.to", type: "number", style: inputStyle }) })] }), _jsx(Label, { title: "Number of points", style: {
87
100
  ...labelStyle,
88
101
  wrapper: {},
89
102
  container: { paddingTop: '10px' },
@@ -10,8 +10,8 @@ import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
10
10
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
11
11
  import { useDispatch } from '../../context/DispatchContext';
12
12
  import { useGlobal } from '../../context/GlobalContext';
13
- import { DropdownMenu } from '../../elements/DropdownMenu';
14
13
  import { PreferencesButton } from '../../elements/PreferencesButton';
14
+ import { ToolbarPopoverItem, } from '../../elements/ToolbarPopoverItem';
15
15
  import { useAlert } from '../../elements/popup/Alert';
16
16
  import AboutPredictionModal from '../../modal/AboutPredictionModal';
17
17
  import PredictSpectraModal from '../../modal/PredictSpectraModal';
@@ -154,7 +154,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
154
154
  });
155
155
  }
156
156
  const hasMolecules = molecules && molecules.length > 0;
157
- return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), _jsxs(Toolbar, { children: [renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [' ', _jsx(DropdownMenu, { onSelect: (data) => {
158
- exportHandler(data);
159
- }, placement: "right-start", targetTagName: "div", targetProps: { style: { flex: 'none' } }, options: MOL_EXPORT_MENU, children: _jsx(Toolbar.Item, { disabled: !hasMolecules, title: "Export As", icon: _jsx(FaFileExport, {}) }) }), _jsx(Toolbar.Item, { title: "Paste molfile", icon: _jsx(FaPaste, {}), onClick: handlePasteMolfileAction }), _jsx(Toolbar.Item, { title: "Add molecule", icon: _jsx(FaPlus, {}), onClick: onOpenMoleculeEditor })] })), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { title: "Delete molecule", icon: _jsx(FaRegTrashAlt, {}), onClick: handleDelete, disabled: !hasMolecules }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(Toolbar.Item, { title: "Float molecule", icon: _jsx(IoOpenOutline, {}), onClick: floatMoleculeHandler, active: moleculesView?.[moleculeKey]?.floating.visible || false, disabled: !hasMolecules }), _jsx(Toolbar.Item, { title: "Show atom number", icon: _jsx("p", { style: styles.atomLabel, children: "#" }), onClick: showAtomNumbersHandler, active: moleculesView?.[moleculeKey]?.showAtomNumber || false, disabled: !hasMolecules })] }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && _jsx(PreferencesButton, { onClick: onClickPreferences }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
157
+ return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), _jsxs(Toolbar, { children: [renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(ToolbarPopoverItem, { options: MOL_EXPORT_MENU, onClick: exportHandler, disabled: !hasMolecules, title: "Export As", icon: _jsx(FaFileExport, {}) }), _jsx(Toolbar.Item, { title: "Paste molfile", icon: _jsx(FaPaste, {}), onClick: handlePasteMolfileAction }), _jsx(Toolbar.Item, { title: "Add molecule", icon: _jsx(FaPlus, {}), onClick: onOpenMoleculeEditor })] })), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { title: "Delete molecule", icon: _jsx(FaRegTrashAlt, {}), onClick: handleDelete, disabled: !hasMolecules }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(Toolbar.Item, { title: "Float molecule", icon: _jsx(IoOpenOutline, {}), onClick: floatMoleculeHandler, active: moleculesView?.[moleculeKey]?.floating.visible || false, disabled: !hasMolecules }), _jsx(Toolbar.Item, { title: "Show atom number", icon: _jsx("p", { style: styles.atomLabel, children: "#" }), onClick: showAtomNumbersHandler, active: moleculesView?.[moleculeKey]?.showAtomNumber || false, disabled: !hasMolecules })] }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(PreferencesButton, { title: "Preferences", onClick: onClickPreferences })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
160
158
  }
@@ -1,11 +1,10 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import { SvgNmrFt } from 'cheminfo-font';
4
+ import { SvgNmrFt, SvgNmrPeaks, SvgNmrPeaksTopLabels } from 'cheminfo-font';
5
5
  import SvgPeaks from 'cheminfo-font/lib-react-cjs/lib-react-tsx/nmr/Peaks';
6
6
  import { useCallback, useMemo, useState, useRef, memo } from 'react';
7
7
  import { FaThinkPeaks } from 'react-icons/fa';
8
- import { Toolbar } from 'react-science/ui';
9
8
  import isInRange from '../../../data/utilities/isInRange';
10
9
  import { useChartData } from '../../context/ChartContext';
11
10
  import { useDispatch } from '../../context/DispatchContext';
@@ -16,12 +15,12 @@ import { useActiveSpectrumPeaksViewState } from '../../hooks/useActiveSpectrumPe
16
15
  import useCheckExperimentalFeature from '../../hooks/useCheckExperimentalFeature';
17
16
  import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
18
17
  import useSpectrum from '../../hooks/useSpectrum';
18
+ import { booleanToString } from '../../utility/booleanToString';
19
19
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
20
- import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
20
+ import DefaultPanelHeader from '../header/DefaultPanelHeader';
21
21
  import PreferencesHeader from '../header/PreferencesHeader';
22
22
  import PeaksPreferences from './PeaksPreferences';
23
23
  import PeaksTable from './PeaksTable';
24
- import { PeaksToggleActions } from './PeaksToggleActions';
25
24
  function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
26
25
  const [filterIsActive, setFilterIsActive] = useState(false);
27
26
  const [isFlipped, setFlipStatus] = useState(false);
@@ -89,8 +88,44 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
89
88
  function toggleDisplayingMode() {
90
89
  dispatch({ type: 'TOGGLE_PEAKS_DISPLAYING_MODE' });
91
90
  }
92
- const counter = peaks?.values?.length || 0;
91
+ const total = peaks?.values?.length || 0;
93
92
  const disabled = !peaks?.values || peaks.values.length === 0;
93
+ const { showPeaks, displayingMode, showPeaksShapes, showPeaksSum } = peaksViewState;
94
+ const leftButtons = [
95
+ {
96
+ disabled,
97
+ icon: _jsx(SvgNmrPeaks, {}),
98
+ title: `${booleanToString(!showPeaks)} peaks`,
99
+ onClick: () => toggleViewProperty('showPeaks'),
100
+ active: showPeaks,
101
+ },
102
+ {
103
+ disabled,
104
+ icon: _jsx(SvgNmrPeaksTopLabels, {}),
105
+ title: `${displayingMode === 'spread' ? 'Single' : 'Spread'} mode`,
106
+ onClick: toggleDisplayingMode,
107
+ active: displayingMode === 'spread',
108
+ },
109
+ ];
110
+ if (isExperimental) {
111
+ leftButtons.unshift({
112
+ disabled,
113
+ icon: _jsx(SvgPeaks, {}),
114
+ title: `${booleanToString(!showPeaksShapes)} peaks shapes`,
115
+ onClick: () => toggleViewProperty('showPeaksShapes'),
116
+ active: showPeaksShapes,
117
+ }, {
118
+ disabled,
119
+ icon: _jsx(SvgNmrFt, {}),
120
+ title: `${booleanToString(!showPeaksSum)} peaks sum`,
121
+ onClick: () => toggleViewProperty('showPeaksSum'),
122
+ active: showPeaksSum,
123
+ }, {
124
+ icon: _jsx(FaThinkPeaks, {}),
125
+ title: 'Optimize peaks',
126
+ onClick: optimizePeaksHandler,
127
+ });
128
+ }
94
129
  return (_jsxs("div", { css: [
95
130
  tablePanelStyle,
96
131
  isFlipped &&
@@ -102,11 +137,7 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
102
137
  }
103
138
  }
104
139
  `,
105
- ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredPeaks?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Peaks", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all peaks' : 'Hide peaks out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: _jsxs(Toolbar, { children: [isExperimental && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgPeaks, {}), title: peaksViewState.showPeaksShapes
106
- ? 'Hide peaks shapes'
107
- : 'Show peaks shapes', onClick: () => toggleViewProperty('showPeaksShapes'), active: peaksViewState.showPeaksShapes }), _jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgNmrFt, {}), title: peaksViewState.showPeaksSum
108
- ? 'Hide peaks sum'
109
- : 'Show peaks sum', onClick: () => toggleViewProperty('showPeaksSum'), active: peaksViewState.showPeaksSum }), _jsx(Toolbar.Item, { icon: _jsx(FaThinkPeaks, {}), title: "Optimize peaks", onClick: optimizePeaksHandler })] })), _jsx(PeaksToggleActions, { disabled: disabled, togglePeaks: peaksViewState.showPeaks, onShowToggle: () => toggleViewProperty('showPeaks'), toggleDisplayingMode: peaksViewState.displayingMode, onDisplayingModeToggle: toggleDisplayingMode })] }) })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(PeaksTable, { data: filteredPeaks, info: info, activeTab: activeTab })) : (_jsx(PeaksPreferences, { ref: settingRef })) })] }));
140
+ ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: filteredPeaks?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Peaks", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all peaks' : 'Hide peaks out of view', onSettingClick: settingsPanelHandler, leftButtons: leftButtons })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx(PeaksTable, { data: filteredPeaks, info: info, activeTab: activeTab })) : (_jsx(PeaksPreferences, { ref: settingRef })) })] }));
110
141
  }
111
142
  const MemoizedPeaksPanel = memo(PeaksPanelInner);
112
143
  const emptyData = { peaks: null, info: {} };