nmrium 0.28.0 → 0.29.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/database/DatabaseSpectrum.js +9 -6
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +8 -6
- package/lib/component/2d/Contours.js +8 -8
- package/lib/component/context/PreferencesContext.d.ts +0 -2
- package/lib/component/elements/CheckBox.js +1 -1
- package/lib/component/elements/CheckBoxCell.d.ts +3 -0
- package/lib/component/elements/CheckBoxCell.js +8 -0
- package/lib/component/elements/formik/FormikCheckBox.d.ts +2 -1
- package/lib/component/elements/formik/FormikCheckBox.js +4 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +6 -5
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +2 -2
- package/lib/component/modal/setting/DatabasesTabContent.js +3 -3
- package/lib/component/modal/setting/DisplayTabContent.d.ts +1 -5
- package/lib/component/modal/setting/DisplayTabContent.js +5 -14
- package/lib/component/modal/setting/GeneralSettings.js +19 -12
- package/lib/component/modal/setting/GeneralTabContent.d.ts +3 -0
- package/lib/component/modal/setting/{ControllersTabContent.js → GeneralTabContent.js} +3 -3
- package/lib/component/modal/setting/ToolsTabContent.d.ts +3 -0
- package/lib/component/modal/setting/ToolsTabContent.js +100 -0
- package/lib/component/panels/Panels.js +7 -4
- package/lib/component/panels/databasePanel/DatabasePanel.js +2 -2
- package/lib/component/reducer/actions/FiltersActions.js +11 -8
- package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib/component/reducer/preferences/actions/initPreferences.js +4 -4
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +1 -1
- package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +13 -16
- package/lib/component/reducer/preferences/actions/setWorkspace.js +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -44
- package/lib/component/reducer/preferences/preferencesReducer.js +0 -3
- package/lib/component/reducer/preferences/{utilites → utilities}/checkKeysExists.d.ts +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/checkKeysExists.js +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/filterObject.d.ts +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/filterObject.js +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/flatObject.d.ts +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/flatObject.js +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/getActiveWorkspace.d.ts +2 -1
- package/lib/component/reducer/preferences/{utilites → utilities}/getActiveWorkspace.js +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/getPreferencesByWorkspace.d.ts +2 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.js +6 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/mapNucleiFormatting.d.ts +0 -0
- package/lib/component/reducer/preferences/{utilites → utilities}/mapNucleiFormatting.js +0 -0
- package/lib/component/utility/Evaluate.js +1 -0
- package/lib/component/workspaces/Workspace.d.ts +12 -8
- package/lib/component/workspaces/basic.d.ts +2 -2
- package/lib/component/workspaces/basic.js +18 -39
- package/lib/component/workspaces/embedded.d.ts +2 -2
- package/lib/component/workspaces/embedded.js +19 -12
- package/lib/component/workspaces/exercise.d.ts +2 -2
- package/lib/component/workspaces/exercise.js +4 -33
- package/lib/component/workspaces/index.d.ts +5 -5
- package/lib/component/workspaces/prediction.d.ts +2 -2
- package/lib/component/workspaces/prediction.js +19 -16
- package/lib/component/workspaces/process1D.d.ts +2 -2
- package/lib/component/workspaces/process1D.js +12 -18
- package/lib/component/workspaces/workspaceDefaultProperties.d.ts +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +71 -0
- package/lib/data/data1d/MultipleAnalysis.js +1 -0
- package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.js +1 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +11 -12
- package/lib/data/data1d/database.js +3 -10
- package/lib/data/data1d/filter1d/autoPhaseCorrection.js +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +14 -10
- package/lib/types/PanelPreferencesType.d.ts +1 -7
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +9 -6
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +8 -6
- package/lib-cjs/component/2d/Contours.js +8 -8
- package/lib-cjs/component/elements/CheckBox.js +1 -1
- package/lib-cjs/component/elements/CheckBoxCell.js +15 -0
- package/lib-cjs/component/elements/formik/FormikCheckBox.js +4 -2
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -5
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +2 -2
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +3 -3
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -14
- package/lib-cjs/component/modal/setting/GeneralSettings.js +19 -12
- package/lib-cjs/component/modal/setting/{ControllersTabContent.js → GeneralTabContent.js} +3 -3
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +105 -0
- package/lib-cjs/component/panels/Panels.js +7 -4
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +2 -2
- package/lib-cjs/component/reducer/actions/FiltersActions.js +11 -8
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +4 -4
- package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +16 -16
- package/lib-cjs/component/reducer/preferences/actions/setWorkspace.js +1 -1
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +0 -3
- package/lib-cjs/component/reducer/preferences/{utilites → utilities}/checkKeysExists.js +0 -0
- package/lib-cjs/component/reducer/preferences/{utilites → utilities}/filterObject.js +0 -0
- package/lib-cjs/component/reducer/preferences/{utilites → utilities}/flatObject.js +0 -0
- package/lib-cjs/component/reducer/preferences/{utilites → utilities}/getActiveWorkspace.js +0 -0
- package/lib-cjs/component/reducer/preferences/{utilites → utilities}/getPreferencesByWorkspace.js +3 -1
- package/lib-cjs/component/reducer/preferences/{utilites → utilities}/mapNucleiFormatting.js +0 -0
- package/lib-cjs/component/utility/Evaluate.js +1 -0
- package/lib-cjs/component/workspaces/basic.js +18 -39
- package/lib-cjs/component/workspaces/embedded.js +19 -12
- package/lib-cjs/component/workspaces/exercise.js +4 -33
- package/lib-cjs/component/workspaces/prediction.js +19 -16
- package/lib-cjs/component/workspaces/process1D.js +12 -18
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +74 -0
- package/lib-cjs/data/data1d/MultipleAnalysis.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/convertDataToFloat64Array.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +11 -12
- package/lib-cjs/data/data1d/database.js +3 -10
- package/lib-cjs/data/data1d/filter1d/autoPhaseCorrection.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +14 -10
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +15 -14
- package/lib/component/modal/setting/ControllersTabContent.d.ts +0 -3
- package/lib/component/reducer/preferences/actions/resetPreferences.d.ts +0 -3
- package/lib/component/reducer/preferences/actions/resetPreferences.js +0 -14
- package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +0 -4
- package/lib-cjs/component/reducer/preferences/actions/resetPreferences.js +0 -18
|
@@ -9,6 +9,7 @@ import { HighlightedSource, useHighlightData } from '../../highlight';
|
|
|
9
9
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
10
10
|
import { spinnerContext } from '../../loader/SpinnerContext';
|
|
11
11
|
import { loadFile } from '../../utility/FileUtility';
|
|
12
|
+
import { PathBuilder } from '../../utility/PathBuilder';
|
|
12
13
|
import { getYScale } from '../utilities/scale';
|
|
13
14
|
function DatabaseSpectrum() {
|
|
14
15
|
const { displayerKey, height, verticalAlign, yDomain, margin } = useChartData();
|
|
@@ -36,13 +37,15 @@ function DatabaseSpectrum() {
|
|
|
36
37
|
setLoading(false);
|
|
37
38
|
const spectrum = spectra?.[0] || null;
|
|
38
39
|
if (spectrum) {
|
|
40
|
+
const pathBuilder = new PathBuilder();
|
|
41
|
+
const finalScaleX = scaleX();
|
|
42
|
+
const finalScaleY = scaleY();
|
|
39
43
|
const { x, re: y } = spectrum.data;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setPath(path);
|
|
44
|
+
pathBuilder.moveTo(finalScaleX(x[0]), finalScaleY(y[0]));
|
|
45
|
+
for (let i = 1; i < x.length; i++) {
|
|
46
|
+
pathBuilder.lineTo(finalScaleX(x[i]), finalScaleY(y[i]));
|
|
47
|
+
}
|
|
48
|
+
setPath(pathBuilder.toString());
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
catch (e) {
|
|
@@ -6,6 +6,7 @@ import { useScaleChecked } from '../../context/ScaleContext';
|
|
|
6
6
|
import { HighlightedSource, useHighlightData } from '../../highlight';
|
|
7
7
|
import { usePanelPreferences } from '../../hooks/usePanelPreferences';
|
|
8
8
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
9
|
+
import { PathBuilder } from '../../utility/PathBuilder';
|
|
9
10
|
import { getYScale } from '../utilities/scale';
|
|
10
11
|
const emptyData = { info: { originFrequency: 400 } };
|
|
11
12
|
function ResurrectedDatabaseRanges() {
|
|
@@ -45,13 +46,14 @@ function ResurrectedDatabaseRanges() {
|
|
|
45
46
|
verticalAlign,
|
|
46
47
|
yDomain,
|
|
47
48
|
});
|
|
49
|
+
const finalScaleX = scaleX();
|
|
48
50
|
const paths = spectra.map(({ data: { x, y }, from, to }) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return { path, from, to };
|
|
51
|
+
const pathBuilder = new PathBuilder();
|
|
52
|
+
pathBuilder.moveTo(finalScaleX(x[0]), scaleY(y[0]));
|
|
53
|
+
for (let i = 1; i < x.length; i++) {
|
|
54
|
+
pathBuilder.lineTo(finalScaleX(x[i]), scaleY(y[i]));
|
|
55
|
+
}
|
|
56
|
+
return { path: pathBuilder.toString(), from, to };
|
|
55
57
|
}, []);
|
|
56
58
|
return (_jsx("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "resurrected-database-ranges", width: "100%", height: "100%", children: paths.map(({ path, from, to }, index) => (
|
|
57
59
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -16,26 +16,26 @@ function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
|
|
|
16
16
|
function buildContourPath(data) {
|
|
17
17
|
const _scaleX = get2DXScale({ margin, width, xDomain });
|
|
18
18
|
const _scaleY = get2DYScale({ margin, height, yDomain });
|
|
19
|
-
const
|
|
19
|
+
const pathBuilder = new PathBuilder();
|
|
20
20
|
for (const element of data) {
|
|
21
21
|
if (element.lines) {
|
|
22
22
|
const lines = element.lines;
|
|
23
23
|
if (lines.length < 1e6) {
|
|
24
24
|
for (let i = 0; i < lines.length; i += 4) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
pathBuilder.moveTo(_scaleX(lines[i] + xShift), _scaleY(lines[i + 1] + yShift));
|
|
26
|
+
pathBuilder.lineTo(_scaleX(lines[i + 2] + xShift), _scaleY(lines[i + 3] + yShift));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
|
|
31
|
+
pathBuilder.moveTo(_scaleX(element[0].x + xShift), _scaleY(element[0].y + yShift));
|
|
32
32
|
for (let j = 1; j < element.length; j++) {
|
|
33
|
-
|
|
33
|
+
pathBuilder.lineTo(_scaleX(element[j].x + xShift), _scaleY(element[j].y + yShift));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
return
|
|
37
|
+
pathBuilder.closePath();
|
|
38
|
+
return pathBuilder.toString();
|
|
39
39
|
}
|
|
40
40
|
const data = useMemo(() => {
|
|
41
41
|
return get(contours, `${spectrumID}.${sign}`, []);
|
|
@@ -46,7 +46,7 @@ function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
|
|
|
46
46
|
return (_jsx("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", style: {
|
|
47
47
|
opacity: isActive
|
|
48
48
|
? 1
|
|
49
|
-
: get(preferences.current, '
|
|
49
|
+
: get(preferences.current, 'general.dimmedSpectraTransparency', 0.1),
|
|
50
50
|
}, d: path }));
|
|
51
51
|
}
|
|
52
52
|
function ContoursInner({ data, displayerKey }) {
|
|
@@ -7,6 +7,6 @@ const CheckBox = forwardRef((props, ref) => {
|
|
|
7
7
|
setCheck(!checked);
|
|
8
8
|
onChange(e);
|
|
9
9
|
}, [checked, onChange]);
|
|
10
|
-
return (_jsx("input", { ref: ref, type: "checkbox", name: name, id: name, onChange: handleCheck,
|
|
10
|
+
return (_jsx("input", { ref: ref, type: "checkbox", name: name, id: name, onChange: handleCheck, checked: checkProps, disabled: disabled, style: style }));
|
|
11
11
|
});
|
|
12
12
|
export default CheckBox;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import FormikCheckBox from './formik/FormikCheckBox';
|
|
3
|
+
export function CheckBoxCell(props) {
|
|
4
|
+
const { name, ...otherProps } = props;
|
|
5
|
+
return (_jsx(FormikCheckBox, { style: {
|
|
6
|
+
container: { display: 'block', margin: '0 auto', width: 'fit-content' },
|
|
7
|
+
}, name: props.name, ...otherProps }, props.name));
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { CheckBoxProps } from '../CheckBox';
|
|
3
|
-
interface FormikCheckBoxProps extends Omit<CheckBoxProps, 'style'> {
|
|
3
|
+
export interface FormikCheckBoxProps extends Omit<CheckBoxProps, 'style'> {
|
|
4
4
|
name: string;
|
|
5
5
|
label?: string;
|
|
6
6
|
className?: string;
|
|
@@ -10,6 +10,7 @@ interface FormikCheckBoxProps extends Omit<CheckBoxProps, 'style'> {
|
|
|
10
10
|
label?: CSSProperties;
|
|
11
11
|
checkbox?: CSSProperties;
|
|
12
12
|
};
|
|
13
|
+
defaultValue?: any;
|
|
13
14
|
}
|
|
14
15
|
declare function FormikCheckBox(props: FormikCheckBoxProps): JSX.Element;
|
|
15
16
|
export default FormikCheckBox;
|
|
@@ -4,9 +4,11 @@ import lodashGet from 'lodash/get';
|
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
5
|
import CheckBox from '../CheckBox';
|
|
6
6
|
function FormikCheckBox(props) {
|
|
7
|
-
const { label, name, onChange = () => null, className = 'checkbox', reverse = false, style = { container: {}, label: {}, checkbox: {} }, ...resProps } = props;
|
|
7
|
+
const { label, name, onChange = () => null, className = 'checkbox', reverse = false, style = { container: {}, label: {}, checkbox: {} }, defaultValue, ...resProps } = props;
|
|
8
8
|
const { values, setFieldValue } = useFormikContext();
|
|
9
|
-
const value = reverse
|
|
9
|
+
const value = reverse
|
|
10
|
+
? !lodashGet(values, name, defaultValue)
|
|
11
|
+
: lodashGet(values, name, defaultValue);
|
|
10
12
|
const changeHandler = useCallback((e) => {
|
|
11
13
|
e.persist();
|
|
12
14
|
onChange(e);
|
|
@@ -6,6 +6,7 @@ import { useDispatch } from '../context/DispatchContext';
|
|
|
6
6
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
7
|
import Label from '../elements/Label';
|
|
8
8
|
import Select from '../elements/Select';
|
|
9
|
+
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
9
10
|
import FormikForm from '../elements/formik/FormikForm';
|
|
10
11
|
import FormikInput from '../elements/formik/FormikInput';
|
|
11
12
|
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
@@ -27,7 +28,7 @@ function BaseLineCorrectionPanel() {
|
|
|
27
28
|
const formRef = useRef();
|
|
28
29
|
const algorithmRef = useRef();
|
|
29
30
|
const [algorithm, setAlgorithm] = useState('polynomial');
|
|
30
|
-
const handleApplyFilter = useCallback((values,
|
|
31
|
+
const handleApplyFilter = useCallback((values, triggerSource = 'apply') => {
|
|
31
32
|
let options = {};
|
|
32
33
|
switch (algorithm) {
|
|
33
34
|
case 'airpls':
|
|
@@ -46,7 +47,7 @@ function BaseLineCorrectionPanel() {
|
|
|
46
47
|
break;
|
|
47
48
|
}
|
|
48
49
|
dispatch({
|
|
49
|
-
type:
|
|
50
|
+
type: triggerSource === 'onChange'
|
|
50
51
|
? CALCULATE_BASE_LINE_CORRECTION_FILTER
|
|
51
52
|
: APPLY_BASE_LINE_CORRECTION_FILTER,
|
|
52
53
|
options,
|
|
@@ -82,12 +83,12 @@ function BaseLineCorrectionPanel() {
|
|
|
82
83
|
const validation = Yup.object().shape({
|
|
83
84
|
degree: Yup.number().integer().min(1).max(6).required(),
|
|
84
85
|
});
|
|
85
|
-
return { validation, initialValue: { degree: 3 } };
|
|
86
|
+
return { livePreview: true, validation, initialValue: { degree: 3 } };
|
|
86
87
|
}
|
|
87
88
|
default:
|
|
88
|
-
return { validation: {}, initialValue: {} };
|
|
89
|
+
return { livePreview: true, validation: {}, initialValue: {} };
|
|
89
90
|
}
|
|
90
91
|
}, [algorithm]);
|
|
91
|
-
return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Algorithm: " }), _jsx(Select, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, defaultValue: "polynomial", onChange: changeAlgorithmHandler }), _jsxs(FormikForm, { ref: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: formData.initialValue, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", children: _jsx(FormikInput, { type: "number", name: "maxIterations", debounceTime: 250 }) }), _jsx(Label, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: _jsx(FormikInput, { type: "number", name: "tolerance", debounceTime: 250 }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } }, debounceTime: 250 }) })), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values,
|
|
92
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Algorithm: " }), _jsx(Select, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, defaultValue: "polynomial", onChange: changeAlgorithmHandler }), _jsxs(FormikForm, { ref: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: { ...formData.initialValue, livePreview: true }, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", children: _jsx(FormikInput, { type: "number", name: "maxIterations", debounceTime: 250 }) }), _jsx(Label, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: _jsx(FormikInput, { type: "number", name: "tolerance", debounceTime: 250 }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } }, debounceTime: 250 }) })), _jsx(Label, { title: "live preview ", style: { label: { padding: '0 5px' } }, children: _jsx(FormikCheckBox, { name: "livePreview" }) }), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, 'onChange') })] }, JSON.stringify(formData.initialValue)), _jsx(ActionButtons, { onDone: () => formRef.current.submitForm(), onCancel: handleCancelFilter })] }));
|
|
92
93
|
}
|
|
93
94
|
export default BaseLineCorrectionPanel;
|
|
@@ -9,7 +9,7 @@ export default function useActiveSpectrumStyleOptions(id) {
|
|
|
9
9
|
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
|
|
10
10
|
const opacity = isActive
|
|
11
11
|
? 1
|
|
12
|
-
: get(preferences.current, '
|
|
12
|
+
: get(preferences.current, 'general.dimmedSpectraTransparency', 0.1);
|
|
13
13
|
return { isActive, opacity };
|
|
14
14
|
}, [activeSpectrum, id, preferences]);
|
|
15
15
|
}
|
|
@@ -3,5 +3,5 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
4
4
|
export function useCheckToolsVisibility() {
|
|
5
5
|
const preferences = usePreferences();
|
|
6
|
-
return useCallback((toolKey) => lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`,
|
|
6
|
+
return useCallback((toolKey) => lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, false), [preferences]);
|
|
7
7
|
}
|
|
@@ -74,7 +74,7 @@ export default function ChangeSumModal({ onSave, onClose, header, sumOptions, })
|
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if (sumOptions?.sumAuto &&
|
|
76
76
|
!general?.hideSetSumFromMolecule &&
|
|
77
|
-
!panels?.structuresPanel?.
|
|
77
|
+
!panels?.structuresPanel?.display) {
|
|
78
78
|
setActiveOption(SumSetOptions.Auto);
|
|
79
79
|
const { mf, moleculeKey: key } = sumOptions;
|
|
80
80
|
formRef.current.setValues({
|
|
@@ -123,5 +123,5 @@ export default function ChangeSumModal({ onSave, onClose, header, sumOptions, })
|
|
|
123
123
|
return (
|
|
124
124
|
// <div css={modalContainer}>
|
|
125
125
|
_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: header }), _jsx(CloseButton, { onClick: onClose })] }), _jsx("div", { className: "tab-content", children: _jsx(FormikForm, { ref: formRef, onSubmit: saveHandler, initialValues: { sum: null, molecule: null }, validationSchema: validationSchema, children: _jsxs(Tabs, { activeTab: setOption, onClick: onTabChangeHandler, children: [!general?.hideSetSumFromMolecule &&
|
|
126
|
-
!panels?.structuresPanel?.
|
|
126
|
+
!panels?.structuresPanel?.display && (_jsx(Tab, { tablabel: "Auto", tabid: SumSetOptions.Auto, children: _jsx(SelectMolecule, { name: "molecule" }) })), _jsx(Tab, { tablabel: "Manual", tabid: SumSetOptions.Manual, children: _jsx("div", { className: "manual-container", children: _jsx(FormikInput, { name: "sum", type: "number", placeholder: "Enter the new value", onKeyDown: handleKeyDown }) }) })] }) }) }), _jsx("div", { className: "footer-container", children: _jsx("button", { type: "button", onClick: () => formRef.current.submitForm(), className: "btn", children: "Set" }) })] }));
|
|
127
127
|
}
|
|
@@ -7,8 +7,8 @@ import generateID from '../../../data/utilities/generateID';
|
|
|
7
7
|
import Button from '../../elements/Button';
|
|
8
8
|
import FormikCheckBox from '../../elements/formik/FormikCheckBox';
|
|
9
9
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
10
|
+
import { getPreferencesByWorkspace } from '../../reducer/preferences/utilities/getPreferencesByWorkspace';
|
|
10
11
|
import { isGoogleDocument } from '../../utility/isGoogleDocument';
|
|
11
|
-
import Workspaces from '../../workspaces';
|
|
12
12
|
const style = {
|
|
13
13
|
table: {
|
|
14
14
|
width: '100%',
|
|
@@ -49,8 +49,8 @@ function DatabasesTabContent({ currentWorkspace }) {
|
|
|
49
49
|
setFieldValue('databases.data', [...databases.data, newDatabase]);
|
|
50
50
|
}, [databases, setFieldValue]);
|
|
51
51
|
const resetDatabaseHandler = useCallback(() => {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const workSpaceDisplayPreferences = getPreferencesByWorkspace(currentWorkspace);
|
|
53
|
+
const database = workSpaceDisplayPreferences.databases.data;
|
|
54
54
|
setFieldValue('databases.data', database);
|
|
55
55
|
}, [currentWorkspace, setFieldValue]);
|
|
56
56
|
return (_jsxs("fieldset", { onClick: (e) => {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
interface DisplayTabContentProps {
|
|
4
|
-
preferences: NMRiumPreferences;
|
|
5
|
-
}
|
|
6
|
-
declare function DisplayTabContent({ preferences }: DisplayTabContentProps): JSX.Element;
|
|
2
|
+
declare function DisplayTabContent(): JSX.Element;
|
|
7
3
|
export default DisplayTabContent;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import lodashGet from 'lodash/get';
|
|
3
2
|
import { useMemo } from 'react';
|
|
3
|
+
import { CheckBoxCell } from '../../elements/CheckBoxCell';
|
|
4
4
|
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
5
|
-
import FormikCheckBox from '../../elements/formik/FormikCheckBox';
|
|
6
5
|
const LIST = [
|
|
7
6
|
{
|
|
8
7
|
label: 'Spectra selection panel',
|
|
@@ -62,12 +61,7 @@ const LIST = [
|
|
|
62
61
|
hideOpenOption: true,
|
|
63
62
|
},
|
|
64
63
|
];
|
|
65
|
-
function
|
|
66
|
-
return (_jsx(FormikCheckBox, { style: {
|
|
67
|
-
container: { display: 'block', margin: '0 auto', width: 'fit-content' },
|
|
68
|
-
}, className: "checkbox-element", name: props.name }, props.name));
|
|
69
|
-
}
|
|
70
|
-
function DisplayTabContent({ preferences }) {
|
|
64
|
+
function DisplayTabContent() {
|
|
71
65
|
const COLUMNS = useMemo(() => [
|
|
72
66
|
{
|
|
73
67
|
index: 1,
|
|
@@ -83,17 +77,14 @@ function DisplayTabContent({ preferences }) {
|
|
|
83
77
|
{
|
|
84
78
|
index: 2,
|
|
85
79
|
Header: 'Active',
|
|
86
|
-
Cell: ({ row }) => (_jsx(CheckBoxCell, { name: `display.${row.original.name}.display
|
|
80
|
+
Cell: ({ row }) => (_jsx(CheckBoxCell, { name: `display.${row.original.name}.display`, defaultValue: false })),
|
|
87
81
|
},
|
|
88
82
|
{
|
|
89
83
|
index: 3,
|
|
90
84
|
Header: 'Open on load',
|
|
91
|
-
Cell: ({ row }) => !row.original.hideOpenOption ? (_jsx(CheckBoxCell, { name: `display.${row.original.name}.open
|
|
85
|
+
Cell: ({ row }) => !row.original.hideOpenOption ? (_jsx(CheckBoxCell, { name: `display.${row.original.name}.open`, defaultValue: false })) : (_jsx("div", {})),
|
|
92
86
|
},
|
|
93
87
|
], []);
|
|
94
|
-
|
|
95
|
-
return LIST.filter((item) => lodashGet(preferences, `${item.name}.hidden`) !== true);
|
|
96
|
-
}, [preferences]);
|
|
97
|
-
return (_jsx("div", { style: { width: '100%', overflow: 'hidden' }, children: _jsx(ReactTable, { columns: COLUMNS, data: data }) }));
|
|
88
|
+
return (_jsx("div", { style: { width: '100%', overflow: 'hidden' }, children: _jsx(ReactTable, { columns: COLUMNS, data: LIST }) }));
|
|
98
89
|
}
|
|
99
90
|
export default DisplayTabContent;
|
|
@@ -4,17 +4,20 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { usePreferences, useWorkspacesList, } from '../../context/PreferencesContext';
|
|
6
6
|
import ActionButtons from '../../elements/ActionButtons';
|
|
7
|
+
import Button from '../../elements/Button';
|
|
7
8
|
import CloseButton from '../../elements/CloseButton';
|
|
8
9
|
import Tab from '../../elements/Tab/Tab';
|
|
9
10
|
import Tabs, { PositionsEnum } from '../../elements/Tab/Tabs';
|
|
10
11
|
import DropDownButton from '../../elements/dropDownButton/DropDownButton';
|
|
11
12
|
import FormikForm from '../../elements/formik/FormikForm';
|
|
12
13
|
import { useAlert } from '../../elements/popup/Alert';
|
|
14
|
+
import { getPreferencesByWorkspace } from '../../reducer/preferences/utilities/getPreferencesByWorkspace';
|
|
13
15
|
import { ModalStyles } from '../ModalStyle';
|
|
14
|
-
import ControllersTabContent from './ControllersTabContent';
|
|
15
16
|
import DatabasesTabContent from './DatabasesTabContent';
|
|
16
17
|
import DisplayTabContent from './DisplayTabContent';
|
|
17
18
|
import FormattingTabContent from './FormattingTabContent';
|
|
19
|
+
import GeneralTabContent from './GeneralTabContent';
|
|
20
|
+
import ToolsTabContent from './ToolsTabContent';
|
|
18
21
|
import WorkspaceItem from './WorkspaceItem';
|
|
19
22
|
import { validation } from './settingsValidation';
|
|
20
23
|
const styles = css `
|
|
@@ -91,8 +94,8 @@ const styles = css `
|
|
|
91
94
|
}
|
|
92
95
|
`;
|
|
93
96
|
function GeneralSettings({ onClose }) {
|
|
94
|
-
const [activeTab, setActiveTab] = useState('
|
|
95
|
-
const { dispatch, ...preferences } = usePreferences();
|
|
97
|
+
const [activeTab, setActiveTab] = useState('general');
|
|
98
|
+
const { dispatch, current: currentWorkspace, ...preferences } = usePreferences();
|
|
96
99
|
const alert = useAlert();
|
|
97
100
|
const refForm = useRef();
|
|
98
101
|
const workspaces = useWorkspacesList();
|
|
@@ -104,19 +107,21 @@ function GeneralSettings({ onClose }) {
|
|
|
104
107
|
},
|
|
105
108
|
]);
|
|
106
109
|
}, [workspaces]);
|
|
107
|
-
const handleSave =
|
|
110
|
+
const handleSave = () => {
|
|
108
111
|
refForm.current.submitForm();
|
|
109
|
-
}
|
|
110
|
-
const handleReset =
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
};
|
|
113
|
+
const handleReset = () => {
|
|
114
|
+
const workSpaceDisplayPreferences = getPreferencesByWorkspace(preferences.workspace.current);
|
|
115
|
+
refForm.current.setValues(workSpaceDisplayPreferences);
|
|
116
|
+
};
|
|
117
|
+
const handleClose = () => {
|
|
113
118
|
onClose?.();
|
|
114
|
-
}
|
|
115
|
-
const submitHandler =
|
|
119
|
+
};
|
|
120
|
+
const submitHandler = (values) => {
|
|
116
121
|
dispatch({ type: 'SET_PREFERENCES', payload: values });
|
|
117
122
|
alert.success('Settings saved successfully');
|
|
118
123
|
onClose?.();
|
|
119
|
-
}
|
|
124
|
+
};
|
|
120
125
|
const tabChangeHandler = useCallback((tab) => {
|
|
121
126
|
setActiveTab(tab.tabid);
|
|
122
127
|
}, []);
|
|
@@ -148,6 +153,8 @@ function GeneralSettings({ onClose }) {
|
|
|
148
153
|
const renderItem = useCallback((item) => {
|
|
149
154
|
return (_jsx(WorkspaceItem, { item: item, onSave: addWorkSpaceHandler, onDelete: deleteWorkSpaceHandler }));
|
|
150
155
|
}, [addWorkSpaceHandler, deleteWorkSpaceHandler]);
|
|
151
|
-
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "General Settings" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "workspace-container", children: [_jsx("span", { className: "label", children: "Workspace : " }), _jsx(DropDownButton, { data: workspacesList, renderItem: renderItem, selectedKey: preferences?.workspace.current, onSelect: ChangeWorkspaceHandler })
|
|
156
|
+
return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "General Settings" }), _jsx(CloseButton, { onClick: onClose, className: "close-bt" })] }), _jsxs("div", { className: "workspace-container", children: [_jsx("span", { className: "label", children: "Workspace : " }), _jsx(DropDownButton, { data: workspacesList, renderItem: renderItem, selectedKey: preferences?.workspace.current, onSelect: ChangeWorkspaceHandler }), _jsx(Button.Danger, { fill: "outline", size: "xSmall", onClick: handleReset, style: {
|
|
157
|
+
marginLeft: '10px',
|
|
158
|
+
}, children: "Reset workspace settings" })] }), _jsx("div", { className: "main-content", children: _jsx(FormikForm, { ref: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { tablabel: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { tablabel: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { tablabel: "Display", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { tablabel: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { tablabel: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: preferences.workspace.current }) }) })] }) }, JSON.stringify(currentWorkspace)) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: handleClose }) })] }));
|
|
152
159
|
}
|
|
153
160
|
export default GeneralSettings;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Label from '../../elements/Label';
|
|
3
3
|
import FormikInput from '../../elements/formik/FormikInput';
|
|
4
|
-
function
|
|
5
|
-
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }), _jsx(Label, { title: "Transparency of Dimmed Spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "
|
|
4
|
+
function GeneralTabContent() {
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "section-header", children: "Spectra" }), _jsx(Label, { title: "Transparency of Dimmed Spectra [ 0 - 1 ]", children: _jsx(FormikInput, { name: "general.dimmedSpectraTransparency", checkValue: (value) => value >= 0 && value <= 1, type: "number" }) })] }));
|
|
6
6
|
}
|
|
7
|
-
export default
|
|
7
|
+
export default GeneralTabContent;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { CheckBoxCell } from '../../elements/CheckBoxCell';
|
|
4
|
+
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
5
|
+
const LIST = [
|
|
6
|
+
{
|
|
7
|
+
label: 'Zoom in',
|
|
8
|
+
name: 'toolBarButtons.zoomTool',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: 'Zoom out',
|
|
12
|
+
name: 'toolBarButtons.zoomOutTool',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Import',
|
|
16
|
+
name: 'toolBarButtons.import',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Export As',
|
|
20
|
+
name: 'toolBarButtons.exportAs',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Stack Alignments',
|
|
24
|
+
name: 'toolBarButtons.spectraStackAlignments',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Center Alignments',
|
|
28
|
+
name: 'toolBarButtons.spectraCenterAlignments',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Real/Imaginary ',
|
|
32
|
+
name: 'toolBarButtons.realImaginary',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Peak picking',
|
|
36
|
+
name: 'toolBarButtons.peakTool',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Integral',
|
|
40
|
+
name: 'toolBarButtons.integralTool',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'Zone Picking',
|
|
44
|
+
name: 'toolBarButtons.zonePickingTool',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Range picking',
|
|
48
|
+
name: 'toolBarButtons.rangePickingTool',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'Slicing',
|
|
52
|
+
name: 'toolBarButtons.slicingTool',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: 'Zero filling',
|
|
56
|
+
name: 'toolBarButtons.zeroFillingTool',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'Fourier transform',
|
|
60
|
+
name: 'toolBarButtons.FFTTool',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'Phase correction',
|
|
64
|
+
name: 'toolBarButtons.phaseCorrectionTool',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 'Baseline correction',
|
|
68
|
+
name: 'toolBarButtons.baselineCorrectionTool',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'Exclusion zones',
|
|
72
|
+
name: 'toolBarButtons.exclusionZonesTool',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: 'Multiple spectra analysis',
|
|
76
|
+
name: 'toolBarButtons.multipleSpectraAnalysisTool',
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
function ToolsTabContent() {
|
|
80
|
+
const COLUMNS = useMemo(() => [
|
|
81
|
+
{
|
|
82
|
+
index: 1,
|
|
83
|
+
Header: '#',
|
|
84
|
+
Cell: ({ row }) => row.index + 1,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
index: 1,
|
|
88
|
+
Header: 'Tool',
|
|
89
|
+
accessor: 'label',
|
|
90
|
+
style: { width: '60%' },
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
index: 2,
|
|
94
|
+
Header: 'Active',
|
|
95
|
+
Cell: ({ row }) => (_jsx(CheckBoxCell, { name: `display.${row.original.name}`, defaultValue: false })),
|
|
96
|
+
},
|
|
97
|
+
], []);
|
|
98
|
+
return (_jsx("div", { style: { width: '100%', overflow: 'hidden' }, children: _jsx(ReactTable, { columns: COLUMNS, data: LIST }) }));
|
|
99
|
+
}
|
|
100
|
+
export default ToolsTabContent;
|
|
@@ -119,7 +119,11 @@ export const TOOLS_PANELS_ACCORDION = {
|
|
|
119
119
|
function usePanelPreferences() {
|
|
120
120
|
const preferences = usePreferences();
|
|
121
121
|
return useCallback((item) => {
|
|
122
|
-
|
|
122
|
+
const defaultValue = {
|
|
123
|
+
display: false,
|
|
124
|
+
open: false,
|
|
125
|
+
};
|
|
126
|
+
return lodashGet(preferences.current, `display.panels.${item.hidePreferenceKey}`, defaultValue);
|
|
123
127
|
}, [preferences]);
|
|
124
128
|
}
|
|
125
129
|
function PanelsInner({ displayerMode: displayedMode }) {
|
|
@@ -127,15 +131,14 @@ function PanelsInner({ displayerMode: displayedMode }) {
|
|
|
127
131
|
const isExperimental = useCheckExperimentalFeature();
|
|
128
132
|
const check = useCallback((item) => {
|
|
129
133
|
const panelOptions = getPanelPreferences(item);
|
|
130
|
-
return ((panelOptions?.
|
|
131
|
-
panelOptions?.display &&
|
|
134
|
+
return ((panelOptions?.display &&
|
|
132
135
|
item.isExperimental === undefined &&
|
|
133
136
|
(item.mode == null || item.mode === displayedMode)) ||
|
|
134
137
|
(item.isExperimental && isExperimental));
|
|
135
138
|
}, [displayedMode, getPanelPreferences, isExperimental]);
|
|
136
139
|
const isOpened = useCallback((item) => {
|
|
137
140
|
const panelOptions = getPanelPreferences(item);
|
|
138
|
-
return panelOptions?.
|
|
141
|
+
return panelOptions?.display && panelOptions?.open;
|
|
139
142
|
}, [getPanelPreferences]);
|
|
140
143
|
return (_jsx("div", { style: { width: '100%', height: '100%', flex: '1 1 0%' }, children: _jsx(Accordion, { children: accordionItems.map((item) => {
|
|
141
144
|
return (check(item) && (_jsx(Accordion.Item, { title: item.title, defaultOpened: isOpened(item), children: item.component }, item.title)));
|
|
@@ -154,7 +154,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
154
154
|
databaseDataRef.current = database
|
|
155
155
|
?.value;
|
|
156
156
|
}
|
|
157
|
-
const hideLoading = await alert.showLoading(`
|
|
157
|
+
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
158
158
|
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
159
159
|
setKeywords({ ...emptyKeywords });
|
|
160
160
|
hideLoading();
|
|
@@ -163,7 +163,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
163
163
|
useEffect(() => {
|
|
164
164
|
setTimeout(async () => {
|
|
165
165
|
if (databaseInstance.current) {
|
|
166
|
-
const hideLoading = await alert.showLoading(`
|
|
166
|
+
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
167
167
|
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
168
168
|
hideLoading();
|
|
169
169
|
setKeywords({ ...emptyKeywords });
|
|
@@ -100,14 +100,17 @@ function calculateBaseLineCorrection(draft, action) {
|
|
|
100
100
|
...(action?.options ? { options: action.options } : {}),
|
|
101
101
|
};
|
|
102
102
|
const { zones, options } = draft.toolOptions.data.baselineCorrection;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
const { livePreview, ...filterOptions } = options;
|
|
104
|
+
if (livePreview) {
|
|
105
|
+
let _data = { data: { x, re, im }, info };
|
|
106
|
+
baselineCorrection(_data, {
|
|
107
|
+
zones,
|
|
108
|
+
...filterOptions,
|
|
109
|
+
});
|
|
110
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
111
|
+
draft.tempData[index].data.im = newIm;
|
|
112
|
+
draft.tempData[index].data.re = newRe;
|
|
113
|
+
}
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
function calculateManualPhaseCorrection(draft, filterOptions) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import generateID from '../../../../data/utilities/generateID';
|
|
2
2
|
import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
|
|
3
3
|
export function addWorkspace(draft, action) {
|
|
4
|
-
const { workspace: workspaceName, data: { display,
|
|
4
|
+
const { workspace: workspaceName, data: { display, general, formatting, databases }, } = action.payload;
|
|
5
5
|
const newWorkSpace = {
|
|
6
6
|
version: 1,
|
|
7
7
|
label: workspaceName,
|
|
8
8
|
display,
|
|
9
|
-
|
|
9
|
+
general,
|
|
10
10
|
formatting,
|
|
11
11
|
databases,
|
|
12
12
|
};
|