nmrium 1.7.0 → 1.9.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.
- package/lib/component/1d/ranges/Atoms.d.ts.map +1 -1
- package/lib/component/1d/ranges/Atoms.js +24 -9
- package/lib/component/1d/ranges/Atoms.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +32 -42
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.d.ts.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.js.map +1 -1
- package/lib/component/2d/useTracesSpectra.d.ts.map +1 -1
- package/lib/component/2d/useTracesSpectra.js +2 -0
- package/lib/component/2d/useTracesSpectra.js.map +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.js +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts.map +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +6 -0
- package/lib/component/EventsTrackers/KeysListenerTracker.js.map +1 -1
- package/lib/component/hooks/useExport.js +1 -1
- package/lib/component/hooks/useExport.js.map +1 -1
- package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
- package/lib/component/loader/useLoadFiles.js +17 -7
- package/lib/component/loader/useLoadFiles.js.map +1 -1
- package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
- package/lib/component/main/NMRiumStateProvider.js +2 -3
- package/lib/component/main/NMRiumStateProvider.js.map +1 -1
- package/lib/component/modal/LoadJCAMPModal.js +7 -2
- package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts.map +1 -1
- package/lib/component/modal/MoleculeStructureEditorModal.js +7 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js.map +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
- package/lib/component/modal/SaveAsModal.js +6 -2
- package/lib/component/modal/SaveAsModal.js.map +1 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.d.ts.map +1 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +17 -1
- package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts +6 -0
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js +87 -0
- package/lib/component/panels/MoleculesPanel/MoleculeOptionsPanel.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +18 -26
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +36 -31
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts +13 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.js +66 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/{useAtomAssignment.d.ts → hooks/useAtomAssignment.d.ts} +1 -1
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/{useAtomAssignment.js → hooks/useAtomAssignment.js} +32 -16
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts +12 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js +58 -0
- package/lib/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts +5 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.js +2 -0
- package/lib/component/panels/MoleculesPanel/utilities/AtomData.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts +16 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js +47 -0
- package/lib/component/panels/MoleculesPanel/utilities/extractFromAtom.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts +18 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js +31 -0
- package/lib/component/panels/MoleculesPanel/utilities/getAssignIds.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts +3 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js +12 -0
- package/lib/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts +4 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js +25 -0
- package/lib/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.js.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts +6 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.d.ts.map +1 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js +18 -0
- package/lib/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.js.map +1 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.d.ts +5 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.d.ts.map +1 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.js +29 -0
- package/lib/component/panels/databasePanel/DatabaseInfo.js.map +1 -0
- package/lib/component/panels/databasePanel/DatabaseTable.d.ts.map +1 -1
- package/lib/component/panels/databasePanel/DatabaseTable.js +21 -3
- package/lib/component/panels/databasePanel/DatabaseTable.js.map +1 -1
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts +9 -0
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.d.ts.map +1 -0
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.js +27 -0
- package/lib/component/panels/hooks/useMoleculeAnnotationCore.js.map +1 -0
- package/lib/component/panels/informationPanel/InformationEditionModal.js +1 -1
- package/lib/component/panels/informationPanel/InformationEditionModal.js.map +1 -1
- package/lib/component/reducer/IgnoreActions.d.ts.map +1 -1
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/IgnoreActions.js.map +1 -1
- package/lib/component/reducer/Reducer.d.ts +11 -5
- package/lib/component/reducer/Reducer.d.ts.map +1 -1
- package/lib/component/reducer/Reducer.js +8 -3
- package/lib/component/reducer/Reducer.js.map +1 -1
- package/lib/component/reducer/actions/DatabaseActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +4 -2
- package/lib/component/reducer/actions/DatabaseActions.js.map +1 -1
- package/lib/component/reducer/actions/LoadAction.d.ts +7 -4
- package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -1
- package/lib/component/reducer/actions/LoadAction.js +35 -26
- package/lib/component/reducer/actions/LoadAction.js.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +20 -5
- package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +42 -28
- package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +10 -4
- package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.js +24 -3
- package/lib/component/reducer/actions/RangesActions.js.map +1 -1
- package/lib/component/reducer/actions/ZonesActions.d.ts +1 -1
- package/lib/component/reducer/actions/ZonesActions.d.ts.map +1 -1
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts +4 -0
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.d.ts.map +1 -0
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js +7 -0
- package/lib/component/reducer/preferences/actions/changeDefaultMoleculeSettings.js.map +1 -0
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -2
- package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +3 -0
- package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
- package/lib/component/toolbar/ToolBar.d.ts.map +1 -1
- package/lib/component/toolbar/ToolBar.js +5 -1
- package/lib/component/toolbar/ToolBar.js.map +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
- package/lib/component/toolbar/ToolTypes.js +2 -1
- package/lib/component/toolbar/ToolTypes.js.map +1 -1
- package/lib/component/utility/filterDatabaseInfoEntry.d.ts +3 -0
- package/lib/component/utility/filterDatabaseInfoEntry.d.ts.map +1 -0
- package/lib/component/utility/filterDatabaseInfoEntry.js +9 -0
- package/lib/component/utility/filterDatabaseInfoEntry.js.map +1 -0
- package/lib/component/workspaces/assignment.d.ts.map +1 -1
- package/lib/component/workspaces/assignment.js +7 -0
- package/lib/component/workspaces/assignment.js.map +1 -1
- package/lib/component/workspaces/basic.d.ts.map +1 -1
- package/lib/component/workspaces/basic.js +5 -0
- package/lib/component/workspaces/basic.js.map +1 -1
- package/lib/component/workspaces/embedded.d.ts.map +1 -1
- package/lib/component/workspaces/embedded.js +5 -0
- package/lib/component/workspaces/embedded.js.map +1 -1
- package/lib/component/workspaces/exercise.d.ts.map +1 -1
- package/lib/component/workspaces/exercise.js +5 -0
- package/lib/component/workspaces/exercise.js.map +1 -1
- package/lib/component/workspaces/prediction.d.ts.map +1 -1
- package/lib/component/workspaces/prediction.js +6 -1
- package/lib/component/workspaces/prediction.js.map +1 -1
- package/lib/component/workspaces/process1D.d.ts.map +1 -1
- package/lib/component/workspaces/process1D.js +6 -0
- package/lib/component/workspaces/process1D.js.map +1 -1
- package/lib/component/workspaces/simulation.js +1 -1
- package/lib/component/workspaces/simulation.js.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +19 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
- package/lib/data/SpectraManager.d.ts +1 -1
- package/lib/data/SpectraManager.d.ts.map +1 -1
- package/lib/data/SpectraManager.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +17 -16
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +0 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +7 -6
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
- package/lib/data/molecules/Molecule.d.ts +1 -17
- package/lib/data/molecules/Molecule.d.ts.map +1 -1
- package/lib/data/molecules/Molecule.js +3 -7
- package/lib/data/molecules/Molecule.js.map +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +3 -2
- package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
- package/lib/data/molecules/MoleculeManager.js +31 -7
- package/lib/data/molecules/MoleculeManager.js.map +1 -1
- package/lib/utils/clipboard/clipboardHooks.js +4 -4
- package/lib/utils/clipboard/clipboardHooks.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +30 -29
- package/src/component/1d/ranges/Atoms.tsx +36 -13
- package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +38 -79
- package/src/component/1d-2d/components/FloatMoleculeStructures/FloatMolecules.tsx +5 -2
- package/src/component/2d/useTracesSpectra.ts +2 -0
- package/src/component/2d/zones/SignalsGuideLines.tsx +1 -1
- package/src/component/EventsTrackers/KeysListenerTracker.tsx +6 -0
- package/src/component/hooks/useExport.tsx +1 -1
- package/src/component/loader/useLoadFiles.ts +19 -7
- package/src/component/main/NMRiumStateProvider.tsx +2 -3
- package/src/component/modal/LoadJCAMPModal.tsx +10 -4
- package/src/component/modal/MoleculeStructureEditorModal.tsx +10 -3
- package/src/component/modal/MultipletAnalysisModal.tsx +1 -1
- package/src/component/modal/SaveAsModal.tsx +8 -2
- package/src/component/modal/setting/settings-tabs/ToolsTabContent.tsx +17 -1
- package/src/component/panels/MoleculesPanel/MoleculeOptionsPanel.tsx +160 -0
- package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +77 -101
- package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +63 -42
- package/src/component/panels/MoleculesPanel/MoleculeStructure.tsx +117 -0
- package/src/component/panels/MoleculesPanel/{useAtomAssignment.tsx → hooks/useAtomAssignment.tsx} +47 -25
- package/src/component/panels/MoleculesPanel/hooks/useExtractAtomAssignmentLabel.ts +74 -0
- package/src/component/panels/MoleculesPanel/utilities/AtomData.ts +4 -0
- package/src/component/panels/MoleculesPanel/utilities/extractFromAtom.ts +63 -0
- package/src/component/panels/MoleculesPanel/utilities/getAssignIds.ts +59 -0
- package/src/component/panels/MoleculesPanel/utilities/getCurrentDiaIDsToHighlight.ts +12 -0
- package/src/component/panels/MoleculesPanel/utilities/getHighlightsOnHover.ts +36 -0
- package/src/component/panels/MoleculesPanel/utilities/getUniqueDiaIDs.ts +20 -0
- package/src/component/panels/databasePanel/DatabaseInfo.tsx +43 -0
- package/src/component/panels/databasePanel/DatabaseTable.tsx +33 -1
- package/src/component/panels/hooks/useMoleculeAnnotationCore.ts +36 -0
- package/src/component/panels/informationPanel/InformationEditionModal.tsx +2 -0
- package/src/component/reducer/IgnoreActions.ts +2 -1
- package/src/component/reducer/Reducer.ts +21 -8
- package/src/component/reducer/actions/DatabaseActions.ts +4 -2
- package/src/component/reducer/actions/LoadAction.ts +51 -38
- package/src/component/reducer/actions/MoleculeActions.ts +85 -37
- package/src/component/reducer/actions/RangesActions.ts +50 -5
- package/src/component/reducer/actions/ZonesActions.ts +1 -1
- package/src/component/reducer/preferences/actions/changeDefaultMoleculeSettings.ts +16 -0
- package/src/component/reducer/preferences/panelsPreferencesDefaultValues.ts +1 -1
- package/src/component/reducer/preferences/preferencesReducer.ts +11 -1
- package/src/component/toolbar/ToolBar.tsx +6 -1
- package/src/component/toolbar/ToolTypes.ts +2 -1
- package/src/component/utility/filterDatabaseInfoEntry.ts +10 -0
- package/src/component/workspaces/assignment.ts +7 -0
- package/src/component/workspaces/basic.ts +5 -0
- package/src/component/workspaces/embedded.ts +5 -0
- package/src/component/workspaces/exercise.ts +5 -0
- package/src/component/workspaces/prediction.ts +6 -1
- package/src/component/workspaces/process1D.ts +6 -0
- package/src/component/workspaces/simulation.ts +1 -1
- package/src/component/workspaces/workspaceDefaultProperties.ts +19 -1
- package/src/data/SpectraManager.ts +1 -7
- package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +17 -19
- package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +2 -1
- package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +7 -10
- package/src/data/molecules/Molecule.ts +5 -25
- package/src/data/molecules/MoleculeManager.ts +40 -8
- package/src/index.tsx +0 -3
- package/src/utils/clipboard/clipboardHooks.ts +6 -6
- package/src/versionInfo.ts +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +0 -43
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts.map +0 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +0 -129
- package/lib/component/panels/MoleculesPanel/Utilities.js.map +0 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +0 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +0 -1
- package/src/component/panels/MoleculesPanel/Utilities.ts +0 -188
|
@@ -60,6 +60,10 @@ const LIST: ListItem[] = [
|
|
|
60
60
|
label: 'Range picking',
|
|
61
61
|
name: 'rangePicking',
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
label: 'Inset',
|
|
65
|
+
name: 'inset',
|
|
66
|
+
},
|
|
63
67
|
{
|
|
64
68
|
label: 'Slicing',
|
|
65
69
|
name: 'slicing',
|
|
@@ -92,10 +96,22 @@ const LIST: ListItem[] = [
|
|
|
92
96
|
label: 'Fourier transform',
|
|
93
97
|
name: 'fft',
|
|
94
98
|
},
|
|
99
|
+
{
|
|
100
|
+
label: 'Fourier transform dimension one',
|
|
101
|
+
name: 'fftDimension1',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: 'Fourier transform dimension two',
|
|
105
|
+
name: 'fftDimension2',
|
|
106
|
+
},
|
|
95
107
|
{
|
|
96
108
|
label: 'Phase correction',
|
|
97
109
|
name: 'phaseCorrection',
|
|
98
110
|
},
|
|
111
|
+
{
|
|
112
|
+
label: 'Two-Dimensional phase correction',
|
|
113
|
+
name: 'phaseCorrectionTwoDimensions',
|
|
114
|
+
},
|
|
99
115
|
{
|
|
100
116
|
label: 'Baseline correction',
|
|
101
117
|
name: 'baselineCorrection',
|
|
@@ -105,7 +121,7 @@ const LIST: ListItem[] = [
|
|
|
105
121
|
name: 'exclusionZones',
|
|
106
122
|
},
|
|
107
123
|
{
|
|
108
|
-
label: 'Multiple spectra
|
|
124
|
+
label: 'Multiple spectra integration',
|
|
109
125
|
name: 'multipleSpectraAnalysis',
|
|
110
126
|
},
|
|
111
127
|
{
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
3
|
+
import type { BoundingBox, MoleculeView } from '@zakodium/nmrium-core';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import * as Yup from 'yup';
|
|
6
|
+
|
|
7
|
+
import { usePreferences } from '../../context/PreferencesContext.tsx';
|
|
8
|
+
import { CheckController } from '../../elements/CheckController.js';
|
|
9
|
+
import { GroupPane } from '../../elements/GroupPane.js';
|
|
10
|
+
import type { LabelStyle } from '../../elements/Label.js';
|
|
11
|
+
import Label from '../../elements/Label.js';
|
|
12
|
+
import { NumberInput2Controller } from '../../elements/NumberInput2Controller.js';
|
|
13
|
+
import { Select2Controller } from '../../elements/Select2Controller.js';
|
|
14
|
+
import PreferencesHeader from '../header/PreferencesHeader.tsx';
|
|
15
|
+
|
|
16
|
+
const atomAnnotations: Array<{
|
|
17
|
+
value: MoleculeView['atomAnnotation'];
|
|
18
|
+
label: string;
|
|
19
|
+
}> = [
|
|
20
|
+
{ value: 'none', label: 'None' },
|
|
21
|
+
{ value: 'atom-numbers', label: 'Atoms number' },
|
|
22
|
+
{ value: 'custom-labels', label: 'Custom labels' },
|
|
23
|
+
];
|
|
24
|
+
const Container = styled.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 100%;
|
|
29
|
+
`;
|
|
30
|
+
const InnerContainer = styled.div`
|
|
31
|
+
overflow: auto;
|
|
32
|
+
height: 100%;
|
|
33
|
+
display: block;
|
|
34
|
+
background-color: white;
|
|
35
|
+
`;
|
|
36
|
+
const boundingBoxSchema: Yup.ObjectSchema<BoundingBox> = Yup.object({
|
|
37
|
+
width: Yup.number().required().min(0, 'Width must be positive'),
|
|
38
|
+
height: Yup.number().required().min(0, 'Height must be positive'),
|
|
39
|
+
x: Yup.number().required(),
|
|
40
|
+
y: Yup.number().required(),
|
|
41
|
+
}).defined();
|
|
42
|
+
|
|
43
|
+
const moleculeViewSchema: Yup.ObjectSchema<MoleculeView> = Yup.object({
|
|
44
|
+
floating: Yup.object({
|
|
45
|
+
visible: Yup.boolean().required(),
|
|
46
|
+
bounding: boundingBoxSchema.required(),
|
|
47
|
+
}),
|
|
48
|
+
showLabel: Yup.boolean().required(),
|
|
49
|
+
atomAnnotation: Yup.mixed<'none' | 'atom-numbers' | 'custom-labels'>()
|
|
50
|
+
.oneOf(['none', 'atom-numbers', 'custom-labels'])
|
|
51
|
+
.required()
|
|
52
|
+
.default('none'),
|
|
53
|
+
}).defined();
|
|
54
|
+
|
|
55
|
+
const labelStyle: LabelStyle = {
|
|
56
|
+
label: { flex: 4, fontWeight: '500' },
|
|
57
|
+
wrapper: { flex: 8, display: 'flex', alignItems: 'center' },
|
|
58
|
+
container: { padding: '5px 0' },
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const styles = {
|
|
62
|
+
select: {
|
|
63
|
+
width: '100%',
|
|
64
|
+
minWidth: '100px',
|
|
65
|
+
maxWidth: '280px',
|
|
66
|
+
height: 30,
|
|
67
|
+
margin: 0,
|
|
68
|
+
},
|
|
69
|
+
groupHeader: {
|
|
70
|
+
borderBottom: '1px solid #efefef',
|
|
71
|
+
paddingBottom: '5px',
|
|
72
|
+
fontWeight: '600',
|
|
73
|
+
color: '#005d9e',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
interface MoleculeOptionsPanelProps {
|
|
78
|
+
onClose: () => void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function MoleculeOptionsPanel(props: MoleculeOptionsPanelProps) {
|
|
82
|
+
const { onClose } = props;
|
|
83
|
+
const {
|
|
84
|
+
current: { defaultMoleculeSettings },
|
|
85
|
+
} = usePreferences();
|
|
86
|
+
const { handleSubmit, control } = useForm<MoleculeView>({
|
|
87
|
+
defaultValues: defaultMoleculeSettings,
|
|
88
|
+
resolver: yupResolver(moleculeViewSchema),
|
|
89
|
+
});
|
|
90
|
+
const { dispatch } = usePreferences();
|
|
91
|
+
|
|
92
|
+
function handleSave() {
|
|
93
|
+
void handleSubmit((values) => {
|
|
94
|
+
dispatch({ type: 'CHANGE_DEFAULT_MOLECULE_SETTINGS', payload: values });
|
|
95
|
+
onClose();
|
|
96
|
+
})();
|
|
97
|
+
}
|
|
98
|
+
return (
|
|
99
|
+
<Container>
|
|
100
|
+
<PreferencesHeader onSave={handleSave} onClose={onClose} />
|
|
101
|
+
<InnerContainer>
|
|
102
|
+
<GroupPane
|
|
103
|
+
text="General"
|
|
104
|
+
style={{
|
|
105
|
+
header: styles.groupHeader,
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<Label title="Show label" style={labelStyle}>
|
|
109
|
+
<CheckController control={control} name="showLabel" />
|
|
110
|
+
</Label>
|
|
111
|
+
<Label title="Atom annotation" style={labelStyle}>
|
|
112
|
+
<Select2Controller
|
|
113
|
+
control={control}
|
|
114
|
+
items={atomAnnotations}
|
|
115
|
+
name="atomAnnotation"
|
|
116
|
+
/>
|
|
117
|
+
</Label>
|
|
118
|
+
</GroupPane>
|
|
119
|
+
<GroupPane
|
|
120
|
+
text="Size & position"
|
|
121
|
+
style={{
|
|
122
|
+
header: styles.groupHeader,
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<Label title="Floating molecule" style={labelStyle}>
|
|
126
|
+
<CheckController control={control} name="floating.visible" />
|
|
127
|
+
</Label>
|
|
128
|
+
<Label title="X (%)" style={labelStyle}>
|
|
129
|
+
<NumberInput2Controller
|
|
130
|
+
control={control}
|
|
131
|
+
name="floating.bounding.x"
|
|
132
|
+
fill
|
|
133
|
+
/>
|
|
134
|
+
</Label>
|
|
135
|
+
<Label title="Y (%)" style={labelStyle}>
|
|
136
|
+
<NumberInput2Controller
|
|
137
|
+
control={control}
|
|
138
|
+
name="floating.bounding.y"
|
|
139
|
+
fill
|
|
140
|
+
/>
|
|
141
|
+
</Label>
|
|
142
|
+
<Label title="Width" style={labelStyle}>
|
|
143
|
+
<NumberInput2Controller
|
|
144
|
+
control={control}
|
|
145
|
+
name="floating.bounding.width"
|
|
146
|
+
fill
|
|
147
|
+
/>
|
|
148
|
+
</Label>
|
|
149
|
+
<Label title="Height" style={labelStyle}>
|
|
150
|
+
<NumberInput2Controller
|
|
151
|
+
control={control}
|
|
152
|
+
name="floating.bounding.height"
|
|
153
|
+
fill
|
|
154
|
+
/>
|
|
155
|
+
</Label>
|
|
156
|
+
</GroupPane>
|
|
157
|
+
</InnerContainer>
|
|
158
|
+
</Container>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import type { SerializedStyles } from '@emotion/react';
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { memo, useEffect, useState } from 'react';
|
|
4
|
+
import { memo, useCallback, useEffect, useState } from 'react';
|
|
5
5
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
6
|
-
import OCLnmr from 'react-ocl-nmr';
|
|
7
6
|
|
|
8
7
|
import type {
|
|
9
8
|
MoleculesView,
|
|
10
9
|
StateMoleculeExtended,
|
|
11
10
|
} from '../../../data/molecules/Molecule.js';
|
|
12
11
|
import { useChartData } from '../../context/ChartContext.js';
|
|
13
|
-
import { useDispatch } from '../../context/DispatchContext.js';
|
|
14
12
|
import { NextPrev } from '../../elements/NextPrev.js';
|
|
15
|
-
import { useHighlightColor } from '../../hooks/useHighlightColor.js';
|
|
16
13
|
import { useMoleculeEditor } from '../../modal/MoleculeStructureEditorModal.js';
|
|
17
14
|
|
|
18
15
|
import MoleculeHeader from './MoleculeHeader.js';
|
|
16
|
+
import { MoleculeOptionsPanel } from './MoleculeOptionsPanel.tsx';
|
|
19
17
|
import MoleculePanelHeader from './MoleculePanelHeader.js';
|
|
20
|
-
import
|
|
18
|
+
import { MoleculeStructure } from './MoleculeStructure.tsx';
|
|
21
19
|
|
|
22
20
|
const styles: Record<
|
|
23
21
|
'panel' | 'innerPanel' | 'molecule' | 'slider' | 'items',
|
|
@@ -61,20 +59,13 @@ function MoleculePanelInner(props: MoleculePanelInnerProps) {
|
|
|
61
59
|
const { molecules: moleculesProp, moleculesView } = props;
|
|
62
60
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
63
61
|
const [molecules, setMolecules] = useState<StateMoleculeExtended[]>([]);
|
|
62
|
+
const [isFlipped, setFlipStatus] = useState(false);
|
|
64
63
|
|
|
65
|
-
const dispatch = useDispatch();
|
|
66
64
|
const { modal, openMoleculeEditor } = useMoleculeEditor();
|
|
67
|
-
const highlightColor = useHighlightColor();
|
|
68
|
-
|
|
69
|
-
const {
|
|
70
|
-
currentDiaIDsToHighlight,
|
|
71
|
-
handleOnAtomHover,
|
|
72
|
-
handleOnClickAtom,
|
|
73
|
-
assignedDiaIDsMerged,
|
|
74
|
-
} = useAtomAssignment();
|
|
75
65
|
|
|
76
66
|
useEffect(() => {
|
|
77
67
|
if (moleculesProp) {
|
|
68
|
+
// eslint-disable-next-line react-you-might-not-need-an-effect/no-derived-state
|
|
78
69
|
setMolecules((prevMolecules) => {
|
|
79
70
|
if (moleculesProp.length > prevMolecules.length) {
|
|
80
71
|
setCurrentIndex(molecules.length);
|
|
@@ -84,14 +75,6 @@ function MoleculePanelInner(props: MoleculePanelInnerProps) {
|
|
|
84
75
|
}
|
|
85
76
|
}, [molecules.length, moleculesProp]);
|
|
86
77
|
|
|
87
|
-
function handleReplaceMolecule(molecule: any, molfile: any) {
|
|
88
|
-
const { id, label } = molecule;
|
|
89
|
-
dispatch({
|
|
90
|
-
type: 'SET_MOLECULE',
|
|
91
|
-
payload: { molfile, id, label },
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
78
|
function moleculeIndexHandler(index: any) {
|
|
96
79
|
setCurrentIndex(index);
|
|
97
80
|
}
|
|
@@ -99,89 +82,82 @@ function MoleculePanelInner(props: MoleculePanelInnerProps) {
|
|
|
99
82
|
const lastIndex = molecules?.length > 0 ? molecules.length - 1 : 0;
|
|
100
83
|
const activeIndex = Math.min(currentIndex, lastIndex);
|
|
101
84
|
|
|
85
|
+
const settingsPanelHandler = useCallback(() => {
|
|
86
|
+
setFlipStatus(!isFlipped);
|
|
87
|
+
}, [isFlipped]);
|
|
88
|
+
|
|
89
|
+
const onClose = useCallback(() => {
|
|
90
|
+
setFlipStatus(false);
|
|
91
|
+
}, []);
|
|
92
|
+
|
|
102
93
|
return (
|
|
103
94
|
<div css={styles.panel}>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
setHoverAtom={handleOnAtomHover}
|
|
162
|
-
showAtomNumber={
|
|
163
|
-
moleculesView?.[mol.id]?.showAtomNumber || false
|
|
164
|
-
}
|
|
165
|
-
noCarbonLabelWithCustomLabel
|
|
166
|
-
/>
|
|
167
|
-
</div>
|
|
95
|
+
{!isFlipped && (
|
|
96
|
+
<MoleculePanelHeader
|
|
97
|
+
currentIndex={activeIndex}
|
|
98
|
+
moleculesView={moleculesView}
|
|
99
|
+
molecules={molecules}
|
|
100
|
+
onOpenMoleculeEditor={() => openMoleculeEditor()}
|
|
101
|
+
onMoleculeIndexChange={moleculeIndexHandler}
|
|
102
|
+
onClickPreferences={settingsPanelHandler}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
{isFlipped && <MoleculeOptionsPanel onClose={onClose} />}
|
|
106
|
+
{!isFlipped && (
|
|
107
|
+
<div css={styles.innerPanel}>
|
|
108
|
+
<div css={styles.molecule}>
|
|
109
|
+
<ResponsiveChart>
|
|
110
|
+
{({ height, width }) => {
|
|
111
|
+
return (
|
|
112
|
+
<NextPrev
|
|
113
|
+
onChange={(slideIndex) => setCurrentIndex(slideIndex)}
|
|
114
|
+
index={currentIndex}
|
|
115
|
+
>
|
|
116
|
+
{molecules && molecules.length > 0 ? (
|
|
117
|
+
molecules.map((mol: StateMoleculeExtended, index) => {
|
|
118
|
+
return (
|
|
119
|
+
<div key={mol.id} css={styles.items}>
|
|
120
|
+
<MoleculeHeader
|
|
121
|
+
currentMolecule={mol}
|
|
122
|
+
molecules={molecules}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<div
|
|
126
|
+
css={styles.slider}
|
|
127
|
+
className="mol-svg-container"
|
|
128
|
+
onDoubleClick={() => openMoleculeEditor(mol)}
|
|
129
|
+
style={{
|
|
130
|
+
backgroundColor:
|
|
131
|
+
(index + 1) % 2 !== 0 ? '#fafafa' : 'white',
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<MoleculeStructure
|
|
135
|
+
index={index}
|
|
136
|
+
width={width}
|
|
137
|
+
height={height - 60}
|
|
138
|
+
molecule={mol}
|
|
139
|
+
moleculeView={moleculesView?.[mol.id] || {}}
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
})
|
|
145
|
+
) : (
|
|
146
|
+
<div
|
|
147
|
+
css={styles.slider}
|
|
148
|
+
style={{ height: '100%' }}
|
|
149
|
+
onClick={() => openMoleculeEditor()}
|
|
150
|
+
>
|
|
151
|
+
<span>Click to draw molecule</span>
|
|
168
152
|
</div>
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
>
|
|
176
|
-
<span>Click to draw molecule</span>
|
|
177
|
-
</div>
|
|
178
|
-
)}
|
|
179
|
-
</NextPrev>
|
|
180
|
-
);
|
|
181
|
-
}}
|
|
182
|
-
</ResponsiveChart>
|
|
153
|
+
)}
|
|
154
|
+
</NextPrev>
|
|
155
|
+
);
|
|
156
|
+
}}
|
|
157
|
+
</ResponsiveChart>
|
|
158
|
+
</div>
|
|
183
159
|
</div>
|
|
184
|
-
|
|
160
|
+
)}
|
|
185
161
|
{modal}
|
|
186
162
|
</div>
|
|
187
163
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Molecule } from 'openchemlib';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
FaCopy,
|
|
@@ -8,43 +8,40 @@ import {
|
|
|
8
8
|
FaFileImage,
|
|
9
9
|
FaPaste,
|
|
10
10
|
FaPlus,
|
|
11
|
+
FaRegBookmark,
|
|
11
12
|
FaRegTrashAlt,
|
|
12
13
|
} from 'react-icons/fa';
|
|
13
14
|
import { FaMaximize, FaMinimize } from 'react-icons/fa6';
|
|
14
15
|
import { IoOpenOutline } from 'react-icons/io5';
|
|
16
|
+
import { MdNumbers, MdOutlineLabelOff } from 'react-icons/md';
|
|
15
17
|
import { PanelHeader, Toolbar } from 'react-science/ui';
|
|
16
18
|
|
|
17
19
|
import type {
|
|
18
20
|
MoleculesView,
|
|
19
21
|
StateMoleculeExtended,
|
|
20
22
|
} from '../../../data/molecules/Molecule.js';
|
|
21
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
getMolecules,
|
|
25
|
+
parseErrorMessage,
|
|
26
|
+
} from '../../../data/molecules/MoleculeManager.js';
|
|
22
27
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents.js';
|
|
23
28
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks.js';
|
|
24
29
|
import { useDispatch } from '../../context/DispatchContext.js';
|
|
25
30
|
import { useGlobal } from '../../context/GlobalContext.js';
|
|
31
|
+
import { usePreferences } from '../../context/PreferencesContext.tsx';
|
|
26
32
|
import { useToaster } from '../../context/ToasterContext.js';
|
|
27
33
|
import { useTopicMolecule } from '../../context/TopicMoleculeContext.js';
|
|
28
34
|
import type { ToolbarPopoverMenuItem } from '../../elements/ToolbarPopoverItem.js';
|
|
29
35
|
import { ToolbarPopoverItem } from '../../elements/ToolbarPopoverItem.js';
|
|
30
36
|
import AboutPredictionModal from '../../modal/AboutPredictionModal.js';
|
|
31
37
|
import PredictSpectraModal from '../../modal/PredictSpectraModal.js';
|
|
38
|
+
import { booleanToString } from '../../utility/booleanToString.ts';
|
|
32
39
|
import {
|
|
33
40
|
browserNotSupportedErrorToast,
|
|
34
41
|
copyPNGToClipboard,
|
|
35
42
|
exportAsSVG,
|
|
36
43
|
} from '../../utility/export.js';
|
|
37
|
-
|
|
38
|
-
const styles: Record<'atomLabel', CSSProperties> = {
|
|
39
|
-
atomLabel: {
|
|
40
|
-
width: '14px',
|
|
41
|
-
height: '14px',
|
|
42
|
-
padding: 0,
|
|
43
|
-
margin: 0,
|
|
44
|
-
textAlign: 'center',
|
|
45
|
-
lineHeight: 1,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
44
|
+
import { useMoleculeAnnotationCore } from '../hooks/useMoleculeAnnotationCore.ts';
|
|
48
45
|
|
|
49
46
|
const MOL_EXPORT_MENU: ToolbarPopoverMenuItem[] = [
|
|
50
47
|
{
|
|
@@ -110,7 +107,9 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
110
107
|
const { rootRef } = useGlobal();
|
|
111
108
|
const toaster = useToaster();
|
|
112
109
|
const dispatch = useDispatch();
|
|
113
|
-
|
|
110
|
+
const {
|
|
111
|
+
current: { defaultMoleculeSettings },
|
|
112
|
+
} = usePreferences();
|
|
114
113
|
const moleculeKey = molecules?.[currentIndex]?.id;
|
|
115
114
|
const saveAsSVGHandler = useCallback(() => {
|
|
116
115
|
if (!rootRef) return;
|
|
@@ -204,16 +203,18 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
204
203
|
* @param text - text from clipboard
|
|
205
204
|
* @returns
|
|
206
205
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
|
|
207
|
+
async function handlePasteMolecule(text?: string) {
|
|
209
208
|
try {
|
|
210
209
|
const molecules = getMolecules(text);
|
|
211
|
-
dispatch({
|
|
212
|
-
|
|
210
|
+
dispatch({
|
|
211
|
+
type: 'ADD_MOLECULES',
|
|
212
|
+
payload: { molecules, defaultMoleculeSettings },
|
|
213
|
+
});
|
|
214
|
+
} catch (error: any) {
|
|
213
215
|
toaster.show({
|
|
214
216
|
intent: 'danger',
|
|
215
|
-
message:
|
|
216
|
-
'Failed to parse SMILES or molfile. Please paste a valid format',
|
|
217
|
+
message: error?.message || parseErrorMessage,
|
|
217
218
|
});
|
|
218
219
|
} finally {
|
|
219
220
|
cleanShouldFallback();
|
|
@@ -237,13 +238,6 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
237
238
|
});
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
function showAtomNumbersHandler() {
|
|
241
|
-
dispatch({
|
|
242
|
-
type: 'TOGGLE_MOLECULE_ATOM_NUMBER',
|
|
243
|
-
payload: { id: moleculeKey },
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
241
|
const topicMolecule = useTopicMolecule();
|
|
248
242
|
|
|
249
243
|
function expandMoleculeHydrogens(expand?: boolean) {
|
|
@@ -258,30 +252,49 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
258
252
|
dispatch({ type: 'SET_MOLECULE', payload: { id, label, molfile } });
|
|
259
253
|
}
|
|
260
254
|
|
|
255
|
+
function clearCustomAtomLabels() {
|
|
256
|
+
const currentMolecule = molecules[currentIndex];
|
|
257
|
+
|
|
258
|
+
if (!currentMolecule) return;
|
|
259
|
+
const { id, label, molfile } = currentMolecule;
|
|
260
|
+
|
|
261
|
+
const molecule = Molecule.fromMolfile(molfile);
|
|
262
|
+
|
|
263
|
+
for (let atom = 0; atom < molecule.getAllAtoms(); atom++) {
|
|
264
|
+
molecule.setAtomCustomLabel(atom, null);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
dispatch({
|
|
268
|
+
type: 'SET_MOLECULE',
|
|
269
|
+
payload: { id, label, molfile: molecule.toMolfileV3() },
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
261
273
|
const hasMolecules = molecules && molecules.length > 0;
|
|
262
274
|
const showCounter = hasMolecules && renderSource !== 'predictionPanel';
|
|
263
|
-
|
|
264
275
|
const moreMenu: ToolbarPopoverMenuItem[] = [
|
|
265
276
|
{
|
|
266
277
|
icon: <FaMaximize />,
|
|
267
278
|
text: 'Expand all hydrogens',
|
|
268
|
-
data: {
|
|
269
|
-
id: 'expandAllHydrogens',
|
|
270
|
-
},
|
|
271
279
|
disabled: !hasMolecules,
|
|
272
280
|
onClick: () => expandMoleculeHydrogens(true),
|
|
273
281
|
},
|
|
274
282
|
{
|
|
275
283
|
icon: <FaMinimize />,
|
|
276
284
|
text: 'Collapse all hydrogens',
|
|
277
|
-
data: {
|
|
278
|
-
id: 'collapseAllHydrogens',
|
|
279
|
-
},
|
|
280
285
|
disabled: !hasMolecules,
|
|
281
286
|
onClick: () => expandMoleculeHydrogens(false),
|
|
282
287
|
},
|
|
288
|
+
{
|
|
289
|
+
icon: <MdOutlineLabelOff />,
|
|
290
|
+
text: 'Clear custom atom labels',
|
|
291
|
+
disabled: !hasMolecules,
|
|
292
|
+
onClick: () => clearCustomAtomLabels(),
|
|
293
|
+
},
|
|
283
294
|
];
|
|
284
295
|
|
|
296
|
+
const { handleChangeAtomAnnotation, isAnnotation } =
|
|
297
|
+
useMoleculeAnnotationCore(moleculeKey, moleculesView[moleculeKey]);
|
|
285
298
|
return (
|
|
286
299
|
<PanelHeader
|
|
287
300
|
onClickSettings={onClickPreferences}
|
|
@@ -324,6 +337,21 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
324
337
|
{hasMolecules && (
|
|
325
338
|
<PredictSpectraModal molecule={molecules[currentIndex]} />
|
|
326
339
|
)}
|
|
340
|
+
|
|
341
|
+
<Toolbar.Item
|
|
342
|
+
tooltip={`${booleanToString(!isAnnotation('atom-numbers'))} atom number`}
|
|
343
|
+
icon={<MdNumbers />}
|
|
344
|
+
onClick={() => handleChangeAtomAnnotation('atom-numbers')}
|
|
345
|
+
active={isAnnotation('atom-numbers')}
|
|
346
|
+
disabled={!hasMolecules}
|
|
347
|
+
/>
|
|
348
|
+
<Toolbar.Item
|
|
349
|
+
tooltip={`${booleanToString(!isAnnotation('custom-labels'))} custom labels`}
|
|
350
|
+
icon={<FaRegBookmark />}
|
|
351
|
+
onClick={() => handleChangeAtomAnnotation('custom-labels')}
|
|
352
|
+
active={isAnnotation('custom-labels')}
|
|
353
|
+
disabled={!hasMolecules}
|
|
354
|
+
/>
|
|
327
355
|
</>
|
|
328
356
|
)}
|
|
329
357
|
|
|
@@ -334,13 +362,6 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
334
362
|
active={moleculesView?.[moleculeKey]?.floating.visible || false}
|
|
335
363
|
disabled={!hasMolecules}
|
|
336
364
|
/>
|
|
337
|
-
<Toolbar.Item
|
|
338
|
-
tooltip="Show atom number"
|
|
339
|
-
icon={<p style={styles.atomLabel}>#</p>}
|
|
340
|
-
onClick={showAtomNumbersHandler}
|
|
341
|
-
active={moleculesView?.[moleculeKey]?.showAtomNumber || false}
|
|
342
|
-
disabled={!hasMolecules}
|
|
343
|
-
/>
|
|
344
365
|
|
|
345
366
|
<ToolbarPopoverItem
|
|
346
367
|
options={moreMenu}
|
|
@@ -359,7 +380,7 @@ export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
|
359
380
|
onDismiss={cleanShouldFallback}
|
|
360
381
|
onReadText={handlePasteMolecule}
|
|
361
382
|
text={text}
|
|
362
|
-
label="
|
|
383
|
+
label="Enter here a molfile or SMILES"
|
|
363
384
|
/>
|
|
364
385
|
</PanelHeader>
|
|
365
386
|
);
|