nmrium 0.48.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/lib/component/1d/Chart1D.js +3 -1
  2. package/lib/component/1d/LinesSeries.js +1 -1
  3. package/lib/component/1d/SimilarityTree.d.ts +1 -0
  4. package/lib/component/1d/SimilarityTree.js +60 -0
  5. package/lib/component/1d/SpectraLegends.js +1 -1
  6. package/lib/component/1d/Viewer1D.js +142 -124
  7. package/lib/component/1d/jCouplingGraph/JsCoupling.js +1 -1
  8. package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -7
  9. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +114 -125
  10. package/lib/component/1d/multiplicityTree/MultiplicityTrees.d.ts +1 -0
  11. package/lib/component/1d/multiplicityTree/MultiplicityTrees.js +23 -0
  12. package/lib/component/1d/multiplicityTree/generateTreeNodes.d.ts +18 -0
  13. package/lib/component/1d/multiplicityTree/generateTreeNodes.js +66 -0
  14. package/lib/component/1d/ranges/Atoms.d.ts +7 -0
  15. package/lib/component/1d/ranges/Atoms.js +43 -0
  16. package/lib/component/1d/ranges/Range.d.ts +1 -1
  17. package/lib/component/1d/ranges/Range.js +10 -9
  18. package/lib/component/1d/tool/BaseLine.d.ts +2 -0
  19. package/lib/component/1d/tool/BaseLine.js +26 -0
  20. package/lib/component/1d/tool/BaseLineZones.js +18 -3
  21. package/lib/component/2d/Chart2D.js +6 -4
  22. package/lib/component/2d/Viewer2D.js +35 -26
  23. package/lib/component/context/KeyModifierContext.d.ts +13 -2
  24. package/lib/component/context/KeyModifierContext.js +35 -4
  25. package/lib/component/context/LoggerContext.d.ts +9 -0
  26. package/lib/component/context/LoggerContext.js +21 -7
  27. package/lib/component/context/PreferencesContext.d.ts +1 -108
  28. package/lib/component/context/TopicMoleculeContext.d.ts +8 -0
  29. package/lib/component/context/TopicMoleculeContext.js +30 -0
  30. package/lib/component/elements/CloseButton.d.ts +2 -10
  31. package/lib/component/elements/CloseButton.js +3 -20
  32. package/lib/component/elements/CounterLabel.js +0 -1
  33. package/lib/component/elements/DeleteButton.d.ts +5 -7
  34. package/lib/component/elements/DeleteButton.js +7 -5
  35. package/lib/component/elements/FilterButton.d.ts +6 -0
  36. package/lib/component/elements/FilterButton.js +8 -0
  37. package/lib/component/elements/Input.js +4 -1
  38. package/lib/component/elements/PreferencesButton.d.ts +2 -4
  39. package/lib/component/elements/PreferencesButton.js +5 -3
  40. package/lib/component/elements/ReactTable/ReactTable.js +5 -2
  41. package/lib/component/elements/ResizerWithScale.js +19 -2
  42. package/lib/component/elements/SVGGroup.js +2 -2
  43. package/lib/component/elements/SaveButton.d.ts +2 -11
  44. package/lib/component/elements/SaveButton.js +4 -19
  45. package/lib/component/elements/ToolBarButton.d.ts +9 -0
  46. package/lib/component/elements/ToolBarButton.js +14 -0
  47. package/lib/component/elements/formik/FormikTextarea.js +8 -9
  48. package/lib/component/elements/linearAxis/LinearVerticalAxis.js +1 -1
  49. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +2 -1
  50. package/lib/component/elements/popup/Modal/ConfirmDialog.js +11 -8
  51. package/lib/component/elements/resizer/SVGResizer.js +1 -1
  52. package/lib/component/header/BaseLineCorrectionPanel.js +3 -2
  53. package/lib/component/header/Header.js +2 -2
  54. package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
  55. package/lib/component/hooks/useSaveSettings.js +3 -2
  56. package/lib/component/hooks/useToolsFunctions.js +4 -2
  57. package/lib/component/main/InnerNMRium.js +2 -1
  58. package/lib/component/main/InnerNMRiumContents.js +1 -1
  59. package/lib/component/modal/AboutPredictionModal.js +4 -8
  60. package/lib/component/modal/AboutSpectrumSimulationModal.js +4 -8
  61. package/lib/component/modal/CopyClipboardModal.js +1 -1
  62. package/lib/component/modal/EditPeakShapeModal.js +2 -2
  63. package/lib/component/modal/ExportAsJcampModal.d.ts +1 -1
  64. package/lib/component/modal/ExportAsJcampModal.js +8 -4
  65. package/lib/component/modal/ImportPublicationStringModal.d.ts +2 -1
  66. package/lib/component/modal/ImportPublicationStringModal.js +80 -32
  67. package/lib/component/modal/LoadJCAMPModal.js +12 -9
  68. package/lib/component/modal/LogsHistoryModal.d.ts +1 -1
  69. package/lib/component/modal/LogsHistoryModal.js +9 -4
  70. package/lib/component/modal/MoleculeStructureEditorModal.js +10 -3
  71. package/lib/component/modal/MultipletAnalysisModal.js +8 -8
  72. package/lib/component/modal/PredictSpectraModal.js +6 -5
  73. package/lib/component/modal/SaveAsModal.js +2 -2
  74. package/lib/component/modal/aboutUs/AboutUsModal.js +11 -26
  75. package/lib/component/modal/changeSum/ChangeSumModal.d.ts +4 -3
  76. package/lib/component/modal/changeSum/ChangeSumModal.js +10 -3
  77. package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +1 -3
  78. package/lib/component/modal/changeSum/ChangeSumModalContents.js +9 -6
  79. package/lib/component/modal/editRange/EditRangeModal.js +8 -6
  80. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
  81. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +13 -10
  82. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +1 -1
  83. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -0
  84. package/lib/component/modal/editZone/EditZoneModal.js +3 -3
  85. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  86. package/lib/component/modal/setting/GeneralSettings.js +17 -38
  87. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +9 -11
  88. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +2 -4
  89. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
  90. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -23
  91. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +3 -3
  92. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -4
  93. package/lib/component/panels/PeaksPanel/PeaksPanel.js +7 -8
  94. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +8 -6
  95. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +3 -6
  96. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +1 -1
  97. package/lib/component/panels/RangesPanel/RangesHeader.js +8 -31
  98. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  99. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +2 -2
  100. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +39 -5
  101. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +42 -11
  102. package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +4 -2
  103. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +19 -16
  104. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  105. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
  106. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
  107. package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
  108. package/lib/component/panels/ZonesPanel/ZonesPanel.js +2 -26
  109. package/lib/component/panels/databasePanel/DatabasePanel.js +6 -6
  110. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +4 -6
  111. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +12 -13
  112. package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +7 -8
  113. package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
  114. package/lib/component/panels/header/DefaultPanelHeader.js +9 -4
  115. package/lib/component/panels/header/PanelHeader.js +0 -1
  116. package/lib/component/panels/header/PreferencesHeader.d.ts +2 -4
  117. package/lib/component/panels/header/PreferencesHeader.js +9 -23
  118. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +2 -2
  119. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -9
  120. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +3 -3
  121. package/lib/component/reducer/Reducer.js +5 -0
  122. package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
  123. package/lib/component/reducer/actions/DatabaseActions.js +5 -1
  124. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -4
  125. package/lib/component/reducer/actions/FiltersActions.js +92 -55
  126. package/lib/component/reducer/actions/LoadActions.js +10 -8
  127. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -1
  128. package/lib/component/reducer/actions/SpectrumsActions.js +3 -3
  129. package/lib/component/reducer/actions/ToolsActions.d.ts +8 -5
  130. package/lib/component/reducer/actions/ToolsActions.js +51 -44
  131. package/lib/component/toolbar/BasicToolBar.js +11 -29
  132. package/lib/component/utility/export.js +3 -0
  133. package/lib/component/workspaces/exercise.js +1 -0
  134. package/lib/component/workspaces/prediction.js +1 -16
  135. package/lib/component/workspaces/simulation.js +1 -2
  136. package/lib/component/workspaces/workspaceDefaultProperties.js +4 -3
  137. package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
  138. package/lib/data/data1d/Spectrum1D/index.js +0 -1
  139. package/lib/utils/clipboard/clipboardComponents.d.ts +2 -2
  140. package/lib/utils/clipboard/clipboardComponents.js +8 -3
  141. package/lib/versionInfo.js +1 -1
  142. package/package.json +25 -23
  143. package/lib/component/1d/multiplicityTree/LevelNode.d.ts +0 -8
  144. package/lib/component/1d/multiplicityTree/LevelNode.js +0 -8
  145. package/lib/component/1d/multiplicityTree/StringNode.d.ts +0 -11
  146. package/lib/component/1d/multiplicityTree/StringNode.js +0 -7
  147. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +0 -1
  148. package/lib/component/1d/multiplicityTree/TreeColors.js +0 -1
  149. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +0 -21
  150. package/lib/component/1d/multiplicityTree/TreeNodes.js +0 -23
  151. package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +0 -11
  152. package/lib/component/1d/multiplicityTree/buildTreeNode.js +0 -57
  153. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +0 -2
  154. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.js +0 -6
