nmrium 0.19.1 → 0.21.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 -3
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
- package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
- package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
- package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
- package/lib/component/1d/Line.js +11 -23
- package/lib/component/1d/Viewer1D.js +36 -5
- package/lib/component/1d/ranges/Ranges.js +3 -3
- package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
- package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib/component/2d/Contours.js +12 -11
- package/lib/component/2d/Left1DChart.js +7 -9
- package/lib/component/2d/Top1DChart.js +7 -7
- package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +106 -80
- package/lib/component/NMRium.d.ts +8 -3
- package/lib/component/NMRium.js +36 -33
- package/lib/component/elements/NumberInput.d.ts +1 -2
- package/lib/component/elements/Tab/Tab.js +1 -0
- package/lib/component/header/Header.js +10 -3
- package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/hooks/useToolsFunctions.js +2 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -1
- package/lib/component/loader/DropZone.js +88 -88
- package/lib/component/modal/ModalStyle.js +5 -2
- package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +1 -5
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -67
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
- package/lib/component/panels/Panels.js +10 -0
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +0 -3
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +7 -7
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +0 -3
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/reducer/Reducer.d.ts +11 -27
- package/lib/component/reducer/Reducer.js +4 -5
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
- package/lib/component/reducer/actions/FiltersActions.js +60 -18
- package/lib/component/reducer/actions/LoadActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib/component/reducer/actions/RangesActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
- package/lib/component/reducer/actions/ToolsActions.js +13 -59
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/helper/getRange.d.ts +6 -1
- package/lib/component/reducer/helper/getRange.js +1 -1
- package/lib/component/reducer/preferencesReducer.d.ts +2 -0
- package/lib/component/reducer/preferencesReducer.js +76 -36
- package/lib/component/toolbar/FunctionToolBar.js +9 -15
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/utility/PathBuilder.d.ts +7 -0
- package/lib/component/utility/PathBuilder.js +17 -0
- package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
- package/lib/component/utility/getSpectraByNucleus.js +4 -0
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +45 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +45 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +43 -0
- package/lib/data/Filters.d.ts +2 -1
- package/lib/data/Filters.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
- package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
- package/lib/data/types/data1d/ExclusionZone.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -3
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
- package/lib-cjs/component/1d/Line.js +11 -23
- package/lib-cjs/component/1d/Viewer1D.js +36 -5
- package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
- package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib-cjs/component/2d/Contours.js +12 -11
- package/lib-cjs/component/2d/Left1DChart.js +7 -9
- package/lib-cjs/component/2d/Top1DChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +106 -80
- package/lib-cjs/component/NMRium.js +37 -34
- package/lib-cjs/component/elements/Tab/Tab.js +1 -0
- package/lib-cjs/component/header/Header.js +10 -3
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +2 -1
- package/lib-cjs/component/loader/DropZone.js +88 -88
- package/lib-cjs/component/modal/ModalStyle.js +5 -2
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -5
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +48 -66
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
- package/lib-cjs/component/panels/Panels.js +10 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +0 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +0 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/reducer/Reducer.js +4 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
- package/lib-cjs/component/reducer/actions/ToolsActions.js +13 -61
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getRange.js +1 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +75 -35
- package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -15
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/utility/PathBuilder.js +21 -0
- package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +48 -0
- package/lib-cjs/component/workspaces/exercise1D.js +48 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +46 -0
- package/lib-cjs/data/Filters.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
- package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +28 -29
- package/lib/component/1d/ExclusionZone.d.ts +0 -8
- package/lib/component/1d/ExclusionZone.js +0 -30
- package/lib/component/1d/ExclusionZones.d.ts +0 -2
- package/lib/component/1d/ExclusionZones.js +0 -10
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib-cjs/component/1d/ExclusionZone.js +0 -32
- package/lib-cjs/component/1d/ExclusionZones.js +0 -16
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
|
@@ -12,7 +12,7 @@ import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
|
12
12
|
import { SET_KEY_PREFERENCES, APPLY_KEY_PREFERENCES, DELETE_INTEGRAL, DELETE_PEAK_NOTATION, DELETE_RANGE, DELETE_2D_ZONE, DELETE_EXCLUSION_ZONE, } from '../reducer/types/Types';
|
|
13
13
|
import { options } from '../toolbar/ToolTypes';
|
|
14
14
|
function KeysListenerTracker() {
|
|
15
|
-
const { keysPreferences, displayerMode, overDisplayer, data } = useChartData();
|
|
15
|
+
const { keysPreferences, displayerMode, overDisplayer, data, activeSpectrum, } = useChartData();
|
|
16
16
|
const dispatch = useDispatch();
|
|
17
17
|
const alert = useAlert();
|
|
18
18
|
const openLoader = useLoader();
|
|
@@ -23,10 +23,7 @@ function KeysListenerTracker() {
|
|
|
23
23
|
const allow1DTool = useMemo(() => {
|
|
24
24
|
return displayerMode === DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
25
25
|
}, [data, displayerMode]);
|
|
26
|
-
const
|
|
27
|
-
return displayerMode === DISPLAYER_MODE.DM_2D && data && data.length > 0;
|
|
28
|
-
}, [data, displayerMode]);
|
|
29
|
-
const deleteHandler = useCallback((sourceData) => {
|
|
26
|
+
const deleteHandler = useCallback(async (sourceData) => {
|
|
30
27
|
const { type, extra: { id }, } = sourceData;
|
|
31
28
|
switch (type) {
|
|
32
29
|
case HighlightedSource.INTEGRAL: {
|
|
@@ -74,12 +71,15 @@ function KeysListenerTracker() {
|
|
|
74
71
|
break;
|
|
75
72
|
}
|
|
76
73
|
case HighlightedSource.EXCLUSION_ZONE: {
|
|
74
|
+
const hideLoading = await alert.showLoading(`Exclusion filter in progress`);
|
|
77
75
|
dispatch({
|
|
78
76
|
type: DELETE_EXCLUSION_ZONE,
|
|
79
77
|
payload: {
|
|
80
78
|
id,
|
|
79
|
+
spectrumID: sourceData.extra.spectrumID,
|
|
81
80
|
},
|
|
82
81
|
});
|
|
82
|
+
hideLoading();
|
|
83
83
|
// remove keys from the highlighted list after delete
|
|
84
84
|
remove();
|
|
85
85
|
break;
|
|
@@ -87,7 +87,7 @@ function KeysListenerTracker() {
|
|
|
87
87
|
default:
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
|
-
}, [assignmentData, dispatch, remove]);
|
|
90
|
+
}, [assignmentData, dispatch, remove, alert]);
|
|
91
91
|
const keysPreferencesListenerHandler = useCallback((e, num) => {
|
|
92
92
|
if (data && data.length > 0 && num >= 1 && num <= 9) {
|
|
93
93
|
if (e.shiftKey) {
|
|
@@ -117,100 +117,126 @@ function KeysListenerTracker() {
|
|
|
117
117
|
}
|
|
118
118
|
}, [alert, data, dispatch, keysPreferences]);
|
|
119
119
|
const toolsListenerHandler = useCallback((e) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
120
|
+
function check1DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
121
|
+
if (displayerMode === DISPLAYER_MODE.DM_1D && !activeSpectrum) {
|
|
122
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
123
|
+
}
|
|
124
|
+
else if (checkSwitch && displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
125
|
+
throw new Error(`Switch to 1D Mode and select a spectrum to proceed with ${label}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function check2DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
129
|
+
if (displayerMode === DISPLAYER_MODE.DM_2D && !activeSpectrum) {
|
|
130
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
131
|
+
}
|
|
132
|
+
else if (checkSwitch && displayerMode === DISPLAYER_MODE.DM_1D) {
|
|
133
|
+
throw new Error(`Switch to 2D Mode and select a spectrum to proceed with ${label}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
if (!e.shiftKey && !e.metaKey) {
|
|
138
|
+
switch (e.key) {
|
|
139
|
+
case 'f':
|
|
140
|
+
handleFullZoomOut();
|
|
141
|
+
break;
|
|
142
|
+
case 'z':
|
|
143
|
+
case 'Escape':
|
|
144
|
+
handleChangeOption(options.zoom.id);
|
|
145
|
+
break;
|
|
146
|
+
case 'r': {
|
|
147
|
+
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
148
|
+
check2DModeWithActiveSpectrum(options.zone2D.label, false);
|
|
149
|
+
handleChangeOption(options.zone2D.id);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
check1DModeWithActiveSpectrum(options.rangesPicking.label, false);
|
|
153
|
+
handleChangeOption(options.rangesPicking.id);
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 'a': {
|
|
158
|
+
check1DModeWithActiveSpectrum(options.phaseCorrection.label);
|
|
140
159
|
handleChangeOption(options.phaseCorrection.id);
|
|
160
|
+
break;
|
|
141
161
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
case 'b': {
|
|
145
|
-
if (allow1DTool) {
|
|
162
|
+
case 'b': {
|
|
163
|
+
check1DModeWithActiveSpectrum(options.baseLineCorrection.label);
|
|
146
164
|
handleChangeOption(options.baseLineCorrection.id);
|
|
165
|
+
break;
|
|
147
166
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
case 'p': {
|
|
151
|
-
if (allow1DTool) {
|
|
167
|
+
case 'p': {
|
|
168
|
+
check1DModeWithActiveSpectrum(options.peakPicking.label);
|
|
152
169
|
handleChangeOption(options.peakPicking.id);
|
|
170
|
+
break;
|
|
153
171
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
case 'i': {
|
|
157
|
-
if (allow1DTool) {
|
|
172
|
+
case 'i': {
|
|
173
|
+
check1DModeWithActiveSpectrum(options.integral.label);
|
|
158
174
|
handleChangeOption(options.integral.id);
|
|
175
|
+
break;
|
|
159
176
|
}
|
|
160
|
-
|
|
177
|
+
case 'e': {
|
|
178
|
+
check1DModeWithActiveSpectrum(options.exclusionZones.label);
|
|
179
|
+
handleChangeOption(options.exclusionZones.id);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
default:
|
|
161
183
|
}
|
|
162
|
-
default:
|
|
163
184
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
185
|
+
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
186
|
+
switch (e.key) {
|
|
187
|
+
case 'c': {
|
|
188
|
+
if (allow1DTool) {
|
|
189
|
+
alignSpectrumsVerticallyHandler();
|
|
190
|
+
}
|
|
191
|
+
break;
|
|
170
192
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
193
|
+
case 's': {
|
|
194
|
+
if (allow1DTool) {
|
|
195
|
+
changeDisplayViewModeHandler();
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
176
198
|
}
|
|
177
|
-
|
|
199
|
+
default:
|
|
178
200
|
}
|
|
179
|
-
default:
|
|
180
201
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
202
|
+
if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
203
|
+
switch (e.key) {
|
|
204
|
+
case 'c':
|
|
205
|
+
void saveToClipboardHandler();
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
break;
|
|
208
|
+
case 's':
|
|
209
|
+
void saveAsJSONHandler();
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
break;
|
|
212
|
+
case 'o':
|
|
213
|
+
openLoader();
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
break;
|
|
216
|
+
default:
|
|
217
|
+
}
|
|
197
218
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
219
|
+
if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
220
|
+
switch (e.key) {
|
|
221
|
+
case 's':
|
|
222
|
+
case 'S':
|
|
223
|
+
void saveAsHandler();
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
}
|
|
207
228
|
}
|
|
208
229
|
}
|
|
230
|
+
catch (e) {
|
|
231
|
+
alert.error(e.message);
|
|
232
|
+
}
|
|
209
233
|
}, [
|
|
234
|
+
activeSpectrum,
|
|
235
|
+
alert,
|
|
210
236
|
alignSpectrumsVerticallyHandler,
|
|
211
237
|
allow1DTool,
|
|
212
|
-
allow2DTool,
|
|
213
238
|
changeDisplayViewModeHandler,
|
|
239
|
+
displayerMode,
|
|
214
240
|
handleChangeOption,
|
|
215
241
|
handleFullZoomOut,
|
|
216
242
|
openLoader,
|
|
@@ -228,7 +254,7 @@ function KeysListenerTracker() {
|
|
|
228
254
|
else {
|
|
229
255
|
if (['Delete', 'Backspace'].includes(e.key) && highlight.sourceData) {
|
|
230
256
|
e.preventDefault();
|
|
231
|
-
deleteHandler(highlight.sourceData);
|
|
257
|
+
void deleteHandler(highlight.sourceData);
|
|
232
258
|
}
|
|
233
259
|
else {
|
|
234
260
|
toolsListenerHandler(e);
|
|
@@ -3,7 +3,7 @@ import { ReactElement, ReactNode } from 'react';
|
|
|
3
3
|
import { Datum1D } from '../data/types/data1d';
|
|
4
4
|
import { Datum2D } from '../data/types/data2d';
|
|
5
5
|
import { State } from './reducer/Reducer';
|
|
6
|
-
export declare enum
|
|
6
|
+
export declare enum NMRiumWorkspaces {
|
|
7
7
|
EXERCISE_1D = "exercise1D",
|
|
8
8
|
PROCESS_1D = "process1D",
|
|
9
9
|
DEFAULT = "default"
|
|
@@ -11,7 +11,7 @@ export declare enum NMRiumMode {
|
|
|
11
11
|
export interface NMRiumProps {
|
|
12
12
|
data?: NMRiumData;
|
|
13
13
|
onDataChange?: (data: State) => void;
|
|
14
|
-
|
|
14
|
+
workspace?: NMRiumWorkspaces;
|
|
15
15
|
preferences?: NMRiumPreferences;
|
|
16
16
|
emptyText?: ReactNode;
|
|
17
17
|
/**
|
|
@@ -23,6 +23,8 @@ export declare type NMRiumPreferences = Partial<{
|
|
|
23
23
|
general: Partial<{
|
|
24
24
|
disableMultipletAnalysis: boolean;
|
|
25
25
|
hideSetSumFromMolecule: boolean;
|
|
26
|
+
hideGeneralSettings: boolean;
|
|
27
|
+
hideExperimentalFeatures: boolean;
|
|
26
28
|
}>;
|
|
27
29
|
panels: Partial<{
|
|
28
30
|
hideSpectraPanel: boolean;
|
|
@@ -47,12 +49,15 @@ export declare type NMRiumPreferences = Partial<{
|
|
|
47
49
|
hideRealImaginary: boolean;
|
|
48
50
|
hidePeakTool: boolean;
|
|
49
51
|
hideIntegralTool: boolean;
|
|
52
|
+
hideZonePickingTool: boolean;
|
|
53
|
+
hideSlicingTool: boolean;
|
|
50
54
|
hideAutoRangesTool: boolean;
|
|
51
55
|
hideZeroFillingTool: boolean;
|
|
52
56
|
hidePhaseCorrectionTool: boolean;
|
|
53
57
|
hideBaseLineCorrectionTool: boolean;
|
|
54
58
|
hideFFTTool: boolean;
|
|
55
59
|
hideMultipleSpectraAnalysisTool: boolean;
|
|
60
|
+
hideExclusionZonesTool: boolean;
|
|
56
61
|
}>;
|
|
57
62
|
}>;
|
|
58
63
|
export declare type Molecules = Array<{
|
|
@@ -66,6 +71,6 @@ export interface NMRiumData {
|
|
|
66
71
|
molecules?: Molecules;
|
|
67
72
|
spectra: DeepPartial<Spectra>;
|
|
68
73
|
}
|
|
69
|
-
declare function NMRium(
|
|
74
|
+
declare function NMRium(props: NMRiumProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
70
75
|
declare const _default: import("react").MemoExoticComponent<typeof NMRium>;
|
|
71
76
|
export default _default;
|
package/lib/component/NMRium.js
CHANGED
|
@@ -96,17 +96,20 @@ const containerStyles = css `
|
|
|
96
96
|
border-right: 0.55px #bbbbbb solid;
|
|
97
97
|
}
|
|
98
98
|
`;
|
|
99
|
-
export var
|
|
100
|
-
(function (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})(
|
|
99
|
+
export var NMRiumWorkspaces;
|
|
100
|
+
(function (NMRiumWorkspaces) {
|
|
101
|
+
NMRiumWorkspaces["EXERCISE_1D"] = "exercise1D";
|
|
102
|
+
NMRiumWorkspaces["PROCESS_1D"] = "process1D";
|
|
103
|
+
NMRiumWorkspaces["DEFAULT"] = "default";
|
|
104
|
+
})(NMRiumWorkspaces || (NMRiumWorkspaces = {}));
|
|
105
105
|
const defaultPreferences = {};
|
|
106
106
|
const defaultData = {
|
|
107
107
|
spectra: [],
|
|
108
108
|
};
|
|
109
|
-
function NMRium(
|
|
109
|
+
function NMRium(props) {
|
|
110
|
+
return (_jsx(RootLayout, { style: { width: '100%' }, children: _jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, children: _jsx(InnerNMRium, { ...props }, void 0) }, void 0) }, void 0));
|
|
111
|
+
}
|
|
112
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace = NMRiumWorkspaces.DEFAULT, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, }) {
|
|
110
113
|
const rootRef = useRef(null);
|
|
111
114
|
const elementsWraperRef = useRef(null);
|
|
112
115
|
const [show, toggle] = useToggle(false);
|
|
@@ -134,11 +137,11 @@ function NMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT, prefe
|
|
|
134
137
|
type: INIT_PREFERENCES,
|
|
135
138
|
payload: {
|
|
136
139
|
display: preferences,
|
|
137
|
-
|
|
140
|
+
workspace,
|
|
138
141
|
dispatch: dispatchPreferences,
|
|
139
142
|
},
|
|
140
143
|
});
|
|
141
|
-
}, [preferences,
|
|
144
|
+
}, [preferences, workspace]);
|
|
142
145
|
useEffect(() => {
|
|
143
146
|
dispatchMiddleWare({ type: SET_LOADING_FLAG, isLoading: true });
|
|
144
147
|
if (dataProp) {
|
|
@@ -156,30 +159,30 @@ function NMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT, prefe
|
|
|
156
159
|
const mouseLeaveHandler = useCallback(() => {
|
|
157
160
|
dispatchMiddleWare({ type: SET_MOUSE_OVER_DISPLAYER, payload: false });
|
|
158
161
|
}, [dispatchMiddleWare]);
|
|
159
|
-
return (_jsx(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
return (_jsx(GlobalProvider, { value: {
|
|
163
|
+
rootRef: rootRef.current,
|
|
164
|
+
elementsWraperRef: elementsWraperRef.current,
|
|
165
|
+
}, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx("div", { onMouseEnter: mouseEnterHandler, onMouseLeave: mouseLeaveHandler, style: { height: '100%', position: 'relative' }, children: _jsx(AlertProvider, { wrapperRef: elementsWraperRef.current, children: _jsx(DispatchProvider, { value: dispatchMiddleWare, children: _jsx(ChartDataProvider, { value: state, children: _jsx(ModalProvider, { wrapperRef: elementsWraperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { spectraData: spectraData, children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: _jsx(DropZone, { children: _jsxs("div", { style: {
|
|
166
|
+
display: 'flex',
|
|
167
|
+
flexDirection: 'column',
|
|
168
|
+
backgroundColor: 'white',
|
|
169
|
+
width: '100%',
|
|
170
|
+
}, children: [_jsx(Header, { isFullscreen: isFullscreen, onMaximize: toggle }, void 0), _jsxs("div", { style: {
|
|
163
171
|
display: 'flex',
|
|
164
|
-
flexDirection: '
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
left: 0,
|
|
180
|
-
right: 0,
|
|
181
|
-
top: 0,
|
|
182
|
-
bottom: 0,
|
|
183
|
-
} }, String(isFullscreen))] }, void 0)] }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
|
|
172
|
+
flexDirection: 'row',
|
|
173
|
+
height: '100%',
|
|
174
|
+
}, children: [_jsx(ToolBar, {}, void 0), _jsxs(SplitPane, { initialSeparation: "590px", orientation: "horizontal", sideSeparation: "end", children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, {}, void 0), _jsx("div", { "data-test-id": "viewer", style: {
|
|
175
|
+
width: '100%',
|
|
176
|
+
height: '100%',
|
|
177
|
+
}, children: displayerMode ===
|
|
178
|
+
DISPLAYER_MODE.DM_1D ? (_jsx(Viewer1D, { emptyText: emptyText }, void 0)) : (_jsx(Viewer2D, { emptyText: emptyText }, void 0)) }, void 0)] }, void 0), _jsx(Panels, {}, void 0)] }, void 0), _jsx("div", { ref: elementsWraperRef, id: "main-wrapper", style: {
|
|
179
|
+
position: 'absolute',
|
|
180
|
+
pointerEvents: 'none',
|
|
181
|
+
zIndex: 0,
|
|
182
|
+
left: 0,
|
|
183
|
+
right: 0,
|
|
184
|
+
top: 0,
|
|
185
|
+
bottom: 0,
|
|
186
|
+
} }, String(isFullscreen))] }, void 0)] }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0) }, void 0));
|
|
184
187
|
}
|
|
185
188
|
export default memo(NMRium);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface NumberInputProps {
|
|
3
|
-
ref?: any;
|
|
4
3
|
pattern?: string;
|
|
5
4
|
label?: string;
|
|
6
5
|
name?: string;
|
|
@@ -17,5 +16,5 @@ export interface NumberInputProps {
|
|
|
17
16
|
onChange?: (element: any) => void;
|
|
18
17
|
onInput?: () => void;
|
|
19
18
|
}
|
|
20
|
-
declare const NumberInput: import("react").ForwardRefExoticComponent<
|
|
19
|
+
declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
20
|
export default NumberInput;
|
|
@@ -14,6 +14,7 @@ const styles = (styles) => css `
|
|
|
14
14
|
|
|
15
15
|
${styles}
|
|
16
16
|
`;
|
|
17
|
+
/* eslint-enable react/no-unused-prop-types */
|
|
17
18
|
export function InternalTab({ tabid, tablabel, isActive, onClick = () => null, canDelete, onDelete = () => null, tabstyles, render, }) {
|
|
18
19
|
let className = 'tab-list-item';
|
|
19
20
|
// use tab identifier if given (higher priority)
|
|
@@ -5,6 +5,7 @@ import { useMemo, useCallback, memo } from 'react';
|
|
|
5
5
|
import { FaRegWindowMaximize, FaWrench, FaQuestionCircle, } from 'react-icons/fa';
|
|
6
6
|
import { docsBaseUrl } from '../../constants';
|
|
7
7
|
import { useChartData } from '../context/ChartContext';
|
|
8
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
8
9
|
import { useAlert } from '../elements/popup/Alert';
|
|
9
10
|
import { useModal, positions } from '../elements/popup/Modal';
|
|
10
11
|
import AboutUsModal from '../modal/AboutUsModal';
|
|
@@ -17,7 +18,7 @@ import RangesPickingOptionPanel from './RangesPickingOptionPanel';
|
|
|
17
18
|
import ZeroFillingOptionsPanel from './ZeroFillingOptionsPanel';
|
|
18
19
|
import Zones2DOptionPanel from './Zones2DOptionPanel';
|
|
19
20
|
function HeaderInner(props) {
|
|
20
|
-
const { isFullscreen, onMaximize = () => null, selectedOptionPanel } = props;
|
|
21
|
+
const { isFullscreen, onMaximize = () => null, selectedOptionPanel, hideGeneralSettings, } = props;
|
|
21
22
|
const alert = useAlert();
|
|
22
23
|
const modal = useModal();
|
|
23
24
|
const selectedPanel = useMemo(() => {
|
|
@@ -64,10 +65,16 @@ function HeaderInner(props) {
|
|
|
64
65
|
display: 'flex',
|
|
65
66
|
alignItems: 'center',
|
|
66
67
|
justifyContent: 'center',
|
|
67
|
-
}, children: _jsx(SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), _jsx("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}, void 0) }, void 0), _jsx(Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: _jsx(FaWrench, {}, void 0) }, void 0), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
68
|
+
}, children: _jsx(SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), _jsx("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), _jsxs(Toolbar, { orientation: "horizontal", children: [_jsx(Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(docsBaseUrl, '_blank'), children: _jsx(FaQuestionCircle, {}, void 0) }, void 0), !hideGeneralSettings && (_jsx(Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: _jsx(FaWrench, {}, void 0) }, void 0)), !isFullscreen && (_jsx(Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: _jsx(FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
68
69
|
}
|
|
69
70
|
const MemoizedHeader = memo(HeaderInner);
|
|
70
71
|
export default function HeaderWrapper({ isFullscreen, onMaximize }) {
|
|
71
72
|
const { toolOptions: { selectedOptionPanel }, } = useChartData();
|
|
72
|
-
|
|
73
|
+
const { display: { general }, } = usePreferences();
|
|
74
|
+
return (_jsx(MemoizedHeader, { ...{
|
|
75
|
+
selectedOptionPanel,
|
|
76
|
+
isFullscreen,
|
|
77
|
+
onMaximize,
|
|
78
|
+
hideGeneralSettings: general?.hideGeneralSettings || false,
|
|
79
|
+
} }, void 0));
|
|
73
80
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useChartData } from '../context/ChartContext';
|
|
4
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
5
|
+
export default function useActiveSpectrumStyleOptions(id) {
|
|
6
|
+
const { activeSpectrum } = useChartData();
|
|
7
|
+
const preferences = usePreferences();
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id ? true : false;
|
|
10
|
+
const opacity = isActive
|
|
11
|
+
? 1
|
|
12
|
+
: get(preferences, 'controllers.dimmedSpectraTransparency', 0.1);
|
|
13
|
+
return { isActive, opacity };
|
|
14
|
+
}, [activeSpectrum, id, preferences]);
|
|
15
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import lodashGet from 'lodash/get';
|
|
1
2
|
import { useMemo } from 'react';
|
|
2
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
3
4
|
export default function useCheckExperimentalFeature() {
|
|
4
5
|
const preferences = usePreferences();
|
|
5
6
|
return useMemo(() => {
|
|
6
|
-
return !preferences
|
|
7
|
+
return !lodashGet(preferences, 'display.general.hideExperimentalFeatures', false);
|
|
7
8
|
}, [preferences]);
|
|
8
9
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCheckToolsVisibility(): (toolKey: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import lodashGet from 'lodash/get';
|
|
2
|
+
import { usePreferences } from '../context/PreferencesContext';
|
|
3
|
+
export function useCheckToolsVisibility() {
|
|
4
|
+
const preferences = usePreferences();
|
|
5
|
+
return (toolKey) => !lodashGet(preferences, `display.toolBarButtons.${toolKey}`, false);
|
|
6
|
+
}
|
|
@@ -19,8 +19,9 @@ export default function useToolsFunctions() {
|
|
|
19
19
|
options.peakPicking.id,
|
|
20
20
|
options.integral.id,
|
|
21
21
|
options.zone2D.id,
|
|
22
|
+
options.exclusionZones.id,
|
|
22
23
|
].includes(selectedTool)) {
|
|
23
|
-
alert.show('Press Shift + Left Mouse button to select zone
|
|
24
|
+
alert.show('Press Shift + Left Mouse button to select zone');
|
|
24
25
|
}
|
|
25
26
|
if (options[selectedTool].hasOptionPanel &&
|
|
26
27
|
Object.keys(PANELS_ACCORDION).includes(selectedTool)) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataXY, DoubleArray } from 'cheminfo-types';
|
|
1
2
|
export declare enum XYReducerDomainAxis {
|
|
2
3
|
XAxis = "XAxis",
|
|
3
4
|
YAxis = "YAxis"
|
|
@@ -6,5 +7,5 @@ declare type XYReducerDomainAxisType = keyof typeof XYReducerDomainAxis;
|
|
|
6
7
|
export default function useXYReduce(domainAxis: XYReducerDomainAxisType): (data: {
|
|
7
8
|
x: number[];
|
|
8
9
|
y: number[];
|
|
9
|
-
}) =>
|
|
10
|
+
}) => DataXY<DoubleArray>;
|
|
10
11
|
export {};
|