nmrium 0.50.0 → 0.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +7 -7
  2. package/lib/component/elements/CloseButton.d.ts +2 -2
  3. package/lib/component/elements/CloseButton.js +1 -1
  4. package/lib/component/elements/CounterLabel.d.ts +3 -3
  5. package/lib/component/elements/CounterLabel.js +3 -3
  6. package/lib/component/elements/PreferencesButton.d.ts +2 -2
  7. package/lib/component/elements/PreferencesButton.js +2 -4
  8. package/lib/component/elements/SaveButton.d.ts +2 -2
  9. package/lib/component/elements/SaveButton.js +1 -1
  10. package/lib/component/elements/ToolBarButton.d.ts +1 -8
  11. package/lib/component/elements/ToolBarButton.js +2 -11
  12. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  13. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  14. package/lib/component/modal/CopyClipboardModal.js +1 -1
  15. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  16. package/lib/component/modal/SaveAsModal.js +1 -1
  17. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  18. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  19. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  20. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  21. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  22. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
  23. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  24. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -4
  25. package/lib/component/panels/PeaksPanel/PeaksPanel.js +42 -11
  26. package/lib/component/panels/RangesPanel/RangesHeader.js +70 -10
  27. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +46 -5
  28. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  29. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
  30. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
  31. package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
  32. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
  33. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
  34. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
  35. package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
  36. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  37. package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
  38. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +32 -3
  39. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  40. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  41. package/lib/component/toolbar/ToolBar.js +237 -9
  42. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  43. package/lib/component/toolbar/toolbarMenu.js +77 -0
  44. package/lib/component/utility/booleanToString.d.ts +6 -0
  45. package/lib/component/utility/booleanToString.js +4 -0
  46. package/lib/versionInfo.js +1 -1
  47. package/package.json +3 -3
  48. package/lib/component/elements/DeleteButton.d.ts +0 -6
  49. package/lib/component/elements/DeleteButton.js +0 -8
  50. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  51. package/lib/component/elements/DropdownMenu.js +0 -7
  52. package/lib/component/elements/FilterButton.d.ts +0 -6
  53. package/lib/component/elements/FilterButton.js +0 -8
  54. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
  55. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
  56. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  57. package/lib/component/toolbar/BasicToolBar.js +0 -165
  58. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  59. package/lib/component/toolbar/FunctionToolBar.js +0 -148
@@ -1,14 +1,242 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import { Toolbar } from 'react-science/ui';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrRealImag, SvgNmrZeroFilling, } from 'cheminfo-font';
3
+ import { useCallback } from 'react';
4
+ import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
5
+ import { PiKnifeBold } from 'react-icons/pi';
6
+ import { Toolbar, useOnOff } from 'react-science/ui';
4
7
  import { useChartData } from '../context/ChartContext';
