@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
|
@@ -10,7 +10,7 @@ var _action_type = require("../constants/action_type");
|
|
|
10
10
|
var _undo_redo_config = require("./undo_redo_config");
|
|
11
11
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const initialState = {
|
|
14
14
|
selectedIdx: 0,
|
|
15
15
|
multiplicities: [{
|
|
16
16
|
stack: [],
|
|
@@ -19,130 +19,154 @@ var initialState = {
|
|
|
19
19
|
edited: false
|
|
20
20
|
}]
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const defaultEmptyMultiplicity = {
|
|
23
23
|
stack: [],
|
|
24
24
|
shift: 0,
|
|
25
25
|
smExtext: false,
|
|
26
26
|
edited: false
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const setShift = (state, action) => {
|
|
29
|
+
const shift = action.payload.prevOffset;
|
|
30
|
+
const {
|
|
31
|
+
selectedIdx,
|
|
32
|
+
multiplicities
|
|
33
|
+
} = state;
|
|
34
|
+
const selectedMulti = multiplicities[selectedIdx];
|
|
35
|
+
const newSelectedMulti = Object.assign({}, selectedMulti, {
|
|
36
|
+
shift
|
|
35
37
|
});
|
|
36
|
-
|
|
38
|
+
const newMultiplicities = [...multiplicities];
|
|
39
|
+
newMultiplicities[selectedIdx] = newSelectedMulti;
|
|
37
40
|
return Object.assign({}, state, {
|
|
38
|
-
multiplicities:
|
|
41
|
+
multiplicities: newMultiplicities
|
|
39
42
|
});
|
|
40
43
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
dataToRemove
|
|
44
|
-
curveIdx
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
const rmFromStack = (state, action) => {
|
|
45
|
+
const {
|
|
46
|
+
dataToRemove,
|
|
47
|
+
curveIdx
|
|
48
|
+
} = action.payload;
|
|
49
|
+
const {
|
|
50
|
+
multiplicities
|
|
51
|
+
} = state;
|
|
52
|
+
const selectedMulti = multiplicities[curveIdx];
|
|
53
|
+
const {
|
|
54
|
+
stack
|
|
55
|
+
} = selectedMulti;
|
|
56
|
+
const {
|
|
57
|
+
xL,
|
|
58
|
+
xU,
|
|
59
|
+
xExtent
|
|
60
|
+
} = dataToRemove;
|
|
61
|
+
let [txL, txU] = [0, 0];
|
|
53
62
|
if (xL && xU) {
|
|
54
63
|
// rm click integration
|
|
55
|
-
txL = xL;
|
|
56
|
-
txU = xU;
|
|
64
|
+
[txL, txU] = [xL, xU];
|
|
57
65
|
} else if (xExtent) {
|
|
58
66
|
// rm click multiplicity
|
|
59
|
-
|
|
60
|
-
txL = _ref[0];
|
|
61
|
-
txU = _ref[1];
|
|
67
|
+
[txL, txU] = [xExtent.xL, xExtent.xU];
|
|
62
68
|
} else {
|
|
63
69
|
return state;
|
|
64
70
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
kxL = _ref2[0],
|
|
68
|
-
kxU = _ref2[1];
|
|
71
|
+
const newStack = stack.filter(k => {
|
|
72
|
+
const [kxL, kxU] = [k.xExtent.xL, k.xExtent.xU];
|
|
69
73
|
return kxL !== txL && kxU !== txU;
|
|
70
74
|
});
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
const newSmExtext = newStack[0] ? newStack[0].xExtent : false;
|
|
76
|
+
const newSelectedMulti = Object.assign({}, selectedMulti, {
|
|
73
77
|
stack: newStack,
|
|
74
78
|
smExtext: newSmExtext
|
|
75
79
|
});
|
|
76
|
-
|
|
80
|
+
const newMultiplicities = [...multiplicities];
|
|
81
|
+
newMultiplicities[curveIdx] = newSelectedMulti;
|
|
77
82
|
return Object.assign({}, state, {
|
|
78
|
-
multiplicities:
|
|
83
|
+
multiplicities: newMultiplicities,
|
|
79
84
|
selectedIdx: curveIdx
|
|
80
85
|
});
|
|
81
86
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
const updateMpyJ = (state, action) => {
|
|
88
|
+
const {
|
|
89
|
+
payload
|
|
90
|
+
} = action;
|
|
91
|
+
const {
|
|
92
|
+
xExtent,
|
|
93
|
+
value
|
|
94
|
+
} = payload;
|
|
86
95
|
if (!value && value !== '') return state;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const {
|
|
97
|
+
selectedIdx,
|
|
98
|
+
multiplicities
|
|
99
|
+
} = state;
|
|
100
|
+
const selectedMulti = multiplicities[selectedIdx];
|
|
101
|
+
const {
|
|
102
|
+
stack
|
|
103
|
+
} = selectedMulti;
|
|
104
|
+
const regx = /[^0-9.,-]/g;
|
|
105
|
+
const js = value.replace(regx, '').split(',').map(j => parseFloat(j)).filter(j => j);
|
|
106
|
+
const newStack = stack.map(k => {
|
|
98
107
|
if (k.xExtent.xL === xExtent.xL && k.xExtent.xU === xExtent.xU) {
|
|
99
108
|
if (k.mpyType === 'm') return Object.assign({}, k, {
|
|
100
109
|
js: []
|
|
101
110
|
});
|
|
102
111
|
return Object.assign({}, k, {
|
|
103
|
-
js
|
|
112
|
+
js
|
|
104
113
|
});
|
|
105
114
|
}
|
|
106
115
|
return k;
|
|
107
116
|
});
|
|
108
|
-
|
|
117
|
+
const newSelectedMulti = Object.assign({}, selectedMulti, {
|
|
109
118
|
stack: newStack
|
|
110
119
|
});
|
|
111
|
-
|
|
120
|
+
const newMultiplicities = [...multiplicities];
|
|
121
|
+
newMultiplicities[selectedIdx] = newSelectedMulti;
|
|
112
122
|
return Object.assign({}, state, {
|
|
113
|
-
multiplicities:
|
|
123
|
+
multiplicities: newMultiplicities
|
|
114
124
|
});
|
|
115
125
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
const clickMpyOne = (state, action) => {
|
|
127
|
+
const {
|
|
128
|
+
payload
|
|
129
|
+
} = action;
|
|
130
|
+
const {
|
|
131
|
+
curveIdx,
|
|
132
|
+
payloadData
|
|
133
|
+
} = payload;
|
|
134
|
+
const {
|
|
135
|
+
multiplicities
|
|
136
|
+
} = state;
|
|
137
|
+
const selectedMulti = multiplicities[curveIdx];
|
|
138
|
+
const newSelectedMulti = Object.assign({}, selectedMulti, {
|
|
123
139
|
smExtext: payloadData
|
|
124
140
|
});
|
|
125
|
-
|
|
141
|
+
const newMultiplicities = [...multiplicities];
|
|
142
|
+
newMultiplicities[curveIdx] = newSelectedMulti;
|
|
126
143
|
return Object.assign({}, state, {
|
|
127
|
-
multiplicities:
|
|
144
|
+
multiplicities: newMultiplicities,
|
|
128
145
|
selectedIdx: curveIdx
|
|
129
146
|
});
|
|
130
147
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
const clearAll = (state, action) => {
|
|
149
|
+
const {
|
|
150
|
+
payload
|
|
151
|
+
} = action;
|
|
152
|
+
const {
|
|
153
|
+
curveIdx
|
|
154
|
+
} = payload;
|
|
155
|
+
const {
|
|
156
|
+
multiplicities
|
|
157
|
+
} = state;
|
|
158
|
+
const newSelectedMulti = Object.assign({}, defaultEmptyMultiplicity, {
|
|
136
159
|
edited: true
|
|
137
160
|
});
|
|
138
|
-
|
|
161
|
+
const newMultiplicities = [...multiplicities];
|
|
162
|
+
newMultiplicities[curveIdx] = newSelectedMulti;
|
|
139
163
|
return Object.assign({}, state, {
|
|
140
|
-
multiplicities:
|
|
164
|
+
multiplicities: newMultiplicities
|
|
141
165
|
});
|
|
142
166
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
167
|
+
const multiplicityReducer = function () {
|
|
168
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
169
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
146
170
|
switch (action.type) {
|
|
147
171
|
case _action_type.EDITPEAK.SHIFT:
|
|
148
172
|
return setShift(state, action);
|
|
@@ -171,6 +195,5 @@ var multiplicityReducer = function multiplicityReducer() {
|
|
|
171
195
|
return _undo_redo_config.undoRedoActions.indexOf(action.type) >= 0 ? Object.assign({}, state) : state;
|
|
172
196
|
}
|
|
173
197
|
};
|
|
174
|
-
|
|
175
|
-
var _default = undoableMultiplicityReducer;
|
|
176
|
-
exports.default = _default;
|
|
198
|
+
const undoableMultiplicityReducer = (0, _reduxUndo.default)(multiplicityReducer, _undo_redo_config.undoRedoConfig);
|
|
199
|
+
var _default = exports.default = undoableMultiplicityReducer;
|
|
@@ -7,34 +7,32 @@ exports.default = void 0;
|
|
|
7
7
|
var _action_type = require("../constants/action_type");
|
|
8
8
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const initialState = {
|
|
11
11
|
target: false,
|
|
12
12
|
count: 1,
|
|
13
13
|
isAuto: true
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const setTarget = (state, payload) => Object.assign({}, state, {
|
|
16
|
+
target: payload
|
|
17
|
+
});
|
|
18
|
+
const resetAll = (state, payload) => {
|
|
19
|
+
const {
|
|
20
|
+
scanCount,
|
|
21
|
+
scanEditTarget
|
|
22
|
+
} = payload;
|
|
23
23
|
return Object.assign({}, state, {
|
|
24
24
|
target: false,
|
|
25
25
|
count: parseInt(scanCount, 10),
|
|
26
26
|
isAuto: !scanEditTarget
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
37
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
29
|
+
const toggleIsAuto = state => Object.assign({}, state, {
|
|
30
|
+
isAuto: !state.isAuto,
|
|
31
|
+
target: false
|
|
32
|
+
});
|
|
33
|
+
const scanReducer = function () {
|
|
34
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
35
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
38
36
|
switch (action.type) {
|
|
39
37
|
case _action_type.SCAN.SET_TARGET:
|
|
40
38
|
case _action_type.SCAN.RESET_TARGET:
|
|
@@ -47,5 +45,4 @@ var scanReducer = function scanReducer() {
|
|
|
47
45
|
return state;
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
|
-
var _default = scanReducer;
|
|
51
|
-
exports.default = _default;
|
|
48
|
+
var _default = exports.default = scanReducer;
|
|
@@ -9,7 +9,7 @@ var _list_shift = require("../constants/list_shift");
|
|
|
9
9
|
var _shift = require("../helpers/shift");
|
|
10
10
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const shiftNone = _list_shift.LIST_SHIFT_1H[0];
|
|
13
13
|
|
|
14
14
|
// const initialState = {
|
|
15
15
|
// ref: shiftNone,
|
|
@@ -17,7 +17,7 @@ var shiftNone = _list_shift.LIST_SHIFT_1H[0];
|
|
|
17
17
|
// enable: true,
|
|
18
18
|
// };
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const initialState = {
|
|
21
21
|
selectedIdx: 0,
|
|
22
22
|
shifts: [{
|
|
23
23
|
ref: shiftNone,
|
|
@@ -25,27 +25,31 @@ var initialState = {
|
|
|
25
25
|
enable: true
|
|
26
26
|
}]
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
const defaultEmptyShift = {
|
|
29
29
|
ref: shiftNone,
|
|
30
30
|
peak: false,
|
|
31
31
|
enable: true
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const resetRef = payload => {
|
|
34
|
+
const {
|
|
35
|
+
shift,
|
|
36
|
+
layout
|
|
37
|
+
} = payload;
|
|
36
38
|
if (!shift || !shift.solventName || !shift.solventValue) return shiftNone;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
listShift.forEach(
|
|
39
|
+
const name = shift.solventName;
|
|
40
|
+
let target = false;
|
|
41
|
+
const listShift = (0, _list_shift.getListShift)(layout);
|
|
42
|
+
listShift.forEach(l => {
|
|
41
43
|
if (l.name === name) {
|
|
42
44
|
target = l;
|
|
43
45
|
}
|
|
44
46
|
});
|
|
45
47
|
return target || shiftNone[0];
|
|
46
48
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
const resetEnable = payload => {
|
|
50
|
+
const {
|
|
51
|
+
typ
|
|
52
|
+
} = payload.operation;
|
|
49
53
|
switch (typ) {
|
|
50
54
|
case 'NMR':
|
|
51
55
|
return true;
|
|
@@ -53,127 +57,169 @@ var resetEnable = function resetEnable(payload) {
|
|
|
53
57
|
return false;
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
const resetShift = (state, action) => {
|
|
61
|
+
const {
|
|
62
|
+
payload
|
|
63
|
+
} = action;
|
|
64
|
+
const {
|
|
65
|
+
curvesInfo
|
|
66
|
+
} = payload;
|
|
67
|
+
const {
|
|
68
|
+
isMultiCurve,
|
|
69
|
+
curveIdx,
|
|
70
|
+
numberOfCurve
|
|
71
|
+
} = curvesInfo;
|
|
72
|
+
const {
|
|
73
|
+
shifts
|
|
74
|
+
} = state;
|
|
75
|
+
let selectedShift = shifts[curveIdx];
|
|
60
76
|
if (selectedShift === false || selectedShift === undefined) {
|
|
61
77
|
selectedShift = defaultEmptyShift;
|
|
62
78
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
if (isMultiCurve) {
|
|
80
|
+
for (let idx = 0; idx < numberOfCurve; idx += 1) {
|
|
81
|
+
const checkShift = shifts[idx];
|
|
82
|
+
if (!checkShift) {
|
|
83
|
+
shifts[idx] = defaultEmptyShift;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const newShift = Object.assign({}, defaultEmptyShift, {
|
|
88
|
+
ref: resetRef(payload),
|
|
89
|
+
enable: resetEnable(payload)
|
|
66
90
|
});
|
|
67
|
-
shifts[
|
|
91
|
+
shifts[curveIdx] = newShift;
|
|
68
92
|
return Object.assign({}, state, {
|
|
69
|
-
shifts
|
|
70
|
-
selectedIdx:
|
|
93
|
+
shifts,
|
|
94
|
+
selectedIdx: curveIdx
|
|
71
95
|
});
|
|
72
96
|
};
|
|
73
|
-
|
|
97
|
+
const updateShift = (state, action) => {
|
|
74
98
|
// eslint-disable-line
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
const {
|
|
100
|
+
selectedIdx,
|
|
101
|
+
shifts
|
|
102
|
+
} = state;
|
|
103
|
+
let selectedShift = shifts[selectedIdx];
|
|
78
104
|
if (selectedShift === false || selectedShift === undefined) {
|
|
79
105
|
selectedShift = defaultEmptyShift;
|
|
80
106
|
}
|
|
81
|
-
|
|
107
|
+
const newShift = Object.assign({}, selectedShift, {
|
|
82
108
|
ref: false,
|
|
83
109
|
enable: selectedShift.enable
|
|
84
110
|
});
|
|
85
111
|
shifts[selectedIdx] = newShift;
|
|
86
112
|
return Object.assign({}, state, {
|
|
87
|
-
shifts
|
|
88
|
-
selectedIdx
|
|
113
|
+
shifts,
|
|
114
|
+
selectedIdx
|
|
89
115
|
});
|
|
90
116
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
117
|
+
const setRef = (state, action) => {
|
|
118
|
+
const {
|
|
119
|
+
payload
|
|
120
|
+
} = action;
|
|
121
|
+
const {
|
|
122
|
+
dataToSet,
|
|
123
|
+
curveIdx
|
|
124
|
+
} = payload;
|
|
125
|
+
const {
|
|
126
|
+
shifts
|
|
127
|
+
} = state;
|
|
128
|
+
let selectedShift = shifts[curveIdx];
|
|
97
129
|
if (selectedShift === false || selectedShift === undefined) {
|
|
98
130
|
selectedShift = defaultEmptyShift;
|
|
99
131
|
}
|
|
100
|
-
|
|
132
|
+
const newShift = Object.assign({}, selectedShift, {
|
|
101
133
|
ref: dataToSet,
|
|
102
134
|
enable: true
|
|
103
135
|
});
|
|
104
136
|
shifts[curveIdx] = newShift;
|
|
105
137
|
return Object.assign({}, state, {
|
|
106
|
-
shifts
|
|
138
|
+
shifts,
|
|
107
139
|
selectedIdx: curveIdx
|
|
108
140
|
});
|
|
109
141
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
142
|
+
const setPeak = (state, action) => {
|
|
143
|
+
const {
|
|
144
|
+
payload
|
|
145
|
+
} = action;
|
|
146
|
+
const {
|
|
147
|
+
dataToSet,
|
|
148
|
+
curveIdx
|
|
149
|
+
} = payload;
|
|
150
|
+
const {
|
|
151
|
+
shifts
|
|
152
|
+
} = state;
|
|
153
|
+
let selectedShift = shifts[curveIdx];
|
|
116
154
|
if (selectedShift === false || selectedShift === undefined) {
|
|
117
155
|
selectedShift = defaultEmptyShift;
|
|
118
156
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
const resX = (0, _shift.CalcResidualX)(selectedShift.ref, selectedShift.peak, dataToSet);
|
|
158
|
+
const trueApex = (0, _shift.RealPts)([dataToSet], resX)[0];
|
|
159
|
+
const isSamePt = selectedShift.peak.x === trueApex.x;
|
|
160
|
+
const truePeak = trueApex && trueApex.x && !isSamePt ? trueApex : false;
|
|
161
|
+
const newShift = Object.assign({}, selectedShift, {
|
|
124
162
|
peak: truePeak,
|
|
125
163
|
enable: true
|
|
126
164
|
});
|
|
127
165
|
shifts[curveIdx] = newShift;
|
|
128
166
|
return Object.assign({}, state, {
|
|
129
|
-
shifts
|
|
167
|
+
shifts,
|
|
130
168
|
selectedIdx: curveIdx
|
|
131
169
|
});
|
|
132
170
|
};
|
|
133
|
-
|
|
171
|
+
const removePeak = (state, action) => {
|
|
134
172
|
// eslint-disable-line
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
173
|
+
const {
|
|
174
|
+
selectedIdx,
|
|
175
|
+
shifts
|
|
176
|
+
} = state;
|
|
177
|
+
let selectedShift = shifts[selectedIdx];
|
|
138
178
|
if (selectedShift === false || selectedShift === undefined) {
|
|
139
179
|
selectedShift = defaultEmptyShift;
|
|
140
180
|
}
|
|
141
|
-
|
|
181
|
+
const newShift = Object.assign({}, selectedShift, {
|
|
142
182
|
peak: false,
|
|
143
183
|
enable: true
|
|
144
184
|
});
|
|
145
185
|
shifts[selectedIdx] = newShift;
|
|
146
186
|
return Object.assign({}, state, {
|
|
147
|
-
shifts
|
|
148
|
-
selectedIdx
|
|
187
|
+
shifts,
|
|
188
|
+
selectedIdx
|
|
149
189
|
});
|
|
150
190
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
191
|
+
const addNegative = (state, action) => {
|
|
192
|
+
const {
|
|
193
|
+
payload
|
|
194
|
+
} = action;
|
|
195
|
+
const {
|
|
196
|
+
dataToAdd,
|
|
197
|
+
curveIdx
|
|
198
|
+
} = payload;
|
|
199
|
+
const {
|
|
200
|
+
shifts
|
|
201
|
+
} = state;
|
|
202
|
+
let selectedShift = shifts[curveIdx];
|
|
157
203
|
if (selectedShift === false || selectedShift === undefined) {
|
|
158
204
|
selectedShift = defaultEmptyShift;
|
|
159
205
|
}
|
|
160
|
-
|
|
206
|
+
const rmApex = selectedShift.peak.x === dataToAdd.x;
|
|
161
207
|
if (!rmApex) {
|
|
162
208
|
return state;
|
|
163
209
|
}
|
|
164
|
-
|
|
210
|
+
const newShift = Object.assign({}, selectedShift, {
|
|
165
211
|
peak: false,
|
|
166
212
|
enable: true
|
|
167
213
|
});
|
|
168
214
|
shifts[curveIdx] = newShift;
|
|
169
215
|
return Object.assign({}, state, {
|
|
170
|
-
shifts
|
|
216
|
+
shifts,
|
|
171
217
|
selectedIdx: curveIdx
|
|
172
218
|
});
|
|
173
219
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
220
|
+
const shiftReducer = function () {
|
|
221
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
222
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
177
223
|
switch (action.type) {
|
|
178
224
|
case _action_type.SHIFT.SET_REF:
|
|
179
225
|
return setRef(state, action);
|
|
@@ -196,5 +242,4 @@ var shiftReducer = function shiftReducer() {
|
|
|
196
242
|
return state;
|
|
197
243
|
}
|
|
198
244
|
};
|
|
199
|
-
var _default = shiftReducer;
|
|
200
|
-
exports.default = _default;
|
|
245
|
+
var _default = exports.default = shiftReducer;
|
|
@@ -7,16 +7,16 @@ exports.default = void 0;
|
|
|
7
7
|
var _action_type = require("../constants/action_type");
|
|
8
8
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const initialState = {
|
|
11
11
|
nmrSimPeaks: []
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const resetAll = (state, action) => {
|
|
14
|
+
const newState = action.payload;
|
|
15
15
|
return Object.assign({}, state, newState);
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const simulatioinReducer = function () {
|
|
18
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
19
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
20
20
|
switch (action.type) {
|
|
21
21
|
case _action_type.SIMULATION.RESET_ALL_RDC:
|
|
22
22
|
return resetAll(state, action);
|
|
@@ -24,5 +24,4 @@ var simulatioinReducer = function simulatioinReducer() {
|
|
|
24
24
|
return state;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
var _default = simulatioinReducer;
|
|
28
|
-
exports.default = _default;
|
|
27
|
+
var _default = exports.default = simulatioinReducer;
|
|
@@ -7,12 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
var _action_type = require("../constants/action_type");
|
|
8
8
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const initialState = {
|
|
11
11
|
btnSubmit: false
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const statusReducer = function () {
|
|
14
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
15
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
16
16
|
switch (action.type) {
|
|
17
17
|
case _action_type.STATUS.TOGGLEBTNSUBMIT:
|
|
18
18
|
return Object.assign({}, state, {
|
|
@@ -46,5 +46,4 @@ var statusReducer = function statusReducer() {
|
|
|
46
46
|
return initialState;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
var _default = statusReducer;
|
|
50
|
-
exports.default = _default;
|
|
49
|
+
var _default = exports.default = statusReducer;
|