@complat/react-spectra-editor 1.7.1 → 1.8.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/CHANGELOG.md +28 -0
- package/LICENSE +21 -662
- package/README.md +5 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp.js +2329 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_2.js +2874 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_mz_chemstation.js +3242 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_chemstation.js +854 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_neg.js +1233 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_pos.js +1233 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis.js +48908 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis_chemstation.js +15424 -0
- package/dist/__tests__/units/components/cmd_bar/r05_submit_btn.test.js +158 -3
- package/dist/__tests__/units/components/d3_line_rect.test.js +85 -0
- package/dist/__tests__/units/components/d3_multi/multi_focus.test.js +43 -0
- package/dist/__tests__/units/components/hplc_viewer.test.js +123 -0
- package/dist/__tests__/units/components/panel/info.test.js +55 -15
- package/dist/__tests__/units/features/lc-ms/parsing/lcmsCategory.test.js +73 -0
- package/dist/__tests__/units/features/lc-ms/submit/peaks.test.js +310 -0
- package/dist/actions/curve.js +5 -2
- package/dist/actions/hplc_ms.js +66 -0
- package/dist/actions/integration.js +17 -2
- package/dist/actions/ui.js +39 -11
- package/dist/app.js +21 -8
- package/dist/components/cmd_bar/01_viewer.js +15 -11
- package/dist/components/cmd_bar/03_peak.js +25 -16
- package/dist/components/cmd_bar/04_integration.js +116 -17
- package/dist/components/cmd_bar/08_peak_group.js +83 -0
- package/dist/components/cmd_bar/collapsible_toolbar_group.js +101 -0
- package/dist/components/cmd_bar/common.js +4 -3
- package/dist/components/cmd_bar/index.js +76 -18
- package/dist/components/cmd_bar/r01_layout.js +6 -0
- package/dist/components/cmd_bar/r02_scan.js +15 -11
- package/dist/components/cmd_bar/r03_threshold.js +19 -3
- package/dist/components/cmd_bar/r04_submit.js +61 -6
- package/dist/components/cmd_bar/r05_submit_btn.js +60 -13
- package/dist/components/cmd_bar/r06_predict_btn.js +4 -4
- package/dist/components/cmd_bar/r07_wavelength_btn.js +10 -9
- package/dist/components/cmd_bar/r09_detector.js +2 -2
- package/dist/components/cmd_bar/tri_btn.js +4 -1
- package/dist/components/common/draw.js +6 -5
- package/dist/components/d3_line/index.js +70 -15
- package/dist/components/d3_line/line_focus.js +104 -67
- package/dist/components/d3_line_rect/index.js +836 -0
- package/dist/components/d3_line_rect/line_focus.js +526 -0
- package/dist/components/d3_line_rect/multi_focus.js +433 -0
- package/dist/components/d3_line_rect/rect_focus.js +247 -0
- package/dist/components/d3_multi/index.js +154 -163
- package/dist/components/d3_multi/multi_focus.js +117 -68
- package/dist/components/d3_rect/index.js +6 -0
- package/dist/components/d3_rect/rect_focus.js +17 -5
- package/dist/components/hplc_viewer.js +169 -0
- package/dist/components/lc_ms_uv_tools_bar.js +175 -0
- package/dist/components/multi_jcamps_viewer.js +17 -5
- package/dist/components/panel/compare.js +84 -62
- package/dist/components/panel/cyclic_voltamery_data.js +15 -14
- package/dist/components/panel/graph_selection.js +32 -30
- package/dist/components/panel/index.js +28 -22
- package/dist/components/panel/info.js +75 -26
- package/dist/constants/action_type.js +23 -2
- package/dist/constants/list_graph.js +16 -0
- package/dist/constants/list_layout.js +2 -1
- package/dist/constants/list_ui.js +5 -2
- package/dist/features/lc-ms/entities/extractEntityLCMS.js +187 -0
- package/dist/features/lc-ms/parsing/chemstation.js +108 -0
- package/dist/features/lc-ms/parsing/index.js +46 -0
- package/dist/features/lc-ms/parsing/lcmsCategory.js +44 -0
- package/dist/features/lc-ms/parsing/lcmsJcampInfo.js +18 -0
- package/dist/features/lc-ms/parsing/lcmsMsPage.js +241 -0
- package/dist/features/lc-ms/parsing/pageValue.js +27 -0
- package/dist/features/lc-ms/submit/index.js +24 -0
- package/dist/features/lc-ms/submit/peaks.js +66 -0
- package/dist/features/lc-ms/ui/wavelengthSelect.js +54 -0
- package/dist/fn.js +4 -1
- package/dist/helpers/brush.js +74 -19
- package/dist/helpers/calc.js +4 -2
- package/dist/helpers/cfg.js +5 -4
- package/dist/helpers/chem.js +449 -71
- package/dist/helpers/compass.js +181 -17
- package/dist/helpers/extractEntityLCMS.js +24 -0
- package/dist/helpers/extractParams.js +118 -33
- package/dist/helpers/extractPeaksEdit.js +29 -9
- package/dist/helpers/format.js +189 -4
- package/dist/helpers/init.js +25 -5
- package/dist/helpers/integration.js +130 -17
- package/dist/helpers/integration_draft.js +43 -0
- package/dist/helpers/integration_focus.js +155 -0
- package/dist/helpers/integration_jcamp.js +68 -0
- package/dist/helpers/integration_split.js +202 -0
- package/dist/helpers/mount.js +8 -1
- package/dist/helpers/sweep.js +39 -0
- package/dist/index.js +284 -26
- package/dist/layer_content.js +17 -3
- package/dist/layer_init.js +124 -14
- package/dist/layer_prism.js +31 -5
- package/dist/reducers/index.js +3 -1
- package/dist/reducers/reducer_curve.js +54 -36
- package/dist/reducers/reducer_hplc_ms/hydrate.js +289 -0
- package/dist/reducers/reducer_hplc_ms/index.js +122 -0
- package/dist/reducers/reducer_hplc_ms/persistence.js +74 -0
- package/dist/reducers/reducer_hplc_ms/tic.js +70 -0
- package/dist/reducers/reducer_hplc_ms/utils.js +70 -0
- package/dist/reducers/reducer_hplc_ms/uvvis.js +377 -0
- package/dist/reducers/reducer_integration.js +265 -7
- package/dist/reducers/reducer_layout.js +1 -1
- package/dist/reducers/reducer_submit.js +2 -1
- package/dist/reducers/reducer_ui.js +149 -13
- package/dist/reducers/undo_redo_config.js +2 -2
- package/dist/sagas/saga_lcms_ui.js +85 -0
- package/dist/sagas/saga_ui.js +177 -74
- package/dist/setupTests.js +5 -5
- package/package.json +10 -7
|
@@ -12,9 +12,12 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _chem = require("../../helpers/chem");
|
|
13
13
|
var _manager = require("../../actions/manager");
|
|
14
14
|
var _ui = require("../../actions/ui");
|
|
15
|
+
var _integration = require("../../actions/integration");
|
|
15
16
|
var _line_focus = _interopRequireDefault(require("./line_focus"));
|
|
16
17
|
var _draw = require("../common/draw");
|
|
17
18
|
var _list_ui = require("../../constants/list_ui");
|
|
19
|
+
var _list_graph = require("../../constants/list_graph");
|
|
20
|
+
var _cfg = _interopRequireDefault(require("../../helpers/cfg"));
|
|
18
21
|
var _cyclic_voltammetry = require("../../actions/cyclic_voltammetry");
|
|
19
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
23
|
/* eslint-disable no-mixed-operators */
|
|
@@ -28,17 +31,24 @@ class ViewerLine extends _react.default.Component {
|
|
|
28
31
|
const {
|
|
29
32
|
clickUiTargetAct,
|
|
30
33
|
selectUiSweepAct,
|
|
31
|
-
scrollUiWheelAct
|
|
34
|
+
scrollUiWheelAct,
|
|
35
|
+
splitIntegrationAct,
|
|
36
|
+
addVisualSplitLineAct,
|
|
37
|
+
removeVisualSplitLineAct
|
|
32
38
|
} = props;
|
|
33
|
-
this.rootKlass =
|
|
39
|
+
this.rootKlass = `.${_list_graph.LIST_ROOT_SVG_GRAPH.LINE}`;
|
|
34
40
|
this.focus = new _line_focus.default({
|
|
35
41
|
W,
|
|
36
42
|
H,
|
|
37
43
|
clickUiTargetAct,
|
|
38
44
|
selectUiSweepAct,
|
|
39
|
-
scrollUiWheelAct
|
|
45
|
+
scrollUiWheelAct,
|
|
46
|
+
splitIntegrationAct,
|
|
47
|
+
addVisualSplitLineAct,
|
|
48
|
+
removeVisualSplitLineAct
|
|
40
49
|
});
|
|
41
50
|
this.normChange = this.normChange.bind(this);
|
|
51
|
+
this.syncFocusActions = this.syncFocusActions.bind(this);
|
|
42
52
|
}
|
|
43
53
|
componentDidMount() {
|
|
44
54
|
const {
|
|
@@ -54,16 +64,20 @@ class ViewerLine extends _react.default.Component {
|
|
|
54
64
|
tSfPeaks,
|
|
55
65
|
editPeakSt,
|
|
56
66
|
layoutSt,
|
|
57
|
-
|
|
67
|
+
integrationSt,
|
|
58
68
|
mtplySt,
|
|
59
69
|
sweepExtentSt,
|
|
60
70
|
isUiAddIntgSt,
|
|
71
|
+
isUiSplitIntgSt,
|
|
72
|
+
isUiVisualSplitIntgSt,
|
|
61
73
|
isUiNoBrushSt,
|
|
62
74
|
isHidden,
|
|
63
75
|
wavelength,
|
|
64
76
|
axesUnitsSt,
|
|
65
|
-
resetAllAct
|
|
77
|
+
resetAllAct,
|
|
78
|
+
uiSt
|
|
66
79
|
} = this.props;
|
|
80
|
+
this.syncFocusActions();
|
|
67
81
|
(0, _draw.drawDestroy)(this.rootKlass);
|
|
68
82
|
resetAllAct(feature);
|
|
69
83
|
let xxLabel = xLabel;
|
|
@@ -91,12 +105,15 @@ class ViewerLine extends _react.default.Component {
|
|
|
91
105
|
tSfPeaks,
|
|
92
106
|
editPeakSt,
|
|
93
107
|
layoutSt,
|
|
94
|
-
|
|
108
|
+
integrationSt,
|
|
95
109
|
mtplySt,
|
|
96
110
|
sweepExtentSt,
|
|
97
111
|
isUiAddIntgSt,
|
|
112
|
+
isUiSplitIntgSt,
|
|
113
|
+
isUiVisualSplitIntgSt,
|
|
98
114
|
isUiNoBrushSt,
|
|
99
|
-
wavelength
|
|
115
|
+
wavelength,
|
|
116
|
+
uiSt
|
|
100
117
|
});
|
|
101
118
|
(0, _draw.drawLabel)(this.rootKlass, cLabel, xxLabel, yyLabel);
|
|
102
119
|
(0, _draw.drawDisplay)(this.rootKlass, isHidden);
|
|
@@ -114,15 +131,19 @@ class ViewerLine extends _react.default.Component {
|
|
|
114
131
|
tSfPeaks,
|
|
115
132
|
editPeakSt,
|
|
116
133
|
layoutSt,
|
|
117
|
-
|
|
134
|
+
integrationSt,
|
|
118
135
|
mtplySt,
|
|
119
136
|
sweepExtentSt,
|
|
120
137
|
isUiAddIntgSt,
|
|
138
|
+
isUiSplitIntgSt,
|
|
139
|
+
isUiVisualSplitIntgSt,
|
|
121
140
|
isUiNoBrushSt,
|
|
122
141
|
isHidden,
|
|
123
142
|
wavelength,
|
|
124
|
-
axesUnitsSt
|
|
143
|
+
axesUnitsSt,
|
|
144
|
+
uiSt
|
|
125
145
|
} = this.props;
|
|
146
|
+
this.syncFocusActions();
|
|
126
147
|
this.normChange(prevProps);
|
|
127
148
|
let xxLabel = xLabel;
|
|
128
149
|
let yyLabel = yLabel;
|
|
@@ -148,12 +169,15 @@ class ViewerLine extends _react.default.Component {
|
|
|
148
169
|
tSfPeaks,
|
|
149
170
|
editPeakSt,
|
|
150
171
|
layoutSt,
|
|
151
|
-
|
|
172
|
+
integrationSt,
|
|
152
173
|
mtplySt,
|
|
153
174
|
sweepExtentSt,
|
|
154
175
|
isUiAddIntgSt,
|
|
176
|
+
isUiSplitIntgSt,
|
|
177
|
+
isUiVisualSplitIntgSt,
|
|
155
178
|
isUiNoBrushSt,
|
|
156
|
-
wavelength
|
|
179
|
+
wavelength,
|
|
180
|
+
uiSt
|
|
157
181
|
});
|
|
158
182
|
(0, _draw.drawLabel)(this.rootKlass, cLabel, xxLabel, yyLabel);
|
|
159
183
|
(0, _draw.drawDisplay)(this.rootKlass, isHidden);
|
|
@@ -161,6 +185,25 @@ class ViewerLine extends _react.default.Component {
|
|
|
161
185
|
componentWillUnmount() {
|
|
162
186
|
(0, _draw.drawDestroy)(this.rootKlass);
|
|
163
187
|
}
|
|
188
|
+
syncFocusActions() {
|
|
189
|
+
if (!this.focus) return;
|
|
190
|
+
const {
|
|
191
|
+
clickUiTargetAct,
|
|
192
|
+
selectUiSweepAct,
|
|
193
|
+
scrollUiWheelAct,
|
|
194
|
+
splitIntegrationAct,
|
|
195
|
+
addVisualSplitLineAct,
|
|
196
|
+
removeVisualSplitLineAct
|
|
197
|
+
} = this.props;
|
|
198
|
+
Object.assign(this.focus, {
|
|
199
|
+
clickUiTargetAct,
|
|
200
|
+
selectUiSweepAct,
|
|
201
|
+
scrollUiWheelAct,
|
|
202
|
+
splitIntegrationAct,
|
|
203
|
+
addVisualSplitLineAct,
|
|
204
|
+
removeVisualSplitLineAct
|
|
205
|
+
});
|
|
206
|
+
}
|
|
164
207
|
normChange(prevProps) {
|
|
165
208
|
const {
|
|
166
209
|
feature,
|
|
@@ -173,7 +216,7 @@ class ViewerLine extends _react.default.Component {
|
|
|
173
216
|
}
|
|
174
217
|
render() {
|
|
175
218
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
176
|
-
className:
|
|
219
|
+
className: _list_graph.LIST_ROOT_SVG_GRAPH.LINE
|
|
177
220
|
});
|
|
178
221
|
}
|
|
179
222
|
}
|
|
@@ -186,19 +229,25 @@ const mapStateToProps = (state, props) => ({
|
|
|
186
229
|
tSfPeaks: (0, _chem.ToShiftPeaks)(state, props),
|
|
187
230
|
editPeakSt: state.editPeak.present,
|
|
188
231
|
layoutSt: state.layout,
|
|
189
|
-
|
|
232
|
+
integrationSt: state.integration.present,
|
|
190
233
|
mtplySt: state.multiplicity.present,
|
|
191
234
|
sweepExtentSt: state.ui.sweepExtent,
|
|
192
235
|
isUiAddIntgSt: state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD,
|
|
236
|
+
isUiSplitIntgSt: _cfg.default.showIntegSplitTools(state.layout) && state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_SPLIT,
|
|
237
|
+
isUiVisualSplitIntgSt: _cfg.default.showIntegSplitTools(state.layout) && state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_VISUAL_SPLIT,
|
|
193
238
|
isUiNoBrushSt: _list_ui.LIST_NON_BRUSH_TYPES.indexOf(state.ui.sweepType) < 0,
|
|
194
239
|
wavelength: state.wavelength,
|
|
195
|
-
axesUnitsSt: state.axesUnits
|
|
240
|
+
axesUnitsSt: state.axesUnits,
|
|
241
|
+
uiSt: state.ui
|
|
196
242
|
});
|
|
197
243
|
const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
|
|
198
244
|
resetAllAct: _manager.resetAll,
|
|
199
245
|
clickUiTargetAct: _ui.clickUiTarget,
|
|
200
246
|
selectUiSweepAct: _ui.selectUiSweep,
|
|
201
247
|
scrollUiWheelAct: _ui.scrollUiWheel,
|
|
248
|
+
splitIntegrationAct: _integration.splitIntegration,
|
|
249
|
+
addVisualSplitLineAct: _integration.addVisualSplitLine,
|
|
250
|
+
removeVisualSplitLineAct: _integration.removeVisualSplitLine,
|
|
202
251
|
addNewCylicVoltaPairPeakAct: _cyclic_voltammetry.addNewCylicVoltaPairPeak,
|
|
203
252
|
addCylicVoltaMaxPeakAct: _cyclic_voltammetry.addCylicVoltaMaxPeak,
|
|
204
253
|
addCylicVoltaMinPeakAct: _cyclic_voltammetry.addCylicVoltaMinPeak
|
|
@@ -208,6 +257,7 @@ ViewerLine.propTypes = {
|
|
|
208
257
|
peak: _propTypes.default.array.isRequired,
|
|
209
258
|
freq: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.number]).isRequired,
|
|
210
259
|
comparisons: _propTypes.default.array.isRequired,
|
|
260
|
+
uiSt: _propTypes.default.object.isRequired,
|
|
211
261
|
cLabel: _propTypes.default.string.isRequired,
|
|
212
262
|
xLabel: _propTypes.default.string.isRequired,
|
|
213
263
|
yLabel: _propTypes.default.string.isRequired,
|
|
@@ -216,15 +266,20 @@ ViewerLine.propTypes = {
|
|
|
216
266
|
tSfPeaks: _propTypes.default.array.isRequired,
|
|
217
267
|
editPeakSt: _propTypes.default.object.isRequired,
|
|
218
268
|
layoutSt: _propTypes.default.string.isRequired,
|
|
219
|
-
|
|
269
|
+
integrationSt: _propTypes.default.object.isRequired,
|
|
220
270
|
mtplySt: _propTypes.default.object.isRequired,
|
|
221
271
|
sweepExtentSt: _propTypes.default.object.isRequired,
|
|
222
272
|
isUiAddIntgSt: _propTypes.default.bool.isRequired,
|
|
273
|
+
isUiSplitIntgSt: _propTypes.default.bool.isRequired,
|
|
274
|
+
isUiVisualSplitIntgSt: _propTypes.default.bool.isRequired,
|
|
223
275
|
isUiNoBrushSt: _propTypes.default.bool.isRequired,
|
|
224
276
|
resetAllAct: _propTypes.default.func.isRequired,
|
|
225
277
|
clickUiTargetAct: _propTypes.default.func.isRequired,
|
|
226
278
|
selectUiSweepAct: _propTypes.default.func.isRequired,
|
|
227
279
|
scrollUiWheelAct: _propTypes.default.func.isRequired,
|
|
280
|
+
splitIntegrationAct: _propTypes.default.func.isRequired,
|
|
281
|
+
addVisualSplitLineAct: _propTypes.default.func.isRequired,
|
|
282
|
+
removeVisualSplitLineAct: _propTypes.default.func.isRequired,
|
|
228
283
|
isHidden: _propTypes.default.bool.isRequired,
|
|
229
284
|
wavelength: _propTypes.default.object.isRequired,
|
|
230
285
|
axesUnitsSt: _propTypes.default.object.isRequired
|
|
@@ -9,6 +9,8 @@ var _init = require("../../helpers/init");
|
|
|
9
9
|
var _mount = require("../../helpers/mount");
|
|
10
10
|
var _brush = _interopRequireDefault(require("../../helpers/brush"));
|
|
11
11
|
var _compass = require("../../helpers/compass");
|
|
12
|
+
var _integration_focus = require("../../helpers/integration_focus");
|
|
13
|
+
var _integration_split = require("../../helpers/integration_split");
|
|
12
14
|
var _converter = require("../../helpers/converter");
|
|
13
15
|
var _focus = require("../../helpers/focus");
|
|
14
16
|
var _integration = require("../../helpers/integration");
|
|
@@ -16,7 +18,6 @@ var _multiplicity_calc = require("../../helpers/multiplicity_calc");
|
|
|
16
18
|
var _format = _interopRequireDefault(require("../../helpers/format"));
|
|
17
19
|
var _cfg = _interopRequireDefault(require("../../helpers/cfg"));
|
|
18
20
|
var _list_layout = require("../../constants/list_layout");
|
|
19
|
-
var _calc = require("../../helpers/calc");
|
|
20
21
|
/* eslint-disable prefer-object-spread, no-mixed-operators */
|
|
21
22
|
|
|
22
23
|
const d3 = require('d3');
|
|
@@ -27,7 +28,11 @@ class LineFocus {
|
|
|
27
28
|
H,
|
|
28
29
|
clickUiTargetAct,
|
|
29
30
|
selectUiSweepAct,
|
|
30
|
-
scrollUiWheelAct
|
|
31
|
+
scrollUiWheelAct,
|
|
32
|
+
uiSt,
|
|
33
|
+
splitIntegrationAct,
|
|
34
|
+
addVisualSplitLineAct,
|
|
35
|
+
removeVisualSplitLineAct
|
|
31
36
|
} = props;
|
|
32
37
|
this.jcampIdx = 0;
|
|
33
38
|
this.rootKlass = '.d3Line';
|
|
@@ -37,11 +42,16 @@ class LineFocus {
|
|
|
37
42
|
l: 60,
|
|
38
43
|
r: 5
|
|
39
44
|
};
|
|
45
|
+
this.uiSt = uiSt;
|
|
46
|
+
this.graphIndex = uiSt?.zoom?.graphIndex;
|
|
40
47
|
this.w = W - this.margin.l - this.margin.r;
|
|
41
48
|
this.h = H - this.margin.t - this.margin.b;
|
|
42
49
|
this.clickUiTargetAct = clickUiTargetAct;
|
|
43
50
|
this.selectUiSweepAct = selectUiSweepAct;
|
|
44
51
|
this.scrollUiWheelAct = scrollUiWheelAct;
|
|
52
|
+
this.splitIntegrationAct = splitIntegrationAct;
|
|
53
|
+
this.addVisualSplitLineAct = addVisualSplitLineAct;
|
|
54
|
+
this.removeVisualSplitLineAct = removeVisualSplitLineAct;
|
|
45
55
|
this.brush = d3.brush();
|
|
46
56
|
this.brushX = d3.brushX();
|
|
47
57
|
this.axis = null;
|
|
@@ -66,6 +76,11 @@ class LineFocus {
|
|
|
66
76
|
this.shouldUpdate = {};
|
|
67
77
|
this.freq = false;
|
|
68
78
|
this.layout = _list_layout.LIST_LAYOUT.H1;
|
|
79
|
+
this.isUiAddIntgSt = false;
|
|
80
|
+
this.isUiSplitIntgSt = false;
|
|
81
|
+
this.isUiVisualSplitIntgSt = false;
|
|
82
|
+
this.integrationSplitTargets = null;
|
|
83
|
+
this.firstIntegrationPoint = null;
|
|
69
84
|
this.getShouldUpdate = this.getShouldUpdate.bind(this);
|
|
70
85
|
this.resetShouldUpdate = this.resetShouldUpdate.bind(this);
|
|
71
86
|
this.setTip = this.setTip.bind(this);
|
|
@@ -83,6 +98,10 @@ class LineFocus {
|
|
|
83
98
|
this.drawMtply = this.drawMtply.bind(this);
|
|
84
99
|
this.drawComparisons = this.drawComparisons.bind(this);
|
|
85
100
|
this.onClickTarget = this.onClickTarget.bind(this);
|
|
101
|
+
this.onClickIntegrationTarget = this.onClickIntegrationTarget.bind(this);
|
|
102
|
+
this.onIntegrationMouseMove = this.onIntegrationMouseMove.bind(this);
|
|
103
|
+
this.clearSplitPreview = this.clearSplitPreview.bind(this);
|
|
104
|
+
this.drawVisualSplitLines = this.drawVisualSplitLines.bind(this);
|
|
86
105
|
this.mergedPeaks = this.mergedPeaks.bind(this);
|
|
87
106
|
this.isFirefox = typeof InstallTrigger !== 'undefined';
|
|
88
107
|
this.wavelength = null;
|
|
@@ -111,7 +130,7 @@ class LineFocus {
|
|
|
111
130
|
const sameMySt = prevMySt === nextMySt;
|
|
112
131
|
const sameTePt = prevTePt === this.tTrEndPts.length;
|
|
113
132
|
const sameDtPk = prevDtPk === this.dataPks.length;
|
|
114
|
-
const sameSfPk =
|
|
133
|
+
const sameSfPk = prevSfPk === this.tSfPeaks || Array.isArray(prevSfPk) && Array.isArray(this.tSfPeaks) && prevSfPk.length === this.tSfPeaks.length && prevSfPk.every((peak, idx) => peak === this.tSfPeaks[idx]);
|
|
115
134
|
const sameData = prevData === this.data.length;
|
|
116
135
|
const sameRef = prevEpSt.prevOffset === nextEpSt.prevOffset;
|
|
117
136
|
this.shouldUpdate = Object.assign({}, this.shouldUpdate, {
|
|
@@ -256,49 +275,28 @@ class LineFocus {
|
|
|
256
275
|
const onPeak = true;
|
|
257
276
|
this.clickUiTargetAct(data, onPeak);
|
|
258
277
|
}
|
|
278
|
+
clearSplitPreview() {
|
|
279
|
+
(0, _integration_split.clearIntegrationSplitPreview)(this);
|
|
280
|
+
}
|
|
281
|
+
onIntegrationMouseMove(event, data, shift, ignoreRef) {
|
|
282
|
+
(0, _integration_focus.handleIntegrationMouseMove)(this, event, data, shift, ignoreRef);
|
|
283
|
+
}
|
|
284
|
+
onClickIntegrationTarget(event, data) {
|
|
285
|
+
(0, _integration_focus.handleIntegrationClick)(this, event, data, (clickEvent, clickData) => {
|
|
286
|
+
this.onClickTarget(clickEvent, clickData);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
drawVisualSplitLines(stack, shift, ignoreRef) {
|
|
290
|
+
(0, _integration_focus.drawVisualSplitLinesForFocus)(this, stack, shift, ignoreRef);
|
|
291
|
+
}
|
|
292
|
+
drawAUC(stack, shift = 0) {
|
|
293
|
+
(0, _integration_focus.drawIntegrationAUC)(this, stack, shift);
|
|
294
|
+
}
|
|
259
295
|
mergedPeaks(editPeakSt) {
|
|
260
296
|
if (!editPeakSt) return this.dataPks;
|
|
261
297
|
this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
|
|
262
298
|
return this.dataPks;
|
|
263
299
|
}
|
|
264
|
-
drawAUC(stack) {
|
|
265
|
-
const {
|
|
266
|
-
xt,
|
|
267
|
-
yt
|
|
268
|
-
} = (0, _compass.TfRescale)(this);
|
|
269
|
-
const auc = this.tags.aucPath.selectAll('path').data(stack);
|
|
270
|
-
auc.exit().attr('class', 'exit').remove();
|
|
271
|
-
const integCurve = border => {
|
|
272
|
-
const {
|
|
273
|
-
xL,
|
|
274
|
-
xU
|
|
275
|
-
} = border;
|
|
276
|
-
const ps = this.data.filter(d => d.x > xL && d.x < xU);
|
|
277
|
-
if (!ps[0]) return null;
|
|
278
|
-
const point1 = ps[0];
|
|
279
|
-
const point2 = ps[ps.length - 1];
|
|
280
|
-
const slope = (0, _calc.calcSlope)(point1.x, point1.y, point2.x, point2.y);
|
|
281
|
-
let lastDY = point1.y;
|
|
282
|
-
return d3.area().x(d => xt(d.x)).y0((d, index) => {
|
|
283
|
-
if (index > 0) {
|
|
284
|
-
const lastD = ps[index - 1];
|
|
285
|
-
const y = slope * (d.x - lastD.x) + lastDY;
|
|
286
|
-
lastDY = y;
|
|
287
|
-
return yt(y);
|
|
288
|
-
}
|
|
289
|
-
return yt(0);
|
|
290
|
-
}).y1(d => yt(d.y))(ps);
|
|
291
|
-
};
|
|
292
|
-
auc.enter().append('path').attr('class', 'auc').attr('fill', 'red').attr('stroke', 'none').attr('fill-opacity', 0.2).attr('stroke-width', 2).merge(auc).attr('d', d => integCurve(d)).attr('id', d => `auc${(0, _focus.itgIdTag)(d)}`).on('mouseover', (event, d) => {
|
|
293
|
-
d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
|
|
294
|
-
d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
|
|
295
|
-
d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).style('fill', 'blue');
|
|
296
|
-
}).on('mouseout', (event, d) => {
|
|
297
|
-
d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'none');
|
|
298
|
-
d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).style('fill', 'red');
|
|
299
|
-
d3.select(`#auc${(0, _focus.itgIdTag)(d)}`).style('fill-opacity', 0.2);
|
|
300
|
-
}).on('click', (event, d) => this.onClickTarget(event, d));
|
|
301
|
-
}
|
|
302
300
|
drawPeaks(editPeakSt) {
|
|
303
301
|
const {
|
|
304
302
|
sameXY,
|
|
@@ -355,7 +353,7 @@ class LineFocus {
|
|
|
355
353
|
bpTxt.enter().append('text').attr('class', 'peak-text').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(bpTxt).attr('id', d => `mpp${Math.round(1000 * d.x)}`).text(d => d.x.toFixed(2)).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y) - 25})`).on('click', (event, d) => this.onClickTarget(event, d));
|
|
356
354
|
}
|
|
357
355
|
}
|
|
358
|
-
drawInteg(
|
|
356
|
+
drawInteg(integrationState) {
|
|
359
357
|
const {
|
|
360
358
|
sameXY,
|
|
361
359
|
sameLySt,
|
|
@@ -366,7 +364,7 @@ class LineFocus {
|
|
|
366
364
|
const {
|
|
367
365
|
selectedIdx,
|
|
368
366
|
integrations
|
|
369
|
-
} =
|
|
367
|
+
} = integrationState;
|
|
370
368
|
const selectedIntegration = integrations[selectedIdx];
|
|
371
369
|
const {
|
|
372
370
|
stack,
|
|
@@ -377,9 +375,20 @@ class LineFocus {
|
|
|
377
375
|
const isDisable = _cfg.default.btnCmdIntg(this.layout);
|
|
378
376
|
const ignoreRef = _format.default.isHplcUvVisLayout(this.layout);
|
|
379
377
|
const itgs = isDisable ? [] : stack;
|
|
380
|
-
const
|
|
378
|
+
const {
|
|
379
|
+
showIntegSplit,
|
|
380
|
+
igBarData
|
|
381
|
+
} = (0, _integration_focus.buildIntegrationBarData)(this.layout, itgs);
|
|
382
|
+
Object.assign(this, {
|
|
383
|
+
integrationSplitTargets: {
|
|
384
|
+
stack: itgs,
|
|
385
|
+
shift,
|
|
386
|
+
ignoreRef
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
const igbp = this.tags.igbPath.selectAll('path').data(igBarData);
|
|
381
390
|
igbp.exit().attr('class', 'exit').remove();
|
|
382
|
-
const igcp = this.tags.igcPath.selectAll('path').data(
|
|
391
|
+
const igcp = this.tags.igcPath.selectAll('path').data(igBarData);
|
|
383
392
|
igcp.exit().attr('class', 'exit').remove();
|
|
384
393
|
const igtp = this.tags.igtPath.selectAll('text').data(itgs);
|
|
385
394
|
igtp.exit().attr('class', 'exit').remove();
|
|
@@ -388,10 +397,11 @@ class LineFocus {
|
|
|
388
397
|
const auc = this.tags.aucPath.selectAll('path').data(stack);
|
|
389
398
|
auc.exit().attr('class', 'exit').remove();
|
|
390
399
|
auc.merge(auc);
|
|
400
|
+
this.drawVisualSplitLines(showIntegSplit ? itgs : [], shift, ignoreRef);
|
|
391
401
|
return;
|
|
392
402
|
}
|
|
393
403
|
if (ignoreRef) {
|
|
394
|
-
this.drawAUC(stack);
|
|
404
|
+
this.drawAUC(stack, shift);
|
|
395
405
|
} else {
|
|
396
406
|
// rescale for zoom
|
|
397
407
|
const {
|
|
@@ -407,7 +417,8 @@ class LineFocus {
|
|
|
407
417
|
d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
|
|
408
418
|
d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
|
|
409
419
|
d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', '#228B22');
|
|
410
|
-
|
|
420
|
+
if (showIntegSplit) this.clearSplitPreview();
|
|
421
|
+
}).on('mousemove', showIntegSplit ? (event, d) => this.onIntegrationMouseMove(event, d, shift, ignoreRef) : null).on('click', (event, d) => this.onClickIntegrationTarget(event, d));
|
|
411
422
|
const integCurve = border => {
|
|
412
423
|
const {
|
|
413
424
|
xL,
|
|
@@ -431,7 +442,8 @@ class LineFocus {
|
|
|
431
442
|
d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
|
|
432
443
|
d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
|
|
433
444
|
d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', '#228B22');
|
|
434
|
-
|
|
445
|
+
if (showIntegSplit) this.clearSplitPreview();
|
|
446
|
+
}).on('mousemove', showIntegSplit ? (event, d) => this.onIntegrationMouseMove(event, d, shift, ignoreRef) : null).on('click', (event, d) => this.onClickIntegrationTarget(event, d));
|
|
435
447
|
igtp.enter().append('text').attr('class', 'igtp').attr('font-family', 'Helvetica').style('font-size', '12px').attr('fill', '#228B22').style('text-anchor', 'middle').merge(igtp).attr('id', d => `igtp${(0, _focus.itgIdTag)(d)}`).text(d => (0, _integration.calcArea)(d, refArea, refFactor, ignoreRef)).attr('transform', d => `translate(${xt((d.xL + d.xU) / 2 - shift)}, ${dh - 12})`).on('mouseover', (event, d) => {
|
|
436
448
|
d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
|
|
437
449
|
d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', 'blue');
|
|
@@ -440,8 +452,10 @@ class LineFocus {
|
|
|
440
452
|
d3.select(`#igbp${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
|
|
441
453
|
d3.select(`#igbc${(0, _focus.itgIdTag)(d)}`).attr('stroke', '#228B22');
|
|
442
454
|
d3.select(`#igtp${(0, _focus.itgIdTag)(d)}`).style('fill', '#228B22');
|
|
443
|
-
|
|
455
|
+
if (showIntegSplit) this.clearSplitPreview();
|
|
456
|
+
}).on('mousemove', showIntegSplit ? (event, d) => this.onIntegrationMouseMove(event, d, shift, ignoreRef) : null).on('click', (event, d) => this.onClickIntegrationTarget(event, d));
|
|
444
457
|
}
|
|
458
|
+
this.drawVisualSplitLines(showIntegSplit ? itgs : [], shift, ignoreRef);
|
|
445
459
|
}
|
|
446
460
|
drawMtply(mtplySt) {
|
|
447
461
|
const {
|
|
@@ -452,17 +466,19 @@ class LineFocus {
|
|
|
452
466
|
if (sameXY && sameLySt && sameMySt) return;
|
|
453
467
|
const {
|
|
454
468
|
selectedIdx,
|
|
455
|
-
multiplicities
|
|
456
|
-
} = mtplySt;
|
|
457
|
-
const selectedMulti = multiplicities[selectedIdx];
|
|
469
|
+
multiplicities = []
|
|
470
|
+
} = mtplySt || {};
|
|
471
|
+
const selectedMulti = multiplicities[selectedIdx] || {};
|
|
458
472
|
const {
|
|
459
|
-
stack,
|
|
460
|
-
smExtext,
|
|
461
|
-
shift
|
|
473
|
+
stack = [],
|
|
474
|
+
smExtext = false,
|
|
475
|
+
shift = 0
|
|
462
476
|
} = selectedMulti;
|
|
463
|
-
const
|
|
477
|
+
const hasValidExtent = extent => extent && Number.isFinite(extent.xL) && Number.isFinite(extent.xU);
|
|
478
|
+
const mpys = stack.filter(m => hasValidExtent(m?.xExtent));
|
|
464
479
|
const isDisable = _cfg.default.btnCmdMpy(this.layout);
|
|
465
|
-
if (mpys === 0 || isDisable) return;
|
|
480
|
+
if (mpys.length === 0 || isDisable) return;
|
|
481
|
+
const activeExtent = hasValidExtent(smExtext) ? smExtext : mpys[0].xExtent;
|
|
466
482
|
// rescale for zoom
|
|
467
483
|
const {
|
|
468
484
|
xt
|
|
@@ -478,7 +494,8 @@ class LineFocus {
|
|
|
478
494
|
peaks,
|
|
479
495
|
xExtent
|
|
480
496
|
} = m;
|
|
481
|
-
|
|
497
|
+
const safePeaks = Array.isArray(peaks) ? peaks : [];
|
|
498
|
+
return safePeaks.filter(p => Number.isFinite(p?.x) && Number.isFinite(p?.y)).map(p => Object.assign({}, p, {
|
|
482
499
|
xExtent
|
|
483
500
|
}));
|
|
484
501
|
});
|
|
@@ -493,7 +510,7 @@ class LineFocus {
|
|
|
493
510
|
xL,
|
|
494
511
|
xU
|
|
495
512
|
} = d.xExtent;
|
|
496
|
-
return
|
|
513
|
+
return activeExtent.xL === xL && activeExtent.xU === xU ? 'purple' : '#DA70D6';
|
|
497
514
|
};
|
|
498
515
|
mpyb.enter().append('path').attr('class', 'mpyb').attr('fill', 'none').attr('stroke-width', 2).merge(mpyb).attr('stroke', d => mpyColor(d)).attr('id', d => `mpyb${(0, _focus.mpyIdTag)(d)}`).attr('d', d => mpyBar(d)).on('mouseover', (event, d) => {
|
|
499
516
|
d3.selectAll(`#mpyb${(0, _focus.mpyIdTag)(d)}`).attr('stroke', 'blue');
|
|
@@ -607,13 +624,18 @@ class LineFocus {
|
|
|
607
624
|
comparisons,
|
|
608
625
|
editPeakSt,
|
|
609
626
|
layoutSt,
|
|
610
|
-
|
|
627
|
+
integrationSt,
|
|
611
628
|
mtplySt,
|
|
612
629
|
sweepExtentSt,
|
|
613
630
|
isUiAddIntgSt,
|
|
631
|
+
isUiSplitIntgSt,
|
|
632
|
+
isUiVisualSplitIntgSt,
|
|
614
633
|
isUiNoBrushSt,
|
|
615
|
-
wavelength
|
|
634
|
+
wavelength,
|
|
635
|
+
uiSt
|
|
616
636
|
}) {
|
|
637
|
+
this.uiSt = uiSt;
|
|
638
|
+
this.graphIndex = uiSt?.zoom?.graphIndex;
|
|
617
639
|
this.svg = d3.select('.d3Svg');
|
|
618
640
|
(0, _mount.MountMainFrame)(this, 'focus');
|
|
619
641
|
(0, _mount.MountClip)(this);
|
|
@@ -621,6 +643,11 @@ class LineFocus {
|
|
|
621
643
|
this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
|
|
622
644
|
this.setTip();
|
|
623
645
|
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
|
|
646
|
+
Object.assign(this, {
|
|
647
|
+
isUiSplitIntgSt,
|
|
648
|
+
isUiVisualSplitIntgSt
|
|
649
|
+
});
|
|
650
|
+
if (!isUiSplitIntgSt && !isUiVisualSplitIntgSt) this.clearSplitPreview();
|
|
624
651
|
(0, _compass.MountCompass)(this);
|
|
625
652
|
this.axis = (0, _mount.MountAxis)(this);
|
|
626
653
|
this.path = (0, _mount.MountPath)(this, 'steelblue');
|
|
@@ -637,12 +664,12 @@ class LineFocus {
|
|
|
637
664
|
this.drawGrid();
|
|
638
665
|
this.drawRef();
|
|
639
666
|
this.drawPeaks(editPeakSt);
|
|
640
|
-
this.drawInteg(
|
|
667
|
+
this.drawInteg(integrationSt);
|
|
641
668
|
this.drawMtply(mtplySt);
|
|
642
669
|
this.drawComparisons(comparisons);
|
|
643
670
|
}
|
|
644
671
|
(0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
|
|
645
|
-
this.resetShouldUpdate(editPeakSt,
|
|
672
|
+
this.resetShouldUpdate(editPeakSt, integrationSt, mtplySt);
|
|
646
673
|
}
|
|
647
674
|
update({
|
|
648
675
|
filterSeed,
|
|
@@ -653,30 +680,40 @@ class LineFocus {
|
|
|
653
680
|
comparisons,
|
|
654
681
|
editPeakSt,
|
|
655
682
|
layoutSt,
|
|
656
|
-
|
|
683
|
+
integrationSt,
|
|
657
684
|
mtplySt,
|
|
685
|
+
uiSt,
|
|
658
686
|
sweepExtentSt,
|
|
659
687
|
isUiAddIntgSt,
|
|
688
|
+
isUiSplitIntgSt,
|
|
689
|
+
isUiVisualSplitIntgSt,
|
|
660
690
|
isUiNoBrushSt,
|
|
661
691
|
wavelength
|
|
662
692
|
}) {
|
|
693
|
+
this.uiSt = uiSt;
|
|
694
|
+
this.graphIndex = uiSt?.zoom?.graphIndex;
|
|
663
695
|
this.root = d3.select(this.rootKlass).selectAll('.focus-main');
|
|
664
696
|
this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
|
|
665
697
|
this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
|
|
698
|
+
Object.assign(this, {
|
|
699
|
+
isUiSplitIntgSt,
|
|
700
|
+
isUiVisualSplitIntgSt
|
|
701
|
+
});
|
|
702
|
+
if (!isUiSplitIntgSt && !isUiVisualSplitIntgSt) this.clearSplitPreview();
|
|
666
703
|
if (this.data && this.data.length > 0) {
|
|
667
704
|
this.setConfig(sweepExtentSt);
|
|
668
|
-
this.getShouldUpdate(editPeakSt,
|
|
705
|
+
this.getShouldUpdate(editPeakSt, integrationSt, mtplySt);
|
|
669
706
|
this.drawLine();
|
|
670
707
|
this.drawThres();
|
|
671
708
|
this.drawGrid();
|
|
672
709
|
this.drawRef();
|
|
673
710
|
this.drawPeaks(editPeakSt);
|
|
674
|
-
this.drawInteg(
|
|
711
|
+
this.drawInteg(integrationSt);
|
|
675
712
|
this.drawMtply(mtplySt);
|
|
676
713
|
this.drawComparisons(comparisons);
|
|
677
714
|
}
|
|
678
715
|
(0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
|
|
679
|
-
this.resetShouldUpdate(editPeakSt,
|
|
716
|
+
this.resetShouldUpdate(editPeakSt, integrationSt, mtplySt);
|
|
680
717
|
}
|
|
681
718
|
}
|
|
682
719
|
var _default = exports.default = LineFocus;
|