5
- import BasicToolBar from './BasicToolBar';
6
- import FunctionToolBar from './FunctionToolBar';
7
- function ToolBarInner({ selectedTool }) {
8
- return (_jsxs(Toolbar, { vertical: true, children: [_jsx(FunctionToolBar, { defaultValue: selectedTool }), _jsx(BasicToolBar, {})] }));
8
+ import { useDispatch } from '../context/DispatchContext';
9
+ import { useLoader } from '../context/LoaderContext';
10
+ import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
11
+ import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
12
+ import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
13
+ import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
14
+ import useExport from '../hooks/useExport';
15
+ import useToolsFunctions from '../hooks/useToolsFunctions';
16
+ import { useVerticalAlign } from '../hooks/useVerticalAlign';
17
+ import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
18
+ import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
19
+ import { useMetaInformationImportationModal } from '../modal/metaImportation';
20
+ import { options } from './ToolTypes';
21
+ import { EXPORT_MENU, IMPORT_MENU } from './toolbarMenu';
22
+ function isPopoverToolItem(item) {
23
+ return !!item?.menuItems;
9
24
  }
10
- const MemoizedToolBar = memo(ToolBarInner);
11
25
  export default function ToolBar() {
12
26
  const { toolOptions: { selectedTool }, } = useChartData();
13
- return _jsx(MemoizedToolBar, { selectedTool });
27
+ const isButtonVisible = useCheckToolsVisibility();
28
+ const dispatch = useDispatch();
29
+ const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, handleChangeOption, handleFullZoomOut, } = useToolsFunctions();
30
+ const handleChange = useCallback((selectedOption) => {
31
+ handleChangeOption(selectedOption);
32
+ }, [handleChangeOption]);
33
+ const openLoader = useLoader();
34
+ const openMetaInformationModal = useMetaInformationImportationModal();
35
+ const isExperimentalFeature = useCheckExperimentalFeature();
36
+ const [isLoadJCAMPModalOpened, openLoadJCAMPModal, closeLoadJCAMPModal] = useOnOff(false);
37
+ const [isPublicationStringModalOpened, openPublicationStringModal, closePublicationStringModal,] = useOnOff(false);
38
+ const verticalAlign = useVerticalAlign();
39
+ const { fidCounter, ftCounter } = useDatumWithSpectraStatistics();
40
+ const importMenu = isExperimentalFeature
41
+ ? IMPORT_MENU
42
+ : IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
43
+ const exportMenu = isExperimentalFeature
44
+ ? EXPORT_MENU
45
+ : EXPORT_MENU.filter((item) => item.id !== 'nmre');
46
+ const handleOnFFTFilter = useCallback(() => {
47
+ dispatch({
48
+ type: 'APPLY_FFT_FILTER',
49
+ });
50
+ }, [dispatch]);
51
+ const handleFFtDimension1Filter = useCallback(() => {
52
+ dispatch({
53
+ type: 'APPLY_FFT_DIMENSION_1_FILTER',
54
+ });
55
+ }, [dispatch]);
56
+ const handleFFtDimension2Filter = useCallback(() => {
57
+ dispatch({
58
+ type: 'APPLY_FFT_DIMENSION_2_FILTER',
59
+ });
60
+ }, [dispatch]);
61
+ const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
62
+ function importHandler(data) {
63
+ switch (data?.id) {
64
+ case 'importFile':
65
+ openLoader();
66
+ break;
67
+ case 'importJDX':
68
+ openLoadJCAMPModal();
69
+ break;
70
+ case 'importPublicationString':
71
+ openPublicationStringModal();
72
+ break;
73
+ case 'importMetaInformation':
74
+ openMetaInformationModal();
75
+ break;
76
+ default:
77
+ }
78
+ }
79
+ function exportHandler(data) {
80
+ switch (data?.id) {
81
+ case 'svg':
82
+ void saveAsSVGHandler();
83
+ break;
84
+ case 'png':
85
+ void saveAsPNGHandler();
86
+ break;
87
+ case 'json':
88
+ saveAsJSONHandler();
89
+ break;
90
+ case 'advance_save':
91
+ void saveAsHandler();
92
+ break;
93
+ case 'copy':
94
+ void saveToClipboardHandler();
95
+ break;
96
+ default:
97
+ break;
98
+ }
99
+ }
100
+ const toolItems = [
101
+ {
102
+ id: 'zoom',
103
+ title: options.zoom.label,
104
+ icon: _jsx(FaSearchPlus, {}),
105
+ },
106
+ {
107
+ id: 'zoomOut',
108
+ title: 'Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )',
109
+ onClick: handleFullZoomOut,
110
+ icon: _jsx(FaExpand, {}),
111
+ },
112
+ {
113
+ id: 'peakPicking',
114
+ title: `${options.peakPicking.label} ( Press p )`,
115
+ icon: _jsx(SvgNmrPeakPicking, {}),
116
+ },
117
+ {
118
+ id: 'integral',
119
+ title: `${options.integral.label} ( Press i )`,
120
+ icon: _jsx(SvgNmrIntegrate, {}),
121
+ },
122
+ {
123
+ id: 'zonePicking',
124
+ title: `${options.zonePicking.label} ( Press r )`,
125
+ icon: _jsx(FaDiceFour, {}),
126
+ },
127
+ {
128
+ id: 'slicing',
129
+ title: options.slicing.label,
130
+ icon: _jsx(PiKnifeBold, {}),
131
+ },
132
+ {
133
+ id: 'rangePicking',
134
+ title: `${options.rangePicking.label} ( Press r )`,
135
+ icon: _jsx(SvgNmrRangePicking, {}),
136
+ },
137
+ {
138
+ id: 'multipleSpectraAnalysis',
139
+ title: options.multipleSpectraAnalysis.label,
140
+ icon: _jsx(SvgNmrMultipleAnalysis, {}),
141
+ checkOptions: { checkSpectrumType: false },
142
+ condition: ftCounter > 1,
143
+ },
144
+ {
145
+ id: 'apodization',
146
+ title: `${options.apodization.label} (Press a)`,
147
+ icon: _jsx(SvgNmrApodization, {}),
148
+ },
149
+ {
150
+ id: 'zeroFilling',
151
+ title: `${options.zeroFilling.label} ( Press z )`,
152
+ icon: _jsx(SvgNmrZeroFilling, {}),
153
+ },
154
+ {
155
+ id: 'phaseCorrection',
156
+ title: `${options.phaseCorrection.label} ( Press a )`,
157
+ icon: _jsx(SvgNmrPhaseCorrection, {}),
158
+ },
159
+ {
160
+ id: 'phaseCorrectionTwoDimensions',
161
+ title: `${options.phaseCorrectionTwoDimensions.label} ( Press a )`,
162
+ icon: _jsx(SvgNmrPhaseCorrection, {}),
163
+ },
164
+ {
165
+ id: 'baselineCorrection',
166
+ title: `${options.baselineCorrection.label} ( Press b )`,
167
+ icon: _jsx(SvgNmrBaselineCorrection, {}),
168
+ },
169
+ {
170
+ id: 'exclusionZones',
171
+ title: `${options.exclusionZones.label} ( Press e )`,
172
+ icon: _jsx(SvgNmrMultipleAnalysis, {}),
173
+ checkOptions: { checkSpectrumType: false },
174
+ condition: ftCounter > 0,
175
+ },
176
+ {
177
+ id: 'fft',
178
+ title: `${options.fft.label} ( Press t )`,
179
+ onClick: handleOnFFTFilter,
180
+ icon: _jsx(SvgNmrFourierTransform, {}),
181
+ },
182
+ {
183
+ id: 'fftDimension1',
184
+ title: options.fftDimension1.label,
185
+ onClick: handleFFtDimension1Filter,
186
+ icon: _jsx(SvgNmrFourierTransform, {}),
187
+ },
188
+ {
189
+ id: 'fftDimension2',
190
+ title: options.fftDimension2.label,
191
+ onClick: handleFFtDimension2Filter,
192
+ icon: _jsx(SvgNmrFourierTransform, {}),
193
+ },
194
+ {
195
+ id: 'import',
196
+ title: options.import.label,
197
+ icon: _jsx(FaFileImport, {}),
198
+ menuItems: importMenu,
199
+ onClick: importHandler,
200
+ },
201
+ {
202
+ id: 'exportAs',
203
+ title: options.exportAs.label,
204
+ icon: _jsx(FaFileExport, {}),
205
+ menuItems: exportMenu,
206
+ onClick: exportHandler,
207
+ },
208
+ {
209
+ id: 'spectraStackAlignments',
210
+ title: `${options.spectraStackAlignments.label} ( Press s )`,
211
+ icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})),
212
+ condition: ftCounter > 1,
213
+ onClick: changeDisplayViewModeHandler,
214
+ },
215
+ {
216
+ id: 'realImaginary',
217
+ title: isRealSpectrumShown ? 'Display real ' : 'Display imaginary',
218
+ icon: _jsx(SvgNmrRealImag, {}),
219
+ onClick: changeSpectrumViewHandler,
220
+ },
221
+ {
222
+ id: 'spectraCenterAlignments',
223
+ title: `Baseline ${verticalAlign === 'bottom' ? 'center' : 'bottom'} ( Press c )`,
224
+ icon: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})),
225
+ condition: ftCounter > 0 || fidCounter > 0,
226
+ onClick: alignSpectrumsVerticallyHandler,
227
+ },
228
+ ];
229
+ return (_jsxs(_Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadJCAMPModalOpened, onCloseDialog: closeLoadJCAMPModal }), _jsx(ImportPublicationStringModal, { isOpen: isPublicationStringModalOpened, onClose: closePublicationStringModal }), _jsx(Toolbar, { vertical: true, children: toolItems.map((item) => {
230
+ const { id, icon, title, checkOptions, condition } = item;
231
+ const show = isButtonVisible(id, checkOptions) &&
232
+ (condition === undefined || condition);
233
+ if (!show)
234
+ return null;
235
+ if (isPopoverToolItem(item)) {
236
+ const { menuItems, onClick } = item;
237
+ return (_jsx(ToolbarPopoverItem, { options: menuItems, title: title, id: id, active: selectedTool === id, icon: icon, onClick: onClick }, id));
238
+ }
239
+ const { onClick } = item;
240
+ return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), title: title, id: id, active: selectedTool === id, icon: icon }, id));
241
+ }) })] }));
14
242
  }
