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
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
|
|
2
|
-
import { assignmentAxes } from '../../assignment/AssignmentsContext.js';
|
|
3
|
-
function getElements(activeTab) {
|
|
4
|
-
if (!activeTab)
|
|
5
|
-
return;
|
|
6
|
-
const nuclei = activeTab.split(',');
|
|
7
|
-
return nuclei.map((nucleus) => nucleus.replaceAll(/\d/g, ''));
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Returns the OCL id(s) and number of atoms of an atom when hovering over
|
|
11
|
-
* or clicking on it. This is depending on an optional given axis.
|
|
12
|
-
* In case of an heavy atom with bonded hydrogens the OCL id(s)
|
|
13
|
-
* and number of these hydrogens are added as well.
|
|
14
|
-
*
|
|
15
|
-
* @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
|
|
16
|
-
* @param {string} activeTab - active tab
|
|
17
|
-
* @param {Axis} axis - current axis
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
export function extractFromAtom(diaIDAndInfo, activeTab, axis) {
|
|
21
|
-
const elements = getElements(activeTab);
|
|
22
|
-
if (elements && elements.length > 0 && diaIDAndInfo) {
|
|
23
|
-
const dim = axis === 'x' ? 0 : axis === 'y' ? 1 : null;
|
|
24
|
-
switch (dim !== null && elements[dim]) {
|
|
25
|
-
case diaIDAndInfo.atomLabel: {
|
|
26
|
-
// take always oclID if atom type is same as element of activeTab)
|
|
27
|
-
return {
|
|
28
|
-
oclIDs: [diaIDAndInfo.idCode],
|
|
29
|
-
nbAtoms: diaIDAndInfo.nbEquivalentAtoms,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
case 'H': {
|
|
33
|
-
// if we are in proton spectrum and use then the IDs of attached hydrogens of an atom
|
|
34
|
-
return {
|
|
35
|
-
oclIDs: diaIDAndInfo.attachedHydrogensIDCodes,
|
|
36
|
-
nbAtoms: diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
default:
|
|
40
|
-
return {
|
|
41
|
-
oclIDs: [diaIDAndInfo.idCode].concat(diaIDAndInfo.attachedHydrogensIDCodes),
|
|
42
|
-
nbAtoms: diaIDAndInfo.nbEquivalentAtoms +
|
|
43
|
-
diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return { oclIDs: [], nbAtoms: 0 };
|
|
48
|
-
}
|
|
49
|
-
function getRangesOrZones(spectrum) {
|
|
50
|
-
if (isSpectrum1D(spectrum)) {
|
|
51
|
-
return spectrum.ranges.values;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return spectrum.zones.values;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function getAssignIds(spectrum, id) {
|
|
58
|
-
if (!spectrum)
|
|
59
|
-
return null;
|
|
60
|
-
const data = getRangesOrZones(spectrum);
|
|
61
|
-
const target = isSpectrum1D(spectrum) ? 'range' : 'zone';
|
|
62
|
-
for (let i = 0; i < data.length; i++) {
|
|
63
|
-
const datum = data[i];
|
|
64
|
-
if (datum.id === id) {
|
|
65
|
-
return [{ target, index: i, key: datum.id }];
|
|
66
|
-
}
|
|
67
|
-
const signalIndex = datum.signals.findIndex((signal) => signal.id === id);
|
|
68
|
-
if (signalIndex !== -1) {
|
|
69
|
-
const { id } = datum.signals[signalIndex];
|
|
70
|
-
return [
|
|
71
|
-
{ target, index: i, key: datum.id },
|
|
72
|
-
{ target: 'signal', index: signalIndex, key: id },
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
export function getHighlightsOnHover(assignments, oclIDs, spectra) {
|
|
79
|
-
// set all IDs to highlight when hovering over an atom from AssignKey data
|
|
80
|
-
let highlights = [];
|
|
81
|
-
const assignmentsByKey = assignments.data;
|
|
82
|
-
for (const key in assignmentsByKey) {
|
|
83
|
-
const assignments = assignmentsByKey[key];
|
|
84
|
-
for (const axis of assignmentAxes) {
|
|
85
|
-
if (assignments[axis]?.some((oclKey) => oclIDs.includes(oclKey))) {
|
|
86
|
-
highlights = highlights.concat(assignments[axis]);
|
|
87
|
-
for (const spectrum of spectra) {
|
|
88
|
-
const assignIds = getAssignIds(spectrum, key);
|
|
89
|
-
if (!assignIds) {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
const ids = assignIds.map((item) => item.key);
|
|
93
|
-
highlights.push(...ids);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return highlights;
|
|
99
|
-
}
|
|
100
|
-
export function getCurrentDiaIDsToHighlight(assignmentData) {
|
|
101
|
-
const { highlighted, data } = assignmentData;
|
|
102
|
-
const assignment = highlighted ? data[highlighted.id] : null;
|
|
103
|
-
const axisHover = highlighted ? highlighted.axis : null;
|
|
104
|
-
if (axisHover && assignment?.[axisHover]) {
|
|
105
|
-
return assignment[axisHover];
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
return (assignment?.x || []).concat(assignment?.y || []);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/** */
|
|
112
|
-
export function getUniqueDiaIDs(diaIDs, atomInformation) {
|
|
113
|
-
// a previous version of the code prevented to assign many time the same atom
|
|
114
|
-
// see revision cc13abc18f77b6787b923e3c4edaef51750d9e90
|
|
115
|
-
const { nbAtoms, oclIDs } = atomInformation;
|
|
116
|
-
const diaIDSet = new Set(diaIDs);
|
|
117
|
-
let tempNbAtoms = nbAtoms;
|
|
118
|
-
for (const oclID of oclIDs) {
|
|
119
|
-
if (diaIDSet.has(oclID)) {
|
|
120
|
-
tempNbAtoms *= -1;
|
|
121
|
-
diaIDSet.delete(oclID);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
diaIDSet.add(oclID);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return { diaIDs: Array.from(diaIDSet), nbAtoms: tempNbAtoms };
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=Utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/Utilities.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,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ACD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAtomAssignment.d.ts","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/useAtomAssignment.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAqExC,MAAM,CAAC,OAAO,UAAU,iBAAiB;sCAyKE,YAAY,GAAG,SAAS;sCA/CjD,YAAY,GAAG,SAAS,SAC/B,UAAU;;;EA8EpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAtomAssignment.js","sourceRoot":"","sources":["../../../../src/component/panels/MoleculesPanel/useAtomAssignment.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,yBAAyB,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAGr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AE,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,OAAO,EAAE;aAC7D,CAAC,CAAC;YACH,kBAAkB,CAAC,OAAO,GAAG,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO;QACL,iBAAiB;QACjB,iBAAiB;QACjB,wBAAwB;QACxB,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import type { Range, Zone } from '@zakodium/nmr-types';
|
|
2
|
-
import type { Spectrum } from '@zakodium/nmrium-core';
|
|
3
|
-
import type { DiaIDAndInfo } from 'openchemlib-utils';
|
|
4
|
-
|
|
5
|
-
import { isSpectrum1D } from '../../../data/data1d/Spectrum1D/isSpectrum1D.js';
|
|
6
|
-
import type {
|
|
7
|
-
AssignmentContext,
|
|
8
|
-
Axis,
|
|
9
|
-
} from '../../assignment/AssignmentsContext.js';
|
|
10
|
-
import { assignmentAxes } from '../../assignment/AssignmentsContext.js';
|
|
11
|
-
|
|
12
|
-
interface TargetAssignment {
|
|
13
|
-
key: string;
|
|
14
|
-
index: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface RangeTargetAssignKey extends TargetAssignment {
|
|
18
|
-
target: 'range';
|
|
19
|
-
}
|
|
20
|
-
interface ZoneTargetAssignKey extends TargetAssignment {
|
|
21
|
-
target: 'zone';
|
|
22
|
-
}
|
|
23
|
-
interface SignalTargetAssignKey extends TargetAssignment {
|
|
24
|
-
target: 'signal';
|
|
25
|
-
}
|
|
26
|
-
export type TargetAssignKeys =
|
|
27
|
-
| [RangeTargetAssignKey | ZoneTargetAssignKey]
|
|
28
|
-
| [RangeTargetAssignKey | ZoneTargetAssignKey, SignalTargetAssignKey];
|
|
29
|
-
|
|
30
|
-
export interface AtomData {
|
|
31
|
-
oclIDs: string[];
|
|
32
|
-
nbAtoms: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getElements(activeTab: string) {
|
|
36
|
-
if (!activeTab) return;
|
|
37
|
-
|
|
38
|
-
const nuclei = activeTab.split(',');
|
|
39
|
-
return nuclei.map((nucleus) => nucleus.replaceAll(/\d/g, ''));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Returns the OCL id(s) and number of atoms of an atom when hovering over
|
|
44
|
-
* or clicking on it. This is depending on an optional given axis.
|
|
45
|
-
* In case of an heavy atom with bonded hydrogens the OCL id(s)
|
|
46
|
-
* and number of these hydrogens are added as well.
|
|
47
|
-
*
|
|
48
|
-
* @param {DiaIDAndInfo} diaIDAndInfo - atom returned by OCLnmr component
|
|
49
|
-
* @param {string} activeTab - active tab
|
|
50
|
-
* @param {Axis} axis - current axis
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
export function extractFromAtom(
|
|
54
|
-
diaIDAndInfo: DiaIDAndInfo | undefined,
|
|
55
|
-
activeTab: string,
|
|
56
|
-
axis?: Axis | null,
|
|
57
|
-
): AtomData {
|
|
58
|
-
const elements = getElements(activeTab);
|
|
59
|
-
|
|
60
|
-
if (elements && elements.length > 0 && diaIDAndInfo) {
|
|
61
|
-
const dim = axis === 'x' ? 0 : axis === 'y' ? 1 : null;
|
|
62
|
-
switch (dim !== null && elements[dim]) {
|
|
63
|
-
case diaIDAndInfo.atomLabel: {
|
|
64
|
-
// take always oclID if atom type is same as element of activeTab)
|
|
65
|
-
return {
|
|
66
|
-
oclIDs: [diaIDAndInfo.idCode],
|
|
67
|
-
nbAtoms: diaIDAndInfo.nbEquivalentAtoms,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
case 'H': {
|
|
71
|
-
// if we are in proton spectrum and use then the IDs of attached hydrogens of an atom
|
|
72
|
-
return {
|
|
73
|
-
oclIDs: diaIDAndInfo.attachedHydrogensIDCodes,
|
|
74
|
-
nbAtoms:
|
|
75
|
-
diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
default:
|
|
79
|
-
return {
|
|
80
|
-
oclIDs: [diaIDAndInfo.idCode].concat(
|
|
81
|
-
diaIDAndInfo.attachedHydrogensIDCodes,
|
|
82
|
-
),
|
|
83
|
-
nbAtoms:
|
|
84
|
-
diaIDAndInfo.nbEquivalentAtoms +
|
|
85
|
-
diaIDAndInfo.nbEquivalentAtoms * diaIDAndInfo.nbAttachedHydrogens,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return { oclIDs: [], nbAtoms: 0 };
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function getRangesOrZones(spectrum: Spectrum): Array<Range | Zone> {
|
|
94
|
-
if (isSpectrum1D(spectrum)) {
|
|
95
|
-
return spectrum.ranges.values;
|
|
96
|
-
} else {
|
|
97
|
-
return spectrum.zones.values;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export function getAssignIds(
|
|
102
|
-
spectrum: Spectrum,
|
|
103
|
-
id: string,
|
|
104
|
-
): TargetAssignKeys | null {
|
|
105
|
-
if (!spectrum) return null;
|
|
106
|
-
|
|
107
|
-
const data = getRangesOrZones(spectrum);
|
|
108
|
-
const target = isSpectrum1D(spectrum) ? 'range' : 'zone';
|
|
109
|
-
|
|
110
|
-
for (let i = 0; i < data.length; i++) {
|
|
111
|
-
const datum = data[i];
|
|
112
|
-
|
|
113
|
-
if (datum.id === id) {
|
|
114
|
-
return [{ target, index: i, key: datum.id }];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const signalIndex = datum.signals.findIndex((signal) => signal.id === id);
|
|
118
|
-
if (signalIndex !== -1) {
|
|
119
|
-
const { id } = datum.signals[signalIndex];
|
|
120
|
-
return [
|
|
121
|
-
{ target, index: i, key: datum.id },
|
|
122
|
-
{ target: 'signal', index: signalIndex, key: id },
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function getHighlightsOnHover(
|
|
131
|
-
assignments: AssignmentContext,
|
|
132
|
-
oclIDs: string[],
|
|
133
|
-
spectra: Spectrum[],
|
|
134
|
-
) {
|
|
135
|
-
// set all IDs to highlight when hovering over an atom from AssignKey data
|
|
136
|
-
let highlights: string[] = [];
|
|
137
|
-
const assignmentsByKey = assignments.data;
|
|
138
|
-
|
|
139
|
-
for (const key in assignmentsByKey) {
|
|
140
|
-
const assignments = assignmentsByKey[key];
|
|
141
|
-
for (const axis of assignmentAxes) {
|
|
142
|
-
if (assignments[axis]?.some((oclKey: any) => oclIDs.includes(oclKey))) {
|
|
143
|
-
highlights = highlights.concat(assignments[axis]);
|
|
144
|
-
for (const spectrum of spectra) {
|
|
145
|
-
const assignIds = getAssignIds(spectrum, key);
|
|
146
|
-
if (!assignIds) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const ids = assignIds.map<string>((item) => item.key);
|
|
151
|
-
highlights.push(...ids);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return highlights;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export function getCurrentDiaIDsToHighlight(assignmentData: AssignmentContext) {
|
|
161
|
-
const { highlighted, data } = assignmentData;
|
|
162
|
-
const assignment = highlighted ? data[highlighted.id] : null;
|
|
163
|
-
const axisHover = highlighted ? highlighted.axis : null;
|
|
164
|
-
if (axisHover && assignment?.[axisHover]) {
|
|
165
|
-
return assignment[axisHover];
|
|
166
|
-
} else {
|
|
167
|
-
return (assignment?.x || []).concat(assignment?.y || []);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/** */
|
|
171
|
-
export function getUniqueDiaIDs(diaIDs: string[], atomInformation: AtomData) {
|
|
172
|
-
// a previous version of the code prevented to assign many time the same atom
|
|
173
|
-
// see revision cc13abc18f77b6787b923e3c4edaef51750d9e90
|
|
174
|
-
const { nbAtoms, oclIDs } = atomInformation;
|
|
175
|
-
|
|
176
|
-
const diaIDSet = new Set(diaIDs);
|
|
177
|
-
let tempNbAtoms: number = nbAtoms;
|
|
178
|
-
|
|
179
|
-
for (const oclID of oclIDs) {
|
|
180
|
-
if (diaIDSet.has(oclID)) {
|
|
181
|
-
tempNbAtoms *= -1;
|
|
182
|
-
diaIDSet.delete(oclID);
|
|
183
|
-
} else {
|
|
184
|
-
diaIDSet.add(oclID);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return { diaIDs: Array.from(diaIDSet), nbAtoms: tempNbAtoms };
|
|
188
|
-
}
|