nmrium 0.49.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 (121) hide show
  1. package/README.md +7 -7
  2. package/lib/component/1d/Chart1D.js +3 -1
  3. package/lib/component/1d/LinesSeries.js +1 -1
  4. package/lib/component/1d/SimilarityTree.d.ts +1 -0
  5. package/lib/component/1d/SimilarityTree.js +60 -0
  6. package/lib/component/1d/Viewer1D.js +9 -11
  7. package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -7
  8. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +114 -125
  9. package/lib/component/1d/multiplicityTree/MultiplicityTrees.d.ts +1 -0
  10. package/lib/component/1d/multiplicityTree/MultiplicityTrees.js +23 -0
  11. package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +18 -0
  12. package/lib/component/1d/multiplicityTree/generateTreeNodes.js +66 -0
  13. package/lib/component/1d/ranges/Range.d.ts +1 -1
  14. package/lib/component/1d/ranges/Range.js +8 -9
  15. package/lib/component/elements/CloseButton.d.ts +2 -10
  16. package/lib/component/elements/CloseButton.js +3 -20
  17. package/lib/component/elements/CounterLabel.d.ts +3 -3
  18. package/lib/component/elements/CounterLabel.js +3 -4
  19. package/lib/component/elements/PreferencesButton.d.ts +2 -4
  20. package/lib/component/elements/PreferencesButton.js +3 -3
  21. package/lib/component/elements/ReactTable/ReactTable.js +5 -2
  22. package/lib/component/elements/SaveButton.d.ts +2 -11
  23. package/lib/component/elements/SaveButton.js +4 -19
  24. package/lib/component/elements/ToolBarButton.d.ts +2 -0
  25. package/lib/component/elements/ToolBarButton.js +5 -0
  26. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  27. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  28. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
  29. package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
  30. package/lib/component/hooks/useSaveSettings.js +3 -2
  31. package/lib/component/main/InnerNMRiumContents.js +1 -1
  32. package/lib/component/modal/AboutPredictionModal.js +4 -8
  33. package/lib/component/modal/AboutSpectrumSimulationModal.js +4 -8
  34. package/lib/component/modal/CopyClipboardModal.js +2 -2
  35. package/lib/component/modal/EditPeakShapeModal.js +2 -2
  36. package/lib/component/modal/ExportAsJcampModal.d.ts +1 -1
  37. package/lib/component/modal/ExportAsJcampModal.js +7 -3
  38. package/lib/component/modal/ImportPublicationStringModal.js +15 -11
  39. package/lib/component/modal/LoadJCAMPModal.js +12 -9
  40. package/lib/component/modal/LogsHistoryModal.d.ts +1 -1
  41. package/lib/component/modal/LogsHistoryModal.js +9 -4
  42. package/lib/component/modal/MoleculeStructureEditorModal.js +10 -3
  43. package/lib/component/modal/MultipletAnalysisModal.js +8 -8
  44. package/lib/component/modal/PredictSpectraModal.js +6 -5
  45. package/lib/component/modal/SaveAsModal.js +2 -2
  46. package/lib/component/modal/aboutUs/AboutUsModal.js +11 -26
  47. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +4 -3
  48. package/lib/component/modal/changeSum/ChangeSumModal.js +10 -3
  49. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +1 -3
  50. package/lib/component/modal/changeSum/ChangeSumModalContents.js +9 -6
  51. package/lib/component/modal/editRange/EditRangeModal.js +8 -6
  52. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
  53. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +13 -10
  54. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +1 -1
  55. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -0
  56. package/lib/component/modal/editZone/EditZoneModal.js +3 -3
  57. package/lib/component/modal/metaImportation/MetaImportationModal.js +2 -2
  58. package/lib/component/modal/setting/GeneralSettings.js +17 -38
  59. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +2 -4
  60. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  61. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +22 -25
  62. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  63. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +5 -5
  64. package/lib/component/panels/PeaksPanel/PeaksPanel.js +43 -13
  65. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
  66. package/lib/component/panels/RangesPanel/RangesHeader.js +71 -34
  67. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +46 -5
  68. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +40 -9
  69. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +2 -2
  70. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +2 -2
  71. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +2 -2
  72. package/lib/component/panels/SummaryPanel/SummaryPanel.js +30 -19
  73. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -28
  74. package/lib/component/panels/databasePanel/DatabasePanel.js +6 -6
  75. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +4 -6
  76. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +13 -14
  77. package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
  78. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
  79. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  80. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  81. package/lib/component/panels/header/DefaultPanelHeader.js +30 -9
  82. package/lib/component/panels/header/PanelHeader.js +0 -1
  83. package/lib/component/panels/header/PreferencesHeader.d.ts +2 -4
  84. package/lib/component/panels/header/PreferencesHeader.js +9 -23
  85. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
  86. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +39 -10
  87. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  88. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +3 -3
  89. package/lib/component/reducer/Reducer.js +3 -0
  90. package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
  91. package/lib/component/reducer/actions/DatabaseActions.js +5 -1
  92. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  93. package/lib/component/toolbar/ToolBar.js +237 -9
  94. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  95. package/lib/component/toolbar/toolbarMenu.js +77 -0
  96. package/lib/component/utility/booleanToString.d.ts +6 -0
  97. package/lib/component/utility/booleanToString.js +4 -0
  98. package/lib/utils/clipboard/clipboardComponents.d.ts +2 -2
  99. package/lib/utils/clipboard/clipboardComponents.js +8 -3
  100. package/lib/versionInfo.js +1 -1
  101. package/package.json +17 -16
  102. package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
  103. package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
  104. package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
  105. package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
  106. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
  107. package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
  108. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
  109. package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
  110. package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
  111. package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
  112. package/lib/component/elements/DeleteButton.d.ts +0 -8
  113. package/lib/component/elements/DeleteButton.js +0 -6
  114. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  115. package/lib/component/elements/DropdownMenu.js +0 -7
  116. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -10
  117. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -10
  118. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  119. package/lib/component/toolbar/BasicToolBar.js +0 -165
  120. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  121. package/lib/component/toolbar/FunctionToolBar.js +0 -148