@@ -1,8 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { saveAs } from 'file-saver';
2
3
  import lodashGet from 'lodash/get';
3
4
  import { useMemo, useCallback, useState } from 'react';
4
5
  import { FaCopy, FaRegTrashAlt, FaFileExport } from 'react-icons/fa';
5
6
  import { IoColorPaletteOutline } from 'react-icons/io5';
7
+ import { isSpectrum1D } from '../../../data/data1d/Spectrum1D';
6
8
  import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
7
9
  import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
8
10
  import { useDispatch } from '../../context/DispatchContext';
@@ -42,6 +44,8 @@ var SpectraContextMenuOptionsKeys;
42
44
  SpectraContextMenuOptionsKeys["CopyToClipboard"] = "CopyToClipboard";
43
45
  SpectraContextMenuOptionsKeys["Delete"] = "Delete";
44
46
  SpectraContextMenuOptionsKeys["ExportAsJcamp"] = "ExportAsJcamp";
47
+ SpectraContextMenuOptionsKeys["ExportAsText"] = "ExportAsText";
48
+ SpectraContextMenuOptionsKeys["CopyAsText"] = "CopyAsText";
45
49
  })(SpectraContextMenuOptionsKeys || (SpectraContextMenuOptionsKeys = {}));
46
50
  const Spectra2DContextMenuOptions = [
47
51
  {
@@ -54,19 +58,24 @@ const Spectra2DContextMenuOptions = [
54
58
  icon: _jsx(FaRegTrashAlt, {}),
55
59
  data: { id: SpectraContextMenuOptionsKeys.Delete },
56
60
  },
57
- {
58
- text: 'Export as jcamp',
59
- icon: _jsx(FaFileExport, {}),
60
- data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
61
- },
62
61
  ];
63
62
  const Spectra1DContextMenuOptions = [
64
63
  ...Spectra2DContextMenuOptions,
65
64
  {
66
- text: 'Export as jcamp',
65
+ text: 'Export as JCAMP-DX',
67
66
  icon: _jsx(FaFileExport, {}),
68
67
  data: { id: SpectraContextMenuOptionsKeys.ExportAsJcamp },
69
68
  },
69
+ {
70
+ text: 'Export as text',
71
+ icon: _jsx(FaFileExport, {}),
72
+ data: { id: SpectraContextMenuOptionsKeys.ExportAsText },
73
+ },
74
+ {
75
+ text: 'Copy as text',
76
+ icon: _jsx(FaCopy, {}),
77
+ data: { id: SpectraContextMenuOptionsKeys.CopyAsText },
78
+ },
70
79
  ];
71
80
  export function SpectraTable(props) {
72
81
  const { data, activeSpectra, onChangeVisibility, onOpenSettingModal, onChangeActiveSpectrum, nucleus, } = props;
@@ -75,6 +84,7 @@ export function SpectraTable(props) {
75
84
  const spectraPreferences = usePanelPreferences('spectra', nucleus);
76
85
  const activeSpectraObj = getActiveSpectraAsObject(activeSpectra);
77
86
  const [exportedSpectrum, setExportedSpectrum] = useState();
87
+ const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = useClipboard();
78
88
  const COLUMNS = useMemo(() => ({
79
89
  visible: {
80
90
  id: 'hide-show-spectrum',
@@ -104,7 +114,6 @@ export function SpectraTable(props) {
104
114
  },
105
115
  },
106
116
  }), [onChangeVisibility, onOpenSettingModal]);
107
- const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = useClipboard();
108
117
  const selectContextMenuHandler = useCallback((option, spectrum) => {
109
118
  const { id } = option;
110
119
  switch (id) {
@@ -126,6 +135,17 @@ export function SpectraTable(props) {
126
135
  setExportedSpectrum(spectrum);
127
136
  break;
128
137
  }
138
+ case SpectraContextMenuOptionsKeys.ExportAsText: {
139
+ const data = convertSpectrumToText(spectrum);
140
+ const blob = new Blob([data], { type: 'text/plain' });
141
+ saveAs(blob, `${spectrum.info.name}.tsv`);
142
+ break;
143
+ }
144
+ case SpectraContextMenuOptionsKeys.CopyAsText: {
145
+ const data = convertSpectrumToText(spectrum);
146
+ void rawWriteWithType(data, 'text/plain').then(() => alert.success('Spectrum copied to clipboard'));
147
+ break;
148
+ }
129
149
  default: {
130
150
  break;
131
151
  }
@@ -149,7 +169,7 @@ export function SpectraTable(props) {
149
169
  });
150
170
  }
151
171
  else {
152
- const pathString = path.join('.');
172
+ const pathString = Array.isArray(path) ? path.join('.') : '';
153
173
  let style = columnStyle;
154
174
  let cellRender = null;
155
175
  if (pathString === 'info.name') {
@@ -192,9 +212,10 @@ export function SpectraTable(props) {
192
212
  activated: { opacity: 1 },
193
213
  };
194
214
  }
195
- return (_jsxs(_Fragment, { children: [_jsx(ReactTable, { rowStyle: handleRowStyle, activeRow: handleActiveRow, data: data, columns: tableColumns, onClick: (e, data) => onChangeActiveSpectrum(e, data.original), enableVirtualScroll: true, approxItemHeight: 24, contextMenu: data.info && data.info.dimension === 1
196
- ? Spectra1DContextMenuOptions
197
- : Spectra2DContextMenuOptions, onContextMenuSelect: selectContextMenuHandler, onSortEnd: handleSortEnd, style: { 'table td': { paddingTop: 0, paddingBottom: 0 } } }), exportedSpectrum && (_jsx(ExportAsJcampModal, { spectrum: exportedSpectrum, closeDialog: () => {
215
+ const contextMenu = nucleus.split(',').length === 1
216
+ ? Spectra1DContextMenuOptions
217
+ : Spectra2DContextMenuOptions;
218
+ return (_jsxs(_Fragment, { children: [_jsx(ReactTable, { rowStyle: handleRowStyle, activeRow: handleActiveRow, data: data, columns: tableColumns, onClick: (e, data) => onChangeActiveSpectrum(e, data.original), enableVirtualScroll: true, approxItemHeight: 24, contextMenu: contextMenu, onContextMenuSelect: selectContextMenuHandler, onSortEnd: handleSortEnd, style: { 'table td': { paddingTop: 0, paddingBottom: 0 } } }), exportedSpectrum && (_jsx(ExportAsJcampModal, { spectrum: exportedSpectrum, closeDialog: () => {
198
219
  setExportedSpectrum(null);
199
220
  } })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra" })] }));
200
221
  }
@@ -214,3 +235,13 @@ const ColumnHeader = ({ label, col, }) => {
214
235
  textOverflow: 'ellipsis',
215
236
  }, children: label }));
216
237
  };
238
+ function convertSpectrumToText(spectrum) {
239
+ if (!isSpectrum1D(spectrum))
240
+ return '';
241
+ const { data: { x, re }, } = spectrum;
242
+ const lines = ['x\ty'];
243
+ for (let i = 0; i < x.length; i++) {
244
+ lines.push(`${x[i]}\t${re[i]}`);
245
+ }
246
+ return lines.join('\n');
247
+ }
@@ -18,8 +18,10 @@ function SpectrumListPanel() {
18
18
  setFlipStatus(!isFlipped);
19
19
  }
20
20
  function saveSettingHandler() {
21
- settingsRef.current.saveSetting();
22
- setFlipStatus(!isFlipped);
21
+ const isValid = settingsRef.current.saveSetting();
22
+ if (isValid) {
23
+ setFlipStatus(!isFlipped);
24
+ }
23
25
  }
24
26
  return (_jsx("div", { style: styles, children: isFlipped ? (_jsxs(_Fragment, { children: [_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler }), _jsx(SpectraPreferences, { ref: settingsRef })] })) : (_jsxs(_Fragment, { children: [_jsx(SpectraPanelHeader, { onSettingClick: settingsPanelHandler }), _jsx(SpectrumsTabs, {})] })) }));
25
27
  }
@@ -6,14 +6,18 @@ import Button from '../../../elements/Button';
6
6
  import { CheckBoxCell } from '../../../elements/CheckBoxCell';
7
7
  import ReactTable from '../../../elements/ReactTable/ReactTable';
8
8
  import FormikInput from '../../../elements/formik/FormikInput';
9
- const style = {
10
- width: '100%',
11
- fontSize: '1.1em',
12
- textAlign: 'left',
13
- padding: '0.1em 0.1em',
14
- };
15
9
  const inputStyle = {
16
- border: 'none',
10
+ input: {
11
+ width: '100%',
12
+ fontSize: '1.1em',
13
+ textAlign: 'left',
14
+ backgroundColor: 'transparent',
15
+ },
16
+ inputWrapper: {
17
+ padding: '0.25rem 0.5rem',
18
+ borderRadius: 0,
19
+ borderColor: 'white',
20
+ },
17
21
  };
18
22
  export function SpectraColumnsManager({ nucleus, onAdd, onDelete, datalist, mapOnChangeValue, mapValue, }) {
19
23
  const { values: nucleiPreferences } = useFormikContext();
@@ -25,24 +29,23 @@ export function SpectraColumnsManager({ nucleus, onAdd, onDelete, datalist, mapO
25
29
  },
26
30
  {
27
31
  Header: 'Label',
32
+ style: { padding: 0 },
28
33
  Cell: ({ row }) => {
29
- return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.label`, style: {
30
- input: { ...style, ...inputStyle },
31
- inputWrapper: { border: 'none' },
32
- } }));
34
+ return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.label`, style: inputStyle }));
33
35
  },
34
36
  },
35
37
  {
36
38
  Header: 'Column',
39
+ style: { padding: 0 },
37
40
  Cell: ({ row }) => {
38
41
  const column = row.original;
39
42
  if (column?.name) {
40
- return (_jsx("span", { style: style, children: column?.jpath?.join('.') || column.description }));
43
+ return (_jsx("span", { style: {
44
+ ...inputStyle.input,
45
+ padding: '0.25rem 0.5rem',
46
+ }, children: column?.jpath?.join('.') || column.description }));
41
47
  }
42
- return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.jpath`, style: {
43
- input: { ...style, ...inputStyle },
44
- inputWrapper: { border: 'none' },
45
- }, datalist: datalist, mapOnChangeValue: mapOnChangeValue, mapValue: mapValue }));
48
+ return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.jpath`, style: inputStyle, datalist: datalist, mapOnChangeValue: mapOnChangeValue, mapValue: mapValue }));
46
49
  },
47
50
  },
48
51
  {
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
3
3
  import { css } from '@emotion/react';
4
4
  import { getLinkDim } from 'nmr-correlation';
5
5
  import { useCallback, useMemo, useState } from 'react';
6
- import CloseButton from '../../../../elements/CloseButton';
6
+ import { CloseButton } from '../../../../elements/CloseButton';
7
7
  import Tab from '../../../../elements/Tab/Tab';
8
8
  import Tabs, { PositionsEnum } from '../../../../elements/Tab/Tabs';
9
9
  import { getEditedCorrelations } from '../../utilities/Utilities';
@@ -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 `
@@ -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;
@@ -4,12 +4,12 @@ import { css } from '@emotion/react';
4
4
  import { getLinkDelta, getLinkDim, } from 'nmr-correlation';
5
5
  import { memo, useCallback, useEffect, useMemo, useState } from 'react';
6
6
  import { FaFlask, FaSlidersH } from 'react-icons/fa';
7
+ import { Toolbar } from 'react-science/ui';
7
8
  import { findRange, findSignal1D, findSignal2D, findSpectrum, findZone, } from '../../../data/utilities/FindUtilities';
8
9
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
9
10
  import { useChartData } from '../../context/ChartContext';
10
11
  import { useDispatch } from '../../context/DispatchContext';
11
12
  import Select from '../../elements/Select';
12
- import ToolTip from '../../elements/ToolTip/ToolTip';
13
13
  import { useModal } from '../../elements/popup/Modal';
14
14
  import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHeader';
15
15
  import CorrelationTable from './CorrelationTable/CorrelationTable';
@@ -26,7 +26,8 @@ const panelStyle = css `
26
26
 
27
27
  .extra-header-content {
28
28
  display: flex;
29
- width: 100%;
29
+ flex: 1;
30
+ justify-content: center;
30
31
 
31
32
  .overview-container {
32
33
  width: 100%;
@@ -311,7 +312,7 @@ function SummaryPanel() {
311
312
  const counter = correlationsData ? correlationsData.values.length : 0;
312
313
  return (_jsxs("div", { css: panelStyle, children: [_jsxs(DefaultPanelHeader, { canDelete: false, counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredCorrelationsData?.values.length), onFilter: handleOnFilter, filterToolTip: filterIsActive
313
314
  ? '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
+ : 'Hide correlations out of view', children: [_jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaFlask, {}), title: `Set molecular formula (${correlationsData.options.mf})`, onClick: showSetMolecularFormulaModal }), _jsx(Toolbar.Item, { icon: _jsx(FaSlidersH, {}), title: "Set shift tolerance", onClick: showSetShiftToleranceModal })] }), _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
316
  setSelectedAdditionalColumnsAtomType(selection);
316
317
  if (selection === 'H-H') {
317
318
  setShowProtonsAsRows(true);
@@ -3,11 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
3
3
  import { css } from '@emotion/react';
4
4
  import { useState, useMemo, useCallback, useRef, memo } from 'react';
5
5
  import { FaUnlink } from 'react-icons/fa';
6
+ import { Toolbar } from 'react-science/ui';
6
7
  import { useAssignmentData } from '../../assignment/AssignmentsContext';
7
8
  import { useChartData } from '../../context/ChartContext';
8
9
  import { useDispatch } from '../../context/DispatchContext';
9
- import ActiveButton from '../../elements/ActiveButton';
10
- import ToolTip from '../../elements/ToolTip/ToolTip';
11
10
  import { useModal } from '../../elements/popup/Modal';
12
11
  import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
13
12
  import useSpectrum from '../../hooks/useSpectrum';
@@ -16,28 +15,6 @@ import DefaultPanelHeader, { createFilterLabel, } from '../header/DefaultPanelHe
16
15
  import PreferencesHeader from '../header/PreferencesHeader';
17
16
  import ZonesPreferences from './ZonesPreferences';
18
17
  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
18
  function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones, showSignals, showPeaks, }) {
42
19
  const [filterIsActive, setFilterIsActive] = useState(false);
43
20
  const assignmentData = useAssignmentData();
@@ -142,14 +119,13 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
142
119
  const counter = zones?.values?.length || 0;
143
120
  return (_jsxs("div", { css: [
144
121
  tablePanelStyle,
145
- style,
146
122
  isFlipped &&
147
123
  css `
148
124
  th {
149
125
  position: relative;
150
126
  }
151
127
  `,
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 })) })] }));
128
+ ], children: [!isFlipped && (_jsx(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: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { disabled: !zones.values || zones.values.length === 0, icon: _jsx(FaUnlink, {}), title: "Remove all assignments", onClick: handleOnRemoveAssignments }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "z" }), title: "Show/Hide zones", active: showZones, onClick: handleSetShowZones }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "s" }), title: "Show/Hide signals", active: showSignals, onClick: handleSetShowSignals }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "p" }), title: "Show/Hide peaks", active: showPeaks, onClick: handleSetShowPeaks })] }) })), 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
129
  }
