nmrium 0.25.0 → 0.26.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/multiplicityTree/MultiplicityTree.js +5 -5
- package/lib/component/1d/ranges/Range.js +6 -5
- package/lib/component/2d/zones/Signal.js +8 -8
- package/lib/component/2d/zones/Zone.js +3 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -1
- package/lib/component/assignment/AssignmentsContext.d.ts +35 -0
- package/lib/component/assignment/AssignmentsContext.js +83 -0
- package/lib/component/assignment/AssignmentsReducer.d.ts +32 -0
- package/lib/component/assignment/AssignmentsReducer.js +39 -0
- package/lib/component/assignment/actions/initAssignment.d.ts +5 -0
- package/lib/component/assignment/actions/initAssignment.js +62 -0
- package/lib/component/assignment/actions/removeAssignment.d.ts +16 -0
- package/lib/component/assignment/actions/removeAssignment.js +24 -0
- package/lib/component/assignment/actions/setActiveAssignment.d.ts +10 -0
- package/lib/component/assignment/actions/setActiveAssignment.js +8 -0
- package/lib/component/assignment/actions/toggleAssignment.d.ts +7 -0
- package/lib/component/assignment/actions/toggleAssignment.js +44 -0
- package/lib/component/assignment/index.d.ts +0 -18
- package/lib/component/assignment/index.js +12 -266
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.d.ts +2 -0
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.js +3 -0
- package/lib/component/elements/Button.js +2 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +5 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +38 -10
- package/lib/component/elements/ReactTable/ReactTable.d.ts +3 -1
- package/lib/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib/component/elements/ReactTable/Style.d.ts +1 -3
- package/lib/component/elements/ReactTable/Style.js +1 -7
- package/lib/component/header/BaseLineCorrectionPanel.js +1 -1
- package/lib/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib/component/modal/setting/GeneralSettings.js +2 -1
- package/lib/component/modal/setting/settingsValidation.d.ts +8 -0
- package/lib/component/modal/setting/settingsValidation.js +40 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +4 -3
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.d.ts +10 -0
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +60 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +20 -11
- package/lib/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +12 -11
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +16 -9
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -3
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +5 -18
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +5 -7
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +5 -9
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +20 -20
- package/lib/component/panels/header/SpectraAutomaticPickingButton.d.ts +2 -0
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +30 -0
- package/lib/component/reducer/Reducer.d.ts +2 -0
- package/lib/component/reducer/Reducer.js +4 -1
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +9 -0
- package/lib/component/reducer/actions/AssignmentsActions.js +18 -0
- package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
- package/lib/component/reducer/actions/LoadActions.js +10 -5
- package/lib/component/reducer/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +10 -13
- package/lib/component/reducer/types/Types.d.ts +1 -0
- package/lib/component/reducer/types/Types.js +1 -0
- package/lib/component/utility/FormatNumber.js +1 -1
- package/lib/component/workspaces/Workspace.d.ts +2 -4
- package/lib/component/workspaces/basic.js +8 -9
- package/lib/data/SpectraManager.js +23 -15
- package/lib/data/data1d/Data1DManager.d.ts +1 -1
- package/lib/data/data1d/Data1DManager.js +2 -1
- package/lib/data/data1d/Spectrum1D/toJSON.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib/data/data1d/database.d.ts +1 -2
- package/lib/data/data1d/database.js +1 -1
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +1 -4
- package/lib/data/data2d/Data2DManager.d.ts +1 -1
- package/lib/data/data2d/Data2DManager.js +2 -1
- package/lib/data/data2d/Spectrum2D/toJSON.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +6 -6
- package/lib-cjs/component/1d/ranges/Range.js +8 -7
- package/lib-cjs/component/2d/zones/Signal.js +9 -9
- package/lib-cjs/component/2d/zones/Zone.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +2 -2
- package/lib-cjs/component/assignment/AssignmentsContext.js +88 -0
- package/lib-cjs/component/assignment/AssignmentsReducer.js +45 -0
- package/lib-cjs/component/assignment/actions/initAssignment.js +65 -0
- package/lib-cjs/component/assignment/actions/removeAssignment.js +29 -0
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +11 -0
- package/lib-cjs/component/assignment/actions/toggleAssignment.js +47 -0
- package/lib-cjs/component/assignment/index.js +15 -269
- package/lib-cjs/component/assignment/utilities/filterForIDsWithAssignment.js +7 -0
- package/lib-cjs/component/elements/Button.js +2 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +42 -14
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib-cjs/component/elements/ReactTable/Style.js +1 -9
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +1 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +66 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +67 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +15 -14
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -16
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +21 -21
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +37 -0
- package/lib-cjs/component/reducer/Reducer.js +4 -1
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +21 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +9 -4
- package/lib-cjs/component/reducer/preferencesReducer.js +10 -13
- package/lib-cjs/component/reducer/types/Types.js +2 -1
- package/lib-cjs/component/utility/FormatNumber.js +1 -1
- package/lib-cjs/component/workspaces/basic.js +8 -9
- package/lib-cjs/data/SpectraManager.js +23 -15
- package/lib-cjs/data/data1d/Data1DManager.js +2 -1
- package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib-cjs/data/data2d/Data2DManager.js +2 -1
- package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +19 -19
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
2
|
import { State } from '../Reducer';
|
|
3
3
|
declare function setIsLoading(draft: Draft<State>, isLoading: boolean): void;
|
|
4
|
-
declare function initiate(draft: Draft<State>, action: any):
|
|
4
|
+
declare function initiate(draft: Draft<State>, action: any): State;
|
|
5
5
|
declare function loadJDFFile(draft: Draft<State>, actions: any): void;
|
|
6
6
|
declare function loadJcampFile(draft: Draft<State>, actions: any): void;
|
|
7
7
|
declare function handleLoadJsonFile(draft: Draft<State>, action: any): State;
|
|
@@ -3,7 +3,7 @@ import { addJcamps, addJDFs } from '../../../data/SpectraManager';
|
|
|
3
3
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
4
4
|
import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Constants';
|
|
5
5
|
import { getInitialState } from '../Reducer';
|
|
6
|
-
import { LOAD_JSON_FILE, LOAD_NMREDATA_FILE } from '../types/Types';
|
|
6
|
+
import { INITIATE, LOAD_JSON_FILE, LOAD_NMREDATA_FILE } from '../types/Types';
|
|
7
7
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
8
8
|
import { setActiveTab } from './ToolsActions';
|
|
9
9
|
function setIsLoading(draft, isLoading) {
|
|
@@ -69,11 +69,16 @@ function setPreferences(draft, data) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
function initiate(draft, action) {
|
|
72
|
-
|
|
72
|
+
const state = getInitialState();
|
|
73
|
+
setData(state, action.payload);
|
|
73
74
|
const preferences = action.payload?.preferences || {};
|
|
74
|
-
setActiveTab(
|
|
75
|
-
setPreferences(
|
|
76
|
-
|
|
75
|
+
setActiveTab(state, { tab: preferences?.activeTab || '' });
|
|
76
|
+
setPreferences(state, action.payload);
|
|
77
|
+
state.width = draft.width;
|
|
78
|
+
state.height = draft.height;
|
|
79
|
+
state.isLoading = false;
|
|
80
|
+
state.actionType = INITIATE;
|
|
81
|
+
return state;
|
|
77
82
|
}
|
|
78
83
|
function loadJDFFile(draft, actions) {
|
|
79
84
|
const { files } = actions;
|
|
@@ -164,15 +164,8 @@ declare const preferencesReducer: (base: {
|
|
|
164
164
|
readonly dimmedSpectraTransparency: number;
|
|
165
165
|
};
|
|
166
166
|
readonly formatting: {
|
|
167
|
-
readonly
|
|
168
|
-
readonly key: string;
|
|
169
|
-
readonly name: string;
|
|
170
|
-
readonly ppm: string;
|
|
171
|
-
readonly hz: string;
|
|
172
|
-
}[];
|
|
173
|
-
readonly nucleusByKey: {
|
|
167
|
+
readonly nuclei: {
|
|
174
168
|
readonly [x: string]: {
|
|
175
|
-
readonly key: string;
|
|
176
169
|
readonly name: string;
|
|
177
170
|
readonly ppm: string;
|
|
178
171
|
readonly hz: string;
|
|
@@ -3,7 +3,7 @@ import lodashMerge from 'lodash/merge';
|
|
|
3
3
|
import generateID from '../../data/utilities/generateID';
|
|
4
4
|
import { getLocalStorage, removeData, storeData, } from '../utility/LocalStorage';
|
|
5
5
|
import Workspaces from '../workspaces';
|
|
6
|
-
const LOCAL_STORAGE_VERSION =
|
|
6
|
+
const LOCAL_STORAGE_VERSION = 6;
|
|
7
7
|
export const WORKSPACES = [
|
|
8
8
|
{
|
|
9
9
|
key: 'default',
|
|
@@ -77,16 +77,13 @@ function checkKeysExists(sourceObject, targetObject) {
|
|
|
77
77
|
}
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return { ...acc };
|
|
88
|
-
}, {});
|
|
89
|
-
}
|
|
80
|
+
function mapNucleiFormatting(formatting) {
|
|
81
|
+
const { nuclei, ...res } = formatting;
|
|
82
|
+
const _nuclei = Object.keys(nuclei).reduce((nucleusFormatting, key) => {
|
|
83
|
+
nucleusFormatting[nuclei[key].name.trim().toLowerCase()] = nuclei[key];
|
|
84
|
+
return nucleusFormatting;
|
|
85
|
+
}, {});
|
|
86
|
+
return { nuclei: _nuclei, ...res };
|
|
90
87
|
}
|
|
91
88
|
export function initPreferencesState(state) {
|
|
92
89
|
const nmrLocalStorageVersion = getLocalStorage('nmr-local-storage-version', false);
|
|
@@ -160,7 +157,8 @@ function handleInit(draft, action) {
|
|
|
160
157
|
function handleSetPreferences(draft, action) {
|
|
161
158
|
if (action.payload) {
|
|
162
159
|
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
163
|
-
|
|
160
|
+
let { controllers, formatting, display } = action.payload;
|
|
161
|
+
formatting = mapNucleiFormatting(formatting);
|
|
164
162
|
let localData = getLocalStorage('nmr-general-settings');
|
|
165
163
|
localData.currentWorkspace = draft.workspace.current;
|
|
166
164
|
localData.workspaces = {
|
|
@@ -183,7 +181,6 @@ function handleSetPreferences(draft, action) {
|
|
|
183
181
|
experimentalFeatures: display.general.experimentalFeatures,
|
|
184
182
|
},
|
|
185
183
|
};
|
|
186
|
-
mapNucleus(draft);
|
|
187
184
|
}
|
|
188
185
|
}
|
|
189
186
|
function handleSetPanelsPreferences(draft, action) {
|
|
@@ -121,3 +121,4 @@ export declare const AUTO_ZONES_SPECTRA_PICKING = "AUTO_ZONES_SPECTRA_PICKING";
|
|
|
121
121
|
export declare const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = "GENERATE_SPECTRUM_FROM_PUBLICATION_STRING";
|
|
122
122
|
export declare const RESURRECTING_SPECTRUM_FROM_RANGES = "RESURRECTING_SPECTRUM_FROM_RANGES";
|
|
123
123
|
export declare const SHOW_J_GRAPH = "SHOW_J_GRAPH";
|
|
124
|
+
export declare const SET_AUTOMATIC_ASSIGNMENTS = "SET_AUTOMATIC_ASSIGNMENTS";
|
|
@@ -115,3 +115,4 @@ export const AUTO_ZONES_SPECTRA_PICKING = 'AUTO_ZONES_SPECTRA_PICKING';
|
|
|
115
115
|
export const GENERATE_SPECTRUM_FROM_PUBLICATION_STRING = 'GENERATE_SPECTRUM_FROM_PUBLICATION_STRING';
|
|
116
116
|
export const RESURRECTING_SPECTRUM_FROM_RANGES = 'RESURRECTING_SPECTRUM_FROM_RANGES';
|
|
117
117
|
export const SHOW_J_GRAPH = 'SHOW_J_GRAPH';
|
|
118
|
+
export const SET_AUTOMATIC_ASSIGNMENTS = 'SET_AUTOMATIC_ASSIGNMENTS';
|
|
@@ -7,7 +7,7 @@ function FormatNumber(value, format, prefix = '', suffix = '') {
|
|
|
7
7
|
}
|
|
8
8
|
export function useFormatNumberByNucleus(nucleus) {
|
|
9
9
|
const preferences = usePreferences();
|
|
10
|
-
const nucleusByKey = lodashGet(preferences.current, `formatting.
|
|
10
|
+
const nucleusByKey = lodashGet(preferences.current, `formatting.nuclei`, {
|
|
11
11
|
ppm: '0.0',
|
|
12
12
|
hz: '0.0',
|
|
13
13
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NMRiumPreferences } from '../NMRium';
|
|
2
2
|
interface NucleusFormat {
|
|
3
|
-
key: string;
|
|
4
3
|
name: string;
|
|
5
4
|
ppm: string;
|
|
6
5
|
hz: string;
|
|
@@ -8,9 +7,8 @@ interface NucleusFormat {
|
|
|
8
7
|
interface Controllers {
|
|
9
8
|
dimmedSpectraTransparency: number;
|
|
10
9
|
}
|
|
11
|
-
interface Formatting {
|
|
12
|
-
|
|
13
|
-
nucleusByKey: Record<string, NucleusFormat>;
|
|
10
|
+
export interface Formatting {
|
|
11
|
+
nuclei: Record<string, NucleusFormat>;
|
|
14
12
|
panels: any;
|
|
15
13
|
}
|
|
16
14
|
export interface Workspace {
|
|
@@ -27,15 +27,14 @@ export const basic = {
|
|
|
27
27
|
dimmedSpectraTransparency: 0.1,
|
|
28
28
|
},
|
|
29
29
|
formatting: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
nucleusByKey: {},
|
|
30
|
+
nuclei: {
|
|
31
|
+
'1h': { name: '1H', ppm: '0.00', hz: '0.00' },
|
|
32
|
+
'13c': { name: '13C', ppm: '0.00', hz: '0.00' },
|
|
33
|
+
'15n': { name: '15N', ppm: '0.00', hz: '0.00' },
|
|
34
|
+
'19f': { name: '19F', ppm: '0.00', hz: '0.00' },
|
|
35
|
+
'29si': { name: '29Si', ppm: '0.00', hz: '0.00' },
|
|
36
|
+
'31p': { name: '31P', ppm: '0.00', hz: '0.00' },
|
|
37
|
+
},
|
|
39
38
|
panels: {},
|
|
40
39
|
},
|
|
41
40
|
};
|
|
@@ -29,22 +29,26 @@ export function addJcamp(spectra, jcamp, options, usedColors) {
|
|
|
29
29
|
if (entries.length === 0)
|
|
30
30
|
return;
|
|
31
31
|
// Should be improved when we have a more complex case
|
|
32
|
-
for (let
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
addJcampSS(spectra, entry, options, usedColors);
|
|
32
|
+
for (let index = 0; index < entries.length; index++) {
|
|
33
|
+
let entry = entries[index];
|
|
34
|
+
const components = entry.dependentVariables?.[0]?.components;
|
|
35
|
+
if (components && (components.length > 0 || components.z)) {
|
|
36
|
+
addJcampSS(spectra, { index, entry }, options, usedColors);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
|
-
function addJcampSS(spectra,
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
function addJcampSS(spectra, jcampDatum, options, usedColors) {
|
|
41
|
+
const source = options?.source || {};
|
|
42
|
+
if (!('jcampSpectrumIndex' in source) ||
|
|
43
|
+
source.jcampSpectrumIndex === jcampDatum.index) {
|
|
44
|
+
const dimension = jcampDatum.entry.info.dimension;
|
|
45
|
+
if (dimension === 1) {
|
|
46
|
+
spectra.push(Data1DManager.fromParsedJcamp(jcampDatum.entry, options, usedColors, jcampDatum.index));
|
|
47
|
+
}
|
|
48
|
+
if (dimension === 2) {
|
|
49
|
+
// console.log(options, jcampDatum.entry);
|
|
50
|
+
spectra.push(Data2DManager.fromParsedJcamp(jcampDatum.entry, options, usedColors, jcampDatum.index));
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
function addData(spectra, datum, usedColors) {
|
|
@@ -94,8 +98,12 @@ export async function fromJSON(data = [], usedColors = {}) {
|
|
|
94
98
|
const spectra = [];
|
|
95
99
|
let promises = [];
|
|
96
100
|
for (let datum of data) {
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
const { jcamp, jcampURL } = datum?.source || {};
|
|
102
|
+
if (jcamp != null) {
|
|
103
|
+
addJcamp(spectra, jcamp, datum, usedColors);
|
|
104
|
+
}
|
|
105
|
+
else if (jcampURL != null) {
|
|
106
|
+
promises.push(addJcampFromURL(spectra, jcampURL, datum, usedColors));
|
|
99
107
|
}
|
|
100
108
|
else {
|
|
101
109
|
addData(spectra, datum, usedColors);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function fromBruker(result: any, options?: {}, usedColors?: {}): import("../types/data1d").Datum1D;
|
|
2
2
|
export declare function fromCSD(result: any, options?: {}, usedColors?: {}): import("../types/data1d").Datum1D;
|
|
3
|
-
export declare function fromParsedJcamp(parsedJcamp: any, options: any, usedColors: any): import("../types/data1d").Datum1D;
|
|
3
|
+
export declare function fromParsedJcamp(parsedJcamp: any, options: any, usedColors: any, jcampSpectrumIndex: number): import("../types/data1d").Datum1D;
|
|
@@ -59,13 +59,14 @@ export function fromCSD(result, options = {}, usedColors = {}) {
|
|
|
59
59
|
}, usedColors);
|
|
60
60
|
return datum1D;
|
|
61
61
|
}
|
|
62
|
-
export function fromParsedJcamp(parsedJcamp, options, usedColors) {
|
|
62
|
+
export function fromParsedJcamp(parsedJcamp, options, usedColors, jcampSpectrumIndex) {
|
|
63
63
|
const { dependentVariables, info, meta } = parsedJcamp;
|
|
64
64
|
let data = getData(dependentVariables[0].components);
|
|
65
65
|
if (Array.isArray(info.nucleus))
|
|
66
66
|
info.nucleus = info.nucleus[0];
|
|
67
67
|
const datum1D = initiateDatum1D({
|
|
68
68
|
...options,
|
|
69
|
+
source: { ...options.source, jcampSpectrumIndex },
|
|
69
70
|
info,
|
|
70
71
|
meta,
|
|
71
72
|
data,
|
|
@@ -10,6 +10,7 @@ export declare function toJSON(datum1D: Datum1D, dataExportOption: DataExportOpt
|
|
|
10
10
|
meta: any;
|
|
11
11
|
source: {
|
|
12
12
|
jcampURL: null;
|
|
13
|
+
jcampSpectrumIndex?: undefined;
|
|
13
14
|
};
|
|
14
15
|
id: string;
|
|
15
16
|
display: import("../../types/data1d").Display1D;
|
|
@@ -20,6 +21,7 @@ export declare function toJSON(datum1D: Datum1D, dataExportOption: DataExportOpt
|
|
|
20
21
|
filters: import("../../FiltersManager").Filter[];
|
|
21
22
|
source: {
|
|
22
23
|
jcampURL: string;
|
|
24
|
+
jcampSpectrumIndex: number;
|
|
23
25
|
};
|
|
24
26
|
id: string;
|
|
25
27
|
display: import("../../types/data1d").Display1D;
|
|
@@ -9,8 +9,5 @@ export declare function apply(datum1D: Datum1D, zones?: never[]): void;
|
|
|
9
9
|
export declare function isApplicable(datum1D: Datum1D): boolean;
|
|
10
10
|
export declare function reduce(previousValue: any, newValue: any): {
|
|
11
11
|
once: boolean;
|
|
12
|
-
reduce:
|
|
13
|
-
from: number;
|
|
14
|
-
to: number;
|
|
15
|
-
}[];
|
|
12
|
+
reduce: import("cheminfo-types").FromTo[];
|
|
16
13
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function fromParsedJcamp(parsedJcamp: any, options: any, usedColors: any): import("../types/data2d").Datum2D;
|
|
1
|
+
export declare function fromParsedJcamp(parsedJcamp: any, options: any, usedColors: any, jcampSpectrumIndex: number): import("../types/data2d").Datum2D;
|
|
2
2
|
export declare function fromBruker(result: any, options?: {}, usedColors?: {}): import("../types/data2d").Datum2D;
|
|
3
3
|
export declare function fromCSD(result: any, options?: {}, usedColors?: {}): import("../types/data2d").Datum2D;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { initiateDatum2D } from './Spectrum2D';
|
|
2
|
-
export function fromParsedJcamp(parsedJcamp, options, usedColors) {
|
|
2
|
+
export function fromParsedJcamp(parsedJcamp, options, usedColors, jcampSpectrumIndex) {
|
|
3
3
|
const { dependentVariables, info, meta } = parsedJcamp;
|
|
4
4
|
let data = dependentVariables[0].components;
|
|
5
5
|
const ob = initiateDatum2D({
|
|
6
6
|
...options,
|
|
7
|
+
source: { ...options?.source, jcampSpectrumIndex },
|
|
7
8
|
info,
|
|
8
9
|
meta,
|
|
9
10
|
data,
|
|
@@ -9,6 +9,7 @@ export declare function toJSON(datum: Datum2D, dataExportOption: DataExportOptio
|
|
|
9
9
|
meta: any;
|
|
10
10
|
source: {
|
|
11
11
|
jcampURL: null;
|
|
12
|
+
jcampSpectrumIndex?: undefined;
|
|
12
13
|
};
|
|
13
14
|
id: string;
|
|
14
15
|
} | {
|
|
@@ -17,6 +18,7 @@ export declare function toJSON(datum: Datum2D, dataExportOption: DataExportOptio
|
|
|
17
18
|
display: import("../../types/data2d").Display2D;
|
|
18
19
|
source: {
|
|
19
20
|
jcampURL: string;
|
|
21
|
+
jcampSpectrumIndex: number;
|
|
20
22
|
};
|
|
21
23
|
id: string;
|
|
22
24
|
};
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.26.0' };
|
|
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
7
7
|
/** @jsxImportSource @emotion/react */
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const react_1 = require("react");
|
|
10
|
-
const
|
|
10
|
+
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
11
11
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
12
12
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
13
13
|
const highlight_1 = require("../../highlight");
|
|
@@ -23,7 +23,7 @@ const styles = {
|
|
|
23
23
|
strokeWidth: 1,
|
|
24
24
|
};
|
|
25
25
|
function extractID(assignment) {
|
|
26
|
-
return [assignment.id].concat(assignment.assigned
|
|
26
|
+
return [assignment.id].concat(assignment.assigned?.x || []);
|
|
27
27
|
}
|
|
28
28
|
function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
|
|
29
29
|
distance: 10,
|
|
@@ -31,7 +31,7 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
|
|
|
31
31
|
}, }) {
|
|
32
32
|
const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
|
|
33
33
|
const { data: spectraData, activeSpectrum, toolOptions: { selectedTool }, width, } = (0, ChartContext_1.useChartData)();
|
|
34
|
-
const assignment = (0,
|
|
34
|
+
const assignment = (0, AssignmentsContext_1.useAssignment)(signal.id);
|
|
35
35
|
const highlight = (0, highlight_1.useHighlight)(extractID(assignment), {
|
|
36
36
|
type: highlight_1.HighlightedSource.SIGNAL,
|
|
37
37
|
extra: extractID(assignment),
|
|
@@ -174,11 +174,11 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
|
|
|
174
174
|
? { ...styles, opacity: 1, strokeWidth: 1.5 }
|
|
175
175
|
: styles, ...{
|
|
176
176
|
onMouseEnter: () => {
|
|
177
|
-
assignment.
|
|
177
|
+
assignment.show('x');
|
|
178
178
|
highlight.show();
|
|
179
179
|
},
|
|
180
180
|
onMouseLeave: () => {
|
|
181
|
-
assignment.
|
|
181
|
+
assignment.hide();
|
|
182
182
|
highlight.hide();
|
|
183
183
|
},
|
|
184
184
|
}, ...{
|
|
@@ -189,7 +189,7 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
|
|
|
189
189
|
: (e) => {
|
|
190
190
|
if (e.shiftKey) {
|
|
191
191
|
e.stopPropagation();
|
|
192
|
-
assignment.
|
|
192
|
+
assignment.setActive('x');
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
}, children: multiplicityTree }));
|
|
@@ -8,7 +8,8 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("@emotion/react");
|
|
9
9
|
const react_2 = require("react");
|
|
10
10
|
const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
|
|
11
|
-
const
|
|
11
|
+
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
12
|
+
const filterForIDsWithAssignment_1 = require("../../assignment/utilities/filterForIDsWithAssignment");
|
|
12
13
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
13
14
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
14
15
|
const Resizer_1 = __importDefault(require("../../elements/resizer/Resizer"));
|
|
@@ -47,9 +48,9 @@ const stylesHighlighted = (0, react_1.css) `
|
|
|
47
48
|
`;
|
|
48
49
|
function Range({ rangeData, showMultiplicityTrees, selectedTool, startEditMode, }) {
|
|
49
50
|
const { id, from, to, integration, signals } = rangeData;
|
|
50
|
-
const assignmentData = (0,
|
|
51
|
-
const assignmentRange = (0,
|
|
52
|
-
const highlightRange = (0, highlight_1.useHighlight)([assignmentRange.id].concat(assignmentRange.assigned
|
|
51
|
+
const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
|
|
52
|
+
const assignmentRange = (0, AssignmentsContext_1.useAssignment)(id);
|
|
53
|
+
const highlightRange = (0, highlight_1.useHighlight)([assignmentRange.id].concat(assignmentRange.assigned?.x || []).concat((0, filterForIDsWithAssignment_1.filterForIDsWithAssignment)(assignmentData, signals.map((_signal) => _signal.id))), { type: highlight_1.HighlightedSource.RANGE, extra: { id } });
|
|
53
54
|
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
54
55
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
55
56
|
const [reduceOpacity, setReduceOpacity] = (0, react_2.useState)(false);
|
|
@@ -76,18 +77,18 @@ function Range({ rangeData, showMultiplicityTrees, selectedTool, startEditMode,
|
|
|
76
77
|
});
|
|
77
78
|
}, [dispatch, rangeData, scaleX]);
|
|
78
79
|
const mouseEnterHandler = (0, react_2.useCallback)(() => {
|
|
79
|
-
assignmentRange.
|
|
80
|
+
assignmentRange.show('x');
|
|
80
81
|
highlightRange.show();
|
|
81
82
|
}, [assignmentRange, highlightRange]);
|
|
82
83
|
const mouseLeaveHandler = (0, react_2.useCallback)(() => {
|
|
83
|
-
assignmentRange.
|
|
84
|
+
assignmentRange.hide();
|
|
84
85
|
highlightRange.hide();
|
|
85
86
|
}, [assignmentRange, highlightRange]);
|
|
86
87
|
const assignHandler = (0, react_2.useCallback)((e) => {
|
|
87
88
|
if (selectedTool === ToolTypes_1.options.rangesPicking.id &&
|
|
88
89
|
e.shiftKey &&
|
|
89
90
|
!isBlockedByEditing) {
|
|
90
|
-
assignmentRange.
|
|
91
|
+
assignmentRange.setActive('x');
|
|
91
92
|
}
|
|
92
93
|
}, [assignmentRange, isBlockedByEditing, selectedTool]);
|
|
93
94
|
return ((0, jsx_runtime_1.jsxs)("g", { "data-test-id": "range", style: { outline: 'none' }, css: isBlockedByEditing ||
|
|
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
7
7
|
/** @jsxImportSource @emotion/react */
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const Concatenation_1 = require("../../../data/utilities/Concatenation");
|
|
10
|
-
const
|
|
10
|
+
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
11
11
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
12
12
|
const highlight_1 = require("../../highlight");
|
|
13
13
|
const scale_1 = require("../utilities/scale");
|
|
@@ -19,7 +19,7 @@ const Signal = (0, react_1.memo)(({ signal, isVisible }) => {
|
|
|
19
19
|
const buildIDs = (0, react_1.useCallback)((id) => {
|
|
20
20
|
return [id].concat((0, Concatenation_1.buildID)(id, 'X'), (0, Concatenation_1.buildID)(id, 'Y'));
|
|
21
21
|
}, []);
|
|
22
|
-
const assignment = (0,
|
|
22
|
+
const assignment = (0, AssignmentsContext_1.useAssignment)(signal.id);
|
|
23
23
|
const highlight = (0, highlight_1.useHighlight)(buildIDs(assignment.id));
|
|
24
24
|
const highlightData = (0, highlight_1.useHighlightData)();
|
|
25
25
|
const [isHighlighted, setIsHighlighted] = (0, react_1.useState)(false);
|
|
@@ -39,13 +39,13 @@ const Signal = (0, react_1.memo)(({ signal, isVisible }) => {
|
|
|
39
39
|
]);
|
|
40
40
|
if (!signal)
|
|
41
41
|
return null;
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)("g", { className: "zone-signal", onMouseEnter: () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("g", { className: "zone-signal", children: [isVisible.signals && ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)(SignalCrosshair_1.default, { signal: signal }), (0, jsx_runtime_1.jsx)("circle", { onMouseEnter: () => {
|
|
43
|
+
assignment.show();
|
|
44
|
+
highlight.show();
|
|
45
|
+
}, onMouseLeave: () => {
|
|
46
|
+
assignment.hide();
|
|
47
|
+
highlight.hide();
|
|
48
|
+
}, cx: scaleX(signal.x.delta || 0), cy: scaleY(signal.y.delta || 0), r: isHighlighted ? 6 : 4, fill: isHighlighted ? 'green' : 'darkgreen' }, signal.id)] })), (0, jsx_runtime_1.jsx)("g", { className: "zone-signal-peak", style: { pointerEvents: 'none' }, children: isVisible.peaks &&
|
|
49
49
|
signal.peaks &&
|
|
50
50
|
signal.peaks.map((peak, i) => ((0, jsx_runtime_1.jsx)("circle", { cx: scaleX(peak.x), cy: scaleY(peak.y), r: 2, fill: "black" }, `${signal.id + i}`))) })] }));
|
|
51
51
|
});
|
|
@@ -8,7 +8,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("@emotion/react");
|
|
9
9
|
const react_2 = require("react");
|
|
10
10
|
const ZoneUtilities_1 = require("../../../data/utilities/ZoneUtilities");
|
|
11
|
-
const
|
|
11
|
+
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
12
12
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
13
13
|
const highlight_1 = require("../../highlight");
|
|
14
14
|
const scale_1 = require("../utilities/scale");
|
|
@@ -42,7 +42,7 @@ const stylesHighlighted = (0, react_1.css) `
|
|
|
42
42
|
`;
|
|
43
43
|
const Zone = ({ zoneData, isVisible }) => {
|
|
44
44
|
const { x, y, id, signals } = zoneData;
|
|
45
|
-
const assignmentZone = (0,
|
|
45
|
+
const assignmentZone = (0, AssignmentsContext_1.useAssignment)(id);
|
|
46
46
|
const highlightZone = (0, highlight_1.useHighlight)([assignmentZone.id], {
|
|
47
47
|
type: highlight_1.HighlightedSource.ZONE,
|
|
48
48
|
extra: { id: assignmentZone.id },
|
|
@@ -59,10 +59,10 @@ const Zone = ({ zoneData, isVisible }) => {
|
|
|
59
59
|
return ((0, jsx_runtime_1.jsxs)("g", { css: highlightZone.isActive || assignmentZone.isActive
|
|
60
60
|
? stylesHighlighted
|
|
61
61
|
: stylesOnHover, onMouseEnter: () => {
|
|
62
|
-
assignmentZone.
|
|
62
|
+
assignmentZone.show();
|
|
63
63
|
highlightZone.show();
|
|
64
64
|
}, onMouseLeave: () => {
|
|
65
|
-
assignmentZone.
|
|
65
|
+
assignmentZone.hide();
|
|
66
66
|
highlightZone.hide();
|
|
67
67
|
}, children: [isVisible.zones && ((0, jsx_runtime_1.jsx)("g", { transform: `translate(${scaleX(x2)},${scaleY(y1)})`, children: (0, jsx_runtime_1.jsx)("rect", { x: "0", width: scaleX(x1) - scaleX(x2), height: scaleY(y2) - scaleY(y1), className: "Integral-area", fill: "#0000000f", stroke: reduceOpacity ? '#343a40' : 'darkgreen', strokeWidth: reduceOpacity ? '0' : '1' }) })), signals.map((_signal, i) => ((0, jsx_runtime_1.jsx)(Signal_1.default, { signal: _signal, isVisible: isVisible }, `${id + i}`)))] }, id));
|
|
68
68
|
};
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const checkModifierKeyActivated_1 = __importDefault(require("../../data/utilities/checkModifierKeyActivated"));
|
|
8
|
-
const
|
|
8
|
+
const AssignmentsContext_1 = require("../assignment/AssignmentsContext");
|
|
9
9
|
const ChartContext_1 = require("../context/ChartContext");
|
|
10
10
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
11
11
|
const LoaderContext_1 = require("../context/LoaderContext");
|
|
@@ -24,7 +24,7 @@ function KeysListenerTracker() {
|
|
|
24
24
|
const { handleChangeOption, handleFullZoomOut, alignSpectrumsVerticallyHandler, changeDisplayViewModeHandler, } = (0, useToolsFunctions_1.default)();
|
|
25
25
|
const { saveToClipboardHandler, saveAsJSONHandler, saveAsHandler } = (0, useExport_1.default)();
|
|
26
26
|
const { highlight, remove } = (0, index_1.useHighlightData)();
|
|
27
|
-
const assignmentData = (0,
|
|
27
|
+
const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
|
|
28
28
|
const allow1DTool = (0, react_1.useMemo)(() => {
|
|
29
29
|
return displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
30
30
|
}, [data, displayerMode]);
|