@@ -2,7 +2,7 @@ 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
4
  import { useCallback, useEffect, useState } from 'react';
5
- import CloseButton from '../../elements/CloseButton';
5
+ import { CloseButton } from '../../elements/CloseButton';
6
6
  import MolecularFormulaInput from '../../elements/MolecularFormulaInput';
7
7
  import MoleculeSelection from '../../elements/MoleculeSelection';
8
8
  const modalContainer = css `
@@ -90,5 +90,5 @@ export default function SetMolecularFormulaModal({ onClose, onSave, molecules, p
90
90
  const onChangeHandlerMoleculeSelection = useCallback((index) => {
91
91
  setCurrentIndex(index);
92
92
  }, []);
93
- return (_jsxs("div", { css: modalContainer, children: [_jsx("div", { className: "header handle", children: _jsx(CloseButton, { onClick: onClose }) }), _jsx("div", { children: _jsx("p", { className: "info", children: "Please type in a molecular formula!" }) }), _jsx(MolecularFormulaInput, { onSave: onSaveHandlerMolecularFormulaInput, previousMF: previousMF }), _jsxs("div", { children: [_jsx("p", { className: "optional", children: "OR" }), _jsx("p", { className: "optional2", children: "Select a molecule as reference!" })] }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx("button", { type: "button", onClick: onSaveHandlerMoleculeSelection, children: "Set" })] }));
93
+ return (_jsxs("div", { css: modalContainer, children: [_jsx("div", { className: "header handle", children: _jsx(CloseButton, { title: "Close", onClick: onClose }) }), _jsx("div", { children: _jsx("p", { className: "info", children: "Please type in a molecular formula!" }) }), _jsx(MolecularFormulaInput, { onSave: onSaveHandlerMolecularFormulaInput, previousMF: previousMF }), _jsxs("div", { children: [_jsx("p", { className: "optional", children: "OR" }), _jsx("p", { className: "optional2", children: "Select a molecule as reference!" })] }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx("button", { type: "button", onClick: onSaveHandlerMoleculeSelection, children: "Set" })] }));
94
94
  }
@@ -2,7 +2,7 @@ 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
4
  import { useEffect, useState } from 'react';
5
- import CloseButton from '../../elements/CloseButton';
5
+ import { CloseButton } from '../../elements/CloseButton';
6
6
  const modalContainer = css `
7
7
  width: 220px;
8
8
  height: 270px;
@@ -95,7 +95,7 @@ export default function SetShiftToleranceModal({ onClose, onSave, previousTolera
95
95
  setIsValid({ ...isValid, [atomType]: false });
96
96
  }
97
97
  }
98
- return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Set Shift Tolerances" }), _jsx(CloseButton, { 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" })] }));
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
99
  }
