@complat/react-spectra-editor 1.0.0-rc2 → 1.0.0-rc20.patch-1
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/README.md +16 -0
- package/dist/__tests__/fixtures/aif_jcamp_1.js +136 -0
- package/dist/__tests__/fixtures/aif_jcamp_2.js +122 -0
- package/dist/__tests__/fixtures/backup/nmr1h_a.js +3518 -0
- package/dist/__tests__/fixtures/backup/xrd_jcamp_1.js +10705 -0
- package/dist/__tests__/fixtures/cds_jcamp.js +861 -0
- package/dist/__tests__/fixtures/compare_ir_1_jcamp.js +585 -0
- package/dist/__tests__/fixtures/compare_ir_2_jcamp.js +515 -0
- package/dist/__tests__/fixtures/compare_uv_vis_jcamp.js +640 -0
- package/dist/__tests__/fixtures/cyclic_voltammetry_1.js +778 -0
- package/dist/__tests__/fixtures/cyclic_voltammetry_2.js +758 -0
- package/dist/__tests__/fixtures/cyclic_voltammetry_3.js +759 -0
- package/dist/__tests__/fixtures/dls_acf_jcamp.js +148 -0
- package/dist/__tests__/fixtures/dls_intensity_jcamp.js +151 -0
- package/dist/__tests__/fixtures/emissions_jcamp.js +883 -0
- package/dist/__tests__/fixtures/hplc_uvvis_jcamp.js +638 -0
- package/dist/__tests__/fixtures/hplc_uvvis_jcamp_2.js +221 -0
- package/dist/__tests__/fixtures/ir_jcamp.js +148 -0
- package/dist/__tests__/fixtures/ir_result.js +46 -0
- package/dist/__tests__/fixtures/ir_svg.js +8 -0
- package/dist/__tests__/fixtures/ms_jcamp.js +64 -0
- package/dist/__tests__/fixtures/nmr13c_dept_jcamp.js +3543 -0
- package/dist/__tests__/fixtures/nmr13c_jcamp.js +1229 -0
- package/dist/__tests__/fixtures/nmr15n_jcamp.js +7177 -0
- package/dist/__tests__/fixtures/nmr19f_jcamp.js +6560 -0
- package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +2005 -0
- package/dist/__tests__/fixtures/nmr1h_jcamp.js +4516 -0
- package/dist/__tests__/fixtures/nmr29si_jcamp.js +3029 -0
- package/dist/__tests__/fixtures/nmr31p_jcamp.js +3418 -0
- package/dist/__tests__/fixtures/nmr_result.js +68 -0
- package/dist/__tests__/fixtures/nmr_svg.js +8 -0
- package/dist/__tests__/fixtures/phenylalanin.js +142 -0
- package/dist/__tests__/fixtures/qDescValue.js +65 -0
- package/dist/__tests__/fixtures/raman_jcamp.js +410 -0
- package/dist/__tests__/fixtures/sec_1_jcamp.js +425 -0
- package/dist/__tests__/fixtures/sec_2_jcamp.js +407 -0
- package/dist/__tests__/fixtures/sec_3_jcamp.js +408 -0
- package/dist/__tests__/fixtures/sec_4_jcamp.js +407 -0
- package/dist/__tests__/fixtures/tga_jcamp.js +4157 -0
- package/dist/__tests__/fixtures/uv_vis_jcamp.js +249 -0
- package/dist/__tests__/fixtures/xrd_jcamp_1.js +436 -0
- package/dist/__tests__/fixtures/xrd_jcamp_2.js +955 -0
- package/dist/__tests__/fixtures/xrd_jcamp_3.js +1871 -0
- package/dist/__tests__/units/components/panel/graph_selection.test.js +72 -0
- package/dist/__tests__/units/components/panel/peaks.test.js +87 -0
- package/dist/actions/curve.js +15 -14
- package/dist/actions/cyclic_voltammetry.js +40 -60
- package/dist/actions/edit_peak.js +8 -12
- package/dist/actions/forecast.js +16 -24
- package/dist/actions/integration.js +12 -18
- package/dist/actions/jcamp.js +16 -24
- package/dist/actions/layout.js +4 -6
- package/dist/actions/manager.js +20 -30
- package/dist/actions/meta.js +4 -6
- package/dist/actions/multiplicity.js +24 -36
- package/dist/actions/scan.js +12 -18
- package/dist/actions/shift.js +8 -12
- package/dist/actions/status.js +12 -18
- package/dist/actions/submit.js +16 -24
- package/dist/actions/threshold.js +20 -30
- package/dist/actions/ui.js +25 -31
- package/dist/actions/wavelength.js +4 -6
- package/dist/app.js +25 -23
- package/dist/components/cmd_bar/01_viewer.js +24 -34
- package/dist/components/cmd_bar/02_zoom.js +18 -28
- package/dist/components/cmd_bar/03_peak.js +50 -66
- package/dist/components/cmd_bar/04_integration.js +70 -84
- package/dist/components/cmd_bar/05_multiplicity.js +42 -56
- package/dist/components/cmd_bar/06_undo_redo.js +22 -36
- package/dist/components/cmd_bar/07_pecker.js +24 -34
- package/dist/components/cmd_bar/common.js +11 -7
- package/dist/components/cmd_bar/index.js +17 -23
- package/dist/components/cmd_bar/r01_layout.js +79 -56
- package/dist/components/cmd_bar/r02_scan.js +70 -87
- package/dist/components/cmd_bar/r03_threshold.js +54 -68
- package/dist/components/cmd_bar/r04_submit.js +71 -83
- package/dist/components/cmd_bar/r05_submit_btn.js +64 -72
- package/dist/components/cmd_bar/r06_predict_btn.js +142 -152
- package/dist/components/cmd_bar/r07_wavelength_btn.js +28 -36
- package/dist/components/cmd_bar/tri_btn.js +91 -113
- package/dist/components/common/chem.js +2 -3
- package/dist/components/common/comps.js +2 -2
- package/dist/components/common/draw.js +30 -11
- package/dist/components/d3_line/index.js +154 -176
- package/dist/components/d3_line/line_focus.js +595 -739
- package/dist/components/d3_multi/index.js +153 -174
- package/dist/components/d3_multi/multi_focus.js +725 -850
- package/dist/components/d3_rect/index.js +112 -134
- package/dist/components/d3_rect/rect_focus.js +163 -208
- package/dist/components/forecast/comps.js +60 -68
- package/dist/components/forecast/ir_comps.js +49 -56
- package/dist/components/forecast/ir_viewer.js +61 -68
- package/dist/components/forecast/nmr_comps.js +62 -72
- package/dist/components/forecast/nmr_viewer.js +59 -68
- package/dist/components/forecast/section_loading.js +39 -63
- package/dist/components/forecast_viewer.js +109 -119
- package/dist/components/multi_jcamps_viewer.js +97 -113
- package/dist/components/panel/compare.js +183 -192
- package/dist/components/panel/cyclic_voltamery_data.js +149 -165
- package/dist/components/panel/graph_selection.js +143 -132
- package/dist/components/panel/index.js +112 -144
- package/dist/components/panel/info.js +125 -132
- package/dist/components/panel/multiplicity.js +215 -223
- package/dist/components/panel/multiplicity_coupling.js +108 -136
- package/dist/components/panel/multiplicity_select.js +43 -51
- package/dist/components/panel/peaks.js +130 -132
- package/dist/constants/action_type.js +23 -39
- package/dist/constants/list_layout.js +7 -4
- package/dist/constants/list_shift.js +117 -103
- package/dist/constants/list_ui.js +3 -6
- package/dist/constants/list_wavelength.js +7 -8
- package/dist/fn.js +2 -3
- package/dist/helpers/brush.js +49 -65
- package/dist/helpers/calc.js +2 -4
- package/dist/helpers/carbonFeatures.js +22 -20
- package/dist/helpers/cfg.js +49 -67
- package/dist/helpers/chem.js +450 -393
- package/dist/helpers/compass.js +92 -83
- package/dist/helpers/converter.js +52 -65
- package/dist/helpers/extractParams.js +60 -52
- package/dist/helpers/extractPeaksEdit.js +29 -25
- package/dist/helpers/focus.js +2 -6
- package/dist/helpers/format.js +416 -361
- package/dist/helpers/init.js +41 -37
- package/dist/helpers/integration.js +18 -21
- package/dist/helpers/mount.js +57 -61
- package/dist/helpers/multiplicity.js +19 -24
- package/dist/helpers/multiplicity_calc.js +39 -50
- package/dist/helpers/multiplicity_complat.js +21 -47
- package/dist/helpers/multiplicity_manual.js +49 -55
- package/dist/helpers/multiplicity_verify_basic.js +108 -111
- package/dist/helpers/shift.js +15 -23
- package/dist/helpers/zoom.js +7 -11
- package/dist/index.js +680 -630
- package/dist/layer_content.js +40 -43
- package/dist/layer_init.js +162 -184
- package/dist/layer_prism.js +38 -41
- package/dist/reducers/index.js +2 -3
- package/dist/reducers/reducer_curve.js +35 -26
- package/dist/reducers/reducer_edit_peak.js +122 -98
- package/dist/reducers/reducer_forecast.js +57 -44
- package/dist/reducers/reducer_integration.js +135 -103
- package/dist/reducers/reducer_jcamp.js +49 -44
- package/dist/reducers/reducer_layout.js +5 -6
- package/dist/reducers/reducer_manager.js +5 -6
- package/dist/reducers/reducer_meta.js +5 -6
- package/dist/reducers/reducer_multiplicity.js +100 -77
- package/dist/reducers/reducer_scan.js +17 -20
- package/dist/reducers/reducer_shift.js +115 -70
- package/dist/reducers/reducer_simulation.js +7 -8
- package/dist/reducers/reducer_status.js +5 -6
- package/dist/reducers/reducer_submit.js +12 -15
- package/dist/reducers/reducer_threshold.js +5 -6
- package/dist/reducers/reducer_ui.js +5 -6
- package/dist/reducers/reducer_voltammetry.js +156 -96
- package/dist/reducers/reducer_wavelength.js +5 -6
- package/dist/reducers/undo_redo_config.js +3 -5
- package/dist/sagas/index.js +2 -15
- package/dist/sagas/saga_edit_peak.js +54 -68
- package/dist/sagas/saga_manager.js +86 -130
- package/dist/sagas/saga_meta.js +25 -31
- package/dist/sagas/saga_multi_entities.js +40 -103
- package/dist/sagas/saga_multiplicity.js +336 -406
- package/dist/sagas/saga_ui.js +296 -475
- package/dist/setupTests.js +8 -0
- package/dist/third_party/jAnalyzer.js +66 -67
- package/dist/third_party/peakInterval.js +34 -34
- package/package.json +14 -14
- package/dist/components/cmd_bar/03_peak_bk.js +0 -139
- package/dist/components/cmd_bar/04_integration_bk.js +0 -180
- package/dist/components/cmd_bar/05_multiplicity_bk.js +0 -131
- package/dist/components/cmd_bar/r01_layout_bk.js +0 -186
- package/dist/components/cmd_bar/r06_predict_btn_bk.js +0 -220
- package/dist/components/d3_line/line_focus_bk.js +0 -825
- package/dist/components/d3_multi/index_bk.js +0 -210
- package/dist/components/d3_multi/multi_focus_bk.js +0 -533
- package/dist/components/panel/compare_bk.js +0 -256
- package/dist/components/panel/cyclic_voltamery_data_bk.js +0 -292
- package/dist/components/panel/index_bk.js +0 -178
- package/dist/components/panel/info_bk.js +0 -235
- package/dist/components/panel/multiplicity_bk.js +0 -280
- package/dist/helpers/carbonFeatures_bk.js +0 -45
- package/dist/helpers/cfg_bk.js +0 -80
- package/dist/helpers/chem_bk.js +0 -787
- package/dist/helpers/compass_bk.js +0 -149
- package/dist/helpers/converter_bk.js +0 -96
- package/dist/helpers/extractPeaksEdit_bk.js +0 -53
- package/dist/helpers/format_bk.js +0 -497
- package/dist/index_bk.js +0 -640
- package/dist/layer_content_bk.js +0 -105
- package/dist/layer_init_bk.js +0 -235
- package/dist/layer_prism_bk.js +0 -133
- package/dist/reducers/reducer_edit_peak_bk.js +0 -108
- package/dist/reducers/reducer_integration_bk.js +0 -134
- package/dist/reducers/reducer_jcamp_bk.js +0 -71
- package/dist/reducers/reducer_multiplicity_bk.js +0 -126
- package/dist/reducers/reducer_shift_bk.js +0 -88
- package/dist/reducers/reducer_voltammetry_bk.js +0 -287
- package/dist/sagas/saga_edit_peak_bk.js +0 -73
- package/dist/sagas/saga_multi_entities_bk.js +0 -106
- package/dist/sagas/saga_multiplicity_bk.js +0 -351
- package/dist/sagas/saga_ui_bk.js +0 -453
|
@@ -6,36 +6,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _action_type = require("../constants/action_type");
|
|
9
|
-
var
|
|
9
|
+
var _extractParams = require("../helpers/extractParams");
|
|
10
10
|
var _chem = require("../helpers/chem");
|
|
11
11
|
var _format = _interopRequireDefault(require("../helpers/format"));
|
|
12
12
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const initialState = {
|
|
15
15
|
listCurves: [],
|
|
16
|
-
curveIdx: 0
|
|
16
|
+
curveIdx: 0,
|
|
17
|
+
isShowAllCurve: false
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const setAllCurves = (state, action) => {
|
|
20
|
+
const {
|
|
21
|
+
payload
|
|
22
|
+
} = action;
|
|
20
23
|
if (payload) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
topic
|
|
24
|
-
feature
|
|
25
|
-
hasEdit
|
|
26
|
-
integration
|
|
24
|
+
const entities = payload.map((entity, idx) => {
|
|
25
|
+
const {
|
|
26
|
+
topic,
|
|
27
|
+
feature,
|
|
28
|
+
hasEdit,
|
|
29
|
+
integration
|
|
30
|
+
} = (0, _extractParams.extractParams)(entity, 1);
|
|
27
31
|
// const layout = entity.layout;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
const {
|
|
33
|
+
layout
|
|
34
|
+
} = entity;
|
|
35
|
+
const maxminPeak = (0, _chem.Convert2MaxMinPeak)(layout, feature, 0);
|
|
36
|
+
const color = _format.default.mutiEntitiesColors(idx);
|
|
31
37
|
return {
|
|
32
|
-
layout
|
|
33
|
-
topic
|
|
34
|
-
feature
|
|
35
|
-
hasEdit
|
|
36
|
-
integration
|
|
37
|
-
maxminPeak
|
|
38
|
-
color
|
|
38
|
+
layout,
|
|
39
|
+
topic,
|
|
40
|
+
feature,
|
|
41
|
+
hasEdit,
|
|
42
|
+
integration,
|
|
43
|
+
maxminPeak,
|
|
44
|
+
color,
|
|
39
45
|
curveIdx: idx
|
|
40
46
|
};
|
|
41
47
|
});
|
|
@@ -49,9 +55,9 @@ var setAllCurves = function setAllCurves(state, action) {
|
|
|
49
55
|
listCurves: payload
|
|
50
56
|
});
|
|
51
57
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
const curveReducer = function () {
|
|
59
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
60
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
55
61
|
switch (action.type) {
|
|
56
62
|
case _action_type.CURVE.SELECT_WORKING_CURVE:
|
|
57
63
|
return Object.assign({}, state, {
|
|
@@ -59,9 +65,12 @@ var curveReducer = function curveReducer() {
|
|
|
59
65
|
});
|
|
60
66
|
case _action_type.CURVE.SET_ALL_CURVES:
|
|
61
67
|
return setAllCurves(state, action);
|
|
68
|
+
case _action_type.CURVE.SET_SHOULD_SHOW_ALL_CURVES:
|
|
69
|
+
return Object.assign({}, state, {
|
|
70
|
+
isShowAllCurve: action.payload
|
|
71
|
+
});
|
|
62
72
|
default:
|
|
63
73
|
return state;
|
|
64
74
|
}
|
|
65
75
|
};
|
|
66
|
-
var _default = curveReducer;
|
|
67
|
-
exports.default = _default;
|
|
76
|
+
var _default = exports.default = curveReducer;
|
|
@@ -5,14 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
8
|
var _reduxUndo = _interopRequireDefault(require("redux-undo"));
|
|
10
9
|
var _action_type = require("../constants/action_type");
|
|
11
10
|
var _undo_redo_config = require("./undo_redo_config");
|
|
12
11
|
var _calc = require("../helpers/calc");
|
|
13
12
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
const initialState = {
|
|
16
15
|
selectedIdx: 0,
|
|
17
16
|
peaks: [{
|
|
18
17
|
prevOffset: 0,
|
|
@@ -20,151 +19,170 @@ var initialState = {
|
|
|
20
19
|
neg: []
|
|
21
20
|
}]
|
|
22
21
|
};
|
|
23
|
-
|
|
22
|
+
const defaultEmptyPeaks = {
|
|
24
23
|
prevOffset: 0,
|
|
25
24
|
pos: [],
|
|
26
25
|
neg: []
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const addToPos = (state, action) => {
|
|
28
|
+
const {
|
|
29
|
+
peaks
|
|
30
|
+
} = state;
|
|
31
|
+
const {
|
|
32
|
+
payload
|
|
33
|
+
} = action;
|
|
34
|
+
const {
|
|
35
|
+
dataToAdd,
|
|
36
|
+
curveIdx
|
|
37
|
+
} = payload;
|
|
38
|
+
let selectedEditPeaks = peaks[curveIdx];
|
|
34
39
|
if (!selectedEditPeaks) {
|
|
35
40
|
selectedEditPeaks = defaultEmptyPeaks;
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return (0, _calc.almostEqual)(n.x, dataToAdd.x);
|
|
41
|
-
});
|
|
42
|
+
const oriPosState = selectedEditPeaks.pos;
|
|
43
|
+
const oriNegState = selectedEditPeaks.neg;
|
|
44
|
+
const idxN = oriNegState.findIndex(n => (0, _calc.almostEqual)(n.x, dataToAdd.x));
|
|
42
45
|
if (idxN >= 0) {
|
|
43
46
|
// rm the peak from oriNegState if it is already deleted.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
neg
|
|
47
|
+
const neg = [...oriNegState.slice(0, idxN), ...oriNegState.slice(idxN + 1)];
|
|
48
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
49
|
+
neg
|
|
47
50
|
});
|
|
48
|
-
|
|
51
|
+
const newPeaks = [...peaks];
|
|
52
|
+
newPeaks[curveIdx] = newSelectedEditPeaks;
|
|
49
53
|
return Object.assign({}, state, {
|
|
50
|
-
peaks:
|
|
54
|
+
peaks: newPeaks
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
|
-
|
|
54
|
-
return (0, _calc.almostEqual)(p.x, dataToAdd.x);
|
|
55
|
-
});
|
|
57
|
+
const idxP = oriPosState.findIndex(p => (0, _calc.almostEqual)(p.x, dataToAdd.x));
|
|
56
58
|
if (idxP < 0) {
|
|
57
59
|
// add the peak
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
pos
|
|
60
|
+
const pos = [...oriPosState, dataToAdd];
|
|
61
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
62
|
+
pos
|
|
61
63
|
});
|
|
62
|
-
|
|
64
|
+
const newPeaks = [...peaks];
|
|
65
|
+
newPeaks[curveIdx] = newSelectedEditPeaks;
|
|
63
66
|
return Object.assign({}, state, {
|
|
64
|
-
peaks:
|
|
67
|
+
peaks: newPeaks,
|
|
65
68
|
selectedIdx: curveIdx
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
71
|
return state;
|
|
69
72
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
pos
|
|
73
|
+
const rmFromPos = (state, action) => {
|
|
74
|
+
const {
|
|
75
|
+
selectedIdx,
|
|
76
|
+
peaks
|
|
77
|
+
} = state;
|
|
78
|
+
const selectedEditPeaks = peaks[selectedIdx];
|
|
79
|
+
const oriPosState = selectedEditPeaks.pos;
|
|
80
|
+
const idx = oriPosState.findIndex(p => p.x === action.payload.x);
|
|
81
|
+
const pos = [...oriPosState.slice(0, idx), ...oriPosState.slice(idx + 1)];
|
|
82
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
83
|
+
pos
|
|
81
84
|
});
|
|
82
|
-
|
|
85
|
+
const newPeaks = [...peaks];
|
|
86
|
+
newPeaks[selectedIdx] = newSelectedEditPeaks;
|
|
83
87
|
return Object.assign({}, state, {
|
|
84
|
-
peaks:
|
|
88
|
+
peaks: newPeaks
|
|
85
89
|
});
|
|
86
90
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
const addToNeg = (state, action) => {
|
|
92
|
+
const {
|
|
93
|
+
peaks
|
|
94
|
+
} = state;
|
|
95
|
+
const {
|
|
96
|
+
payload
|
|
97
|
+
} = action;
|
|
98
|
+
const {
|
|
99
|
+
dataToAdd,
|
|
100
|
+
curveIdx
|
|
101
|
+
} = payload;
|
|
102
|
+
let selectedEditPeaks = peaks[curveIdx];
|
|
93
103
|
if (!selectedEditPeaks) {
|
|
94
104
|
selectedEditPeaks = defaultEmptyPeaks;
|
|
95
105
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return n.x === dataToAdd.x;
|
|
100
|
-
});
|
|
106
|
+
const oriPosState = selectedEditPeaks.pos;
|
|
107
|
+
const oriNegState = selectedEditPeaks.neg;
|
|
108
|
+
const idxP = oriPosState.findIndex(n => n.x === dataToAdd.x);
|
|
101
109
|
if (idxP >= 0) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
pos
|
|
110
|
+
const pos = [...oriPosState.slice(0, idxP), ...oriPosState.slice(idxP + 1)];
|
|
111
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
112
|
+
pos
|
|
105
113
|
});
|
|
106
|
-
|
|
114
|
+
const newPeaks = [...peaks];
|
|
115
|
+
newPeaks[curveIdx] = newSelectedEditPeaks;
|
|
107
116
|
return Object.assign({}, state, {
|
|
108
|
-
peaks:
|
|
117
|
+
peaks: newPeaks
|
|
109
118
|
});
|
|
110
119
|
}
|
|
111
|
-
|
|
112
|
-
return n.x === dataToAdd.x;
|
|
113
|
-
});
|
|
120
|
+
const idxN = oriNegState.findIndex(n => n.x === dataToAdd.x);
|
|
114
121
|
if (idxN < 0) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
neg
|
|
122
|
+
const neg = [...oriNegState, dataToAdd];
|
|
123
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
124
|
+
neg
|
|
118
125
|
});
|
|
119
|
-
|
|
126
|
+
const newPeaks = [...peaks];
|
|
127
|
+
newPeaks[curveIdx] = newSelectedEditPeaks;
|
|
120
128
|
return Object.assign({}, state, {
|
|
121
|
-
peaks:
|
|
129
|
+
peaks: newPeaks,
|
|
122
130
|
selectedIdx: curveIdx
|
|
123
131
|
});
|
|
124
132
|
}
|
|
125
133
|
return state;
|
|
126
134
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
neg
|
|
135
|
+
const rmFromNeg = (state, action) => {
|
|
136
|
+
const {
|
|
137
|
+
selectedIdx,
|
|
138
|
+
peaks
|
|
139
|
+
} = state;
|
|
140
|
+
const selectedEditPeaks = peaks[selectedIdx];
|
|
141
|
+
const oriNegState = selectedEditPeaks.neg;
|
|
142
|
+
const idx = oriNegState.findIndex(n => n.x === action.payload.x);
|
|
143
|
+
const neg = [...oriNegState.slice(0, idx), ...oriNegState.slice(idx + 1)];
|
|
144
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
145
|
+
neg
|
|
138
146
|
});
|
|
139
|
-
|
|
147
|
+
const newPeaks = [...peaks];
|
|
148
|
+
newPeaks[selectedIdx] = newSelectedEditPeaks;
|
|
140
149
|
return Object.assign({}, state, {
|
|
141
|
-
peaks:
|
|
150
|
+
peaks: newPeaks
|
|
142
151
|
});
|
|
143
152
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
const processShift = (state, action) => {
|
|
154
|
+
const {
|
|
155
|
+
payload
|
|
156
|
+
} = action;
|
|
157
|
+
const {
|
|
158
|
+
curveIdx
|
|
159
|
+
} = action.payload;
|
|
160
|
+
const {
|
|
161
|
+
peaks
|
|
162
|
+
} = state;
|
|
163
|
+
let selectedEditPeaks = peaks[curveIdx];
|
|
149
164
|
if (!selectedEditPeaks) {
|
|
150
165
|
selectedEditPeaks = defaultEmptyPeaks;
|
|
151
166
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
const {
|
|
168
|
+
pos,
|
|
169
|
+
neg,
|
|
170
|
+
prevOffset
|
|
171
|
+
} = payload;
|
|
172
|
+
const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
|
|
173
|
+
pos,
|
|
174
|
+
neg,
|
|
175
|
+
prevOffset
|
|
159
176
|
});
|
|
160
|
-
|
|
177
|
+
const newPeaks = [...peaks];
|
|
178
|
+
newPeaks[curveIdx] = newSelectedEditPeaks;
|
|
161
179
|
return Object.assign({}, state, {
|
|
162
|
-
peaks:
|
|
180
|
+
peaks: newPeaks
|
|
163
181
|
});
|
|
164
182
|
};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
183
|
+
const editPeakReducer = function () {
|
|
184
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
185
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
168
186
|
switch (action.type) {
|
|
169
187
|
case _action_type.EDITPEAK.ADD_POSITIVE:
|
|
170
188
|
return addToPos(state, action);
|
|
@@ -177,11 +195,17 @@ var editPeakReducer = function editPeakReducer() {
|
|
|
177
195
|
case _action_type.EDITPEAK.SHIFT:
|
|
178
196
|
return processShift(state, action);
|
|
179
197
|
case _action_type.MANAGER.RESETALL:
|
|
180
|
-
return
|
|
198
|
+
return {
|
|
199
|
+
selectedIdx: 0,
|
|
200
|
+
peaks: [{
|
|
201
|
+
prevOffset: 0,
|
|
202
|
+
pos: [],
|
|
203
|
+
neg: []
|
|
204
|
+
}]
|
|
205
|
+
};
|
|
181
206
|
default:
|
|
182
207
|
return _undo_redo_config.undoRedoActions.indexOf(action.type) >= 0 ? Object.assign({}, state) : state;
|
|
183
208
|
}
|
|
184
209
|
};
|
|
185
|
-
|
|
186
|
-
var _default = undoableEditPeakReducer;
|
|
187
|
-
exports.default = _default;
|
|
210
|
+
const undoableEditPeakReducer = (0, _reduxUndo.default)(editPeakReducer, _undo_redo_config.undoRedoConfig);
|
|
211
|
+
var _default = exports.default = undoableEditPeakReducer;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _action_type = require("../constants/action_type");
|
|
10
8
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
const initialState = {
|
|
13
11
|
predictions: {
|
|
14
12
|
outline: {},
|
|
15
13
|
output: {
|
|
@@ -17,69 +15,85 @@ var initialState = {
|
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
const updateIrResl = (stResl, plPred) => {
|
|
19
|
+
const {
|
|
20
|
+
sma,
|
|
21
|
+
identity,
|
|
22
|
+
value
|
|
23
|
+
} = plPred;
|
|
24
|
+
const {
|
|
25
|
+
svgs
|
|
26
|
+
} = stResl;
|
|
27
|
+
const prevFgs = stResl.fgs;
|
|
28
|
+
const nextVal = {
|
|
29
|
+
[`status${identity}`]: value
|
|
30
|
+
};
|
|
31
|
+
const nextFgs = prevFgs.map(fg => {
|
|
28
32
|
if (fg.sma === sma) {
|
|
29
33
|
return Object.assign({}, fg, nextVal);
|
|
30
34
|
}
|
|
31
35
|
return fg;
|
|
32
36
|
});
|
|
33
|
-
|
|
37
|
+
const nextResult = {
|
|
34
38
|
type: 'ir',
|
|
35
39
|
fgs: nextFgs,
|
|
36
|
-
svgs
|
|
40
|
+
svgs
|
|
37
41
|
};
|
|
38
42
|
return nextResult;
|
|
39
43
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const updateIrStatus = (state, action) => {
|
|
45
|
+
const {
|
|
46
|
+
predictions
|
|
47
|
+
} = action.payload;
|
|
48
|
+
const {
|
|
49
|
+
outline,
|
|
50
|
+
output
|
|
51
|
+
} = state.predictions;
|
|
52
|
+
const stResl = output.result[0];
|
|
53
|
+
const nextResl = updateIrResl(stResl, predictions);
|
|
47
54
|
return Object.assign({}, state, {
|
|
48
55
|
predictions: {
|
|
49
|
-
outline
|
|
56
|
+
outline,
|
|
50
57
|
output: {
|
|
51
58
|
result: [nextResl]
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
});
|
|
55
62
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
const updateNmrResl = (stResl, plPred) => {
|
|
64
|
+
const {
|
|
65
|
+
idx,
|
|
66
|
+
atom,
|
|
67
|
+
identity,
|
|
68
|
+
value
|
|
69
|
+
} = plPred;
|
|
70
|
+
const preResult = stResl;
|
|
71
|
+
const nextShifts = preResult.shifts.map((s, index) => {
|
|
63
72
|
if (s.atom === atom && index === idx) {
|
|
64
|
-
return Object.assign({}, s,
|
|
73
|
+
return Object.assign({}, s, {
|
|
74
|
+
[`status${identity}`]: value
|
|
75
|
+
});
|
|
65
76
|
}
|
|
66
77
|
return s;
|
|
67
78
|
});
|
|
68
|
-
|
|
79
|
+
const nextResult = Object.assign({}, preResult, {
|
|
69
80
|
shifts: nextShifts
|
|
70
81
|
});
|
|
71
82
|
return nextResult;
|
|
72
83
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
const updateNmrStatus = (state, action) => {
|
|
85
|
+
const {
|
|
86
|
+
predictions
|
|
87
|
+
} = action.payload;
|
|
88
|
+
const {
|
|
89
|
+
outline,
|
|
90
|
+
output
|
|
91
|
+
} = state.predictions;
|
|
92
|
+
const stResl = output.result[0];
|
|
93
|
+
const nextResl = updateNmrResl(stResl, predictions);
|
|
94
|
+
const newSt = Object.assign({}, state, {
|
|
81
95
|
predictions: {
|
|
82
|
-
outline
|
|
96
|
+
outline,
|
|
83
97
|
output: {
|
|
84
98
|
result: [nextResl]
|
|
85
99
|
}
|
|
@@ -87,9 +101,9 @@ var updateNmrStatus = function updateNmrStatus(state, action) {
|
|
|
87
101
|
});
|
|
88
102
|
return newSt;
|
|
89
103
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
104
|
+
const forecastReducer = function () {
|
|
105
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
106
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
93
107
|
switch (action.type) {
|
|
94
108
|
case _action_type.FORECAST.INIT_STATUS:
|
|
95
109
|
if (!action.payload) return state;
|
|
@@ -105,5 +119,4 @@ var forecastReducer = function forecastReducer() {
|
|
|
105
119
|
return state;
|
|
106
120
|
}
|
|
107
121
|
};
|
|
108
|
-
var _default = forecastReducer;
|
|
109
|
-
exports.default = _default;
|
|
122
|
+
var _default = exports.default = forecastReducer;
|