nmrium 1.2.0 → 1.3.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/FloatPublicationString.js +1 -1
- package/lib/component/1d/FloatPublicationString.js.map +1 -1
- package/lib/component/1d/FloatingRanges.js +1 -1
- package/lib/component/1d/FloatingRanges.js.map +1 -1
- package/lib/component/1d/inset/DraggableInset.js +1 -1
- package/lib/component/1d/inset/DraggableInset.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +23 -6
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
- package/lib/component/main/NMRiumViewer.d.ts.map +1 -1
- package/lib/component/main/NMRiumViewer.js +13 -2
- package/lib/component/main/NMRiumViewer.js.map +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js +5 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +1 -0
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.js +1 -1
- package/lib/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +21 -2
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +17 -12
- package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.js +7 -6
- package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +2 -2
- package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
- package/lib/component/toolbar/ToolBar.js +7 -7
- 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/renderCoreSlot.d.ts +8 -1
- package/lib/component/utility/renderCoreSlot.d.ts.map +1 -1
- package/lib/component/utility/renderCoreSlot.js +10 -2
- package/lib/component/utility/renderCoreSlot.js.map +1 -1
- package/lib/data/SpectraManager.js +1 -1
- package/lib/data/SpectraManager.js.map +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
- package/lib/data/molecules/MoleculeManager.js +5 -0
- package/lib/data/molecules/MoleculeManager.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +6 -6
- package/src/component/1d/FloatPublicationString.tsx +1 -1
- package/src/component/1d/FloatingRanges.tsx +1 -1
- package/src/component/1d/inset/DraggableInset.tsx +1 -1
- package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +36 -15
- package/src/component/main/NMRiumViewer.tsx +16 -2
- package/src/component/modal/aboutUs/AboutUsModal.tsx +59 -41
- package/src/component/panels/MoleculesPanel/MoleculePanel.tsx +1 -0
- package/src/component/panels/MoleculesPanel/useAtomAssignment.tsx +1 -0
- package/src/component/panels/filtersPanel/Filters/ExclusionZonesOptionsPanel.tsx +1 -0
- package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +25 -2
- package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
- package/src/component/reducer/actions/FiltersActions.ts +38 -13
- package/src/component/reducer/actions/SpectraActions.ts +7 -6
- package/src/component/reducer/actions/ToolsActions.ts +5 -4
- package/src/component/toolbar/ToolBar.tsx +7 -7
- package/src/component/toolbar/ToolTypes.ts +2 -1
- package/src/component/utility/renderCoreSlot.tsx +12 -2
- package/src/data/SpectraManager.ts +1 -1
- package/src/data/molecules/MoleculeManager.ts +8 -0
- package/src/versionInfo.ts +1 -1
|
@@ -3,6 +3,8 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import { ResponsiveChart } from 'react-d3-utils';
|
|
4
4
|
import { BsArrowsMove } from 'react-icons/bs';
|
|
5
5
|
import { FaTimes } from 'react-icons/fa';
|
|
6
|
+
import type { MolfileSvgRendererProps } from 'react-ocl';
|
|
7
|
+
import { MolfileSvgRenderer } from 'react-ocl';
|
|
6
8
|
import OCLnmr from 'react-ocl-nmr';
|
|
7
9
|
import { Rnd } from 'react-rnd';
|
|
8
10
|
|
|
@@ -24,6 +26,7 @@ import useAtomAssignment from '../../../panels/MoleculesPanel/useAtomAssignment.
|
|
|
24
26
|
interface DraggableMoleculeProps extends DraggableStructureProps {
|
|
25
27
|
width: number;
|
|
26
28
|
height: number;
|
|
29
|
+
renderAsSVG?: boolean;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
interface DraggableStructureProps {
|
|
@@ -49,6 +52,7 @@ const ReactRnd = styled(Rnd)`
|
|
|
49
52
|
export function DraggableStructure(props: DraggableStructureProps) {
|
|
50
53
|
const { molecule, moleculeView } = props;
|
|
51
54
|
const { viewerRef } = useGlobal();
|
|
55
|
+
|
|
52
56
|
const isExportProcessStart = useCheckExportStatus();
|
|
53
57
|
const dispatch = useDispatch();
|
|
54
58
|
const { modal, openMoleculeEditor } = useMoleculeEditor();
|
|
@@ -78,6 +82,7 @@ export function DraggableStructure(props: DraggableStructureProps) {
|
|
|
78
82
|
bounding.width += width;
|
|
79
83
|
bounding.height += height;
|
|
80
84
|
}
|
|
85
|
+
|
|
81
86
|
dispatch({
|
|
82
87
|
type: 'CHANGE_FLOAT_MOLECULE_POSITION',
|
|
83
88
|
payload: { id: molecule.id, bounding: bounding as MoleculeBoundingRect },
|
|
@@ -124,7 +129,7 @@ export function DraggableStructure(props: DraggableStructureProps) {
|
|
|
124
129
|
if (isExportProcessStart) {
|
|
125
130
|
return (
|
|
126
131
|
<g transform={`translate(${x} ${y})`}>
|
|
127
|
-
<DraggableMolecule {...{ width, height }} {...props} />
|
|
132
|
+
<DraggableMolecule renderAsSVG {...{ width, height }} {...props} />
|
|
128
133
|
</g>
|
|
129
134
|
);
|
|
130
135
|
}
|
|
@@ -137,7 +142,7 @@ export function DraggableStructure(props: DraggableStructureProps) {
|
|
|
137
142
|
minHeight={100}
|
|
138
143
|
dragHandleClassName="handle"
|
|
139
144
|
enableUserSelectHack={false}
|
|
140
|
-
bounds={viewerRef}
|
|
145
|
+
bounds={`#${viewerRef.id}`}
|
|
141
146
|
style={{ zIndex: 1 }}
|
|
142
147
|
className="draggable-molecule"
|
|
143
148
|
onDragStart={() => setIsMoveActive(true)}
|
|
@@ -186,7 +191,14 @@ export function DraggableStructure(props: DraggableStructureProps) {
|
|
|
186
191
|
}
|
|
187
192
|
|
|
188
193
|
function DraggableMolecule(props: DraggableMoleculeProps) {
|
|
189
|
-
const {
|
|
194
|
+
const {
|
|
195
|
+
molecule,
|
|
196
|
+
index,
|
|
197
|
+
moleculeView,
|
|
198
|
+
width,
|
|
199
|
+
height,
|
|
200
|
+
renderAsSVG = false,
|
|
201
|
+
} = props;
|
|
190
202
|
const {
|
|
191
203
|
currentDiaIDsToHighlight,
|
|
192
204
|
handleOnAtomHover,
|
|
@@ -196,25 +208,35 @@ function DraggableMolecule(props: DraggableMoleculeProps) {
|
|
|
196
208
|
const highlightColor = useHighlightColor();
|
|
197
209
|
const dispatch = useDispatch();
|
|
198
210
|
|
|
211
|
+
const atomHighlightColor =
|
|
212
|
+
currentDiaIDsToHighlight?.length > 0 ? '#ff000080' : highlightColor;
|
|
213
|
+
const baseProps: MolfileSvgRendererProps = {
|
|
214
|
+
id: `molSVG${index || ''}`,
|
|
215
|
+
height,
|
|
216
|
+
width,
|
|
217
|
+
label: molecule.label,
|
|
218
|
+
labelFontSize: 15,
|
|
219
|
+
labelColor: 'rgb(0,0,0)',
|
|
220
|
+
molfile: molecule.molfile,
|
|
221
|
+
atomHighlightColor,
|
|
222
|
+
atomHighlightOpacity: 1,
|
|
223
|
+
showAtomNumber: moleculeView.showAtomNumber,
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
if (renderAsSVG) {
|
|
227
|
+
return <MolfileSvgRenderer {...baseProps} />;
|
|
228
|
+
}
|
|
229
|
+
|
|
199
230
|
return (
|
|
200
231
|
<OCLnmr
|
|
201
|
-
|
|
202
|
-
height={height}
|
|
203
|
-
width={width}
|
|
204
|
-
label={molecule.label}
|
|
205
|
-
labelFontSize={15}
|
|
206
|
-
labelColor="rgb(0,0,0)"
|
|
207
|
-
molfile={molecule.molfile}
|
|
232
|
+
{...baseProps}
|
|
208
233
|
setSelectedAtom={handleOnClickAtom}
|
|
209
|
-
atomHighlightColor={
|
|
210
|
-
currentDiaIDsToHighlight?.length > 0 ? '#ff000080' : highlightColor
|
|
211
|
-
}
|
|
212
|
-
atomHighlightOpacity={1}
|
|
213
234
|
highlights={
|
|
214
235
|
currentDiaIDsToHighlight?.length > 0
|
|
215
236
|
? currentDiaIDsToHighlight
|
|
216
237
|
: assignedDiaIDsMerged
|
|
217
238
|
}
|
|
239
|
+
atomHighlightStrategy="prefer-editor-props"
|
|
218
240
|
setHoverAtom={handleOnAtomHover}
|
|
219
241
|
setMolfile={(molfile) => {
|
|
220
242
|
dispatch({
|
|
@@ -226,7 +248,6 @@ function DraggableMolecule(props: DraggableMoleculeProps) {
|
|
|
226
248
|
},
|
|
227
249
|
});
|
|
228
250
|
}}
|
|
229
|
-
showAtomNumber={moleculeView.showAtomNumber}
|
|
230
251
|
/>
|
|
231
252
|
);
|
|
232
253
|
}
|
|
@@ -10,6 +10,7 @@ import { SVGRootContainer } from '../1d-2d/components/SVGRootContainer.js';
|
|
|
10
10
|
import Viewer2D from '../2d/Viewer2D.js';
|
|
11
11
|
import { useChartData } from '../context/ChartContext.js';
|
|
12
12
|
import { useExportSettings } from '../elements/export/index.js';
|
|
13
|
+
import { usePrintPage } from '../elements/print/PrintProvider.tsx';
|
|
13
14
|
import {
|
|
14
15
|
useCheckExportStatus,
|
|
15
16
|
useViewportSize,
|
|
@@ -33,13 +34,26 @@ export function NMRiumViewer(props: NMRiumViewerProps) {
|
|
|
33
34
|
const viewPort = useViewportSize();
|
|
34
35
|
const { displayerMode } = useChartData();
|
|
35
36
|
const exportSettings = useExportSettings();
|
|
37
|
+
const printSettings = usePrintPage();
|
|
36
38
|
|
|
37
39
|
useOnRender(onRender);
|
|
38
40
|
|
|
39
41
|
const isExportingProcessStart = useCheckExportStatus();
|
|
40
42
|
|
|
41
|
-
if (isExportingProcessStart && exportSettings) {
|
|
42
|
-
|
|
43
|
+
if (isExportingProcessStart && (exportSettings || printSettings)) {
|
|
44
|
+
if (!exportSettings && !printSettings) {
|
|
45
|
+
return <text>Print/export settings are missing.</text>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { width, height } = exportSettings || printSettings || {};
|
|
49
|
+
let exportHeight = height;
|
|
50
|
+
let exportWidth = width;
|
|
51
|
+
|
|
52
|
+
if (exportSettings) {
|
|
53
|
+
exportHeight = exportSettings.exportHeight;
|
|
54
|
+
exportWidth = exportSettings.exportWidth;
|
|
55
|
+
}
|
|
56
|
+
|
|
43
57
|
return (
|
|
44
58
|
<SVGRootContainer
|
|
45
59
|
enableBoxBorder={displayerMode === '2D'}
|
|
@@ -4,8 +4,10 @@ import { SvgLogoNmrium } from 'cheminfo-font';
|
|
|
4
4
|
import { Toolbar, useOnOff } from 'react-science/ui';
|
|
5
5
|
|
|
6
6
|
import versionInfo from '../../../versionInfo.js';
|
|
7
|
+
import { useCore } from '../../context/CoreContext.js';
|
|
7
8
|
import Logo from '../../elements/Logo.js';
|
|
8
9
|
import { StyledDialogBody } from '../../elements/StyledDialogBody.js';
|
|
10
|
+
import { renderCoreSlot } from '../../utility/renderCoreSlot.js';
|
|
9
11
|
|
|
10
12
|
import AboutUsZakodium from './AboutUsZakodium.js';
|
|
11
13
|
|
|
@@ -69,8 +71,60 @@ const Separator = styled.span`
|
|
|
69
71
|
width: 15px;
|
|
70
72
|
`;
|
|
71
73
|
|
|
74
|
+
const modalContentFallback = (
|
|
75
|
+
<>
|
|
76
|
+
<InfoBlock>
|
|
77
|
+
<Logo width={160} height={50} />
|
|
78
|
+
Version <VersionInfo />
|
|
79
|
+
<Separator />
|
|
80
|
+
<a
|
|
81
|
+
href="https://github.com/cheminfo/nmrium"
|
|
82
|
+
target="_blank"
|
|
83
|
+
rel="noreferrer"
|
|
84
|
+
>
|
|
85
|
+
GitHub ( https://github.com/cheminfo/nmrium )
|
|
86
|
+
</a>
|
|
87
|
+
</InfoBlock>
|
|
88
|
+
<InfoBlock>
|
|
89
|
+
<Separator />
|
|
90
|
+
</InfoBlock>
|
|
91
|
+
<span className="content">
|
|
92
|
+
This project is developed by Zakodium Sàrl (Switzerland), the University
|
|
93
|
+
of Cologne (Germany), Johannes Gutenberg University Mainz (Germany) and
|
|
94
|
+
Universidad del Valle (Colombia).
|
|
95
|
+
</span>
|
|
96
|
+
<InfoBlock>
|
|
97
|
+
<Separator />
|
|
98
|
+
<span className="title">Funding is provided by</span>
|
|
99
|
+
<Separator />
|
|
100
|
+
</InfoBlock>
|
|
101
|
+
<div className="content">
|
|
102
|
+
<ul>
|
|
103
|
+
<li>
|
|
104
|
+
IDNMR grant, which part of the Scientific Library Services and
|
|
105
|
+
Information Systems (LIS) initiative of the DFG.
|
|
106
|
+
</li>
|
|
107
|
+
<li>
|
|
108
|
+
<AboutUsZakodium />
|
|
109
|
+
</li>
|
|
110
|
+
<li>Universidad del Valle (Cali, Colombia).</li>
|
|
111
|
+
<li>
|
|
112
|
+
This project has received funding from the European Union’s Horizon
|
|
113
|
+
2020 research and innovation programme under grant agreement No
|
|
114
|
+
957189. The project is part of BATTERY 2030+, the large-scale European
|
|
115
|
+
research initiative for inventing the sustainable batteries of the
|
|
116
|
+
future.
|
|
117
|
+
</li>
|
|
118
|
+
</ul>
|
|
119
|
+
</div>
|
|
120
|
+
<Separator />
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
|
|
72
124
|
function AboutUsModal() {
|
|
73
125
|
const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
|
|
126
|
+
const core = useCore();
|
|
127
|
+
|
|
74
128
|
return (
|
|
75
129
|
<>
|
|
76
130
|
<Toolbar.Item
|
|
@@ -91,47 +145,11 @@ function AboutUsModal() {
|
|
|
91
145
|
>
|
|
92
146
|
<CustomDialogBody>
|
|
93
147
|
<Container>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
GitHub ( https://git.nmrium.org )
|
|
100
|
-
</a>
|
|
101
|
-
</InfoBlock>
|
|
102
|
-
<InfoBlock>
|
|
103
|
-
<Separator />
|
|
104
|
-
</InfoBlock>
|
|
105
|
-
<span className="content">
|
|
106
|
-
This project is developed by Zakodium Sàrl (Switzerland), the
|
|
107
|
-
University of Cologne (Germany), Johannes Gutenberg University
|
|
108
|
-
Mainz (Germany) and Universidad del Valle (Colombia).
|
|
109
|
-
</span>
|
|
110
|
-
<InfoBlock>
|
|
111
|
-
<Separator />
|
|
112
|
-
<span className="title">Funding is provided by</span>
|
|
113
|
-
<Separator />
|
|
114
|
-
</InfoBlock>
|
|
115
|
-
<div className="content">
|
|
116
|
-
<ul>
|
|
117
|
-
<li>
|
|
118
|
-
IDNMR grant, which part of the Scientific Library Services and
|
|
119
|
-
Information Systems (LIS) initiative of the DFG.
|
|
120
|
-
</li>
|
|
121
|
-
<li>
|
|
122
|
-
<AboutUsZakodium />
|
|
123
|
-
</li>
|
|
124
|
-
<li>Universidad del Valle (Cali, Colombia).</li>
|
|
125
|
-
<li>
|
|
126
|
-
This project has received funding from the European Union’s
|
|
127
|
-
Horizon 2020 research and innovation programme under grant
|
|
128
|
-
agreement No 957189. The project is part of BATTERY 2030+, the
|
|
129
|
-
large-scale European research initiative for inventing the
|
|
130
|
-
sustainable batteries of the future.
|
|
131
|
-
</li>
|
|
132
|
-
</ul>
|
|
133
|
-
</div>
|
|
134
|
-
<Separator />
|
|
148
|
+
{renderCoreSlot(
|
|
149
|
+
core,
|
|
150
|
+
'topbar.about_us.modal',
|
|
151
|
+
modalContentFallback,
|
|
152
|
+
)}
|
|
135
153
|
</Container>
|
|
136
154
|
</CustomDialogBody>
|
|
137
155
|
</Dialog>
|
|
@@ -157,6 +157,7 @@ function MoleculePanelInner(props: MoleculePanelInnerProps) {
|
|
|
157
157
|
? currentDiaIDsToHighlight
|
|
158
158
|
: assignedDiaIDsMerged
|
|
159
159
|
}
|
|
160
|
+
atomHighlightStrategy="prefer-editor-props"
|
|
160
161
|
setHoverAtom={handleOnAtomHover}
|
|
161
162
|
showAtomNumber={
|
|
162
163
|
moleculesView?.[mol.id]?.showAtomNumber || false
|
|
@@ -185,6 +185,7 @@ export default function useAtomAssignment() {
|
|
|
185
185
|
) {
|
|
186
186
|
if (checkModifierKeyActivated(event) || !activatedAssignment) return;
|
|
187
187
|
|
|
188
|
+
event.preventDefault(); // prevent floating form custom label edit
|
|
188
189
|
const { axis, id } = activatedAssignment;
|
|
189
190
|
|
|
190
191
|
if (!id || !axis) {
|
|
@@ -27,6 +27,15 @@ export const nonRemovableFilters = new Set<BaseFilterEntry['name']>([
|
|
|
27
27
|
'digitalFilter',
|
|
28
28
|
'digitalFilter2D',
|
|
29
29
|
]);
|
|
30
|
+
const readOnlyFilters = new Set<BaseFilterEntry['name']>([
|
|
31
|
+
'digitalFilter',
|
|
32
|
+
'shiftX',
|
|
33
|
+
'exclusionZones',
|
|
34
|
+
'fft',
|
|
35
|
+
'digitalFilter2D',
|
|
36
|
+
'fftDimension1',
|
|
37
|
+
'fftDimension2',
|
|
38
|
+
]);
|
|
30
39
|
|
|
31
40
|
const IconButton = styled(Button)`
|
|
32
41
|
font-size: 16px;
|
|
@@ -121,9 +130,14 @@ function FilterElements(props: FilterElementsProps) {
|
|
|
121
130
|
});
|
|
122
131
|
}
|
|
123
132
|
|
|
133
|
+
const isEditable =
|
|
134
|
+
!hideFilterRestoreButton &&
|
|
135
|
+
activeFilterID !== id &&
|
|
136
|
+
!readOnlyFilters.has(name);
|
|
137
|
+
|
|
124
138
|
return (
|
|
125
139
|
<>
|
|
126
|
-
{
|
|
140
|
+
{isEditable && (
|
|
127
141
|
<IconButton
|
|
128
142
|
intent="success"
|
|
129
143
|
tooltipProps={{
|
|
@@ -244,11 +258,20 @@ function FiltersInner(props: FiltersInnerProps) {
|
|
|
244
258
|
return null;
|
|
245
259
|
});
|
|
246
260
|
}
|
|
261
|
+
}, [filters, selectedTool]);
|
|
247
262
|
|
|
263
|
+
useEffect(() => {
|
|
248
264
|
if (Filters?.[selectedTool]) {
|
|
249
265
|
openSection(selectedTool);
|
|
266
|
+
return;
|
|
250
267
|
}
|
|
251
|
-
|
|
268
|
+
|
|
269
|
+
const filter = filters.find((filter) => filter.id === activeFilterID);
|
|
270
|
+
|
|
271
|
+
if (filter) {
|
|
272
|
+
openSection(filter.name);
|
|
273
|
+
}
|
|
274
|
+
}, [activeFilterID, filters, selectedTool]);
|
|
252
275
|
|
|
253
276
|
const filtersList = [...filters];
|
|
254
277
|
|
|
@@ -446,9 +446,13 @@ function rollbackSpectrumByFilter(
|
|
|
446
446
|
const filterIndex = spectrum.filters.findIndex((f) => f[searchBy] === key);
|
|
447
447
|
if (filterIndex === -1 || reset) {
|
|
448
448
|
if (draft.tempData) {
|
|
449
|
-
const activeFilterIndex =
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
const activeFilterIndex =
|
|
450
|
+
!reset && toolData.activeFilterID
|
|
451
|
+
? spectrum.filters.findIndex(
|
|
452
|
+
(f) => f.id === toolData.activeFilterID,
|
|
453
|
+
)
|
|
454
|
+
: spectrum.filters.length;
|
|
455
|
+
|
|
452
456
|
const filters = spectrum.filters.slice(0, activeFilterIndex);
|
|
453
457
|
reapplyFilters(spectrum, filters);
|
|
454
458
|
}
|
|
@@ -793,6 +797,8 @@ function handleShiftSpectrumAlongXAxis(
|
|
|
793
797
|
return;
|
|
794
798
|
}
|
|
795
799
|
|
|
800
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
801
|
+
|
|
796
802
|
//apply filter into the spectrum
|
|
797
803
|
const options = action.payload;
|
|
798
804
|
|
|
@@ -808,9 +814,14 @@ function handleShiftSpectrumAlongXAxis(
|
|
|
808
814
|
applyFilter: false,
|
|
809
815
|
});
|
|
810
816
|
|
|
811
|
-
Filters1DManager.applyFilters(
|
|
812
|
-
|
|
813
|
-
|
|
817
|
+
Filters1DManager.applyFilters(
|
|
818
|
+
draft.data[index] as Spectrum1D,
|
|
819
|
+
[{ name: 'shiftX', value: { shift } }],
|
|
820
|
+
{
|
|
821
|
+
filterIndex: activeFilterIndex,
|
|
822
|
+
forceReapply: activeFilterIndex !== -1,
|
|
823
|
+
},
|
|
824
|
+
);
|
|
814
825
|
|
|
815
826
|
updateView(draft, shiftX.domainUpdateRules);
|
|
816
827
|
}
|
|
@@ -824,9 +835,14 @@ function handleShiftSpectrumAlongXAxis(
|
|
|
824
835
|
searchBy: 'name',
|
|
825
836
|
applyFilter: false,
|
|
826
837
|
});
|
|
827
|
-
Filters2DManager.applyFilters(
|
|
828
|
-
|
|
829
|
-
|
|
838
|
+
Filters2DManager.applyFilters(
|
|
839
|
+
draft.data[index] as Spectrum2D,
|
|
840
|
+
[{ name: 'shift2DX', value: { shift: shiftX } }],
|
|
841
|
+
{
|
|
842
|
+
filterIndex: activeFilterIndex,
|
|
843
|
+
forceReapply: activeFilterIndex !== -1,
|
|
844
|
+
},
|
|
845
|
+
);
|
|
830
846
|
updateView(draft, shift2DX.domainUpdateRules);
|
|
831
847
|
}
|
|
832
848
|
|
|
@@ -836,9 +852,14 @@ function handleShiftSpectrumAlongXAxis(
|
|
|
836
852
|
searchBy: 'name',
|
|
837
853
|
applyFilter: false,
|
|
838
854
|
});
|
|
839
|
-
Filters2DManager.applyFilters(
|
|
840
|
-
|
|
841
|
-
|
|
855
|
+
Filters2DManager.applyFilters(
|
|
856
|
+
draft.data[index] as Spectrum2D,
|
|
857
|
+
[{ name: 'shift2DY', value: { shift: shiftY } }],
|
|
858
|
+
{
|
|
859
|
+
filterIndex: activeFilterIndex,
|
|
860
|
+
forceReapply: activeFilterIndex !== -1,
|
|
861
|
+
},
|
|
862
|
+
);
|
|
842
863
|
|
|
843
864
|
updateView(draft, shift2DY.domainUpdateRules);
|
|
844
865
|
}
|
|
@@ -1079,7 +1100,11 @@ function handleCalculateApodizationFilter(
|
|
|
1079
1100
|
if (!tempRollback) {
|
|
1080
1101
|
apodization.apply(spectrum, options);
|
|
1081
1102
|
} else {
|
|
1082
|
-
|
|
1103
|
+
const index = datum.filters.findIndex(
|
|
1104
|
+
(filter) => filter.name === 'apodization',
|
|
1105
|
+
);
|
|
1106
|
+
|
|
1107
|
+
for (const filter of datum.filters.slice(index)) {
|
|
1083
1108
|
const { name, value } = filter;
|
|
1084
1109
|
|
|
1085
1110
|
delete filter.error;
|
|
@@ -399,11 +399,11 @@ function handleChangeActiveSpectrum(
|
|
|
399
399
|
* not refresh the y domain if the next and previous selected spectra have Ft or we do not have previous or next active spectra
|
|
400
400
|
*/
|
|
401
401
|
const refreshDomain =
|
|
402
|
-
previousActiveSpectraHasFT === undefined ||
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
402
|
+
(previousActiveSpectraHasFT === undefined ||
|
|
403
|
+
previousActiveSpectraHasFT !== newActiveSpectraHasFT) &&
|
|
404
|
+
spectra &&
|
|
405
|
+
spectra?.length > 0 &&
|
|
406
|
+
spectraIds?.length > 0;
|
|
407
407
|
|
|
408
408
|
/**
|
|
409
409
|
* if the active spectrum not is FID then do not refresh the domain and the mode when the first time you activate spectrum
|
|
@@ -709,7 +709,7 @@ function handleSimulateSpectrum(
|
|
|
709
709
|
(s) => s.id === draft.view.currentSimulatedSpectrumKey,
|
|
710
710
|
);
|
|
711
711
|
}
|
|
712
|
-
const { frequency, to, from } = options;
|
|
712
|
+
const { frequency, to, from, nbPoints } = options;
|
|
713
713
|
|
|
714
714
|
const info = {
|
|
715
715
|
originFrequency: frequency,
|
|
@@ -731,6 +731,7 @@ function handleSimulateSpectrum(
|
|
|
731
731
|
info: {
|
|
732
732
|
isFt: true,
|
|
733
733
|
nucleus: '1H',
|
|
734
|
+
nbPoints,
|
|
734
735
|
...info,
|
|
735
736
|
},
|
|
736
737
|
},
|
|
@@ -148,10 +148,11 @@ function handleResetSelectedTool(draft: Draft<State>) {
|
|
|
148
148
|
resetSelectedTool(draft);
|
|
149
149
|
}
|
|
150
150
|
function resetSelectedTool(draft: Draft<State>) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
const {
|
|
152
|
+
selectedTool,
|
|
153
|
+
data: { activeFilterID },
|
|
154
|
+
} = draft.toolOptions;
|
|
155
|
+
if ((selectedTool && Tools[selectedTool].isFilter) || activeFilterID) {
|
|
155
156
|
resetTool(draft, { reset: true, toolId: draft.toolOptions.selectedTool });
|
|
156
157
|
}
|
|
157
158
|
}
|
|
@@ -249,7 +249,7 @@ export default function ToolBar() {
|
|
|
249
249
|
title: options.peakPicking.label,
|
|
250
250
|
shortcuts: ['p'],
|
|
251
251
|
description: 'Detect peaks manually or automatically in the spectrum.',
|
|
252
|
-
link: 'https://docs.nmrium.org/
|
|
252
|
+
link: 'https://docs.nmrium.org/help/peaks',
|
|
253
253
|
},
|
|
254
254
|
|
|
255
255
|
icon: <SvgNmrPeakPicking />,
|
|
@@ -290,7 +290,7 @@ export default function ToolBar() {
|
|
|
290
290
|
title: options.rangePicking.label,
|
|
291
291
|
shortcuts: ['r'],
|
|
292
292
|
description: `Define ranges and analyse multiplet automatically or manually. Click, drag, and release ${!invert ? 'while holding SHIFT' : ''} to draw the range. Ranges can be resized by moving the edges.`,
|
|
293
|
-
link: 'https://docs.nmrium.org/
|
|
293
|
+
link: 'https://docs.nmrium.org/help/ranges',
|
|
294
294
|
},
|
|
295
295
|
icon: <SvgNmrRangePicking />,
|
|
296
296
|
},
|
|
@@ -308,6 +308,7 @@ export default function ToolBar() {
|
|
|
308
308
|
shortcuts: ['a'],
|
|
309
309
|
description:
|
|
310
310
|
'Apply mathematical function that the FID is multiplied by before Fourier Transform.',
|
|
311
|
+
link: 'https://docs.nmrium.org/help/apodization',
|
|
311
312
|
},
|
|
312
313
|
icon: <SvgNmrApodization />,
|
|
313
314
|
},
|
|
@@ -332,7 +333,7 @@ export default function ToolBar() {
|
|
|
332
333
|
shortcuts: ['z'],
|
|
333
334
|
description:
|
|
334
335
|
'Improve spectrum quality by increasing the number of points. By default, the number of points is twice as many as in the original FID.',
|
|
335
|
-
link: 'https://docs.nmrium.org/
|
|
336
|
+
link: 'https://docs.nmrium.org/help/zero-filling',
|
|
336
337
|
},
|
|
337
338
|
icon: <SvgNmrZeroFilling />,
|
|
338
339
|
},
|
|
@@ -360,7 +361,7 @@ export default function ToolBar() {
|
|
|
360
361
|
title: options.phaseCorrection.label,
|
|
361
362
|
shortcuts: ['a'],
|
|
362
363
|
description: `Correct the spectrum phase manually or automatically. For manual phase correction, define the pivot${!invert ? ' using SHIFT +' : ''} click, then press the PH0 and PH1 button, and move the mouse horizontally.`,
|
|
363
|
-
link: 'https://docs.nmrium.org/
|
|
364
|
+
link: 'https://docs.nmrium.org/help/phase',
|
|
364
365
|
},
|
|
365
366
|
icon: <SvgNmrPhaseCorrection />,
|
|
366
367
|
},
|
|
@@ -380,7 +381,7 @@ export default function ToolBar() {
|
|
|
380
381
|
title: options.baselineCorrection.label,
|
|
381
382
|
shortcuts: ['b'],
|
|
382
383
|
description: `Correct the baseline of the spectrum. You should draw zones corresponding to the noise using click, drag, release${!invert ? 'while holding SHIFT' : ''}.`,
|
|
383
|
-
link: 'https://docs.nmrium.org/
|
|
384
|
+
link: 'https://docs.nmrium.org/help/baseline',
|
|
384
385
|
},
|
|
385
386
|
icon: <SvgNmrBaselineCorrection />,
|
|
386
387
|
},
|
|
@@ -401,7 +402,7 @@ export default function ToolBar() {
|
|
|
401
402
|
title: options.fft.label,
|
|
402
403
|
shortcuts: ['t'],
|
|
403
404
|
description: 'Perform a Fourier transform on the FID.',
|
|
404
|
-
link: 'https://docs.nmrium.org/
|
|
405
|
+
link: 'https://docs.nmrium.org/help/ft',
|
|
405
406
|
},
|
|
406
407
|
onClick: handleOnFFTFilter,
|
|
407
408
|
icon: <SvgNmrFourierTransform />,
|
|
@@ -455,7 +456,6 @@ export default function ToolBar() {
|
|
|
455
456
|
title: `Display ${isRealSpectrumShown ? 'real' : 'imaginary'}`,
|
|
456
457
|
description:
|
|
457
458
|
'Toggle between the imaginary and real parts of the spectrum.',
|
|
458
|
-
link: 'https://docs.nmrium.org/20_1d-spectra/views',
|
|
459
459
|
},
|
|
460
460
|
icon: <SvgNmrRealImag />,
|
|
461
461
|
onClick: changeSpectrumViewHandler,
|
|
@@ -382,7 +382,8 @@ export const options: RecordOptions = {
|
|
|
382
382
|
spectraOptions: [
|
|
383
383
|
{
|
|
384
384
|
info: [
|
|
385
|
-
{ key: '
|
|
385
|
+
{ key: 'isFtDimensionOne', value: true },
|
|
386
|
+
{ key: 'isFt', value: false },
|
|
386
387
|
{ key: 'isComplex', value: true },
|
|
387
388
|
],
|
|
388
389
|
active: true,
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import type { NMRiumCore, SupportedUISlot } from '@zakodium/nmrium-core';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Render all components registered in the given slot.
|
|
6
|
+
*
|
|
7
|
+
* @param core
|
|
8
|
+
* @param slot
|
|
9
|
+
* @param fallback - return fallback if no component is registered in the slot
|
|
10
|
+
*/
|
|
4
11
|
export function renderCoreSlot(
|
|
5
12
|
core: NMRiumCore,
|
|
6
13
|
slot: SupportedUISlot,
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
fallback?: ReactNode,
|
|
15
|
+
): ReactNode {
|
|
16
|
+
const jsx = Array.from(core.slot(slot), ([key, Component]) => (
|
|
9
17
|
<Component key={key} slot={slot} />
|
|
10
18
|
));
|
|
19
|
+
|
|
20
|
+
return jsx.length > 0 ? jsx : fallback;
|
|
11
21
|
}
|
|
@@ -214,5 +214,5 @@ export async function exportForCT(options: ExportForCTOptions) {
|
|
|
214
214
|
await zip.add(`${molFileName}.mol`, new TextReader(molecule.toMolfile()));
|
|
215
215
|
|
|
216
216
|
const blob = await zip.close();
|
|
217
|
-
fileSaver.saveAs(blob, name);
|
|
217
|
+
fileSaver.saveAs(blob, `${name}.zip`);
|
|
218
218
|
}
|
|
@@ -4,6 +4,7 @@ import { Molecule } from 'openchemlib';
|
|
|
4
4
|
import type { StateMolecule, StateMoleculeExtended } from './Molecule.js';
|
|
5
5
|
import { initMolecule } from './Molecule.js';
|
|
6
6
|
|
|
7
|
+
//TODO: Move molecule initialization to nmrium-core and log an error if the molecule cannot be parsed.
|
|
7
8
|
export function fromJSON(
|
|
8
9
|
mols: StateMolecule[],
|
|
9
10
|
reservedMolecules: StateMolecule[] = [],
|
|
@@ -13,6 +14,13 @@ export function fromJSON(
|
|
|
13
14
|
const molecules: StateMoleculeExtended[] = [];
|
|
14
15
|
for (const mol of mols) {
|
|
15
16
|
const molecule = Molecule.fromMolfile(mol.molfile);
|
|
17
|
+
|
|
18
|
+
const atomCount = molecule.getAllAtoms();
|
|
19
|
+
|
|
20
|
+
if (atomCount === 0) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
molecules.push(
|
|
17
25
|
initMolecule({
|
|
18
26
|
molfile: molecule.toMolfileV3(),
|
package/src/versionInfo.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v1.
|
|
1
|
+
export default { version: 'v1.3.0' };
|