100
100
  function Rows({ tolerance, onChange, isValid }) {
101
101
  return Object.keys(tolerance).map((atomType) => {
@@ -9,9 +9,8 @@ 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 ToolTip from '../../elements/ToolTip/ToolTip';
13
12
  import { useModal } from '../../elements/popup/Modal';
14
- import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
13
+ import DefaultPanelHeader from '../header/DefaultPanelHeader';
15
14
  import CorrelationTable from './CorrelationTable/CorrelationTable';
16
15
  import Overview from './Overview';
17
16
  import SetMolecularFormulaModal from './SetMolecularFormulaModal';
@@ -26,7 +25,8 @@ const panelStyle = css `
26
25
 
27
26
  .extra-header-content {
28
27
  display: flex;
29
- width: 100%;
28
+ flex: 1;
29
+ justify-content: center;
30
30
 
31
31
  .overview-container {
32
32
  width: 100%;
@@ -308,22 +308,33 @@ function SummaryPanel() {
308
308
  const handleOnFilter = useCallback(() => {
309
309
  setFilterIsActive(!filterIsActive);
310
310
  }, [filterIsActive]);
311
- const counter = correlationsData ? correlationsData.values.length : 0;
312
- return (_jsxs("div", { css: panelStyle, children: [_jsxs(DefaultPanelHeader, { canDelete: false, counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredCorrelationsData?.values.length), onFilter: handleOnFilter, filterToolTip: filterIsActive
311
+ 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
313
313
  ? 'Show all correlations'
314
- : 'Hide correlations out of view', children: [_jsx(ToolTip, { title: `Set molecular formula (${correlationsData.options.mf})`, popupPlacement: "right", children: _jsx("button", { type: "button", onClick: showSetMolecularFormulaModal, children: _jsx(FaFlask, {}) }) }), _jsx(ToolTip, { title: `Set shift tolerance`, popupPlacement: "right", children: _jsx("button", { type: "button", onClick: showSetShiftToleranceModal, children: _jsx(FaSlidersH, {}) }) }), _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) => {
315
- setSelectedAdditionalColumnsAtomType(selection);
316
- if (selection === 'H-H') {
317
- setShowProtonsAsRows(true);
318
- }
319
- else {
320
- setShowProtonsAsRows(false);
321
- }
322
- }, items: additionalColumnTypes, defaultValue: selectedAdditionalColumnsAtomType, style: {
323
- fontSize: '12px',
324
- width: '70px',
325
- height: '18px',
326
- border: '1px solid grey',
327
- } })] }) })] })] }), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData })] }));
314
+ : 'Hide correlations out of view', leftButtons: [
315
+ {
316
+ icon: _jsx(FaFlask, {}),
317
+ title: `Set molecular formula (${correlationsData.options.mf})`,
318
+ onClick: showSetMolecularFormulaModal,
319
+ },
320
+ {
321
+ icon: _jsx(FaSlidersH, {}),
322
+ title: 'Set shift tolerance',
323
+ onClick: showSetShiftToleranceModal,
324
+ },
325
+ ], 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
+ setSelectedAdditionalColumnsAtomType(selection);
327
+ if (selection === 'H-H') {
328
+ setShowProtonsAsRows(true);
329
+ }
330
+ else {
331
+ setShowProtonsAsRows(false);
332
+ }
333
+ }, items: additionalColumnTypes, defaultValue: selectedAdditionalColumnsAtomType, style: {
334
+ fontSize: '12px',
335
+ width: '70px',
336
+ height: '18px',
337
+ border: '1px solid grey',
338
+ } })] }) })] }) }), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData })] }));
328
339
  }
329
340
  export default memo(SummaryPanel);
@@ -6,38 +6,14 @@ import { FaUnlink } from 'react-icons/fa';
6
6
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
7
7
  import { useChartData } from '../../context/ChartContext';
8
8
  import { useDispatch } from '../../context/DispatchContext';
9
- import ActiveButton from '../../elements/ActiveButton';
10
- import ToolTip from '../../elements/ToolTip/ToolTip';
11
9
  import { useModal } from '../../elements/popup/Modal';
12
10
  import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
13
11
  import useSpectrum from '../../hooks/useSpectrum';
14
12
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
15
- import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
13
+ import DefaultPanelHeader from '../header/DefaultPanelHeader';
16
14
  import PreferencesHeader from '../header/PreferencesHeader';
17
15
  import ZonesPreferences from './ZonesPreferences';
18
16
  import ZonesTable from './ZonesTable';
19
- const style = css `
20
- .remove-assignments-btn {
21
- border-radius: 5px;
22
- margin-top: 3px;
23
- margin-left: 2px;
24
- border: none;
25
- height: 16px;
26
- width: 18px;
27
- font-size: 12px;
28
- padding: 0;
29
- background-color: transparent;
30
- }
31
-
32
- .toggle {
33
- width: 22px;
34
- height: 22px;
35
- margin-left: 2px;
36
- display: flex;
37
- justify-content: center;
38
- align-items: center;
39
- }
40
- `;
41
17
  function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, }) {
42
18
  const [filterIsActive, setFilterIsActive] = useState(false);
43
19
  const assignmentData = useAssignmentData();
@@ -139,17 +115,41 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
139
115
  payload: { key: 'showPeaks' },
140
116
  });
141
117
  };
142
- const counter = zones?.values?.length || 0;
118
+ const total = zones?.values?.length || 0;
143
119
  return (_jsxs("div", { css: [
144
120
  tablePanelStyle,
145
- style,
146
121
  isFlipped &&
147
122
  css `
148
123
  th {
149
124
  position: relative;
150
125
  }
151
126
  `,
152
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && tableData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: [_jsx(ToolTip, { title: `Remove all assignments`, popupPlacement: "right", children: _jsx("button", { className: "remove-assignments-btn", type: "button", onClick: handleOnRemoveAssignments, disabled: !zones.values || zones.values.length === 0, children: _jsx(FaUnlink, {}) }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide zones", popupPlacement: "right", value: showZones, onClick: handleSetShowZones, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "z" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide signals", popupPlacement: "right", value: showSignals, onClick: handleSetShowSignals, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "s" }) }), _jsx(ActiveButton, { popupTitle: "Show/Hide peaks", popupPlacement: "right", value: showPeaks, onClick: handleSetShowPeaks, children: _jsx("span", { style: { fontSize: '12px', pointerEvents: 'none' }, children: "p" }) })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: _jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nucleus: activeTab, info: info }) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
127
+ ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: tableData?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', onSettingClick: settingsPanelHandler, leftButtons: [
128
+ {
129
+ disabled: !zones.values || zones.values.length === 0,
130
+ icon: _jsx(FaUnlink, {}),
131
+ title: 'Remove all assignments',
132
+ onClick: handleOnRemoveAssignments,
133
+ },
134
+ {
135
+ icon: _jsx("span", { children: "z" }),
136
+ title: 'Show/Hide zones',
137
+ active: showZones,
138
+ onClick: handleSetShowZones,
139
+ },
140
+ {
141
+ icon: _jsx("span", { children: "s" }),
142
+ title: 'Show/Hide signals',
143
+ active: showSignals,
144
+ onClick: handleSetShowSignals,
145
+ },
146
+ {
147
+ icon: _jsx("span", { children: "p" }),
148
+ title: 'Show/Hide peaks',
149
+ active: showPeaks,
150
+ onClick: handleSetShowPeaks,
151
+ },
152
+ ] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: _jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nucleus: activeTab, info: info }) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
153
153
  }
154
154
  const MemoizedZonesPanel = memo(ZonesPanelInner);
155
155
  const emptyData = { zones: {}, info: {} };
@@ -59,13 +59,13 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
59
59
  solvents: [],
60
60
  });
61
61
  const [idCode, setIdCode] = useState();
62
- const settingsPanelHandler = useCallback(() => {
63
- setFlipStatus(!isFlipped);
64
- }, [isFlipped]);
65
- const saveSettingHandler = useCallback(() => {
62
+ function settingsPanelHandler() {
63
+ setFlipStatus((flag) => !flag);
64
+ }
65
+ function saveSettingHandler() {
66
66
  settingRef.current.saveSetting();
67
67
  setFlipStatus(false);
68
- }, []);
68
+ }
69
69
  const search = useCallback((solvents) => {
70
70
  const { solvent, searchKeywords } = keywords;
71
71
  if (databaseInstance.current) {
@@ -232,7 +232,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
232
232
  }
233
233
  }
234
234
  `,
235
- ], children: [!isFlipped && (_jsxs(_Fragment, { children: [_jsx(DatabaseSearchOptions, { databases: databases, defaultDatabase: defaultDatabase, idCode: idCode, keywords: keywords, result: result, selectedTool: selectedTool, total: databaseInstance.current?.data.length || 0, onKeywordsChange: (options) => setKeywords((prevKeywords) => ({ ...prevKeywords, ...options })), onSettingClick: settingsPanelHandler, onStructureClick: openSearchByStructure, onDatabaseChange: handleChangeDatabase }), _jsx(DatabaseStructureSearchModal, { isOpen: isOpenSearchByStructure, onClose: closeSearchByStructure, onChange: searchByStructureHandler, idCode: idCode })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
235
+ ], children: [!isFlipped && (_jsxs(_Fragment, { children: [_jsx(DatabaseSearchOptions, { databases: databases, defaultDatabase: defaultDatabase, idCode: idCode, keywords: keywords, result: result, total: databaseInstance.current?.data.length || 0, onKeywordsChange: (options) => setKeywords((prevKeywords) => ({ ...prevKeywords, ...options })), onSettingClick: settingsPanelHandler, onStructureClick: openSearchByStructure, onDatabaseChange: handleChangeDatabase }), _jsx(DatabaseStructureSearchModal, { isOpen: isOpenSearchByStructure, onClose: closeSearchByStructure, onChange: searchByStructureHandler, idCode: idCode })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (tableData && tableData.length > 0 ? (_jsx(DatabaseTable, { data: tableData, totalCount: result.data.length, onAdd: resurrectHandler, onSave: saveHandler })) : (_jsx(NoTableData, { text: databases && databases?.length > 0
236
236
  ? 'Please select a database'
237
237
  : 'Please add databases URL in the general preferences' }))) : (_jsx(DatabasePreferences, { ref: settingRef })) })] }));
238
238
  }
@@ -1,18 +1,16 @@
1
- /// <reference types="react" />
1
+ import { ToolbarItemProps } from 'react-science/ui';
2
2
  import { DataBaseSearchResultEntry, DatabaseSearchKeywords, Databases } from './DatabasePanel';
3
- type OnClick = React.ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
4
3
  interface DatabaseSearchOptionsProps {
5
4
  databases: Databases;
6
5
  defaultDatabase: string;
7
6
  keywords: DatabaseSearchKeywords;
8
7
  result: DataBaseSearchResultEntry;
9
- selectedTool: string;
10
8
  idCode?: string;
11
9
  total: number;
12
10
  onKeywordsChange: (k: Partial<DatabaseSearchKeywords>) => void;
13
- onSettingClick: OnClick;
14
- onStructureClick: OnClick;
11
+ onSettingClick: ToolbarItemProps['onClick'];
12
+ onStructureClick: ToolbarItemProps['onClick'];
15
13
  onDatabaseChange: (databaseKey: string) => void;
16
14
  }
17
- export declare function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, selectedTool, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }: DatabaseSearchOptionsProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }: DatabaseSearchOptionsProps): import("react/jsx-runtime").JSX.Element;
18
16
  export {};
@@ -2,18 +2,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { BsHexagon, BsHexagonFill } from 'react-icons/bs';
3
3
  import { FaICursor } from 'react-icons/fa';
4
4
  import { IoSearchOutline } from 'react-icons/io5';
5
- import Button from '../../elements/Button';
5
+ import { TbBinaryTree } from 'react-icons/tb';
6
+ import { useChartData } from '../../context/ChartContext';
7
+ import { useDispatch } from '../../context/DispatchContext';
6
8
  import { CounterLabel } from '../../elements/CounterLabel';
7
9
  import Input from '../../elements/Input';
8
10
  import { PreferencesButton } from '../../elements/PreferencesButton';
9
11
  import Select from '../../elements/Select';
10
- import ToggleButton from '../../elements/ToggleButton';
12
+ import { ToolBarButton } from '../../elements/ToolBarButton';
11
13
  import useToolsFunctions from '../../hooks/useToolsFunctions';
12
14
  import { options } from '../../toolbar/ToolTypes';
13
- import { createFilterLabel } from '../header/DefaultPanelHeader';
15
+ import { formatCounterLabel } from '../header/DefaultPanelHeader';
14
16
  import PanelHeader from '../header/PanelHeader';
15
- export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, selectedTool, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }) {
17
+ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }) {
16
18
  const { handleChangeOption } = useToolsFunctions();
19
+ const { view: { spectra: { showSimilarityTree }, }, toolOptions: { selectedTool }, } = useChartData();
20
+ const dispatch = useDispatch();
17
21
  function enableFilterHandler(flag) {
18
22
  const tool = !flag ? options.zoom.id : options.databaseRangesSelection.id;
19
23
  handleChangeOption(tool);
@@ -32,22 +36,17 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
32
36
  function clearHandler() {
33
37
  onKeywordsChange({ searchKeywords: '' });
34
38
  }
39
+ function handleShowSimilarityTree() {
40
+ dispatch({ type: 'TOGGLE_SIMILARITY_TREE' });
41
+ }
35
42
  return (_jsxs(PanelHeader, { style: { flexDirection: 'column', alignItems: 'normal' }, children: [_jsxs("div", { style: {
36
43
  display: 'flex',
37
44
  justifyContent: 'space-between',
38
45
  paddingBottom: '2px',
39
- }, children: [_jsx(Select, { style: { flex: 6 }, 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, { 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: {
40
47
  display: 'flex',
41
48
  alignItems: 'center',
42
49
  flex: 2,
43
50
  justifyContent: 'flex-end',
44
- }, children: [_jsx(CounterLabel, { children: createFilterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToggleButton, { defaultValue: selectedTool === options.databaseRangesSelection.id, popupTitle: "Filter by select ranges", popupPlacement: "right", onClick: enableFilterHandler, children: _jsx(FaICursor, { style: {
45
- pointerEvents: 'none',
46
- fontSize: '12px',
47
- transform: 'rotate(90deg)',
48
- } }) }, selectedTool), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(Button.Done, { fill: "clear", onClick: onStructureClick, style: { padding: '5px' }, children: !idCode ? (_jsx(BsHexagon, { style: {
49
- fontSize: '12px',
50
- } })) : (_jsx(BsHexagonFill, { style: {
51
- fontSize: '12px',
52
- } })) })] })] }));
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 stricture", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
53
52
  }
@@ -1,13 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
+ import { Dialog, DialogBody } from '@blueprintjs/core';
4
+ import { css } from '@emotion/react';
3
5
  import { StructureEditor } from 'react-ocl/full';
4
- import { Modal } from 'react-science/ui';
5
6
  export function DatabaseStructureSearchModal({ onChange, isOpen, idCode, onClose, }) {
6
- return (_jsxs(Modal, { hasCloseButton: true, isOpen: isOpen, onRequestClose: () => {
7
+ return (_jsx(Dialog, { isOpen: isOpen, onClose: () => {
7
8
  onClose?.();
8
- }, maxWidth: 1000, children: [_jsx(Modal.Header, { children: _jsx("div", { style: {
9
- color: 'rgb(0, 93, 158)',
10
- width: '100%',
11
- textAlign: 'center',
12
- }, children: _jsx("span", { children: "Search by structure" }) }) }), _jsx(Modal.Body, { children: _jsx(StructureEditor, { initialIDCode: idCode, svgMenu: true, fragment: true, onChange: (molFile, molecule, idCode) => onChange(idCode) }) })] }));
9
+ }, style: { width: 720 }, title: "Search by structure", children: _jsx(DialogBody, { css: css `
10
+ background-color: white;
11
+ `, children: _jsx(StructureEditor, { initialIDCode: idCode, svgMenu: true, fragment: true, onChange: (molFile, molecule, idCode) => onChange(idCode) }) }) }));
13
12
  }
@@ -26,5 +26,5 @@ export default function FiltersPanel() {
26
26
  buttons,
27
27
  });
28
28
  }
29
- return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { showSettingButton: false, deleteToolTip: "Delete all filters", onDelete: handelDeleteFilter }), _jsx("div", { className: "inner-container", children: _jsx(FiltersTable, {}) })] }));
29
+ return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { deleteToolTip: "Delete all filters", onDelete: handelDeleteFilter }), _jsx("div", { className: "inner-container", children: _jsx(FiltersTable, {}) })] }));
30
30
  }