154
130
  const MemoizedZonesPanel = memo(ZonesPanelInner);
155
131
  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 { ToolBarButtonProps } from '../../elements/ToolBarButton';
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: ToolBarButtonProps['onClick'];
12
+ onStructureClick: ToolBarButtonProps['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
15
  import { createFilterLabel } 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, style: { marginRight: '5px' } }), _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: {
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, { children: createFilterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { 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, style: { marginRight: '5px' } }), _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(ToolBarButton, { title: "Search by stricture", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick, style: { marginLeft: '5px' } })] })] }));
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
  }
@@ -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,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 { useState } from 'react';
4
3
  import { CounterLabel } from '../../elements/CounterLabel';
4
+ import { DeleteButton } from '../../elements/DeleteButton';
5
+ import { FilterButton } from '../../elements/FilterButton';
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: {
@@ -19,6 +19,11 @@ export function createFilterLabel(total, counter) {
19
19
  return `[ ${counter}/${total} ]`;
20
20
  }
21
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 })] }));
22
+ const [isFiltered, setFilterStatus] = useState(false);
23
+ function handleFilter() {
24
+ setFilterStatus((previousValue) => !previousValue);
25
+ onFilter();
26
+ }
27
+ return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [canDelete && (_jsx(DeleteButton, { disabled: counter === 0 || disableDelete, title: deleteToolTip, onClick: onDelete })), filterToolTip && (_jsx(FilterButton, { onClick: handleFilter, active: isFiltered, title: filterToolTip })), children] }), renderRightButtons?.(), counterLabel && _jsx(CounterLabel, { children: counterLabel }), showSettingButton && _jsx(PreferencesButton, { onClick: onSettingClick })] }));
23
28
  }
24
29
  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
  }