@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
package/dist/helpers/compass.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -9,47 +8,51 @@ exports.TfRescale = exports.MouseMove = exports.MountCompass = exports.ClickComp
|
|
|
9
8
|
var d3 = _interopRequireWildcard(require("d3"));
|
|
10
9
|
var _format = _interopRequireDefault(require("./format"));
|
|
11
10
|
var _chem = require("./chem");
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const TfRescale = focus => {
|
|
14
|
+
const xt = focus.scales.x;
|
|
15
|
+
const yt = focus.scales.y;
|
|
17
16
|
return {
|
|
18
|
-
xt
|
|
19
|
-
yt
|
|
17
|
+
xt,
|
|
18
|
+
yt
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
exports.TfRescale = TfRescale;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
? d3.event.offsetX
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
const fetchPt = (focus, xt) => {
|
|
23
|
+
// const rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
24
|
+
// ? d3.event.offsetX
|
|
25
|
+
// : d3.mouse(focus.root.node())[0];
|
|
26
|
+
const rawMouseX = d3.mouse(focus.root.node())[0];
|
|
27
|
+
const mouseX = xt.invert(rawMouseX);
|
|
28
|
+
const bisectDate = d3.bisector(d => +d.x).left;
|
|
29
|
+
const dt = focus.data;
|
|
30
|
+
const ls = dt.length;
|
|
31
|
+
const sortData = ls > 0 && dt[0].x > dt[ls - 1].x ? dt.reverse() : dt;
|
|
32
|
+
const idx = bisectDate(sortData, +mouseX);
|
|
34
33
|
return sortData[idx];
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
? d3.event.offsetX
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
const fetchFreePt = (focus, xt, yt) => {
|
|
36
|
+
// const rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
37
|
+
// ? d3.event.offsetX
|
|
38
|
+
// : d3.mouse(focus.root.node())[0];
|
|
39
|
+
// const rawMouseY = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
40
|
+
// ? d3.event.offsetY
|
|
41
|
+
// : d3.mouse(focus.root.node())[1];
|
|
42
|
+
const rawMouseX = d3.mouse(focus.root.node())[0];
|
|
43
|
+
const rawMouseY = d3.mouse(focus.root.node())[1];
|
|
44
|
+
const mouseX = xt.invert(rawMouseX);
|
|
45
|
+
const mouseY = yt.invert(rawMouseY);
|
|
46
|
+
const distance2 = (x1, x2, y1, y2) => {
|
|
47
|
+
const dx = x1 - x2;
|
|
48
|
+
const dy = y1 - y2;
|
|
46
49
|
return dx * dx + dy * dy;
|
|
47
50
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
dt.forEach(
|
|
52
|
-
|
|
51
|
+
let minDistance = Number.MAX_VALUE;
|
|
52
|
+
const dt = focus.data;
|
|
53
|
+
let selectPoint = null;
|
|
54
|
+
dt.forEach(pt => {
|
|
55
|
+
const distance = distance2(pt.x, mouseX, pt.y, mouseY);
|
|
53
56
|
if (minDistance > distance) {
|
|
54
57
|
minDistance = distance;
|
|
55
58
|
selectPoint = pt;
|
|
@@ -57,46 +60,49 @@ var fetchFreePt = function fetchFreePt(focus, xt, yt) {
|
|
|
57
60
|
});
|
|
58
61
|
return selectPoint;
|
|
59
62
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
xt
|
|
63
|
-
yt
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
const MouseMove = focus => {
|
|
64
|
+
const {
|
|
65
|
+
xt,
|
|
66
|
+
yt
|
|
67
|
+
} = TfRescale(focus);
|
|
68
|
+
const {
|
|
69
|
+
freq,
|
|
70
|
+
layout,
|
|
71
|
+
wavelength
|
|
72
|
+
} = focus;
|
|
67
73
|
if (_format.default.isCyclicVoltaLayout(layout)) {
|
|
68
|
-
|
|
74
|
+
const pt = fetchFreePt(focus, xt, yt);
|
|
69
75
|
if (pt) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
focus.root.select('.compass').attr('transform',
|
|
76
|
+
const tx = xt(pt.x);
|
|
77
|
+
const ty = yt(pt.y);
|
|
78
|
+
focus.root.select('.compass').attr('transform', `translate(${tx},${ty})`);
|
|
73
79
|
focus.root.select('.x-hover-line').attr('y1', 0 - ty).attr('y2', focus.h - ty);
|
|
74
|
-
focus.root.select('.cursor-txt').attr('transform',
|
|
80
|
+
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(pt.x.toFixed(3));
|
|
75
81
|
if (freq) {
|
|
76
|
-
focus.root.select('.cursor-txt-hz').attr('transform',
|
|
82
|
+
focus.root.select('.cursor-txt-hz').attr('transform', `translate(${tx},${20})`).text(`${(pt.x * freq).toFixed(3)} Hz`);
|
|
77
83
|
} else {
|
|
78
84
|
focus.root.select('.cursor-txt-hz').text('');
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
} else {
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
focus.root.select('.compass').attr('transform',
|
|
87
|
-
focus.root.select('.x-hover-line').attr('y1', 0 -
|
|
88
|
+
const pt = fetchPt(focus, xt);
|
|
89
|
+
if (pt) {
|
|
90
|
+
const tx = xt(pt.x);
|
|
91
|
+
const ty = yt(pt.y);
|
|
92
|
+
focus.root.select('.compass').attr('transform', `translate(${tx},${ty})`);
|
|
93
|
+
focus.root.select('.x-hover-line').attr('y1', 0 - ty).attr('y2', focus.h - ty);
|
|
88
94
|
if (_format.default.isXRDLayout(layout)) {
|
|
89
|
-
|
|
95
|
+
let dValue = 0.0;
|
|
90
96
|
if (wavelength) {
|
|
91
|
-
dValue = (0, _chem.Convert2DValue)(
|
|
97
|
+
dValue = (0, _chem.Convert2DValue)(pt.x, wavelength.value).toExponential(2);
|
|
92
98
|
} else {
|
|
93
|
-
dValue = (0, _chem.Convert2DValue)(
|
|
99
|
+
dValue = (0, _chem.Convert2DValue)(pt.x).toExponential(2);
|
|
94
100
|
}
|
|
95
|
-
focus.root.select('.cursor-txt-hz').attr('transform',
|
|
101
|
+
focus.root.select('.cursor-txt-hz').attr('transform', `translate(${tx},${ty - 30})`).text(`2Theta: ${pt.x.toExponential(2)}, d-value: ${dValue}`);
|
|
96
102
|
} else {
|
|
97
|
-
focus.root.select('.cursor-txt').attr('transform',
|
|
103
|
+
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(pt.x.toFixed(3));
|
|
98
104
|
if (freq) {
|
|
99
|
-
focus.root.select('.cursor-txt-hz').attr('transform',
|
|
105
|
+
focus.root.select('.cursor-txt-hz').attr('transform', `translate(${tx},${20})`).text(`${(pt.x * freq).toFixed(3)} Hz`);
|
|
100
106
|
} else {
|
|
101
107
|
focus.root.select('.cursor-txt-hz').text('');
|
|
102
108
|
}
|
|
@@ -105,23 +111,28 @@ var MouseMove = function MouseMove(focus) {
|
|
|
105
111
|
}
|
|
106
112
|
};
|
|
107
113
|
exports.MouseMove = MouseMove;
|
|
108
|
-
|
|
114
|
+
const ClickCompass = focus => {
|
|
109
115
|
d3.event.stopPropagation();
|
|
110
116
|
d3.event.preventDefault();
|
|
111
|
-
|
|
112
|
-
xt
|
|
113
|
-
yt
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
const {
|
|
118
|
+
xt,
|
|
119
|
+
yt
|
|
120
|
+
} = TfRescale(focus);
|
|
121
|
+
let pt = fetchPt(focus, xt);
|
|
122
|
+
const {
|
|
123
|
+
layout,
|
|
124
|
+
cyclicvoltaSt,
|
|
125
|
+
jcampIdx
|
|
126
|
+
} = focus;
|
|
118
127
|
if (_format.default.isCyclicVoltaLayout(layout)) {
|
|
119
128
|
pt = fetchFreePt(focus, xt, yt);
|
|
120
|
-
|
|
129
|
+
const onPeak = false;
|
|
121
130
|
if (cyclicvoltaSt) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
const {
|
|
132
|
+
spectraList
|
|
133
|
+
} = cyclicvoltaSt;
|
|
134
|
+
const spectra = spectraList[jcampIdx];
|
|
135
|
+
const voltammetryPeakIdx = spectra.selectedIdx;
|
|
125
136
|
focus.clickUiTargetAct(pt, onPeak, voltammetryPeakIdx, jcampIdx);
|
|
126
137
|
} else {
|
|
127
138
|
focus.clickUiTargetAct(pt, onPeak);
|
|
@@ -131,21 +142,19 @@ var ClickCompass = function ClickCompass(focus) {
|
|
|
131
142
|
}
|
|
132
143
|
};
|
|
133
144
|
exports.ClickCompass = ClickCompass;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
const MountCompass = focus => {
|
|
146
|
+
const {
|
|
147
|
+
root,
|
|
148
|
+
w,
|
|
149
|
+
h
|
|
150
|
+
} = focus;
|
|
151
|
+
const compass = root.append('g').attr('class', 'compass');
|
|
152
|
+
const cursor = root.append('g').attr('class', 'cursor');
|
|
153
|
+
const overlay = root.append('rect').attr('class', 'overlay-focus').attr('width', w).attr('height', h).attr('opacity', 0.0);
|
|
141
154
|
compass.append('line').attr('class', 'x-hover-line hover-line').attr('stroke', '#777').attr('stroke-width', 1).attr('stroke-dasharray', 2, 2);
|
|
142
155
|
compass.append('circle').attr('r', 4).attr('fill', 'none').attr('stroke', '#777').attr('stroke-width', 2);
|
|
143
156
|
cursor.append('text').attr('class', 'cursor-txt').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle');
|
|
144
157
|
cursor.append('text').attr('class', 'cursor-txt-hz').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').style('fill', '#D68910');
|
|
145
|
-
overlay.on('mousemove',
|
|
146
|
-
return MouseMove(focus);
|
|
147
|
-
}).on('click', function () {
|
|
148
|
-
return ClickCompass(focus);
|
|
149
|
-
});
|
|
158
|
+
overlay.on('mousemove', () => MouseMove(focus)).on('click', () => ClickCompass(focus));
|
|
150
159
|
};
|
|
151
160
|
exports.MountCompass = MountCompass;
|
|
@@ -1,113 +1,100 @@
|
|
|
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.ToXY = exports.PksEdit = exports.PeckersEdit = exports.IsSame = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var length = data ? data.length : 0;
|
|
7
|
+
const ToXY = data => {
|
|
8
|
+
const length = data ? data.length : 0;
|
|
11
9
|
if (length === 0) return [];
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
let peaks = [];
|
|
11
|
+
let i = 0;
|
|
14
12
|
for (i = 0; i < length; i += 1) {
|
|
15
|
-
|
|
16
|
-
x
|
|
17
|
-
y
|
|
18
|
-
|
|
13
|
+
const {
|
|
14
|
+
x,
|
|
15
|
+
y
|
|
16
|
+
} = data[i];
|
|
17
|
+
peaks = [...peaks, [x, y]];
|
|
19
18
|
}
|
|
20
19
|
return peaks;
|
|
21
20
|
};
|
|
22
21
|
exports.ToXY = ToXY;
|
|
23
|
-
|
|
24
|
-
return Math.abs((one - two) * 10000000) < 1.0;
|
|
25
|
-
};
|
|
22
|
+
const IsSame = (one, two) => Math.abs((one - two) * 10000000) < 1.0;
|
|
26
23
|
exports.IsSame = IsSame;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const pksRmNeg = (dataPks, editPeakSt) => {
|
|
25
|
+
const {
|
|
26
|
+
selectedIdx,
|
|
27
|
+
peaks
|
|
28
|
+
} = editPeakSt;
|
|
29
|
+
const selectedEditPeaks = peaks[selectedIdx];
|
|
31
30
|
if (!selectedEditPeaks) {
|
|
32
31
|
return dataPks;
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
const {
|
|
34
|
+
neg
|
|
35
|
+
} = selectedEditPeaks;
|
|
35
36
|
if (!neg) {
|
|
36
37
|
return dataPks;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var result = dataPks.map(function (p) {
|
|
42
|
-
var idx = negXs.findIndex(function (nx) {
|
|
43
|
-
return IsSame(nx, p.x);
|
|
44
|
-
});
|
|
39
|
+
const negXs = neg.map(n => n.x);
|
|
40
|
+
const result = dataPks.map(p => {
|
|
41
|
+
const idx = negXs.findIndex(nx => IsSame(nx, p.x));
|
|
45
42
|
return idx >= 0 ? null : p;
|
|
46
|
-
}).filter(
|
|
47
|
-
return r != null;
|
|
48
|
-
});
|
|
43
|
+
}).filter(r => r != null);
|
|
49
44
|
return result;
|
|
50
45
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
const pksAddPos = (dataPks, editPeakSt) => {
|
|
47
|
+
const {
|
|
48
|
+
selectedIdx,
|
|
49
|
+
peaks
|
|
50
|
+
} = editPeakSt;
|
|
51
|
+
const selectedEditPeaks = peaks[selectedIdx];
|
|
55
52
|
if (!selectedEditPeaks) {
|
|
56
53
|
return dataPks;
|
|
57
54
|
}
|
|
58
|
-
|
|
55
|
+
const {
|
|
56
|
+
pos
|
|
57
|
+
} = selectedEditPeaks;
|
|
59
58
|
if (!pos) {
|
|
60
59
|
return dataPks;
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var posPks = dataPks.map(function (p) {
|
|
66
|
-
var idx = posXs.findIndex(function (px) {
|
|
67
|
-
return px === p.x;
|
|
68
|
-
});
|
|
61
|
+
const posXs = pos.map(p => p.x);
|
|
62
|
+
const posPks = dataPks.map(p => {
|
|
63
|
+
const idx = posXs.findIndex(px => px === p.x);
|
|
69
64
|
return idx >= 0 ? null : p;
|
|
70
|
-
}).filter(
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
var result = [].concat((0, _toConsumableArray2.default)(posPks), (0, _toConsumableArray2.default)(pos));
|
|
65
|
+
}).filter(r => r != null);
|
|
66
|
+
const result = [...posPks, ...pos];
|
|
74
67
|
return result;
|
|
75
68
|
};
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const PksEdit = function (dataPks, editPeakSt) {
|
|
70
|
+
let voltammetryPeak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
78
71
|
if (voltammetryPeak && voltammetryPeak.length > 0) {
|
|
79
|
-
|
|
80
|
-
voltammetryPeak.forEach(
|
|
72
|
+
let modDataPks = [];
|
|
73
|
+
voltammetryPeak.forEach(peak => {
|
|
81
74
|
if (peak.max) {
|
|
82
|
-
|
|
75
|
+
modDataPks = [...modDataPks, peak.max];
|
|
83
76
|
}
|
|
84
77
|
if (peak.min) {
|
|
85
|
-
|
|
78
|
+
modDataPks = [...modDataPks, peak.min];
|
|
86
79
|
}
|
|
87
80
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
return _modDataPks;
|
|
81
|
+
modDataPks = modDataPks.sort((a, b) => a.x - b.x);
|
|
82
|
+
return modDataPks;
|
|
92
83
|
}
|
|
93
|
-
|
|
84
|
+
let modDataPks = pksAddPos(dataPks, editPeakSt);
|
|
94
85
|
modDataPks = pksRmNeg(modDataPks, editPeakSt);
|
|
95
|
-
modDataPks = modDataPks.sort(
|
|
96
|
-
return a.x - b.x;
|
|
97
|
-
});
|
|
86
|
+
modDataPks = modDataPks.sort((a, b) => a.x - b.x);
|
|
98
87
|
return modDataPks;
|
|
99
88
|
};
|
|
100
89
|
exports.PksEdit = PksEdit;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
voltammetryPeak.forEach(
|
|
90
|
+
const PeckersEdit = voltammetryPeak => {
|
|
91
|
+
let modDataPeckers = [];
|
|
92
|
+
voltammetryPeak.forEach(peak => {
|
|
104
93
|
if (peak.pecker) {
|
|
105
|
-
modDataPeckers = [
|
|
94
|
+
modDataPeckers = [...modDataPeckers, peak.pecker];
|
|
106
95
|
}
|
|
107
96
|
});
|
|
108
|
-
modDataPeckers = modDataPeckers.sort(
|
|
109
|
-
return a.x - b.x;
|
|
110
|
-
});
|
|
97
|
+
modDataPeckers = modDataPeckers.sort((a, b) => a.x - b.x);
|
|
111
98
|
return modDataPeckers;
|
|
112
99
|
};
|
|
113
100
|
exports.PeckersEdit = PeckersEdit;
|
|
@@ -6,73 +6,81 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.extractParams = void 0;
|
|
8
8
|
var _format = _interopRequireDefault(require("./format"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
const getScanIdx = (entity, scanSt) => {
|
|
10
|
+
const {
|
|
11
|
+
target,
|
|
12
|
+
isAuto
|
|
13
|
+
} = scanSt;
|
|
14
|
+
const {
|
|
15
|
+
features,
|
|
16
|
+
spectra
|
|
17
|
+
} = entity;
|
|
18
|
+
const defaultFeat = features.editPeak || features.autoPeak || features[0];
|
|
19
|
+
const hasEdit = !!defaultFeat.scanEditTarget;
|
|
20
|
+
const defaultIdx = isAuto || !hasEdit ? defaultFeat.scanAutoTarget : defaultFeat.scanEditTarget;
|
|
21
|
+
const defaultCount = +spectra.length;
|
|
22
|
+
let idx = +(target || defaultIdx || 0);
|
|
19
23
|
if (idx > defaultCount) {
|
|
20
24
|
idx = defaultCount;
|
|
21
25
|
}
|
|
22
26
|
return idx - 1;
|
|
23
27
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const extrShare = function (entity, thresSt) {
|
|
29
|
+
let scanIdx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
30
|
+
const {
|
|
31
|
+
spectra,
|
|
32
|
+
features
|
|
33
|
+
} = entity;
|
|
28
34
|
// const { autoPeak, editPeak } = features; // TBD
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const autoPeak = features.autoPeak || features[scanIdx] || features[0];
|
|
36
|
+
const editPeak = features.editPeak || features[scanIdx] || features[0];
|
|
37
|
+
const hasEdit = editPeak && editPeak.data ? editPeak.data[0].x.length > 0 : false;
|
|
38
|
+
const feature = hasEdit && thresSt.isEdit ? editPeak : autoPeak;
|
|
39
|
+
const {
|
|
40
|
+
integration,
|
|
41
|
+
multiplicity
|
|
42
|
+
} = features;
|
|
35
43
|
return {
|
|
36
|
-
spectra
|
|
37
|
-
feature
|
|
38
|
-
hasEdit
|
|
39
|
-
integration
|
|
40
|
-
multiplicity
|
|
44
|
+
spectra,
|
|
45
|
+
feature,
|
|
46
|
+
hasEdit,
|
|
47
|
+
integration,
|
|
48
|
+
multiplicity
|
|
41
49
|
};
|
|
42
50
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
spectra
|
|
47
|
-
feature
|
|
48
|
-
hasEdit
|
|
49
|
-
|
|
51
|
+
const extrMs = (entity, thresSt, scanSt) => {
|
|
52
|
+
const scanIdx = getScanIdx(entity, scanSt);
|
|
53
|
+
const {
|
|
54
|
+
spectra,
|
|
55
|
+
feature,
|
|
56
|
+
hasEdit
|
|
57
|
+
} = extrShare(entity, thresSt, scanIdx);
|
|
58
|
+
const topic = spectra[scanIdx].data[0];
|
|
50
59
|
return {
|
|
51
|
-
topic
|
|
52
|
-
feature
|
|
53
|
-
hasEdit
|
|
60
|
+
topic,
|
|
61
|
+
feature,
|
|
62
|
+
hasEdit
|
|
54
63
|
};
|
|
55
64
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
spectra
|
|
60
|
-
feature
|
|
61
|
-
hasEdit
|
|
62
|
-
integration
|
|
63
|
-
multiplicity
|
|
64
|
-
|
|
65
|
+
const extrNi = (entity, thresSt) => {
|
|
66
|
+
const scanIdx = 0;
|
|
67
|
+
const {
|
|
68
|
+
spectra,
|
|
69
|
+
feature,
|
|
70
|
+
hasEdit,
|
|
71
|
+
integration,
|
|
72
|
+
multiplicity
|
|
73
|
+
} = extrShare(entity, thresSt, scanIdx);
|
|
74
|
+
const topic = spectra[0].data[0];
|
|
65
75
|
return {
|
|
66
|
-
topic
|
|
67
|
-
feature
|
|
68
|
-
hasEdit
|
|
69
|
-
integration
|
|
70
|
-
multiplicity
|
|
76
|
+
topic,
|
|
77
|
+
feature,
|
|
78
|
+
hasEdit,
|
|
79
|
+
integration,
|
|
80
|
+
multiplicity
|
|
71
81
|
};
|
|
72
82
|
};
|
|
73
|
-
|
|
74
|
-
return _format.default.isMsLayout(entity.layout) ? extrMs(entity, thresSt, scanSt) : extrNi(entity, thresSt);
|
|
75
|
-
};
|
|
83
|
+
const extractParams = (entity, thresSt, scanSt) => _format.default.isMsLayout(entity.layout) ? extrMs(entity, thresSt, scanSt) : extrNi(entity, thresSt);
|
|
76
84
|
|
|
77
85
|
// eslint-disable-line
|
|
78
86
|
exports.extractParams = extractParams;
|
|
@@ -10,45 +10,49 @@ var _chem = require("./chem");
|
|
|
10
10
|
var _shift = require("./shift");
|
|
11
11
|
var _format = _interopRequireDefault(require("./format"));
|
|
12
12
|
var _integration = require("./integration");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const niOffset = function (shiftSt) {
|
|
14
|
+
let atIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
15
|
+
const {
|
|
16
|
+
shifts
|
|
17
|
+
} = shiftSt;
|
|
18
|
+
const selectedShift = shifts[atIndex];
|
|
17
19
|
if (!selectedShift) {
|
|
18
20
|
return 0;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const {
|
|
23
|
+
ref,
|
|
24
|
+
peak
|
|
25
|
+
} = selectedShift;
|
|
26
|
+
const offset = (0, _shift.FromManualToOffset)(ref, peak);
|
|
23
27
|
return offset;
|
|
24
28
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var peaks = (0, _chem.Convert2Peak)(feature, thresSt.value, offset);
|
|
32
|
-
var peaksEdit = (0, _converter.PksEdit)(peaks, editPeakSt);
|
|
29
|
+
const msOffset = () => 0;
|
|
30
|
+
const extractPeaksEdit = function (feature, editPeakSt, thresSt, shiftSt, layoutSt) {
|
|
31
|
+
let atIndex = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
32
|
+
const offset = _format.default.isMsLayout(layoutSt) ? msOffset() : niOffset(shiftSt, atIndex);
|
|
33
|
+
const peaks = (0, _chem.Convert2Peak)(feature, thresSt.value, offset);
|
|
34
|
+
const peaksEdit = (0, _converter.PksEdit)(peaks, editPeakSt);
|
|
33
35
|
return peaksEdit;
|
|
34
36
|
};
|
|
35
37
|
exports.extractPeaksEdit = extractPeaksEdit;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const getAUCValue = (integrationSt, layoutSt) => {
|
|
39
|
+
const {
|
|
40
|
+
refArea,
|
|
41
|
+
refFactor,
|
|
42
|
+
stack
|
|
43
|
+
} = integrationSt;
|
|
40
44
|
if (Array.isArray(stack) && stack.length > 0) {
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
const data = stack.at(-1);
|
|
46
|
+
const ignoreRef = _format.default.isHplcUvVisLayout(layoutSt);
|
|
43
47
|
return (0, _integration.calcArea)(data, refArea, refFactor, ignoreRef);
|
|
44
48
|
}
|
|
45
49
|
return 0;
|
|
46
50
|
};
|
|
47
|
-
|
|
51
|
+
const extractAreaUnderCurve = (allIntegrationSt, presentIntegrationSt, layoutSt) => {
|
|
48
52
|
if (_format.default.isHplcUvVisLayout(layoutSt) && Array.isArray(allIntegrationSt) && presentIntegrationSt) {
|
|
49
|
-
|
|
50
|
-
allIntegrationSt.forEach(
|
|
51
|
-
|
|
53
|
+
const results = [];
|
|
54
|
+
allIntegrationSt.forEach(inte => {
|
|
55
|
+
const aucVal = getAUCValue(inte, layoutSt);
|
|
52
56
|
results.push(aucVal);
|
|
53
57
|
});
|
|
54
58
|
return results;
|
package/dist/helpers/focus.js
CHANGED
|
@@ -4,11 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.mpyIdTag = exports.itgIdTag = void 0;
|
|
7
|
-
|
|
8
|
-
return "".concat(Math.round(1000 * d.xL), "-").concat(Math.round(1000 * d.xU));
|
|
9
|
-
};
|
|
7
|
+
const itgIdTag = d => `${Math.round(1000 * d.xL)}-${Math.round(1000 * d.xU)}`;
|
|
10
8
|
exports.itgIdTag = itgIdTag;
|
|
11
|
-
|
|
12
|
-
return "".concat(Math.round(1000 * d.xExtent.xL), "-").concat(Math.round(1000 * d.xExtent.xU));
|
|
13
|
-
};
|
|
9
|
+
const mpyIdTag = d => `${Math.round(1000 * d.xExtent.xL)}-${Math.round(1000 * d.xExtent.xU)}`;
|
|
14
10
|
exports.mpyIdTag = mpyIdTag;
|