@@ -71,7 +71,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
71
71
  modal.showConfirmDialog({
72
72
  message: (_jsxs("span", { children: ["You are about to delete this processing step", _jsxs("span", { style: { color: 'black' }, children: [" ", label, " "] }), " , Are you sure?"] })),
73
73
  buttons,
74
- });
74
+ }, { height: 'auto', width: 'auto' });
75
75
  }, [alert, dispatch, modal, spectraCounter]);
76
76
  const filterSnapShotHandler = useCallback((filter, index) => {
77
77
  selectedFilterIndex.current =
@@ -1,20 +1,24 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
+ import { ToolbarItemProps as BaseToolbarItemProps } from 'react-science/ui';
3
+ interface CustomToolbarItemProps {
4
+ component: ReactNode;
5
+ }
6
+ export type ToolbarItemProps = BaseToolbarItemProps | CustomToolbarItemProps;
2
7
  interface DefaultPanelHeaderProps {
8
+ total?: number;
3
9
  counter?: number;
4
- counterLabel?: string;
5
10
  deleteToolTip?: string;
6
11
  filterToolTip?: string;
7
12
  onDelete?: () => void;
8
13
  onFilter?: () => void;
9
14
  onSettingClick?: () => void;
10
- canDelete?: boolean;
11
15
  disableDelete?: boolean;
12
- showSettingButton?: boolean;
13
16
  children?: ReactNode;
14
17
  style?: CSSProperties;
15
18
  className?: string;
16
- renderRightButtons?: () => ReactNode;
19
+ leftButtons?: ToolbarItemProps[];
20
+ rightButtons?: ToolbarItemProps[];
17
21
  }
18
- export declare function createFilterLabel(total: number, counter: number | false): string;
19
- declare function DefaultPanelHeader({ counter, counterLabel, onDelete, deleteToolTip, onFilter, filterToolTip, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function formatCounterLabel(counter?: number, total?: number): string;
23
+ declare function DefaultPanelHeader(props: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
20
24
  export default DefaultPanelHeader;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FaRegTrashAlt, FaFilter } from 'react-icons/fa';
3
- import Button from '../../elements/Button';
2
+ import { Fragment, useState } from 'react';
3
+ import { FaFilter, FaRegTrashAlt } from 'react-icons/fa';
4
+ import { Toolbar, } from 'react-science/ui';
4
5
  import { CounterLabel } from '../../elements/CounterLabel';
5
6
  import { PreferencesButton } from '../../elements/PreferencesButton';
6
- import ToggleButton from '../../elements/ToggleButton';
7
7
  import PanelHeader from './PanelHeader';
8
8
  const styles = {
9
9
  leftContainer: {
@@ -12,13 +12,34 @@ const styles = {
12
12
  flex: 1,
13
13
  },
14
14
  };
15
- export function createFilterLabel(total, counter) {
16
- if (typeof counter === 'boolean') {
17
- return `[ ${total || 0} ]`;
15
+ function isCustomToolbarItem(item) {
16
+ return 'component' in item;
17
+ }
18
+ export function formatCounterLabel(counter, total) {
19
+ if (counter !== undefined &&
20
+ total !== undefined &&
21
+ counter >= 0 &&
22
+ total >= 0 &&
23
+ counter !== total) {
24
+ return `[ ${counter}/${total} ]`;
25
+ }
26
+ if (total !== undefined) {
27
+ return `[ ${total} ]`;
28
+ }
29
+ return '';
30
+ }
31
+ function DefaultPanelHeader(props) {
32
+ const { total, counter, onDelete, deleteToolTip = 'Delete', onFilter, filterToolTip = '', children, onSettingClick, disableDelete = false, style = {}, className = '', rightButtons = [], leftButtons = [], } = props;
33
+ const [isFiltered, setFilterStatus] = useState(false);
34
+ function handleFilter() {
35
+ setFilterStatus((previousValue) => !previousValue);
36
+ onFilter?.();
18
37
  }
19
- return `[ ${counter}/${total} ]`;
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 }))] }));
20
39
  }