@@ -0,0 +1,4 @@
1
+ import { ToolbarPopoverMenuItem } from '../elements/ToolbarPopoverItem';
2
+ declare const IMPORT_MENU: ToolbarPopoverMenuItem[];
3
+ declare const EXPORT_MENU: ToolbarPopoverMenuItem[];
4
+ export { EXPORT_MENU, IMPORT_MENU };
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FaCopy, FaDownload, FaFile, FaFileDownload, FaFileImage, } from 'react-icons/fa';
3
+ const IMPORT_MENU = [
4
+ {
5
+ icon: _jsx(FaFile, {}),
6
+ text: 'Import from file system (Press Ctrl + O)',
7
+ data: {
8
+ id: 'importFile',
9
+ },
10
+ },
11
+ {
12
+ icon: _jsx(FaFile, {}),
13
+ text: 'Add JCAMP-DX from URL',
14
+ data: {
15
+ id: 'importJDX',
16
+ },
17
+ },
18
+ {
19
+ icon: _jsx(FaFile, {}),
20
+ text: 'Generate spectrum from publication string',
21
+ data: {
22
+ id: 'importPublicationString',
23
+ },
24
+ },
25
+ {
26
+ icon: _jsx(FaFile, {}),
27
+ text: 'Import meta information',
28
+ data: {
29
+ id: 'importMetaInformation',
30
+ },
31
+ },
32
+ ];
33
+ const EXPORT_MENU = [
34
+ {
35
+ icon: _jsx(FaDownload, {}),
36
+ text: 'Export as SVG',
37
+ data: {
38
+ id: 'svg',
39
+ },
40
+ },
41
+ {
42
+ icon: _jsx(FaFileImage, {}),
43
+ text: 'Export as PNG',
44
+ data: {
45
+ id: 'png',
46
+ },
47
+ },
48
+ {
49
+ icon: _jsx(FaFileDownload, {}),
50
+ text: 'Save data ( Press Ctrl + S )',
51
+ data: {
52
+ id: 'json',
53
+ },
54
+ },
55
+ {
56
+ icon: _jsx(FaFileDownload, {}),
57
+ text: 'Save data as ( Press Ctrl + Shift + S )',
58
+ data: {
59
+ id: 'advance_save',
60
+ },
61
+ },
62
+ {
63
+ icon: _jsx(FaFileDownload, {}),
64
+ text: 'Save NMRE data',
65
+ data: {
66
+ id: 'nmre',
67
+ },
68
+ },
69
+ {
70
+ icon: _jsx(FaCopy, {}),
71
+ text: 'Copy image to Clipboard ( Press Ctrl + C )',
72
+ data: {
73
+ id: 'copy',
74
+ },
75
+ },
76
+ ];
77
+ export { EXPORT_MENU, IMPORT_MENU };
@@ -0,0 +1,6 @@
1
+ interface ToStringOptions {
2
+ trueLabel?: string;
3
+ falseLabel?: string;
4
+ }
5
+ export declare function booleanToString(flag: boolean, options?: ToStringOptions): string;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ export function booleanToString(flag, options = {}) {
2
+ const { trueLabel = 'Show', falseLabel = 'Hide' } = options;
3
+ return flag ? trueLabel : falseLabel;
4
+ }
@@ -1 +1 @@
1
- export default { version: 'v0.50.0' };
1
+ export default { version: 'v0.50.1' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.50.0",
4
+ "version": "0.50.1",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -88,7 +88,7 @@
88
88
  "ml-tree-similarity": "^2.2.0",
89
89
  "multiplet-analysis": "^2.1.2",
90
90
  "nmr-correlation": "^2.3.3",
91
- "nmr-load-save": "^0.27.2",
91
+ "nmr-load-save": "^0.27.3",
92
92
  "nmr-processing": "^11.10.1",
93
93
  "nmredata": "^0.9.9",
94
94
  "numeral": "^2.0.6",
@@ -106,7 +106,7 @@
106
106
  "react-ocl-nmr": "^3.0.1",
107
107
  "react-plot": "^1.4.2",
108
108
  "react-rnd": "^10.4.1",
109
- "react-science": "^0.35.0",
109
+ "react-science": "^0.36.0",
110
110
  "react-slider": "^2.0.6",
111
111
  "react-table": "^7.8.0",
112
112
  "react-transition-group": "^4.4.5",
@@ -1,6 +0,0 @@
1
- import { ButtonProps } from '@blueprintjs/core';
2
- interface DeleteButtonProps extends Pick<ButtonProps, 'onClick' | 'title' | 'disabled' | 'active'> {
3
- title: string;
4
- }
5
- export declare function DeleteButton(props: DeleteButtonProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FaRegTrashAlt } from 'react-icons/fa';
3
- import { ToolBarButton } from './ToolBarButton';
4
- export function DeleteButton(props) {
5
- return (_jsx(ToolBarButton, { intent: "danger", style: {
6
- fontSize: '1.125em',
7
- }, ...props, id: "delete-button", icon: _jsx(FaRegTrashAlt, {}) }));
8
- }
@@ -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,6 +0,0 @@
1
- import { ButtonProps } from '@blueprintjs/core';
2
- interface FilterButtonProps extends Pick<ButtonProps, 'onClick' | 'title' | 'disabled' | 'active'> {
3
- title: string;
4
- }
5
- export declare function FilterButton(props: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FaFilter } from 'react-icons/fa';
3
- import { ToolBarButton } from './ToolBarButton';
4
- export function FilterButton(props) {
5
- return (_jsx(ToolBarButton, { id: "filter-button", ...props, style: {
6
- fontSize: '1.125em',
7
- }, icon: _jsx(FaFilter, {}) }));
8
- }
@@ -1,12 +0,0 @@
1
- import { ToolbarItemProps } from 'react-science/ui';
2
- interface PeaksToggleProps {
3
- disabled: boolean;
4
- toggleDisplayingMode: 'single' | 'spread';
5
- toggleDisplayingModeId?: string;
6
- togglePeaks: boolean;
7
- togglePeaksId?: string;
8
- onShowToggle: ToolbarItemProps['onClick'];
9
- onDisplayingModeToggle: ToolbarItemProps['onClick'];
10
- }
11
- export declare function PeaksToggleActions(props: PeaksToggleProps): import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,7 +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 { Toolbar } from 'react-science/ui';
4
- export function PeaksToggleActions(props) {
5
- const { disabled, togglePeaks, togglePeaksId, toggleDisplayingMode, toggleDisplayingModeId, onShowToggle, onDisplayingModeToggle, } = props;
6
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: togglePeaksId, disabled: disabled, icon: _jsx(SvgNmrPeaks, {}), title: `${togglePeaks ? 'Hide' : 'Show'} peaks`, onClick: onShowToggle, active: togglePeaks }), _jsx(Toolbar.Item, { id: toggleDisplayingModeId, disabled: disabled, icon: _jsx(SvgNmrPeaksTopLabels, {}), title: toggleDisplayingMode === 'spread' ? 'Single Mode' : 'Spread mode', onClick: onDisplayingModeToggle, active: toggleDisplayingMode === 'spread' })] }));
7
- }
@@ -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;