@complat/react-spectra-editor 1.5.4 → 1.6.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/dist/actions/cyclic_voltammetry.js +21 -2
- package/dist/components/cmd_bar/index.js +35 -26
- package/dist/components/cmd_bar/r05_submit_btn.js +192 -3
- package/dist/components/cmd_bar/r08_change_axes.js +28 -9
- package/dist/components/cmd_bar/r10_cv_density.js +180 -0
- package/dist/components/d3_multi/index.js +160 -1
- package/dist/components/d3_multi/multi_focus.js +51 -9
- package/dist/components/multi_jcamps_viewer.js +52 -10
- package/dist/components/panel/cyclic_voltamery_data.js +262 -180
- package/dist/components/panel/index.js +5 -3
- package/dist/constants/action_type.js +4 -1
- package/dist/helpers/chem.js +5 -2
- package/dist/helpers/init.js +5 -4
- package/dist/reducers/reducer_voltammetry.js +34 -1
- package/dist/sagas/saga_multi_entities.js +60 -0
- package/package.json +1 -1
|
@@ -9,7 +9,10 @@ var _chem = require("../helpers/chem");
|
|
|
9
9
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
10
10
|
|
|
11
11
|
const initialState = {
|
|
12
|
-
spectraList: []
|
|
12
|
+
spectraList: [],
|
|
13
|
+
areaValue: 1.0,
|
|
14
|
+
areaUnit: 'cm²',
|
|
15
|
+
useCurrentDensity: false
|
|
13
16
|
};
|
|
14
17
|
const initSpectra = {
|
|
15
18
|
list: [],
|
|
@@ -563,6 +566,36 @@ const cyclicVoltaReducer = (state = initialState, action) => {
|
|
|
563
566
|
return Object.assign({}, state, {
|
|
564
567
|
spectraList: []
|
|
565
568
|
});
|
|
569
|
+
case _action_type.CYCLIC_VOLTA_METRY.SET_AREA_VALUE:
|
|
570
|
+
{
|
|
571
|
+
const {
|
|
572
|
+
value
|
|
573
|
+
} = action.payload;
|
|
574
|
+
if (value === '') {
|
|
575
|
+
return Object.assign({}, state, {
|
|
576
|
+
areaValue: ''
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
const areaValue = Number.isFinite(value) ? value : state.areaValue;
|
|
580
|
+
return Object.assign({}, state, {
|
|
581
|
+
areaValue
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
case _action_type.CYCLIC_VOLTA_METRY.SET_AREA_UNIT:
|
|
585
|
+
{
|
|
586
|
+
const {
|
|
587
|
+
unit
|
|
588
|
+
} = action.payload;
|
|
589
|
+
return Object.assign({}, state, {
|
|
590
|
+
areaUnit: unit
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
case _action_type.CYCLIC_VOLTA_METRY.TOGGLE_DENSITY:
|
|
594
|
+
{
|
|
595
|
+
return Object.assign({}, state, {
|
|
596
|
+
useCurrentDensity: !state.useCurrentDensity
|
|
597
|
+
});
|
|
598
|
+
}
|
|
566
599
|
default:
|
|
567
600
|
return state;
|
|
568
601
|
}
|
|
@@ -38,6 +38,66 @@ function* setCyclicVoltametry(action) {
|
|
|
38
38
|
if (layout !== _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
+
const cvSt = yield (0, _effects.select)(state => state.cyclicvolta);
|
|
42
|
+
const {
|
|
43
|
+
feature
|
|
44
|
+
} = firstCurve;
|
|
45
|
+
if (feature) {
|
|
46
|
+
const {
|
|
47
|
+
weAreaValue,
|
|
48
|
+
weAreaUnit,
|
|
49
|
+
currentMode
|
|
50
|
+
} = feature;
|
|
51
|
+
if (typeof weAreaUnit === 'string' && weAreaUnit.length > 0) {
|
|
52
|
+
const unit = weAreaUnit.replace('^2', '²');
|
|
53
|
+
yield (0, _effects.put)({
|
|
54
|
+
type: _action_type.CYCLIC_VOLTA_METRY.SET_AREA_UNIT,
|
|
55
|
+
payload: {
|
|
56
|
+
unit
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
yield (0, _effects.put)({
|
|
61
|
+
type: _action_type.CYCLIC_VOLTA_METRY.SET_AREA_UNIT,
|
|
62
|
+
payload: {
|
|
63
|
+
unit: 'cm²'
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (weAreaValue !== undefined && weAreaValue !== null) {
|
|
68
|
+
let numeric = null;
|
|
69
|
+
if (typeof weAreaValue === 'string') {
|
|
70
|
+
const parsed = parseFloat(weAreaValue);
|
|
71
|
+
if (!Number.isNaN(parsed)) numeric = parsed;
|
|
72
|
+
} else if (Number.isFinite(weAreaValue)) {
|
|
73
|
+
numeric = weAreaValue;
|
|
74
|
+
}
|
|
75
|
+
if (Number.isFinite(numeric)) {
|
|
76
|
+
yield (0, _effects.put)({
|
|
77
|
+
type: _action_type.CYCLIC_VOLTA_METRY.SET_AREA_VALUE,
|
|
78
|
+
payload: {
|
|
79
|
+
value: numeric
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
yield (0, _effects.put)({
|
|
84
|
+
type: _action_type.CYCLIC_VOLTA_METRY.SET_AREA_VALUE,
|
|
85
|
+
payload: {
|
|
86
|
+
value: 1.0
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (typeof currentMode === 'string' && currentMode.length > 0) {
|
|
92
|
+
const wantDensity = currentMode.toUpperCase() === 'DENSITY';
|
|
93
|
+
if (!!cvSt.useCurrentDensity !== wantDensity) {
|
|
94
|
+
yield (0, _effects.put)({
|
|
95
|
+
type: _action_type.CYCLIC_VOLTA_METRY.TOGGLE_DENSITY,
|
|
96
|
+
payload: null
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
41
101
|
for (let index = 0; index < listCurves.length; index++) {
|
|
42
102
|
const curve = listCurves[index];
|
|
43
103
|
const maxminPeak = getMaxMinPeak(curve);
|