21
- function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
22
- return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'red' }, onClick: onDelete, disabled: counter === 0 || disableDelete, toolTip: deleteToolTip, tooltipOrientation: "horizontal", children: _jsx(FaRegTrashAlt, {}) })), filterToolTip ? (_jsx(ToggleButton, { popupTitle: filterToolTip, popupPlacement: "right", onClick: onFilter, children: _jsx(FaFilter, { style: { pointerEvents: 'none', fontSize: '12px' } }) })) : null, children] }), renderRightButtons?.(), counterLabel && _jsx(CounterLabel, { children: counterLabel }), showSettingButton && _jsx(PreferencesButton, { onClick: onSettingClick })] }));
40
+ function mapToolbarButtons(buttons) {
41
+ return buttons.map((props, index) => isCustomToolbarItem(props) ? (
42
+ // eslint-disable-next-line react/no-array-index-key
43
+ _jsx(Fragment, { children: props.component }, `${index}`)) : (_jsx(Toolbar.Item, { ...props }, props.title)));
23
44
  }
24
45
  export default DefaultPanelHeader;
@@ -3,7 +3,6 @@ const containerStyle = {
3
3
  display: 'flex',
4
4
  flexDirection: 'row',
5
5
  borderBottom: '0.55px solid rgb(240 240 240)',
6
- padding: '2px 5px',
7
6
  alignItems: 'center',
8
7
  };
