nmrium 0.33.0-pre.1674059608 → 0.33.0-pre.1674466111
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/elements/formik/FormikColorPicker.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +9 -2
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +31 -4
- package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +2 -2
- package/lib/component/reducer/Reducer.js +4 -0
- package/lib/component/reducer/actions/LoadActions.js +2 -2
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +65 -3
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +40 -0
- package/lib/component/reducer/types/Types.d.ts +2 -0
- package/lib/component/reducer/types/Types.js +2 -0
- package/lib/component/workspaces/Workspace.d.ts +1 -0
- package/lib/data/PredictionManager.js +1 -1
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +3 -0
- package/lib/data/data1d/Spectrum1D/get1DColor.js +14 -0
- package/lib/data/data1d/Spectrum1D/index.d.ts +1 -0
- package/lib/data/data1d/Spectrum1D/index.js +1 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -24
- package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/get2DColor.js +17 -0
- package/lib/data/data2d/Spectrum2D/index.d.ts +1 -0
- package/lib/data/data2d/Spectrum2D/index.js +1 -0
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -17
- package/lib/data/types/data2d/Display2D.d.ts +4 -2
- package/lib/data/utilities/generateColor.d.ts +5 -0
- package/lib/data/utilities/{getColor.js → generateColor.js} +3 -3
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +8 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +30 -3
- package/lib-cjs/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +1 -1
- package/lib-cjs/component/reducer/Reducer.js +4 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -2
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +65 -1
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -0
- package/lib-cjs/component/reducer/types/Types.js +3 -1
- package/lib-cjs/data/PredictionManager.js +2 -2
- package/lib-cjs/data/data1d/Spectrum1D/get1DColor.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -27
- package/lib-cjs/data/data2d/Spectrum2D/get2DColor.js +21 -0
- package/lib-cjs/data/data2d/Spectrum2D/index.js +3 -1
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -17
- package/lib-cjs/data/utilities/{getColor.js → generateColor.js} +6 -6
- package/package.json +2 -2
- package/lib/data/utilities/getColor.d.ts +0 -9
|
@@ -3,7 +3,7 @@ import { useFormikContext } from 'formik';
|
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
4
|
import { memo } from 'react';
|
|
5
5
|
import { ColorPicker } from 'react-science/ui';
|
|
6
|
-
import { COLORS } from '../../../data/utilities/
|
|
6
|
+
import { COLORS } from '../../../data/utilities/generateColor';
|
|
7
7
|
function FormikColorPicker(props) {
|
|
8
8
|
const { onColorChange = () => null, name } = props;
|
|
9
9
|
const { values, setFieldValue } = useFormikContext();
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { SvgNmrSameTop, SvgNmrResetScale } from 'cheminfo-font';
|
|
3
3
|
import { memo, useCallback } from 'react';
|
|
4
4
|
import { FaCreativeCommonsSamplingPlus, FaEye, FaEyeSlash, } from 'react-icons/fa';
|
|
5
|
+
import { IoColorPaletteOutline } from 'react-icons/io5';
|
|
5
6
|
import { useChartData } from '../../context/ChartContext';
|
|
6
7
|
import { useDispatch } from '../../context/DispatchContext';
|
|
7
8
|
import Button from '../../elements/ButtonToolTip';
|
|
@@ -9,7 +10,7 @@ import { useAlert } from '../../elements/popup/Alert';
|
|
|
9
10
|
import { useModal } from '../../elements/popup/Modal';
|
|
10
11
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
11
12
|
import { DISPLAYER_MODE } from '../../reducer/core/Constants';
|
|
12
|
-
import { ADD_MISSING_PROJECTION, CHANGE_VISIBILITY, DELETE_SPECTRA, RESET_SPECTRA_SCALE, SET_SPECTRA_SAME_TOP, } from '../../reducer/types/Types';
|
|
13
|
+
import { ADD_MISSING_PROJECTION, CHANGE_VISIBILITY, DELETE_SPECTRA, RECOLOR_SPECTRA_COLOR, RESET_SPECTRA_SCALE, SET_SPECTRA_SAME_TOP, } from '../../reducer/types/Types';
|
|
13
14
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
14
15
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
15
16
|
import { SpectraAutomaticPickingButton } from '../header/SpectraAutomaticPickingButton';
|
|
@@ -71,7 +72,13 @@ function SpectraPanelHeaderInner({ data, activeSpectrum, activeTab, displayerMod
|
|
|
71
72
|
function resetScaleHandler() {
|
|
72
73
|
dispatch({ type: RESET_SPECTRA_SCALE });
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
function recolorSpectraHandler() {
|
|
76
|
+
dispatch({
|
|
77
|
+
type: RECOLOR_SPECTRA_COLOR,
|
|
78
|
+
payload: {},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return (_jsxs(DefaultPanelHeader, { onDelete: handleDelete, counter: spectra?.length, deleteToolTip: "Delete all spectra", showSettingButton: true, onSettingClick: onSettingClick, children: [_jsx(Button, { popupTitle: "Hide all spectra", onClick: hideAllSpectrumsHandler, children: _jsx(FaEyeSlash, {}) }), _jsx(Button, { popupTitle: "Show all spectra", onClick: showAllSpectrumsHandler, children: _jsx(FaEye, {}) }), displayerMode === DISPLAYER_MODE.DM_2D && activeSpectrum?.info.isFt && (_jsx(Button, { popupTitle: "Add missing projection", onClick: addMissingProjectionHandler, children: _jsx(FaCreativeCommonsSamplingPlus, {}) })), displayerMode === DISPLAYER_MODE.DM_1D && spectra.length > 1 && (_jsxs(_Fragment, { children: [_jsx(Button, { popupTitle: "Reset Scale", onClick: resetScaleHandler, children: _jsx(SvgNmrResetScale, {}) }), _jsx(Button, { popupTitle: "Same Top", onClick: setSameTopHandler, children: _jsx(SvgNmrSameTop, {}) })] })), _jsx(SpectraAutomaticPickingButton, {}), _jsx(Button, { popupTitle: "Recolor spectra", onClick: recolorSpectraHandler, children: _jsx(IoColorPaletteOutline, {}) })] }));
|
|
75
82
|
}
|
|
76
83
|
const MemoizedSpectraPanelHeader = memo(SpectraPanelHeaderInner);
|
|
77
84
|
export default function SpectrumsTabs({ onSettingClick, }) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
+
import { IoColorPaletteOutline } from 'react-icons/io5';
|
|
4
|
+
import { DropdownMenu } from 'react-science/ui';
|
|
3
5
|
import { useDispatch } from '../../context/DispatchContext';
|
|
4
6
|
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
5
7
|
import { useAlert } from '../../elements/popup/Alert';
|
|
6
8
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
7
|
-
import { DELETE_SPECTRA } from '../../reducer/types/Types';
|
|
9
|
+
import { DELETE_SPECTRA, ORDER_SPECTRA, RECOLOR_SPECTRA_COLOR, } from '../../reducer/types/Types';
|
|
8
10
|
import { copyTextToClipboard } from '../../utility/export';
|
|
9
11
|
import ColorIndicator from './base/ColorIndicator';
|
|
10
12
|
import ShowHideSpectrumButton from './base/ShowHideSpectrumButton';
|
|
@@ -33,6 +35,13 @@ const columnStyle = {
|
|
|
33
35
|
paddingTop: 0,
|
|
34
36
|
paddingBottom: 0,
|
|
35
37
|
};
|
|
38
|
+
const options = [
|
|
39
|
+
{
|
|
40
|
+
label: 'Recolor based on distinct value',
|
|
41
|
+
type: 'option',
|
|
42
|
+
icon: _jsx(IoColorPaletteOutline, {}),
|
|
43
|
+
},
|
|
44
|
+
];
|
|
36
45
|
export function SpectraTable(props) {
|
|
37
46
|
const { data, activeSpectrum, onChangeVisibility, onOpenSettingModal, onChangeActiveSpectrum, nucleus, } = props;
|
|
38
47
|
const alert = useAlert();
|
|
@@ -120,13 +129,14 @@ export function SpectraTable(props) {
|
|
|
120
129
|
if (name && COLUMNS[name]) {
|
|
121
130
|
columns.push({
|
|
122
131
|
...COLUMNS[name],
|
|
123
|
-
Header: col.label,
|
|
132
|
+
Header: () => _jsx(ColumnHeader, { label: col.label, col: col }),
|
|
133
|
+
id: name,
|
|
124
134
|
});
|
|
125
135
|
}
|
|
126
136
|
else {
|
|
127
137
|
const path = col?.jpath;
|
|
128
138
|
columns.push({
|
|
129
|
-
Header: col.label,
|
|
139
|
+
Header: () => _jsx(ColumnHeader, { label: col.label, col: col }),
|
|
130
140
|
accessor: path,
|
|
131
141
|
id: `${index}${path}`,
|
|
132
142
|
style: jPathColumnStyle,
|
|
@@ -137,8 +147,25 @@ export function SpectraTable(props) {
|
|
|
137
147
|
}
|
|
138
148
|
return columns;
|
|
139
149
|
}, [COLUMNS, spectraPreferences.columns]);
|
|
150
|
+
function handleSortEnd(data) {
|
|
151
|
+
dispatch({
|
|
152
|
+
type: ORDER_SPECTRA,
|
|
153
|
+
payload: {
|
|
154
|
+
data,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
140
158
|
return (_jsx(ReactTable, { rowStyle: {
|
|
141
159
|
base: activeSpectrum?.id ? { opacity: 0.2 } : {},
|
|
142
160
|
activated: { opacity: 1 },
|
|
143
|
-
}, activeRow: handleActiveRow, data: data, columns: tableColumns, onClick: (e, data) => onChangeActiveSpectrum(e, data.original), enableVirtualScroll: true, approxItemHeight: 26, context: contextMenu }));
|
|
161
|
+
}, activeRow: handleActiveRow, data: data, columns: tableColumns, onClick: (e, data) => onChangeActiveSpectrum(e, data.original), enableVirtualScroll: true, approxItemHeight: 26, context: contextMenu, onSortEnd: handleSortEnd }));
|
|
144
162
|
}
|
|
163
|
+
const ColumnHeader = ({ label, col, }) => {
|
|
164
|
+
const dispatch = useDispatch();
|
|
165
|
+
function selectHandler() {
|
|
166
|
+
if (col?.jpath) {
|
|
167
|
+
dispatch({ type: RECOLOR_SPECTRA_COLOR, payload: { jpath: col?.jpath } });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return (_jsx(DropdownMenu, { trigger: "contextMenu", options: options, onSelect: selectHandler, children: _jsx("div", { children: label }) }));
|
|
171
|
+
};
|
|
@@ -34,7 +34,7 @@ export function SpectraColumnsManager({ nucleus, onAdd, onDelete, datalist, }) {
|
|
|
34
34
|
Cell: ({ row }) => {
|
|
35
35
|
const column = row.original;
|
|
36
36
|
if (column?.name) {
|
|
37
|
-
return _jsx("span", { style: style, children: column?.description });
|
|
37
|
+
return (_jsx("span", { style: style, children: column?.jpath || column.description }));
|
|
38
38
|
}
|
|
39
39
|
return (_jsx(FormikInput, { name: `nuclei.${nucleus}.columns.${row.index}.jpath`, style: { input: { ...style, ...inputStyle } }, datalist: datalist }));
|
|
40
40
|
},
|
|
@@ -833,8 +833,6 @@ export declare const spectrumReducer: (base: {
|
|
|
833
833
|
};
|
|
834
834
|
readonly display: {
|
|
835
835
|
readonly name: string;
|
|
836
|
-
readonly positiveColor: string;
|
|
837
|
-
readonly negativeColor: string;
|
|
838
836
|
readonly isVisible: boolean;
|
|
839
837
|
readonly isPositiveVisible: boolean;
|
|
840
838
|
readonly isNegativeVisible: boolean;
|
|
@@ -848,6 +846,8 @@ export declare const spectrumReducer: (base: {
|
|
|
848
846
|
readonly numberOfLayers: number;
|
|
849
847
|
};
|
|
850
848
|
};
|
|
849
|
+
readonly positiveColor: string;
|
|
850
|
+
readonly negativeColor: string;
|
|
851
851
|
};
|
|
852
852
|
readonly info: {
|
|
853
853
|
readonly nucleus: readonly string[];
|
|
@@ -274,6 +274,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
274
274
|
return SpectrumsActions.importSpectraMetaInfo(draft, action);
|
|
275
275
|
case types.TOGGLE_SPECTRA_LEGEND:
|
|
276
276
|
return SpectrumsActions.handleToggleSpectraLegend(draft);
|
|
277
|
+
case types.RECOLOR_SPECTRA_COLOR:
|
|
278
|
+
return SpectrumsActions.handleRecolorSpectraBasedOnDistinctValue(draft, action);
|
|
279
|
+
case types.ORDER_SPECTRA:
|
|
280
|
+
return SpectrumsActions.handleOrderSpectra(draft, action);
|
|
277
281
|
case types.TOGGLE_REAL_IMAGINARY_VISIBILITY:
|
|
278
282
|
return ToolsActions.handleToggleRealImaginaryVisibility(draft);
|
|
279
283
|
case types.SET_ZOOM:
|
|
@@ -94,7 +94,7 @@ function initData(draft, action) {
|
|
|
94
94
|
state.height = draft.height;
|
|
95
95
|
setPreferences(state, data?.preferences);
|
|
96
96
|
state.isLoading = false;
|
|
97
|
-
state.actionType = action.
|
|
97
|
+
state.actionType = action.type;
|
|
98
98
|
return state;
|
|
99
99
|
}
|
|
100
100
|
function initiate(draft, action) {
|
|
@@ -114,7 +114,7 @@ function loadDropFiles(draft, action) {
|
|
|
114
114
|
setData(draft, action.payload);
|
|
115
115
|
setActiveTab(draft);
|
|
116
116
|
changeSpectrumVerticalAlignment(draft, { align: 'auto-check' });
|
|
117
|
-
draft.actionType = action.
|
|
117
|
+
draft.actionType = action.type;
|
|
118
118
|
draft.isLoading = false;
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateSpectra } from '../../../data/PredictionManager';
|
|
2
2
|
import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
3
3
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
4
|
-
import
|
|
4
|
+
import { generateColor } from '../../../data/utilities/generateColor';
|
|
5
5
|
import { DRAGGABLE_STRUCTURE_INITIAL_POSITION } from '../../1d-2d/components/FloatMoleculeStructures/DraggableStructure';
|
|
6
6
|
import nucleusToString from '../../utility/nucleusToString';
|
|
7
7
|
import { DISPLAYER_MODE } from '../core/Constants';
|
|
@@ -62,7 +62,7 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
62
62
|
draft.isLoading = false;
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
|
-
const color =
|
|
65
|
+
const color = generateColor(false, draft.usedColors['1d']);
|
|
66
66
|
for (const spectrum of generateSpectra(data, options, color)) {
|
|
67
67
|
draft.data.push(spectrum);
|
|
68
68
|
draft.view.spectra.activeSpectra[nucleusToString(spectrum.info.nucleus)] =
|
|
@@ -17,4 +17,6 @@ declare function alignSpectraHandler(draft: Draft<State>, action: any): void;
|
|
|
17
17
|
declare function generateSpectrumFromPublicationStringHandler(draft: Draft<State>, action: any): void;
|
|
18
18
|
declare function importSpectraMetaInfo(draft: Draft<State>, action: any): void;
|
|
19
19
|
declare function handleToggleSpectraLegend(draft: Draft<State>): void;
|
|
20
|
-
|
|
20
|
+
declare function handleRecolorSpectraBasedOnDistinctValue(draft: Draft<State>, action: any): void;
|
|
21
|
+
declare function handleOrderSpectra(draft: Draft<State>, action: any): void;
|
|
22
|
+
export { handleSpectrumVisibility, handleChangeActiveSpectrum, handleChangeSpectrumColor, changeSpectrumSetting, handleDeleteSpectra, addMissingProjectionHandler, alignSpectraHandler, generateSpectrumFromPublicationStringHandler, importSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { original } from 'immer';
|
|
2
|
+
import lodashGet from 'lodash/get';
|
|
2
3
|
import * as Filters from '../../../data/Filters';
|
|
3
4
|
import { applyFilter } from '../../../data/FiltersManager';
|
|
4
|
-
import { generateSpectrumFromPublicationString, getReferenceShift, } from '../../../data/data1d/Spectrum1D';
|
|
5
|
-
import { getMissingProjection, isSpectrum2D, } from '../../../data/data2d/Spectrum2D';
|
|
5
|
+
import { generateSpectrumFromPublicationString, getReferenceShift, isSpectrum1D, get1DColor, } from '../../../data/data1d/Spectrum1D';
|
|
6
|
+
import { getMissingProjection, isSpectrum2D, get2DColor, } from '../../../data/data2d/Spectrum2D';
|
|
6
7
|
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
7
8
|
import { options } from '../../toolbar/ToolTypes';
|
|
8
9
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
9
10
|
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
11
|
+
import { jpathToArray } from '../../utility/jpathToArray';
|
|
10
12
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
11
13
|
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
12
14
|
import { setDomain, setMode } from './DomainActions';
|
|
@@ -190,4 +192,64 @@ function importSpectraMetaInfo(draft, action) {
|
|
|
190
192
|
function handleToggleSpectraLegend(draft) {
|
|
191
193
|
draft.view.spectra.showLegend = !draft.view.spectra.showLegend;
|
|
192
194
|
}
|
|
193
|
-
|
|
195
|
+
function handleRecolorSpectraBasedOnDistinctValue(draft, action) {
|
|
196
|
+
const { data, view: { spectra: { activeTab }, }, } = draft;
|
|
197
|
+
const { jpath = null } = action.payload;
|
|
198
|
+
const spectra = getSpectraByNucleus(activeTab, data);
|
|
199
|
+
if (jpath) {
|
|
200
|
+
//recolor spectra based on distinct value
|
|
201
|
+
const spectraByClass = {};
|
|
202
|
+
for (const spectrum of spectra) {
|
|
203
|
+
const key = String(lodashGet(spectrum, jpathToArray(jpath), ''))
|
|
204
|
+
.toLowerCase()
|
|
205
|
+
.trim()
|
|
206
|
+
.replace(/\r?\n|\r/, '');
|
|
207
|
+
if (spectraByClass[key]) {
|
|
208
|
+
if (isSpectrum1D(spectrum)) {
|
|
209
|
+
spectrum.display.color = spectraByClass[key].display.color;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
spectrum.display.positiveColor = spectraByClass[key].display.positiveColor;
|
|
213
|
+
spectrum.display.negativeColor = spectraByClass[key].display.negativeColor;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
spectraByClass[key] = spectrum;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
//reset spectra colors
|
|
223
|
+
const usedColor = { '1d': [], '2d': [] };
|
|
224
|
+
for (const spectrum of spectra) {
|
|
225
|
+
if (isSpectrum1D(spectrum)) {
|
|
226
|
+
spectrum.display.color = get1DColor(spectrum, usedColor, true).color;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
const { positiveColor, negativeColor } = get2DColor(spectrum, usedColor, true);
|
|
230
|
+
spectrum.display.positiveColor = positiveColor;
|
|
231
|
+
spectrum.display.negativeColor = negativeColor;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function handleOrderSpectra(draft, action) {
|
|
237
|
+
const { data } = action.payload;
|
|
238
|
+
const spectraIndexes = {};
|
|
239
|
+
let index = 0;
|
|
240
|
+
for (const spectrum of draft.data) {
|
|
241
|
+
spectraIndexes[spectrum.id] = index;
|
|
242
|
+
index++;
|
|
243
|
+
}
|
|
244
|
+
const sortedSpectraKey = {};
|
|
245
|
+
const sortedSpectra = [];
|
|
246
|
+
for (const spectrum of data) {
|
|
247
|
+
const spectrumId = spectrum.id;
|
|
248
|
+
sortedSpectraKey[spectrumId] = true;
|
|
249
|
+
sortedSpectra.push(draft.data[spectraIndexes[spectrumId]]);
|
|
250
|
+
}
|
|
251
|
+
draft.data = draft.data
|
|
252
|
+
.filter((s) => !sortedSpectraKey[s.id])
|
|
253
|
+
.concat(sortedSpectra);
|
|
254
|
+
}
|
|
255
|
+
export { handleSpectrumVisibility, handleChangeActiveSpectrum, handleChangeSpectrumColor, changeSpectrumSetting, handleDeleteSpectra, addMissingProjectionHandler, alignSpectraHandler, generateSpectrumFromPublicationStringHandler, importSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, };
|
|
@@ -14,12 +14,14 @@ const getSpectraDefaultValues = (nucleus) => {
|
|
|
14
14
|
name: 'name',
|
|
15
15
|
label: 'Spectrum Name',
|
|
16
16
|
description: 'Spectrum Name',
|
|
17
|
+
jpath: 'display.name',
|
|
17
18
|
visible: true,
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
21
|
name: 'solvent',
|
|
21
22
|
label: 'Solvent',
|
|
22
23
|
description: 'Solvent',
|
|
24
|
+
jpath: 'display.solvent',
|
|
23
25
|
visible: true,
|
|
24
26
|
},
|
|
25
27
|
{
|
|
@@ -209,6 +209,7 @@ declare const preferencesReducer: (base: {
|
|
|
209
209
|
readonly columns: readonly ({
|
|
210
210
|
readonly name: import("../../workspaces/Workspace").PredefinedSpectraColumn;
|
|
211
211
|
readonly description: string;
|
|
212
|
+
readonly jpath?: string | undefined;
|
|
212
213
|
readonly visible: boolean;
|
|
213
214
|
readonly label: string;
|
|
214
215
|
} | {
|
|
@@ -371,6 +372,7 @@ declare const preferencesReducer: (base: {
|
|
|
371
372
|
readonly label: string;
|
|
372
373
|
readonly name: "name" | "intensity";
|
|
373
374
|
readonly visible: boolean;
|
|
375
|
+
readonly jpath?: string | undefined;
|
|
374
376
|
})[];
|
|
375
377
|
};
|
|
376
378
|
readonly "1H": {
|
|
@@ -397,6 +399,7 @@ declare const preferencesReducer: (base: {
|
|
|
397
399
|
readonly label: string;
|
|
398
400
|
readonly name: "name" | "intensity";
|
|
399
401
|
readonly visible: boolean;
|
|
402
|
+
readonly jpath?: string | undefined;
|
|
400
403
|
})[];
|
|
401
404
|
};
|
|
402
405
|
readonly "13C": {
|
|
@@ -423,6 +426,7 @@ declare const preferencesReducer: (base: {
|
|
|
423
426
|
readonly label: string;
|
|
424
427
|
readonly name: "name" | "intensity";
|
|
425
428
|
readonly visible: boolean;
|
|
429
|
+
readonly jpath?: string | undefined;
|
|
426
430
|
})[];
|
|
427
431
|
};
|
|
428
432
|
readonly "2H": {
|
|
@@ -449,6 +453,7 @@ declare const preferencesReducer: (base: {
|
|
|
449
453
|
readonly label: string;
|
|
450
454
|
readonly name: "name" | "intensity";
|
|
451
455
|
readonly visible: boolean;
|
|
456
|
+
readonly jpath?: string | undefined;
|
|
452
457
|
})[];
|
|
453
458
|
};
|
|
454
459
|
readonly "3H": {
|
|
@@ -475,6 +480,7 @@ declare const preferencesReducer: (base: {
|
|
|
475
480
|
readonly label: string;
|
|
476
481
|
readonly name: "name" | "intensity";
|
|
477
482
|
readonly visible: boolean;
|
|
483
|
+
readonly jpath?: string | undefined;
|
|
478
484
|
})[];
|
|
479
485
|
};
|
|
480
486
|
readonly "3He": {
|
|
@@ -501,6 +507,7 @@ declare const preferencesReducer: (base: {
|
|
|
501
507
|
readonly label: string;
|
|
502
508
|
readonly name: "name" | "intensity";
|
|
503
509
|
readonly visible: boolean;
|
|
510
|
+
readonly jpath?: string | undefined;
|
|
504
511
|
})[];
|
|
505
512
|
};
|
|
506
513
|
readonly "7Li": {
|
|
@@ -527,6 +534,7 @@ declare const preferencesReducer: (base: {
|
|
|
527
534
|
readonly label: string;
|
|
528
535
|
readonly name: "name" | "intensity";
|
|
529
536
|
readonly visible: boolean;
|
|
537
|
+
readonly jpath?: string | undefined;
|
|
530
538
|
})[];
|
|
531
539
|
};
|
|
532
540
|
readonly "14N": {
|
|
@@ -553,6 +561,7 @@ declare const preferencesReducer: (base: {
|
|
|
553
561
|
readonly label: string;
|
|
554
562
|
readonly name: "name" | "intensity";
|
|
555
563
|
readonly visible: boolean;
|
|
564
|
+
readonly jpath?: string | undefined;
|
|
556
565
|
})[];
|
|
557
566
|
};
|
|
558
567
|
readonly "15N": {
|
|
@@ -579,6 +588,7 @@ declare const preferencesReducer: (base: {
|
|
|
579
588
|
readonly label: string;
|
|
580
589
|
readonly name: "name" | "intensity";
|
|
581
590
|
readonly visible: boolean;
|
|
591
|
+
readonly jpath?: string | undefined;
|
|
582
592
|
})[];
|
|
583
593
|
};
|
|
584
594
|
readonly "17O": {
|
|
@@ -605,6 +615,7 @@ declare const preferencesReducer: (base: {
|
|
|
605
615
|
readonly label: string;
|
|
606
616
|
readonly name: "name" | "intensity";
|
|
607
617
|
readonly visible: boolean;
|
|
618
|
+
readonly jpath?: string | undefined;
|
|
608
619
|
})[];
|
|
609
620
|
};
|
|
610
621
|
readonly "19F": {
|
|
@@ -631,6 +642,7 @@ declare const preferencesReducer: (base: {
|
|
|
631
642
|
readonly label: string;
|
|
632
643
|
readonly name: "name" | "intensity";
|
|
633
644
|
readonly visible: boolean;
|
|
645
|
+
readonly jpath?: string | undefined;
|
|
634
646
|
})[];
|
|
635
647
|
};
|
|
636
648
|
readonly "23Na": {
|
|
@@ -657,6 +669,7 @@ declare const preferencesReducer: (base: {
|
|
|
657
669
|
readonly label: string;
|
|
658
670
|
readonly name: "name" | "intensity";
|
|
659
671
|
readonly visible: boolean;
|
|
672
|
+
readonly jpath?: string | undefined;
|
|
660
673
|
})[];
|
|
661
674
|
};
|
|
662
675
|
readonly "27Al": {
|
|
@@ -683,6 +696,7 @@ declare const preferencesReducer: (base: {
|
|
|
683
696
|
readonly label: string;
|
|
684
697
|
readonly name: "name" | "intensity";
|
|
685
698
|
readonly visible: boolean;
|
|
699
|
+
readonly jpath?: string | undefined;
|
|
686
700
|
})[];
|
|
687
701
|
};
|
|
688
702
|
readonly "29Si": {
|
|
@@ -709,6 +723,7 @@ declare const preferencesReducer: (base: {
|
|
|
709
723
|
readonly label: string;
|
|
710
724
|
readonly name: "name" | "intensity";
|
|
711
725
|
readonly visible: boolean;
|
|
726
|
+
readonly jpath?: string | undefined;
|
|
712
727
|
})[];
|
|
713
728
|
};
|
|
714
729
|
readonly "31P": {
|
|
@@ -735,6 +750,7 @@ declare const preferencesReducer: (base: {
|
|
|
735
750
|
readonly label: string;
|
|
736
751
|
readonly name: "name" | "intensity";
|
|
737
752
|
readonly visible: boolean;
|
|
753
|
+
readonly jpath?: string | undefined;
|
|
738
754
|
})[];
|
|
739
755
|
};
|
|
740
756
|
readonly "57Fe": {
|
|
@@ -761,6 +777,7 @@ declare const preferencesReducer: (base: {
|
|
|
761
777
|
readonly label: string;
|
|
762
778
|
readonly name: "name" | "intensity";
|
|
763
779
|
readonly visible: boolean;
|
|
780
|
+
readonly jpath?: string | undefined;
|
|
764
781
|
})[];
|
|
765
782
|
};
|
|
766
783
|
readonly "63Cu": {
|
|
@@ -787,6 +804,7 @@ declare const preferencesReducer: (base: {
|
|
|
787
804
|
readonly label: string;
|
|
788
805
|
readonly name: "name" | "intensity";
|
|
789
806
|
readonly visible: boolean;
|
|
807
|
+
readonly jpath?: string | undefined;
|
|
790
808
|
})[];
|
|
791
809
|
};
|
|
792
810
|
readonly "67Zn": {
|
|
@@ -813,6 +831,7 @@ declare const preferencesReducer: (base: {
|
|
|
813
831
|
readonly label: string;
|
|
814
832
|
readonly name: "name" | "intensity";
|
|
815
833
|
readonly visible: boolean;
|
|
834
|
+
readonly jpath?: string | undefined;
|
|
816
835
|
})[];
|
|
817
836
|
};
|
|
818
837
|
readonly "129Xe": {
|
|
@@ -839,6 +858,7 @@ declare const preferencesReducer: (base: {
|
|
|
839
858
|
readonly label: string;
|
|
840
859
|
readonly name: "name" | "intensity";
|
|
841
860
|
readonly visible: boolean;
|
|
861
|
+
readonly jpath?: string | undefined;
|
|
842
862
|
})[];
|
|
843
863
|
};
|
|
844
864
|
} | undefined;
|
|
@@ -2874,6 +2894,7 @@ declare const preferencesReducer: (base: {
|
|
|
2874
2894
|
readonly columns: readonly ({
|
|
2875
2895
|
readonly name: import("../../workspaces/Workspace").PredefinedSpectraColumn;
|
|
2876
2896
|
readonly description: string;
|
|
2897
|
+
readonly jpath?: string | undefined;
|
|
2877
2898
|
readonly visible: boolean;
|
|
2878
2899
|
readonly label: string;
|
|
2879
2900
|
} | {
|
|
@@ -3036,6 +3057,7 @@ declare const preferencesReducer: (base: {
|
|
|
3036
3057
|
readonly label: string;
|
|
3037
3058
|
readonly name: "name" | "intensity";
|
|
3038
3059
|
readonly visible: boolean;
|
|
3060
|
+
readonly jpath?: string | undefined;
|
|
3039
3061
|
})[];
|
|
3040
3062
|
};
|
|
3041
3063
|
readonly "1H": {
|
|
@@ -3062,6 +3084,7 @@ declare const preferencesReducer: (base: {
|
|
|
3062
3084
|
readonly label: string;
|
|
3063
3085
|
readonly name: "name" | "intensity";
|
|
3064
3086
|
readonly visible: boolean;
|
|
3087
|
+
readonly jpath?: string | undefined;
|
|
3065
3088
|
})[];
|
|
3066
3089
|
};
|
|
3067
3090
|
readonly "13C": {
|
|
@@ -3088,6 +3111,7 @@ declare const preferencesReducer: (base: {
|
|
|
3088
3111
|
readonly label: string;
|
|
3089
3112
|
readonly name: "name" | "intensity";
|
|
3090
3113
|
readonly visible: boolean;
|
|
3114
|
+
readonly jpath?: string | undefined;
|
|
3091
3115
|
})[];
|
|
3092
3116
|
};
|
|
3093
3117
|
readonly "2H": {
|
|
@@ -3114,6 +3138,7 @@ declare const preferencesReducer: (base: {
|
|
|
3114
3138
|
readonly label: string;
|
|
3115
3139
|
readonly name: "name" | "intensity";
|
|
3116
3140
|
readonly visible: boolean;
|
|
3141
|
+
readonly jpath?: string | undefined;
|
|
3117
3142
|
})[];
|
|
3118
3143
|
};
|
|
3119
3144
|
readonly "3H": {
|
|
@@ -3140,6 +3165,7 @@ declare const preferencesReducer: (base: {
|
|
|
3140
3165
|
readonly label: string;
|
|
3141
3166
|
readonly name: "name" | "intensity";
|
|
3142
3167
|
readonly visible: boolean;
|
|
3168
|
+
readonly jpath?: string | undefined;
|
|
3143
3169
|
})[];
|
|
3144
3170
|
};
|
|
3145
3171
|
readonly "3He": {
|
|
@@ -3166,6 +3192,7 @@ declare const preferencesReducer: (base: {
|
|
|
3166
3192
|
readonly label: string;
|
|
3167
3193
|
readonly name: "name" | "intensity";
|
|
3168
3194
|
readonly visible: boolean;
|
|
3195
|
+
readonly jpath?: string | undefined;
|
|
3169
3196
|
})[];
|
|
3170
3197
|
};
|
|
3171
3198
|
readonly "7Li": {
|
|
@@ -3192,6 +3219,7 @@ declare const preferencesReducer: (base: {
|
|
|
3192
3219
|
readonly label: string;
|
|
3193
3220
|
readonly name: "name" | "intensity";
|
|
3194
3221
|
readonly visible: boolean;
|
|
3222
|
+
readonly jpath?: string | undefined;
|
|
3195
3223
|
})[];
|
|
3196
3224
|
};
|
|
3197
3225
|
readonly "14N": {
|
|
@@ -3218,6 +3246,7 @@ declare const preferencesReducer: (base: {
|
|
|
3218
3246
|
readonly label: string;
|
|
3219
3247
|
readonly name: "name" | "intensity";
|
|
3220
3248
|
readonly visible: boolean;
|
|
3249
|
+
readonly jpath?: string | undefined;
|
|
3221
3250
|
})[];
|
|
3222
3251
|
};
|
|
3223
3252
|
readonly "15N": {
|
|
@@ -3244,6 +3273,7 @@ declare const preferencesReducer: (base: {
|
|
|
3244
3273
|
readonly label: string;
|
|
3245
3274
|
readonly name: "name" | "intensity";
|
|
3246
3275
|
readonly visible: boolean;
|
|
3276
|
+
readonly jpath?: string | undefined;
|
|
3247
3277
|
})[];
|
|
3248
3278
|
};
|
|
3249
3279
|
readonly "17O": {
|
|
@@ -3270,6 +3300,7 @@ declare const preferencesReducer: (base: {
|
|
|
3270
3300
|
readonly label: string;
|
|
3271
3301
|
readonly name: "name" | "intensity";
|
|
3272
3302
|
readonly visible: boolean;
|
|
3303
|
+
readonly jpath?: string | undefined;
|
|
3273
3304
|
})[];
|
|
3274
3305
|
};
|
|
3275
3306
|
readonly "19F": {
|
|
@@ -3296,6 +3327,7 @@ declare const preferencesReducer: (base: {
|
|
|
3296
3327
|
readonly label: string;
|
|
3297
3328
|
readonly name: "name" | "intensity";
|
|
3298
3329
|
readonly visible: boolean;
|
|
3330
|
+
readonly jpath?: string | undefined;
|
|
3299
3331
|
})[];
|
|
3300
3332
|
};
|
|
3301
3333
|
readonly "23Na": {
|
|
@@ -3322,6 +3354,7 @@ declare const preferencesReducer: (base: {
|
|
|
3322
3354
|
readonly label: string;
|
|
3323
3355
|
readonly name: "name" | "intensity";
|
|
3324
3356
|
readonly visible: boolean;
|
|
3357
|
+
readonly jpath?: string | undefined;
|
|
3325
3358
|
})[];
|
|
3326
3359
|
};
|
|
3327
3360
|
readonly "27Al": {
|
|
@@ -3348,6 +3381,7 @@ declare const preferencesReducer: (base: {
|
|
|
3348
3381
|
readonly label: string;
|
|
3349
3382
|
readonly name: "name" | "intensity";
|
|
3350
3383
|
readonly visible: boolean;
|
|
3384
|
+
readonly jpath?: string | undefined;
|
|
3351
3385
|
})[];
|
|
3352
3386
|
};
|
|
3353
3387
|
readonly "29Si": {
|
|
@@ -3374,6 +3408,7 @@ declare const preferencesReducer: (base: {
|
|
|
3374
3408
|
readonly label: string;
|
|
3375
3409
|
readonly name: "name" | "intensity";
|
|
3376
3410
|
readonly visible: boolean;
|
|
3411
|
+
readonly jpath?: string | undefined;
|
|
3377
3412
|
})[];
|
|
3378
3413
|
};
|
|
3379
3414
|
readonly "31P": {
|
|
@@ -3400,6 +3435,7 @@ declare const preferencesReducer: (base: {
|
|
|
3400
3435
|
readonly label: string;
|
|
3401
3436
|
readonly name: "name" | "intensity";
|
|
3402
3437
|
readonly visible: boolean;
|
|
3438
|
+
readonly jpath?: string | undefined;
|
|
3403
3439
|
})[];
|
|
3404
3440
|
};
|
|
3405
3441
|
readonly "57Fe": {
|
|
@@ -3426,6 +3462,7 @@ declare const preferencesReducer: (base: {
|
|
|
3426
3462
|
readonly label: string;
|
|
3427
3463
|
readonly name: "name" | "intensity";
|
|
3428
3464
|
readonly visible: boolean;
|
|
3465
|
+
readonly jpath?: string | undefined;
|
|
3429
3466
|
})[];
|
|
3430
3467
|
};
|
|
3431
3468
|
readonly "63Cu": {
|
|
@@ -3452,6 +3489,7 @@ declare const preferencesReducer: (base: {
|
|
|
3452
3489
|
readonly label: string;
|
|
3453
3490
|
readonly name: "name" | "intensity";
|
|
3454
3491
|
readonly visible: boolean;
|
|
3492
|
+
readonly jpath?: string | undefined;
|
|
3455
3493
|
})[];
|
|
3456
3494
|
};
|
|
3457
3495
|
readonly "67Zn": {
|
|
@@ -3478,6 +3516,7 @@ declare const preferencesReducer: (base: {
|
|
|
3478
3516
|
readonly label: string;
|
|
3479
3517
|
readonly name: "name" | "intensity";
|
|
3480
3518
|
readonly visible: boolean;
|
|
3519
|
+
readonly jpath?: string | undefined;
|
|
3481
3520
|
})[];
|
|
3482
3521
|
};
|
|
3483
3522
|
readonly "129Xe": {
|
|
@@ -3504,6 +3543,7 @@ declare const preferencesReducer: (base: {
|
|
|
3504
3543
|
readonly label: string;
|
|
3505
3544
|
readonly name: "name" | "intensity";
|
|
3506
3545
|
readonly visible: boolean;
|
|
3546
|
+
readonly jpath?: string | undefined;
|
|
3507
3547
|
})[];
|
|
3508
3548
|
};
|
|
3509
3549
|
} | undefined;
|
|
@@ -136,3 +136,5 @@ export declare const ORDER_MULTIPLE_SPECTRA_ANALYSIS = "ORDER_MULTIPLE_SPECTRA_A
|
|
|
136
136
|
export declare const APPLY_SIGNAL_PROCESSING_FILTER = "APPLY_SIGNAL_PROCESSING_FILTER";
|
|
137
137
|
export declare const IMPORT_SPECTRA_META_INFO = "IMPORT_SPECTRA_META_INFO";
|
|
138
138
|
export declare const TOGGLE_SPECTRA_LEGEND = "TOGGLE_SPECTRA_LEGEND";
|
|
139
|
+
export declare const RECOLOR_SPECTRA_COLOR = "RECOLOR_SPECTRA_COLOR";
|
|
140
|
+
export declare const ORDER_SPECTRA = "ORDER_SPECTRA";
|
|
@@ -130,3 +130,5 @@ export const ORDER_MULTIPLE_SPECTRA_ANALYSIS = 'ORDER_MULTIPLE_SPECTRA_ANALYSIS'
|
|
|
130
130
|
export const APPLY_SIGNAL_PROCESSING_FILTER = 'APPLY_SIGNAL_PROCESSING_FILTER';
|
|
131
131
|
export const IMPORT_SPECTRA_META_INFO = 'IMPORT_SPECTRA_META_INFO';
|
|
132
132
|
export const TOGGLE_SPECTRA_LEGEND = 'TOGGLE_SPECTRA_LEGEND';
|
|
133
|
+
export const RECOLOR_SPECTRA_COLOR = 'RECOLOR_SPECTRA_COLOR';
|
|
134
|
+
export const ORDER_SPECTRA = 'ORDER_SPECTRA';
|
|
@@ -38,6 +38,7 @@ export type PredefinedSpectraColumn = 'visible' | 'name' | 'color' | 'solvent';
|
|
|
38
38
|
export interface PredefinedTableColumn<T> extends BasicColumnPreferences {
|
|
39
39
|
name: T;
|
|
40
40
|
description: string;
|
|
41
|
+
jpath?: string;
|
|
41
42
|
}
|
|
42
43
|
export interface JpathTableColumn extends BasicColumnPreferences {
|
|
43
44
|
jpath: string;
|
|
@@ -4,7 +4,7 @@ import OCL from 'openchemlib/full';
|
|
|
4
4
|
import { DatumKind } from './constants/SignalsKinds';
|
|
5
5
|
import { initiateDatum1D, mapRanges, updateIntegralsRelativeValues, } from './data1d/Spectrum1D';
|
|
6
6
|
import { initiateDatum2D } from './data2d/Spectrum2D';
|
|
7
|
-
import { adjustAlpha } from './utilities/
|
|
7
|
+
import { adjustAlpha } from './utilities/generateColor';
|
|
8
8
|
export const defaultPredictionOptions = {
|
|
9
9
|
name: '',
|
|
10
10
|
frequency: 400,
|