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
@@ -1,11 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { Signal1D } from 'nmr-processing';
3
- export interface TreeNodeData {
4
- startX: number;
5
- _startX: number;
6
- ratio: number;
7
- multiplicityIndex: number;
8
- color: string;
9
- }
10
- declare function createTreeNodes(signal: Signal1D, spectrumData: Spectrum1D): (multiplicityIndex: number, jIndices: number[], treeNodesData: TreeNodeData[], startX: number) => TreeNodeData[] | null;
11
- export default createTreeNodes;
@@ -1,57 +0,0 @@
1
- import lodashGet from 'lodash/get';
2
- import { getMultiplicityNumber, getPascal, } from '../../panels/extra/utilities/MultiplicityUtilities';
3
- import { TREE_LEVEL_COLORS } from './TreeColors';
4
- function createTreeNodes(signal, spectrumData) {
5
- function buildTreeNodesData(multiplicityIndex, jIndices, treeNodesData, startX) {
6
- if (!signal.multiplicity) {
7
- return null;
8
- }
9
- if (multiplicityIndex >= signal.multiplicity.length) {
10
- return treeNodesData;
11
- }
12
- // re-use colors if needed
13
- const color = TREE_LEVEL_COLORS[multiplicityIndex % TREE_LEVEL_COLORS.length];
14
- const jIndex = jIndices.indexOf(multiplicityIndex);
15
- const frequency = lodashGet(spectrumData, 'info.originFrequency', 0);
16
- const coupling = jIndex >= 0 && frequency > 0 && signal?.js?.[jIndex]
17
- ? signal.js[jIndex].coupling / frequency // convert to ppm
18
- : null;
19
- // in case of "s": no coupling constant and build one tree node only
20
- if (!coupling) {
21
- treeNodesData.push({
22
- startX,
23
- _startX: startX,
24
- ratio: 1,
25
- multiplicityIndex,
26
- color,
27
- });
28
- // go to next multiplet in multiplicity string
29
- buildTreeNodesData(multiplicityIndex + 1, jIndices, treeNodesData, startX);
30
- }
31
- else {
32
- // in case of other multiplets
33
- const multiplicity = signal.multiplicity || '';
34
- const pascal = getPascal(getMultiplicityNumber(multiplicity.charAt(multiplicityIndex)), 0.5); // @TODO for now we use the default spin of 1 / 2 only
35
- let _startX = pascal.length % 2 === 0
36
- ? startX - (pascal.length / 2) * coupling + coupling / 2 // in case of even number of nodes
37
- : startX - (pascal.length / 2 - 0.5) * coupling; // in case of odd number of nodes
38
- for (const [k, ratio] of pascal.entries()) {
39
- if (k > 0) {
40
- _startX += coupling;
41
- }
42
- treeNodesData.push({
43
- startX,
44
- _startX,
45
- ratio,
46
- multiplicityIndex,
47
- color,
48
- });
49
- // go to next multiplet in multiplicity string
50
- buildTreeNodesData(multiplicityIndex + 1, jIndices, treeNodesData, _startX);
51
- }
52
- }
53
- return treeNodesData;
54
- }
55
- return buildTreeNodesData;
56
- }
57
- export default createTreeNodes;
@@ -1,8 +0,0 @@
1
- interface DeleteButtonProps {
2
- onDelete?: () => void;
3
- fill?: string;
4
- x: string | number;
5
- y: string | number;
6
- }
7
- declare function DeleteButton(props: DeleteButtonProps): import("react/jsx-runtime").JSX.Element;
8
- export default DeleteButton;
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- function DeleteButton(props) {
3
- const { x = 'initial', y = 'initial', onDelete = () => null, fill = '#c81121', } = props;
4
- return (_jsxs("svg", { className: "delete-button", x: x, y: y, onClick: onDelete, "data-no-export": "true", children: [_jsx("rect", { rx: "5", width: "16", height: "16", fill: fill }), _jsx("line", { x1: "5", x2: "10", y1: "8", y2: "8", stroke: "white", strokeWidth: "2" })] }));
5
- }
6
- export default DeleteButton;
@@ -1,9 +0,0 @@
1
- import { MenuItemProps, PopoverProps } from '@blueprintjs/core';
2
- export interface DropdownMenuItem extends MenuItemProps {
3
- data?: object;
4
- }
5
- export interface DropdownMenuProps extends Omit<PopoverProps, 'onSelect' | 'content'> {
6
- options: DropdownMenuItem[];
7
- onSelect: (data?: object) => void;
8
- }
9
- export declare function DropdownMenu(props: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Menu, MenuItem, Popover, } from '@blueprintjs/core';
3
- export function DropdownMenu(props) {
4
- const { options, onSelect, children, ...other } = props;
5
- const content = (_jsx(Menu, { children: options.map((option) => (_jsx(MenuItem, { ...option, onClick: () => onSelect(option?.data) }, JSON.stringify(option)))) }));
6
- return (_jsx(Popover, { ...other, content: content, children: children }));
7
- }
@@ -1,10 +0,0 @@
1
- import { ActiveButtonProps } from '../../elements/ActiveButton';
2
- interface PeaksToggleProps {
3
- disbale: boolean;
4
- displayingMode: 'single' | 'spread';
5
- showPeaks: boolean;
6
- onShowToggle: ActiveButtonProps['onClick'];
7
- onDisplayingModeToggle: ActiveButtonProps['onClick'];
8
- }
9
- export declare function PeaksToggleActions(props: PeaksToggleProps): import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { SvgNmrPeaks, SvgNmrPeaksTopLabels } from 'cheminfo-font';
3
- import ActiveButton from '../../elements/ActiveButton';
4
- const style = {
5
- margin: '0 2px',
6
- };
7
- export function PeaksToggleActions(props) {
8
- const { disbale, displayingMode, showPeaks, onShowToggle, onDisplayingModeToggle, } = props;
9
- return (_jsxs(_Fragment, { children: [_jsx(ActiveButton, { style: style, popupTitle: showPeaks ? 'Hide peaks' : 'Show peaks', popupPlacement: "right", onClick: onShowToggle, disabled: disbale, value: showPeaks, children: _jsx(SvgNmrPeaks, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), _jsx(ActiveButton, { style: style, popupTitle: displayingMode === 'spread' ? 'Single Mode' : 'Spread mode', popupPlacement: "right", onClick: onDisplayingModeToggle, disabled: disbale, value: displayingMode === 'spread', children: _jsx(SvgNmrPeaksTopLabels, { style: { pointerEvents: 'none', fontSize: '12px' } }) })] }));
10
- }
@@ -1 +0,0 @@
1
- export default function BasicToolBar(): import("react/jsx-runtime").JSX.Element;
@@ -1,165 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { SvgNmrRealImag, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrAlignBottom, SvgNmrAlignCenter, } from 'cheminfo-font';
3
- import { memo } from 'react';
4
- import { FaDownload, FaFileDownload, FaFileImage, FaCopy, FaFileExport, FaFile, FaFileImport, } from 'react-icons/fa';
5
- import { Toolbar, useOnOff } from 'react-science/ui';
6
- import { useChartData } from '../context/ChartContext';
7
- import { useLoader } from '../context/LoaderContext';
8
- import { DropdownMenu } from '../elements/DropdownMenu';
9
- import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
10
- import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
11
- import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
12
- import useExport from '../hooks/useExport';
13
- import useToolsFunctions from '../hooks/useToolsFunctions';
14
- import { useVerticalAlign } from '../hooks/useVerticalAlign';
15
- import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
16
- import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
17
- import { useMetaInformationImportationModal } from '../modal/metaImportation';
18
- import { options } from './ToolTypes';
19
- const IMPORT_MENU = [
20
- {
21
- icon: _jsx(FaFile, {}),
22
- text: 'Import from file system (Press Ctrl + O)',
23
- data: {
24
- id: 'importFile',
25
- },
26
- },
27
- {
28
- icon: _jsx(FaFile, {}),
29
- text: 'Add JCAMP-DX from URL',
30
- data: {
31
- id: 'importJDX',
32
- },
33
- },
34
- {
35
- icon: _jsx(FaFile, {}),
36
- text: 'Generate spectrum from publication string',
37
- data: {
38
- id: 'importPublicationString',
39
- },
40
- },
41
- {
42
- icon: _jsx(FaFile, {}),
43
- text: 'Import meta information',
44
- data: {
45
- id: 'importMetaInformation',
46
- },
47
- },
48
- ];
49
- const EXPORT_MENU = [
50
- {
51
- icon: _jsx(FaDownload, {}),
52
- text: 'Export as SVG',
53
- data: {
54
- id: 'svg',
55
- },
56
- },
57
- {
58
- icon: _jsx(FaFileImage, {}),
59
- text: 'Export as PNG',
60
- data: {
61
- id: 'png',
62
- },
63
- },
64
- {
65
- icon: _jsx(FaFileDownload, {}),
66
- text: 'Save data ( Press Ctrl + S )',
67
- data: {
68
- id: 'json',
69
- },
70
- },
71
- {
72
- icon: _jsx(FaFileDownload, {}),
73
- text: 'Save data as ( Press Ctrl + Shift + S )',
74
- data: {
75
- id: 'advance_save',
76
- },
77
- },
78
- {
79
- icon: _jsx(FaFileDownload, {}),
80
- text: 'Save NMRE data',
81
- data: {
82
- id: 'nmre',
83
- },
84
- },
85
- {
86
- icon: _jsx(FaCopy, {}),
87
- text: 'Copy image to Clipboard ( Press Ctrl + C )',
88
- data: {
89
- id: 'copy',
90
- },
91
- },
92
- ];
93
- function BasicToolBarInner({ verticalAlign, ftCounter, fidCounter, }) {
94
- const openLoader = useLoader();
95
- const openMetaInformationModal = useMetaInformationImportationModal();
96
- const isExperimentalFeature = useCheckExperimentalFeature();
97
- const isButtonVisible = useCheckToolsVisibility();
98
- const [isLoadJCAMPModalOpened, openLoadJCAMPModal, closeLoadJCAMPModal] = useOnOff(false);
99
- const [isPublicationStringModalOpened, openPublicationStringModal, closePublicationStringModal,] = useOnOff(false);
100
- const importMenu = isExperimentalFeature
101
- ? IMPORT_MENU
102
- : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
103
- const exportMenu = isExperimentalFeature
104
- ? EXPORT_MENU
105
- : EXPORT_MENU.filter((item) => item.id !== 'nmre');
106
- const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = useToolsFunctions();
107
- const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
108
- function importHandler(data) {
109
- switch (data?.id) {
110
- case 'importFile':
111
- openLoader();
112
- break;
113
- case 'importJDX':
114
- openLoadJCAMPModal();
115
- break;
116
- case 'importPublicationString':
117
- openPublicationStringModal();
118
- break;
119
- case 'importMetaInformation':
120
- openMetaInformationModal();
121
- break;
122
- default:
123
- }
124
- }
125
- function exportHandler(data) {
126
- switch (data?.id) {
127
- case 'svg':
128
- void saveAsSVGHandler();
129
- break;
130
- case 'png':
131
- void saveAsPNGHandler();
132
- break;
133
- case 'json':
134
- saveAsJSONHandler();
135
- break;
136
- case 'advance_save':
137
- void saveAsHandler();
138
- break;
139
- case 'copy':
140
- void saveToClipboardHandler();
141
- break;
142
- default:
143
- break;
144
- }
145
- }
146
- return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadJCAMPModalOpened, onCloseDialog: closeLoadJCAMPModal }), _jsx(ImportPublicationStringModal, { isOpen: isPublicationStringModalOpened, onClose: closePublicationStringModal }), isButtonVisible('import') && (_jsx(DropdownMenu, { placement: "right-start", onSelect: (data) => {
147
- importHandler(data);
148
- }, targetTagName: "div", targetProps: { style: { flex: 'none' } }, options: importMenu, children: _jsx(Toolbar.Item, { id: options.import.id, title: options.import.label, icon: _jsx(FaFileImport, {}) }) })), isButtonVisible('exportAs') && (_jsx(DropdownMenu, { onSelect: (data) => {
149
- exportHandler(data);
150
- }, placement: "right-start", targetTagName: "div", targetProps: { style: { flex: 'none' } }, options: exportMenu, children: _jsx(Toolbar.Item, { id: options.exportAs.id, title: options.exportAs.label, icon: _jsx(FaFileExport, {}) }) })), isButtonVisible('spectraStackAlignments') && ftCounter > 1 && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display real ' : 'Display imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", icon: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
151
- (ftCounter > 0 || fidCounter > 0) && (_jsx(Toolbar.Item, { id: "baseline-position", title: verticalAlign === 'bottom'
152
- ? 'Baseline center ( Press c )'
153
- : 'Baseline bottom ( Press c )', onClick: alignSpectrumsVerticallyHandler, className: "cheminfo", icon: _jsx(_Fragment, { children: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})) }) }))] }));
154
- }
155
- const MemoizedBasicToolBar = memo(BasicToolBarInner);
156
- export default function BasicToolBar() {
157
- const { displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
158
- const verticalAlign = useVerticalAlign();
159
- const { fidCounter, ftCounter } = useDatumWithSpectraStatistics();
160
- return (_jsx(MemoizedBasicToolBar, { fidCounter,
161
- ftCounter,
162
- verticalAlign,
163
- displayerMode,
164
- activeTab }));
165
- }
@@ -1,3 +0,0 @@
1
- export default function FunctionToolBar({ defaultValue, }: {
2
- defaultValue?: string;
3
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,148 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrZeroFilling, } from 'cheminfo-font';
3
- import { useState, useEffect, useCallback, memo } from 'react';
4
- import { FaSearchPlus, FaExpand, FaDiceFour } from 'react-icons/fa';
5
- import { PiKnifeBold } from 'react-icons/pi';
6
- import { Toolbar } from 'react-science/ui';
7
- import { useChartData } from '../context/ChartContext';
8
- import { useDispatch } from '../context/DispatchContext';
9
- import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
10
- import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
11
- import useToolsFunctions from '../hooks/useToolsFunctions';
12
- import { options } from './ToolTypes';
13
- function FunctionToolBarInner({ defaultValue, ftCounter, }) {
14
- const [option, setOption] = useState('');
15
- const isButtonVisible = useCheckToolsVisibility();
16
- const dispatch = useDispatch();
17
- const { handleChangeOption, handleFullZoomOut } = useToolsFunctions();
18
- const handleChange = useCallback((selectedOption) => {
19
- setOption(selectedOption);
20
- handleChangeOption(selectedOption);
21
- }, [handleChangeOption]);
22
- useEffect(() => {
23
- setOption(defaultValue);
24
- }, [defaultValue]);
25
- const handleOnFFTFilter = useCallback(() => {
26
- dispatch({
27
- type: 'APPLY_FFT_FILTER',
28
- });
29
- }, [dispatch]);
30
- const handleFFtDimension1Filter = useCallback(() => {
31
- dispatch({
32
- type: 'APPLY_FFT_DIMENSION_1_FILTER',
33
- });
34
- }, [dispatch]);
35
- const handleFFtDimension2Filter = useCallback(() => {
36
- dispatch({
37
- type: 'APPLY_FFT_DIMENSION_2_FILTER',
38
- });
39
- }, [dispatch]);
40
- const toolItems = [
41
- {
42
- id: 'zoom',
43
- label: options.zoom.label,
44
- icon: _jsx(FaSearchPlus, {}),
45
- },
46
- {
47
- id: 'zoomOut',
48
- label: 'Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )',
49
- onClick: handleFullZoomOut,
50
- icon: _jsx(FaExpand, {}),
51
- },
52
- {
53
- id: 'peakPicking',
54
- label: `${options.peakPicking.label} ( Press p )`,
55
- icon: _jsx(SvgNmrPeakPicking, {}),
56
- },
57
- {
58
- id: 'integral',
59
- label: `${options.integral.label} ( Press i )`,
60
- icon: _jsx(SvgNmrIntegrate, {}),
61
- },
62
- {
63
- id: 'zonePicking',
64
- label: `${options.zonePicking.label} ( Press r )`,
65
- icon: _jsx(FaDiceFour, {}),
66
- },
67
- {
68
- id: 'slicing',
69
- label: options.slicing.label,
70
- icon: _jsx(PiKnifeBold, {}),
71
- },
72
- {
73
- id: 'rangePicking',
74
- label: `${options.rangePicking.label} ( Press r )`,
75
- icon: _jsx(SvgNmrRangePicking, {}),
76
- },
77
- {
78
- id: 'multipleSpectraAnalysis',
79
- label: options.multipleSpectraAnalysis.label,
80
- icon: _jsx(SvgNmrMultipleAnalysis, {}),
81
- checkOptions: { checkSpectrumType: false },
82
- condition: ftCounter > 1,
83
- },
84
- {
85
- id: 'apodization',
86
- label: `${options.apodization.label} (Press a)`,
87
- icon: _jsx(SvgNmrApodization, {}),
88
- },
89
- {
90
- id: 'zeroFilling',
91
- label: `${options.zeroFilling.label} ( Press z )`,
92
- icon: _jsx(SvgNmrZeroFilling, {}),
93
- },
94
- {
95
- id: 'phaseCorrection',
96
- label: `${options.phaseCorrection.label} ( Press a )`,
97
- icon: _jsx(SvgNmrPhaseCorrection, {}),
98
- },
99
- {
100
- id: 'phaseCorrectionTwoDimensions',
101
- label: `${options.phaseCorrectionTwoDimensions.label} ( Press a )`,
102
- icon: _jsx(SvgNmrPhaseCorrection, {}),
103
- },
104
- {
105
- id: 'baselineCorrection',
106
- label: `${options.baselineCorrection.label} ( Press b )`,
107
- icon: _jsx(SvgNmrBaselineCorrection, {}),
108
- },
109
- {
110
- id: 'exclusionZones',
111
- label: `${options.exclusionZones.label} ( Press e )`,
112
- icon: _jsx(SvgNmrMultipleAnalysis, {}),
113
- checkOptions: { checkSpectrumType: false },
114
- condition: ftCounter > 0,
115
- },
116
- {
117
- id: 'fft',
118
- label: `${options.fft.label} ( Press t )`,
119
- onClick: handleOnFFTFilter,
120
- icon: _jsx(SvgNmrFourierTransform, {}),
121
- },
122
- {
123
- id: 'fftDimension1',
124
- label: options.fftDimension1.label,
125
- onClick: handleFFtDimension1Filter,
126
- icon: _jsx(SvgNmrFourierTransform, {}),
127
- },
128
- {
129
- id: 'fftDimension2',
130
- label: options.fftDimension2.label,
131
- onClick: handleFFtDimension2Filter,
132
- icon: _jsx(SvgNmrFourierTransform, {}),
133
- },
134
- ];
135
- return (_jsx(_Fragment, { children: toolItems.map((item) => {
136
- const { id, icon, label, checkOptions, onClick, condition } = item;
137
- return (isButtonVisible(id, checkOptions) &&
138
- (condition === undefined || condition) && (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), title: label, id: id, active: option === id, icon: icon }, id)));
139
- }) }));
140
- }
141
- const MemoizedFunctionToolBar = memo(FunctionToolBarInner);
142
- export default function FunctionToolBar({ defaultValue = options.zoom.id, }) {
143
- const { displayerMode } = useChartData();
144
- const data = useDatumWithSpectraStatistics();
145
- return (_jsx(MemoizedFunctionToolBar, { ...data,
146
- displayerMode,
147
- defaultValue }));
148
- }