9
8
  export default function PanelHeader(props) {
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
1
  interface PreferencesHeaderProps {
3
2
  onClose: () => void;
4
3
  onSave: () => void;
5
4
  }
6
- declare function PreferencesHeader({ onClose, onSave }: PreferencesHeaderProps): import("@emotion/react/jsx-runtime").JSX.Element;
7
- declare const _default: import("react").MemoExoticComponent<typeof PreferencesHeader>;
8
- export default _default;
5
+ declare function PreferencesHeader({ onClose, onSave }: PreferencesHeaderProps): import("react/jsx-runtime").JSX.Element;
6
+ export default PreferencesHeader;
@@ -1,25 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { memo } from 'react';
5
- import CloseButton from '../../elements/CloseButton';
6
- import SaveButton from '../../elements/SaveButton';
7
- const styles = css `
8
- display: flex;
9
- flex-direction: row-reverse;
10
- border-bottom: 0.55px solid rgb(240 240 240);
11
-
12
- button {
13
- background-color: transparent;
14
- border: none;
15
- padding: 5px;
16
- }
17
-
18
- button:disabled {
19
- opacity: 0.6;
20
- }
21
- `;
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CloseButton } from '../../elements/CloseButton';
3
+ import { SaveButton } from '../../elements/SaveButton';
22
4
  function PreferencesHeader({ onClose, onSave }) {
23
- return (_jsxs("div", { css: styles, children: [_jsx(CloseButton, { onClick: onClose, popupTitle: "Close preferences" }), _jsx(SaveButton, { onClick: onSave, popupTitle: "Save preferences" })] }));
5
+ return (_jsxs("div", { style: {
6
+ display: 'flex',
7
+ flexDirection: 'row-reverse',
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" })] }));
24
10
  }
25
- export default memo(PreferencesHeader);
11
+ export default PreferencesHeader;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SvgNmrRangePicking } from 'cheminfo-font';
3
3
  import { useCallback } from 'react';
4
+ import { Toolbar } from 'react-science/ui';
4
5
  import { useChartData } from '../../context/ChartContext';
5
6
  import { useDispatch } from '../../context/DispatchContext';
6
- import Button from '../../elements/Button';
7
7
  import { useAlert } from '../../elements/popup/Alert';
8
8
  import { useCheckToolsVisibility } from '../../hooks/useCheckToolsVisibility';
9
9
  export function SpectraAutomaticPickingButton() {
@@ -25,5 +25,5 @@ export function SpectraAutomaticPickingButton() {
25
25
  !isToolVisible('autoRangeAndZonePicking')) {
26
26
  return null;
27
27
  }
28
- return (_jsx(Button.BarButton, { tooltipOrientation: "horizontal", toolTip: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler, children: _jsx(SvgNmrRangePicking, {}) }));
28
+ return (_jsx(Toolbar.Item, { icon: _jsx(SvgNmrRangePicking, {}), title: "Automatic Ranges/Zones picking for all spectra", onClick: automaticPickingHandler }));
29
29
  }
@@ -1,4 +1,4 @@
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
4
  import { SvgNmrOverlay } from 'cheminfo-font';
@@ -11,11 +11,10 @@ import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardCompon
11
11
  import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
12
12
  import { useChartData } from '../../context/ChartContext';
13
13
  import { useDispatch } from '../../context/DispatchContext';
14
- import ActiveButton from '../../elements/ActiveButton';
15
- import Button from '../../elements/ButtonToolTip';
16
14
  import { useAlert } from '../../elements/popup/Alert';
17
15
  import { usePanelPreferences } from '../../hooks/usePanelPreferences';
18
16
  import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
17
+ import { booleanToString } from '../../utility/booleanToString';
19
18
  import { tablePanelStyle } from '../extra/BasicPanelStyle';
20
19
  import DefaultPanelHeader from '../header/DefaultPanelHeader';
21
20
  import PreferencesHeader from '../header/PreferencesHeader';
@@ -52,6 +51,42 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
52
51
  return;
53
52
  void rawWriteWithType(data).then(() => alert.success('Data copied to clipboard'));
54
53
  }, [alert, rawWriteWithType, spectra, spectraAnalysis, spectraPreferences]);
54
+ function handleSpectraCalibration() {
55
+ setCalibration((value) => {
56
+ if (value)
57
+ dispatch({ type: 'RESET_SELECTED_TOOL' });
58
+ return !value;
59
+ });
60
+ }
61
+ let lefButtons = [
62
+ {
63
+ icon: _jsx(FaFileExport, {}),
64
+ title: 'Copy To Clipboard',
65
+ onClick: copyToClipboardHandler,
66
+ },
67
+ ];
68
+ if (displayerMode === '1D') {
69
+ lefButtons = lefButtons.concat([
70
+ {
71
+ icon: _jsx(SvgNmrOverlay, {}),
72
+ title: 'Spectra calibration',
73
+ onClick: handleSpectraCalibration,
74
+ active: calibration,
75
+ },
76
+ {
77
+ icon: _jsx(IoPulseOutline, {}),
78
+ title: 'Y spectra tracker',
79
+ onClick: showTrackerHandler,
80
+ active: showLegend,
81
+ },
82
+ {
83
+ icon: _jsx(FaChartBar, {}),
84
+ title: `${booleanToString(!showAnalysisChart)} analysis chart`,
85
+ onClick: toggleAnalysisChart,
86
+ active: showAnalysisChart,
87
+ },
88
+ ]);
89
+ }
55
90
  return (_jsxs("div", { css: [
56
91
  tablePanelStyle,
57
92
  isFlipped &&
@@ -60,13 +95,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, dis
60
95
  position: relative;
61
96
  }
62
97
  `,
63
- ], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [_jsx(Button, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: _jsx(FaFileExport, {}) }), displayerMode === '1D' && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Spectra calibration", onClick: () => {
64
- setCalibration((value) => {
65
- if (value)
66
- dispatch({ type: 'RESET_SELECTED_TOOL' });
67
- return !value;
68
- });
69
- }, children: _jsx(SvgNmrOverlay, { style: { fontSize: '16px' } }) }), _jsx(ActiveButton, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, value: showLegend, children: _jsx(IoPulseOutline, {}) }, `${showLegend}`), _jsx(ActiveButton, { popupTitle: `${!showAnalysisChart ? 'Show' : 'Hide'} analysis chart`, popupPlacement: "right", onClick: () => toggleAnalysisChart(), value: showAnalysisChart, style: { marginLeft: '5px' }, children: _jsx(FaChartBar, {}) })] }))] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: isFlipped ? (_jsx(MultipleSpectraAnalysisPreferences, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) : calibration ? (_jsx(AlignSpectra, { nucleus: activeTab, onClose: () => setCalibration(false) })) : (_jsxs("div", { style: { overflow: 'auto', maxHeight: '100%' }, children: [showAnalysisChart && (_jsx(AnalysisChart, { spectraAnalysisData: spectraAnalysis })), _jsx(MultipleSpectraAnalysisTable, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })] })) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra Analysis" })] }));
98
+ ], children: [!isFlipped && (_jsx(DefaultPanelHeader, { deleteToolTip: "Delete All Peaks", onSettingClick: settingsPanelHandler, leftButtons: lefButtons })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: isFlipped ? (_jsx(MultipleSpectraAnalysisPreferences, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) : calibration ? (_jsx(AlignSpectra, { nucleus: activeTab, onClose: () => setCalibration(false) })) : (_jsxs("div", { style: { overflow: 'auto', maxHeight: '100%' }, children: [showAnalysisChart && (_jsx(AnalysisChart, { spectraAnalysisData: spectraAnalysis })), _jsx(MultipleSpectraAnalysisTable, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })] })) }), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra Analysis" })] }));
70
99
  }
71
100
  const MemoizedMultipleSpectraAnalysisPanel = memo(MultipleSpectraAnalysisPanelInner);
72
101
  export default function MultipleSpectraAnalysisPanel() {