nmrium 0.55.0 → 0.56.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/Chart1D.js +3 -1
- package/lib/component/1d/Viewer1D.js +36 -11
- package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
- package/lib/component/1d/matrix/Boxplot.js +97 -0
- package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
- package/lib/component/1d/matrix/Stocsy.js +101 -0
- package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
- package/lib/component/1d/matrix/useMatrix.js +93 -0
- package/lib/component/1d/utilities/scale.d.ts +2 -1
- package/lib/component/1d/utilities/scale.js +6 -1
- package/lib/component/context/PrepareExportContext.d.ts +21 -0
- package/lib/component/context/PrepareExportContext.js +124 -0
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useExport.js +4 -4
- package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
- package/lib/component/hooks/usePanelPreferences.js +3 -1
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
- package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
- package/lib/component/panels/databasePanel/DatabaseTable.js +2 -2
- package/lib/component/reducer/Reducer.d.ts +6 -0
- package/lib/component/reducer/actions/DomainActions.d.ts +5 -2
- package/lib/component/reducer/actions/DomainActions.js +6 -4
- package/lib/component/reducer/actions/FiltersActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +5 -2
- package/lib/component/reducer/actions/SpectraActions.d.ts +1 -0
- package/lib/component/reducer/actions/SpectraActions.js +7 -2
- package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +62 -25
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +5 -2
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +17 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -25
- package/lib/component/reducer/preferences/preferencesReducer.js +7 -1
- package/lib/component/toolbar/ToolBar.js +6 -7
- package/lib/component/utility/PathBuilder.d.ts +1 -0
- package/lib/component/utility/PathBuilder.js +8 -1
- package/lib/data/types/common/DeepPartial.d.ts +3 -0
- package/lib/data/types/common/DeepPartial.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +23 -23
- package/lib/component/elements/CustomToolTip.d.ts +0 -8
- package/lib/component/elements/CustomToolTip.js +0 -107
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import {
|
|
2
|
+
import { MatrixGenerationOptions } from 'nmr-load-save';
|
|
3
|
+
import { MatrixOptions } from '../../../../data/types/data1d/MatrixOptions';
|
|
4
|
+
import { ZoomOptions } from '../../../EventsTrackers/BrushTracker';
|
|
5
|
+
import { FilterType } from '../../../utility/filterType';
|
|
6
|
+
import { ActionType } from '../../types/ActionType';
|
|
7
|
+
import { PreferencesState } from '../preferencesReducer';
|
|
8
|
+
type setMatrixGenerationOptionsAction = ActionType<'SET_MATRIX_GENERATION_OPTIONS', {
|
|
9
|
+
nucleus: string;
|
|
10
|
+
options: MatrixOptions;
|
|
11
|
+
}>;
|
|
12
|
+
type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
13
|
+
zone: {
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
};
|
|
17
|
+
range: {
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
};
|
|
21
|
+
nucleus: string;
|
|
22
|
+
}>;
|
|
23
|
+
type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
24
|
+
zone: {
|
|
25
|
+
id: string;
|
|
26
|
+
from: number;
|
|
27
|
+
to: number;
|
|
28
|
+
};
|
|
29
|
+
nucleus: string;
|
|
30
|
+
}>;
|
|
31
|
+
type ToggleMatrixGenerationViewAction = ActionType<'TOGGLE_MATRIX_GENERATION_VIEW_PROPERTY', {
|
|
32
|
+
key: keyof FilterType<MatrixGenerationOptions, boolean>;
|
|
33
|
+
nucleus: string;
|
|
34
|
+
}>;
|
|
35
|
+
type ChangeMatrixGenerationScaleAction = ActionType<'CHANGE_MATRIX_GENERATION_SCALE', {
|
|
36
|
+
zoomOptions: ZoomOptions;
|
|
37
|
+
nucleus: string;
|
|
38
|
+
}>;
|
|
39
|
+
type ChangeMatrixGenerationStocsyChemicalShiftAction = ActionType<'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT', {
|
|
40
|
+
nucleus: string;
|
|
41
|
+
chemicalShift: number;
|
|
42
|
+
}>;
|
|
43
|
+
export type MatrixGenerationActions = ToggleMatrixGenerationViewAction | deleteMatrixGenerationExclusionZoneAction | addMatrixGenerationExclusionZoneAction | setMatrixGenerationOptionsAction | ChangeMatrixGenerationScaleAction | ChangeMatrixGenerationStocsyChemicalShiftAction;
|
|
3
44
|
declare function addExclusionZone(draft: Draft<PreferencesState>, action: addMatrixGenerationExclusionZoneAction): void;
|
|
4
45
|
declare function deleteExclusionZone(draft: Draft<PreferencesState>, action: any): void;
|
|
5
46
|
declare function setMatrixGenerationOptions(draft: Draft<PreferencesState>, action: any): void;
|
|
6
|
-
|
|
47
|
+
declare function toggleMatrixGenerationViewProperty(draft: Draft<PreferencesState>, action: ToggleMatrixGenerationViewAction): void;
|
|
48
|
+
declare function resetDefaultViewMatrixGenerationOptions(draft: Draft<PreferencesState>, action: ToggleMatrixGenerationViewAction): void;
|
|
49
|
+
declare function changeMatrixGenerationScale(draft: Draft<PreferencesState>, action: ChangeMatrixGenerationScaleAction): void;
|
|
50
|
+
declare function changeMatrixGenerationStocsyChemicalShift(draft: Draft<PreferencesState>, action: ChangeMatrixGenerationStocsyChemicalShiftAction): null | undefined;
|
|
51
|
+
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, resetDefaultViewMatrixGenerationOptions, };
|
|
@@ -1,42 +1,79 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
|
+
import { toScaleRatio } from '../../helper/Zoom1DManager';
|
|
3
|
+
import { getMatrixGenerationDefaultOptions } from '../panelsPreferencesDefaultValues';
|
|
2
4
|
import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
+
function getMatrixGenerationPanelOptions(draft, nucleus) {
|
|
6
|
+
initMatrixGeneration(draft, nucleus);
|
|
7
|
+
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
8
|
+
const panels = currentWorkspacePreferences.panels;
|
|
9
|
+
const matrixGeneration = panels.matrixGeneration?.[nucleus];
|
|
10
|
+
return matrixGeneration;
|
|
11
|
+
}
|
|
12
|
+
function initMatrixGeneration(draft, nucleus) {
|
|
5
13
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
6
14
|
const panels = currentWorkspacePreferences.panels;
|
|
7
|
-
const exclusionZone = {
|
|
8
|
-
id: v4(),
|
|
9
|
-
...zone,
|
|
10
|
-
};
|
|
11
15
|
if (!panels.matrixGeneration?.[nucleus]) {
|
|
12
|
-
const options =
|
|
13
|
-
exclusionsZones: [exclusionZone],
|
|
14
|
-
filters: [],
|
|
15
|
-
range,
|
|
16
|
-
numberOfPoints: 1024,
|
|
17
|
-
};
|
|
16
|
+
const options = getMatrixGenerationDefaultOptions();
|
|
18
17
|
panels.matrixGeneration = {
|
|
19
18
|
...panels.matrixGeneration,
|
|
20
19
|
[nucleus]: options,
|
|
21
20
|
};
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
return panels.matrixGeneration;
|
|
23
|
+
}
|
|
24
|
+
function addExclusionZone(draft, action) {
|
|
25
|
+
const { zone, range, nucleus } = action.payload;
|
|
26
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
27
|
+
if (!matrixGeneration)
|
|
28
|
+
return;
|
|
29
|
+
const exclusionZone = {
|
|
30
|
+
id: v4(),
|
|
31
|
+
...zone,
|
|
32
|
+
};
|
|
33
|
+
matrixGeneration.matrixOptions.range = range;
|
|
34
|
+
matrixGeneration.matrixOptions.exclusionsZones.push(exclusionZone);
|
|
26
35
|
}
|
|
27
36
|
function deleteExclusionZone(draft, action) {
|
|
28
37
|
const { zone, nucleus } = action.payload;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
38
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
39
|
+
if (!matrixGeneration)
|
|
40
|
+
return;
|
|
41
|
+
const options = matrixGeneration.matrixOptions;
|
|
42
|
+
options.exclusionsZones = options.exclusionsZones.filter((_zone) => _zone.id !== zone.id);
|
|
35
43
|
}
|
|
36
44
|
function setMatrixGenerationOptions(draft, action) {
|
|
37
45
|
const { options, nucleus } = action.payload;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
47
|
+
matrixGeneration.matrixOptions = options;
|
|
48
|
+
}
|
|
49
|
+
function toggleMatrixGenerationViewProperty(draft, action) {
|
|
50
|
+
const { key, nucleus } = action.payload;
|
|
51
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
52
|
+
if (!matrixGeneration)
|
|
53
|
+
return;
|
|
54
|
+
matrixGeneration[key] = !matrixGeneration[key];
|
|
55
|
+
}
|
|
56
|
+
function resetDefaultViewMatrixGenerationOptions(draft, action) {
|
|
57
|
+
const { nucleus } = action.payload;
|
|
58
|
+
const matrixGeneration = initMatrixGeneration(draft, nucleus);
|
|
59
|
+
const currentOptions = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
60
|
+
const { matrixOptions } = currentOptions;
|
|
61
|
+
const { matrixOptions: defaultMatrixOptions, ...vewOptions } = getMatrixGenerationDefaultOptions();
|
|
62
|
+
matrixGeneration[nucleus] = { matrixOptions, ...vewOptions };
|
|
63
|
+
}
|
|
64
|
+
function changeMatrixGenerationScale(draft, action) {
|
|
65
|
+
const { zoomOptions, nucleus } = action.payload;
|
|
66
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
67
|
+
if (!matrixGeneration)
|
|
68
|
+
return;
|
|
69
|
+
const scaleRatio = toScaleRatio(zoomOptions);
|
|
70
|
+
matrixGeneration.scaleRatio *= scaleRatio;
|
|
71
|
+
}
|
|
72
|
+
function changeMatrixGenerationStocsyChemicalShift(draft, action) {
|
|
73
|
+
const { chemicalShift, nucleus } = action.payload;
|
|
74
|
+
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
75
|
+
if (!matrixGeneration)
|
|
76
|
+
return null;
|
|
77
|
+
matrixGeneration.chemicalShift = chemicalShift;
|
|
41
78
|
}
|
|
42
|
-
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions };
|
|
79
|
+
export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, resetDefaultViewMatrixGenerationOptions, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PanelsPreferences } from 'nmr-load-save';
|
|
1
|
+
import { MatrixGenerationOptions, PanelsPreferences } from 'nmr-load-save';
|
|
2
|
+
import { DeepPartial } from '../../../data/types/common/DeepPartial';
|
|
2
3
|
declare const getSpectraDefaultValues: (nucleus?: string) => PanelsPreferences['spectra'];
|
|
3
4
|
declare const getIntegralDefaultValues: (nucleus?: string) => PanelsPreferences['integrals'];
|
|
4
5
|
declare const getZoneDefaultValues: (nucleus?: string) => PanelsPreferences['zones'];
|
|
@@ -6,4 +7,6 @@ declare const getRangeDefaultValues: (nucleus?: string) => PanelsPreferences['ra
|
|
|
6
7
|
declare const getPeaksDefaultValues: (nucleus?: string) => PanelsPreferences['peaks'];
|
|
7
8
|
declare const databaseDefaultValues: PanelsPreferences['database'];
|
|
8
9
|
declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences['multipleSpectraAnalysis'];
|
|
9
|
-
|
|
10
|
+
declare function getMatrixGenerationDefaultOptions(): DeepPartial<MatrixGenerationOptions>;
|
|
11
|
+
declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences['matrixGeneration'];
|
|
12
|
+
export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
|
|
@@ -148,4 +148,20 @@ const getMultipleSpectraAnalysisDefaultValues = (nucleus) => {
|
|
|
148
148
|
};
|
|
149
149
|
return nucleus ? { [nucleus]: preferences } : {};
|
|
150
150
|
};
|
|
151
|
-
|
|
151
|
+
function getMatrixGenerationDefaultOptions() {
|
|
152
|
+
return {
|
|
153
|
+
matrixOptions: {
|
|
154
|
+
exclusionsZones: [],
|
|
155
|
+
filters: [],
|
|
156
|
+
numberOfPoints: 1024,
|
|
157
|
+
},
|
|
158
|
+
chemicalShift: null,
|
|
159
|
+
scaleRatio: 1,
|
|
160
|
+
showBoxPlot: false,
|
|
161
|
+
showStocsy: false,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
const getMatrixGenerationDefaultValues = (nucleus) => {
|
|
165
|
+
return nucleus ? { [nucleus]: getMatrixGenerationDefaultOptions() } : {};
|
|
166
|
+
};
|
|
167
|
+
export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MultipleSpectraAnalysisPreferences, Workspace, WorkSpaceSource } from 'nmr-load-save';
|
|
2
2
|
import { Reducer } from 'react';
|
|
3
3
|
import { SplitPaneSize } from 'react-science/ui';
|
|
4
|
-
import { MatrixOptions } from '../../../data/types/data1d/MatrixOptions';
|
|
5
4
|
import type { NMRiumWorkspace, NMRiumPreferences } from '../../main';
|
|
6
5
|
import { ActionType } from '../types/ActionType';
|
|
6
|
+
import { MatrixGenerationActions } from './actions/matrixGeneration';
|
|
7
7
|
export declare const WORKSPACES_KEYS: {
|
|
8
8
|
componentKey: string;
|
|
9
9
|
nmriumKey: string;
|
|
@@ -60,33 +60,10 @@ export type SetSpectraAnalysisPanelPreferencesAction = ActionType<'SET_SPECTRA_A
|
|
|
60
60
|
nucleus: string;
|
|
61
61
|
data: MultipleSpectraAnalysisPreferences;
|
|
62
62
|
}>;
|
|
63
|
-
export type setMatrixGenerationOptionsAction = ActionType<'SET_MATRIX_GENERATION_OPTIONS', {
|
|
64
|
-
nucleus: string;
|
|
65
|
-
options: MatrixOptions;
|
|
66
|
-
}>;
|
|
67
|
-
export type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
68
|
-
zone: {
|
|
69
|
-
from: number;
|
|
70
|
-
to: number;
|
|
71
|
-
};
|
|
72
|
-
range: {
|
|
73
|
-
from: number;
|
|
74
|
-
to: number;
|
|
75
|
-
};
|
|
76
|
-
nucleus: string;
|
|
77
|
-
}>;
|
|
78
|
-
export type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
79
|
-
zone: {
|
|
80
|
-
id: string;
|
|
81
|
-
from: number;
|
|
82
|
-
to: number;
|
|
83
|
-
};
|
|
84
|
-
nucleus: string;
|
|
85
|
-
}>;
|
|
86
63
|
export type SetVerticalSplitterPositionAction = ActionType<'SET_VERTICAL_SPLITTER_POSITION', {
|
|
87
64
|
value: SplitPaneSize;
|
|
88
65
|
}>;
|
|
89
|
-
type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction |
|
|
66
|
+
type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction | MatrixGenerationActions | SetVerticalSplitterPositionAction;
|
|
90
67
|
export declare const WORKSPACES: Array<{
|
|
91
68
|
key: NMRiumWorkspace;
|
|
92
69
|
label: string;
|
|
@@ -6,7 +6,7 @@ import { addWorkspace } from './actions/addWorkspace';
|
|
|
6
6
|
import { analyzeSpectra, changeAnalysisColumnValueKey, deleteAnalysisColumn, setSpectraAnalysisPanelsPreferences, } from './actions/analyzeSpectra';
|
|
7
7
|
import { applyGeneralPreferences } from './actions/applyGeneralPreferences';
|
|
8
8
|
import { initPreferences } from './actions/initPreferences';
|
|
9
|
-
import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, } from './actions/matrixGeneration';
|
|
9
|
+
import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, } from './actions/matrixGeneration';
|
|
10
10
|
import { removeWorkspace } from './actions/removeWorkspace';
|
|
11
11
|
import { setActiveWorkspace } from './actions/setActiveWorkspace';
|
|
12
12
|
import { setPanelsPreferences } from './actions/setPanelsPreferences';
|
|
@@ -125,8 +125,14 @@ function innerPreferencesReducer(draft, action) {
|
|
|
125
125
|
return addExclusionZone(draft, action);
|
|
126
126
|
case 'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE':
|
|
127
127
|
return deleteExclusionZone(draft, action);
|
|
128
|
+
case 'TOGGLE_MATRIX_GENERATION_VIEW_PROPERTY':
|
|
129
|
+
return toggleMatrixGenerationViewProperty(draft, action);
|
|
128
130
|
case 'SET_VERTICAL_SPLITTER_POSITION':
|
|
129
131
|
return setVerticalSplitterPosition(draft, action);
|
|
132
|
+
case 'CHANGE_MATRIX_GENERATION_SCALE':
|
|
133
|
+
return changeMatrixGenerationScale(draft, action);
|
|
134
|
+
case 'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT':
|
|
135
|
+
return changeMatrixGenerationStocsyChemicalShift(draft, action);
|
|
130
136
|
default:
|
|
131
137
|
return draft;
|
|
132
138
|
}
|
|
@@ -3,12 +3,11 @@ import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaseline
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
|
|
5
5
|
import { PiKnifeBold } from 'react-icons/pi';
|
|
6
|
-
import { Toolbar } from 'react-science/ui';
|
|
6
|
+
import { Toolbar, TooltipHelpContent, } from 'react-science/ui';
|
|
7
7
|
import { useChartData } from '../context/ChartContext';
|
|
8
8
|
import { useDispatch } from '../context/DispatchContext';
|
|
9
9
|
import { useLoader } from '../context/LoaderContext';
|
|
10
10
|
import { usePreferences } from '../context/PreferencesContext';
|
|
11
|
-
import { CustomToolTip } from '../elements/CustomToolTip';
|
|
12
11
|
import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
|
|
13
12
|
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
|
|
14
13
|
import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
|
|
@@ -87,7 +86,7 @@ export default function ToolBar() {
|
|
|
87
86
|
function exportHandler(data) {
|
|
88
87
|
switch (data?.id) {
|
|
89
88
|
case 'svg':
|
|
90
|
-
|
|
89
|
+
saveAsSVGHandler();
|
|
91
90
|
break;
|
|
92
91
|
case 'png':
|
|
93
92
|
void saveAsPNGHandler();
|
|
@@ -112,8 +111,8 @@ export default function ToolBar() {
|
|
|
112
111
|
title: options.zoom.label,
|
|
113
112
|
subTitles: [
|
|
114
113
|
{ title: 'Vertical', shortcuts: ['Scroll wheel'] },
|
|
115
|
-
{ title: 'Horizontal', shortcuts: ['
|
|
116
|
-
{ title: 'Pan', shortcuts: ['Right
|
|
114
|
+
{ title: 'Horizontal', shortcuts: ['⇧', 'Scroll wheel'] },
|
|
115
|
+
{ title: 'Pan', shortcuts: ['Right button'] },
|
|
117
116
|
],
|
|
118
117
|
},
|
|
119
118
|
icon: _jsx(FaSearchPlus, {}),
|
|
@@ -325,12 +324,12 @@ export default function ToolBar() {
|
|
|
325
324
|
return null;
|
|
326
325
|
if (isPopoverToolItem(item)) {
|
|
327
326
|
const { menuItems, onClick } = item;
|
|
328
|
-
return (_jsx(ToolbarPopoverItem, { options: menuItems, tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(
|
|
327
|
+
return (_jsx(ToolbarPopoverItem, { options: menuItems, tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(TooltipHelpContent, { ...tooltip })), tooltipProps: {
|
|
329
328
|
minimal: true,
|
|
330
329
|
}, id: id, active: selectedTool === id, icon: icon, onClick: onClick }, id));
|
|
331
330
|
}
|
|
332
331
|
const { onClick } = item;
|
|
333
|
-
return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(
|
|
332
|
+
return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(TooltipHelpContent, { ...tooltip })), tooltipProps: {
|
|
334
333
|
minimal: true,
|
|
335
334
|
}, id: id, active: selectedTool === id, icon: icon }, id));
|
|
336
335
|
}) })] }));
|
|
@@ -19,11 +19,18 @@ export class PathBuilder {
|
|
|
19
19
|
toString() {
|
|
20
20
|
return this.array.join(' ');
|
|
21
21
|
}
|
|
22
|
+
concatPath(pathBuilder) {
|
|
23
|
+
return this.array.concat(pathBuilder.array).join(' ');
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Clamp values to avoid rendering issues of the SVG.
|
|
25
28
|
* This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
|
|
26
29
|
*/
|
|
27
30
|
function clamp(value) {
|
|
28
|
-
|
|
31
|
+
if (value < -1e5)
|
|
32
|
+
return -1e5;
|
|
33
|
+
if (value > 1e5)
|
|
34
|
+
return 1e5;
|
|
35
|
+
return value;
|
|
29
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.56.0' };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.56.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "lib/component/main/index.js",
|
|
7
7
|
"types": "lib/component/main/index.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"url": "git+https://github.com/cheminfo/nmrium.git"
|
|
47
47
|
},
|
|
48
48
|
"volta": {
|
|
49
|
-
"node": "20.
|
|
49
|
+
"node": "20.14.0"
|
|
50
50
|
},
|
|
51
51
|
"overrides": {
|
|
52
52
|
"react": "$react",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ml-array-mean": "^1.1.6",
|
|
81
81
|
"ml-array-median": "^1.1.6",
|
|
82
82
|
"ml-array-xy-equally-spaced": "^1.2.1",
|
|
83
|
-
"ml-baseline-correction-regression": "^
|
|
83
|
+
"ml-baseline-correction-regression": "^2.0.1",
|
|
84
84
|
"ml-conrec": "^5.0.2",
|
|
85
85
|
"ml-gsd": "^12.1.6",
|
|
86
86
|
"ml-matrix": "^6.11.0",
|
|
@@ -90,14 +90,14 @@
|
|
|
90
90
|
"ml-tree-similarity": "^2.2.0",
|
|
91
91
|
"multiplet-analysis": "^2.1.2",
|
|
92
92
|
"nmr-correlation": "^2.3.3",
|
|
93
|
-
"nmr-load-save": "0.
|
|
94
|
-
"nmr-processing": "^12.3.
|
|
93
|
+
"nmr-load-save": "^0.33.1",
|
|
94
|
+
"nmr-processing": "^12.3.2",
|
|
95
95
|
"nmredata": "^0.9.9",
|
|
96
96
|
"numeral": "^2.0.6",
|
|
97
|
-
"openchemlib": "^8.
|
|
98
|
-
"openchemlib-utils": "^5.
|
|
97
|
+
"openchemlib": "^8.13.0",
|
|
98
|
+
"openchemlib-utils": "^5.21.1",
|
|
99
99
|
"papaparse": "^5.4.1",
|
|
100
|
-
"re-resizable": "6.9.
|
|
100
|
+
"re-resizable": "6.9.17",
|
|
101
101
|
"react-d3-utils": "^1.0.0",
|
|
102
102
|
"react-dropzone": "^14.2.3",
|
|
103
103
|
"react-error-boundary": "^4.0.13",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"react-ocl": "^6.1.0",
|
|
108
108
|
"react-ocl-nmr": "^3.0.1",
|
|
109
109
|
"react-plot": "^1.4.2",
|
|
110
|
-
"react-rnd": "^10.4.
|
|
111
|
-
"react-science": "^
|
|
110
|
+
"react-rnd": "^10.4.11",
|
|
111
|
+
"react-science": "^4.0.0",
|
|
112
112
|
"react-slider": "^2.0.6",
|
|
113
113
|
"react-table": "^7.8.0",
|
|
114
114
|
"react-transition-group": "^4.4.5",
|
|
@@ -117,39 +117,39 @@
|
|
|
117
117
|
"yup": "^1.4.0"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"@babel/plugin-transform-modules-commonjs": "^7.24.
|
|
121
|
-
"@babel/preset-react": "^7.24.
|
|
122
|
-
"@babel/preset-typescript": "^7.24.
|
|
123
|
-
"@playwright/test": "^1.44.
|
|
120
|
+
"@babel/plugin-transform-modules-commonjs": "^7.24.6",
|
|
121
|
+
"@babel/preset-react": "^7.24.6",
|
|
122
|
+
"@babel/preset-typescript": "^7.24.6",
|
|
123
|
+
"@playwright/test": "^1.44.1",
|
|
124
124
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
125
125
|
"@types/d3": "^7.4.3",
|
|
126
|
-
"@types/lodash": "^4.17.
|
|
127
|
-
"@types/node": "^20.12.
|
|
126
|
+
"@types/lodash": "^4.17.4",
|
|
127
|
+
"@types/node": "^20.12.13",
|
|
128
128
|
"@types/papaparse": "^5.3.14",
|
|
129
|
-
"@types/react": "^18.3.
|
|
129
|
+
"@types/react": "^18.3.3",
|
|
130
130
|
"@types/react-dom": "^18.3.0",
|
|
131
131
|
"@types/react-table": "^7.7.20",
|
|
132
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
132
|
+
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
133
133
|
"@vitest/coverage-v8": "^1.6.0",
|
|
134
134
|
"cross-env": "^7.0.3",
|
|
135
|
-
"cspell": "^8.8.
|
|
135
|
+
"cspell": "^8.8.3",
|
|
136
136
|
"eslint": "^8.57.0",
|
|
137
137
|
"eslint-config-cheminfo-react": "^11.0.1",
|
|
138
138
|
"eslint-config-cheminfo-typescript": "^12.4.0",
|
|
139
139
|
"modern-normalize": "^2.0.0",
|
|
140
140
|
"postcss-styled-syntax": "^0.6.4",
|
|
141
141
|
"prettier": "^3.2.5",
|
|
142
|
-
"rc-menu": "^9.
|
|
142
|
+
"rc-menu": "^9.14.0",
|
|
143
143
|
"react": "^18.3.1",
|
|
144
144
|
"react-dom": "^18.3.1",
|
|
145
145
|
"react-router-dom": "^6.23.1",
|
|
146
146
|
"rimraf": "^5.0.7",
|
|
147
147
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
148
148
|
"serve": "^14.2.3",
|
|
149
|
-
"stylelint": "^16.
|
|
149
|
+
"stylelint": "^16.6.1",
|
|
150
150
|
"stylelint-config-standard": "^36.0.0",
|
|
151
151
|
"typescript": "^5.4.5",
|
|
152
|
-
"vite": "^5.2.
|
|
152
|
+
"vite": "^5.2.12",
|
|
153
153
|
"vitest": "^1.6.0"
|
|
154
154
|
}
|
|
155
|
-
}
|
|
155
|
+
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
const styles = {
|
|
5
|
-
titleContainer: {
|
|
6
|
-
display: 'flex',
|
|
7
|
-
justifyContent: 'space-between',
|
|
8
|
-
flexWrap: 'wrap',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
},
|
|
11
|
-
title: {
|
|
12
|
-
fontSize: '0.9rem',
|
|
13
|
-
flex: 1,
|
|
14
|
-
padding: '5px 0',
|
|
15
|
-
textAlign: 'left',
|
|
16
|
-
color: 'white',
|
|
17
|
-
},
|
|
18
|
-
description: {
|
|
19
|
-
paddingTop: '1rem',
|
|
20
|
-
fontSize: '0.7rem',
|
|
21
|
-
textAlign: 'left',
|
|
22
|
-
color: 'white',
|
|
23
|
-
},
|
|
24
|
-
shortcutContainer: {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
textWrap: 'nowrap',
|
|
27
|
-
color: 'white',
|
|
28
|
-
},
|
|
29
|
-
shortcutItem: {
|
|
30
|
-
display: 'flex',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
padding: '0.2rem',
|
|
34
|
-
border: '1px solid #ccc',
|
|
35
|
-
borderRadius: '4px',
|
|
36
|
-
height: 'calc(0.2rem + 20px)',
|
|
37
|
-
minWidth: 'calc(0.2rem + 20px)' /* Adjust padding and border width */,
|
|
38
|
-
marginLeft: '5px',
|
|
39
|
-
fontSize: '0.75rem',
|
|
40
|
-
fontWeight: 'bold',
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
export function CustomToolTip(props) {
|
|
44
|
-
const { title, shortcuts = [], subTitles = [], description = '', link, } = props;
|
|
45
|
-
return (_jsxs("div", { style: {
|
|
46
|
-
width: 250,
|
|
47
|
-
padding: '0.5rem',
|
|
48
|
-
}, children: [_jsxs("div", { style: styles.titleContainer, children: [_jsx("span", { style: styles.title, children: title }), _jsx(ShortCuts, { shortcuts: shortcuts })] }), _jsx(SubTitles, { items: subTitles }), (description || link) && (_jsxs("p", { style: styles.description, children: [description, link && (_jsx("a", { style: description ? { paddingLeft: '5px' } : {}, target: "_blank", href: link, rel: "noreferrer", children: "Learn more" }))] }))] }));
|
|
49
|
-
}
|
|
50
|
-
function ShortCuts({ shortcuts, style = {}, }) {
|
|
51
|
-
return (_jsx("div", { style: styles.shortcutContainer, children: shortcuts.map((key, index) => {
|
|
52
|
-
return (_jsx("div", { style: {
|
|
53
|
-
...styles.shortcutItem,
|
|
54
|
-
...(index === 0 && { margin: 0 }),
|
|
55
|
-
...style,
|
|
56
|
-
}, children: _jsx("span", { children: key }) }, key));
|
|
57
|
-
}) }));
|
|
58
|
-
}
|
|
59
|
-
const subTitleStyle = css `
|
|
60
|
-
padding-left: 5px;
|
|
61
|
-
list-style: none;
|
|
62
|
-
|
|
63
|
-
li {
|
|
64
|
-
position: relative;
|
|
65
|
-
padding-left: 15px;
|
|
66
|
-
box-sizing: border-box;
|
|
67
|
-
|
|
68
|
-
&::before {
|
|
69
|
-
position: absolute;
|
|
70
|
-
top: 15px;
|
|
71
|
-
left: 0;
|
|
72
|
-
width: 10px;
|
|
73
|
-
height: 1px;
|
|
74
|
-
margin: auto;
|
|
75
|
-
content: '';
|
|
76
|
-
background-color: white;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&::after {
|
|
80
|
-
position: absolute;
|
|
81
|
-
top: 0;
|
|
82
|
-
bottom: 0;
|
|
83
|
-
left: 0;
|
|
84
|
-
width: 1px;
|
|
85
|
-
height: 100%;
|
|
86
|
-
content: '';
|
|
87
|
-
background-color: white;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
&:last-child::after {
|
|
91
|
-
height: 15px;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
li:first-child {
|
|
96
|
-
padding-top: 5px;
|
|
97
|
-
|
|
98
|
-
&::before {
|
|
99
|
-
top: 20px;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
103
|
-
function SubTitles({ items }) {
|
|
104
|
-
if (!items || items.length === 0)
|
|
105
|
-
return null;
|
|
106
|
-
return (_jsx("ul", { css: subTitleStyle, children: items.map(({ shortcuts = [], title }) => (_jsx("li", { children: _jsxs("div", { style: styles.titleContainer, children: [_jsx("span", { style: { ...styles.title, fontSize: '0.7rem' }, children: title }), _jsx(ShortCuts, { style: { padding: '0.1rem' }, shortcuts: shortcuts })] }) }, title))) }));
|
|
107
|
-
}
|