@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/init.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,58 +8,63 @@ exports.InitTip = exports.InitScale = exports.InitPathCall = exports.InitAxisCal
|
|
|
9
8
|
var d3 = _interopRequireWildcard(require("d3"));
|
|
10
9
|
var _d3Tip = _interopRequireDefault(require("d3-tip"));
|
|
11
10
|
var _format = _interopRequireDefault(require("./format"));
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 InitScale = function (target) {
|
|
14
|
+
let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
15
|
+
const xRange = reverse ? [target.w, 0] : [0, target.w];
|
|
16
|
+
const x = d3.scaleLinear().range(xRange);
|
|
17
|
+
const y = d3.scaleLinear().range([target.h, 0]);
|
|
19
18
|
return {
|
|
20
|
-
x
|
|
21
|
-
y
|
|
19
|
+
x,
|
|
20
|
+
y
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
23
|
exports.InitScale = InitScale;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const InitAxisCall = count => {
|
|
25
|
+
const yAxisFormat = d3.format('.2n');
|
|
26
|
+
const xAxisCall = d3.axisBottom().ticks(10);
|
|
27
|
+
const yAxisCall = d3.axisLeft().ticks(count).tickFormat(yAxisFormat);
|
|
29
28
|
return {
|
|
30
29
|
x: xAxisCall,
|
|
31
30
|
y: yAxisCall
|
|
32
31
|
};
|
|
33
32
|
};
|
|
34
33
|
exports.InitAxisCall = InitAxisCall;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return target.scales.x(d.x);
|
|
38
|
-
}).y(function (d) {
|
|
39
|
-
return target.scales.y(d.y);
|
|
40
|
-
});
|
|
34
|
+
const InitPathCall = target => {
|
|
35
|
+
const line = d3.line().x(d => target.scales.x(d.x)).y(d => target.scales.y(d.y));
|
|
41
36
|
return line;
|
|
42
37
|
};
|
|
43
38
|
exports.InitPathCall = InitPathCall;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
const tpStyle = () => {
|
|
40
|
+
const stBorder = ' border: 2px solid #aaa;';
|
|
41
|
+
const stBorderRadius = ' border-radius: 5px;';
|
|
42
|
+
const stBackground = ' background: #555;';
|
|
43
|
+
const stColor = ' color: #fff;';
|
|
44
|
+
const stPadding = ' padding: 8px;';
|
|
45
|
+
const stOpacity = ' opacity: 0.9; ';
|
|
46
|
+
const stZindex = ' z-index: 1999;';
|
|
47
|
+
const stFontFamily = ' font-family: Helvetica;';
|
|
48
|
+
const style = stBorder + stBorderRadius + stBackground + stColor + stPadding + stOpacity + stPadding + stZindex + stFontFamily;
|
|
54
49
|
return style;
|
|
55
50
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
const tpDiv = (d, digits) => `
|
|
52
|
+
<div
|
|
53
|
+
class="peak-tp"
|
|
54
|
+
style="${tpStyle()}"
|
|
55
|
+
>
|
|
56
|
+
<span> x: ${_format.default.fixDigit(d.x, digits)}</span>
|
|
57
|
+
<br/>
|
|
58
|
+
<span> y: ${d3.format('.2~e')(d.y)}</span>
|
|
59
|
+
<div>
|
|
60
|
+
`;
|
|
61
|
+
const InitTip = () => {
|
|
60
62
|
d3.select('.peak-tp').remove();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const tip = (0, _d3Tip.default)().attr('class', 'd3-tip').html(_ref => {
|
|
64
|
+
let {
|
|
65
|
+
d,
|
|
66
|
+
layout
|
|
67
|
+
} = _ref;
|
|
64
68
|
return tpDiv(d, _format.default.spectraDigit(layout));
|
|
65
69
|
});
|
|
66
70
|
return tip;
|
|
@@ -7,11 +7,10 @@ exports.getArea = exports.getAbsoluteArea = exports.calcArea = void 0;
|
|
|
7
7
|
var _calc = require("./calc");
|
|
8
8
|
/* eslint-disable no-mixed-operators */
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var pt = data[i];
|
|
10
|
+
const getArea = (xL, xU, data) => {
|
|
11
|
+
let [iL, iU] = [data.length - 1, 0];
|
|
12
|
+
for (let i = 0; i < data.length; i += 1) {
|
|
13
|
+
const pt = data[i];
|
|
15
14
|
if (xL <= pt.x && pt.x <= xU) {
|
|
16
15
|
if (iL > i) {
|
|
17
16
|
iL = i;
|
|
@@ -24,31 +23,29 @@ var getArea = function getArea(xL, xU, data) {
|
|
|
24
23
|
return Math.abs(data[iU].k - data[iL].k);
|
|
25
24
|
};
|
|
26
25
|
exports.getArea = getArea;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return d.x > xL && d.x < xU;
|
|
30
|
-
});
|
|
26
|
+
const getAbsoluteArea = (xL, xU, data) => {
|
|
27
|
+
const ps = data.filter(d => d.x > xL && d.x < xU);
|
|
31
28
|
if (!ps[0]) return 0;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
let area = 0;
|
|
30
|
+
const point1 = ps[0];
|
|
31
|
+
const point2 = ps[ps.length - 1];
|
|
32
|
+
const slope = (0, _calc.calcSlope)(point1.x, point1.y, point2.x, point2.y);
|
|
33
|
+
let lastDY = point1.y;
|
|
37
34
|
if (ps.length > 1) {
|
|
38
|
-
for (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
for (let i = 1; i < ps.length; i += 1) {
|
|
36
|
+
const pt = ps[i];
|
|
37
|
+
const lastD = ps[i - 1];
|
|
38
|
+
const y = slope * (pt.x - lastD.x) + lastDY;
|
|
42
39
|
lastDY = y;
|
|
43
|
-
|
|
40
|
+
const delta = Math.abs(pt.y - y);
|
|
44
41
|
area += delta;
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
44
|
return area;
|
|
48
45
|
};
|
|
49
46
|
exports.getAbsoluteArea = getAbsoluteArea;
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const calcArea = function (d, refArea, refFactor) {
|
|
48
|
+
let ignoreRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
52
49
|
if (ignoreRef) {
|
|
53
50
|
return d.absoluteArea.toFixed(2);
|
|
54
51
|
}
|
package/dist/helpers/mount.js
CHANGED
|
@@ -5,111 +5,107 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.MountThresLine = exports.MountTags = exports.MountRef = exports.MountPath = exports.MountMarker = exports.MountMainFrame = exports.MountGrid = exports.MountComparePath = exports.MountClip = exports.MountBars = exports.MountAxisLabelY = exports.MountAxisLabelX = exports.MountAxis = void 0;
|
|
7
7
|
var _compass = require("./compass");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const MountTags = target => {
|
|
9
|
+
const igbPath = target.root.append('g').attr('class', 'igbPath-clip').attr('clip-path', 'url(#clip)');
|
|
10
|
+
const igcPath = target.root.append('g').attr('class', 'igcPath-clip').attr('clip-path', 'url(#clip)');
|
|
11
|
+
const igtPath = target.root.append('g').attr('class', 'igtPath-clip').attr('clip-path', 'url(#clip)');
|
|
12
|
+
const pPath = target.root.append('g').attr('class', 'pPath-clip').attr('clip-path', 'url(#clip)');
|
|
13
|
+
const bpPath = target.root.append('g').attr('class', 'bpPath-clip').attr('clip-path', 'url(#clip)');
|
|
14
|
+
const bpTxt = target.root.append('g').attr('class', 'bpTxt-clip').attr('clip-path', 'url(#clip)');
|
|
15
|
+
const mpybPath = target.root.append('g').attr('class', 'mpybPath-clip').attr('clip-path', 'url(#clip)');
|
|
16
|
+
const mpyt1Path = target.root.append('g').attr('class', 'mpyt1Path-clip').attr('clip-path', 'url(#clip)');
|
|
17
|
+
const mpyt2Path = target.root.append('g').attr('class', 'mpyt2Path-clip').attr('clip-path', 'url(#clip)');
|
|
18
|
+
const mpypPath = target.root.append('g').attr('class', 'mpypPath-clip').attr('clip-path', 'url(#clip)');
|
|
19
|
+
const aucPath = target.root.append('g').attr('class', 'aucPath-clip').attr('clip-path', 'url(#clip)');
|
|
20
|
+
const peckerPath = target.root.append('g').attr('class', 'peckerPath-clip').attr('clip-path', 'url(#clip)');
|
|
21
21
|
return {
|
|
22
|
-
pPath
|
|
23
|
-
bpPath
|
|
24
|
-
bpTxt
|
|
25
|
-
igbPath
|
|
26
|
-
igcPath
|
|
27
|
-
igtPath
|
|
28
|
-
mpybPath
|
|
29
|
-
mpyt1Path
|
|
30
|
-
mpyt2Path
|
|
31
|
-
mpypPath
|
|
32
|
-
aucPath
|
|
33
|
-
peckerPath
|
|
22
|
+
pPath,
|
|
23
|
+
bpPath,
|
|
24
|
+
bpTxt,
|
|
25
|
+
igbPath,
|
|
26
|
+
igcPath,
|
|
27
|
+
igtPath,
|
|
28
|
+
mpybPath,
|
|
29
|
+
mpyt1Path,
|
|
30
|
+
mpyt2Path,
|
|
31
|
+
mpypPath,
|
|
32
|
+
aucPath,
|
|
33
|
+
peckerPath // eslint-disable-line
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
exports.MountTags = MountTags;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
const MountBars = target => {
|
|
38
|
+
const bars = target.root.append('g').attr('class', 'bars-clip').attr('clip-path', 'url(#clip)');
|
|
39
39
|
return bars;
|
|
40
40
|
};
|
|
41
41
|
exports.MountBars = MountBars;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const MountRef = target => {
|
|
43
|
+
const ref = target.root.append('g').attr('class', 'ref-clip').attr('clip-path', 'url(#ref-clip)');
|
|
44
44
|
return ref;
|
|
45
45
|
};
|
|
46
46
|
exports.MountRef = MountRef;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return (0, _compass.ClickCompass)(target);
|
|
50
|
-
});
|
|
47
|
+
const MountPath = (target, color) => {
|
|
48
|
+
const path = target.root.append('g').attr('class', 'line-clip').attr('clip-path', 'url(#clip)').append('path').attr('class', 'line').style('fill', 'none').style('stroke', color).style('stroke-width', 1).on('click', () => (0, _compass.ClickCompass)(target));
|
|
51
49
|
return path;
|
|
52
50
|
};
|
|
53
51
|
exports.MountPath = MountPath;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return (0, _compass.ClickCompass)(target);
|
|
58
|
-
});
|
|
52
|
+
const MountComparePath = function (target, color, id) {
|
|
53
|
+
let alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
54
|
+
const path = target.root.append('g').attr('class', 'line-clip-compare').attr('id', id).attr('clip-path', 'url(#clip)').append('path').attr('class', 'line').style('fill', 'none').style('stroke', color).style('stroke-opacity', alpha).style('stroke-width', 1).style('stroke-dasharray', '30, 3').on('click', () => (0, _compass.ClickCompass)(target));
|
|
59
55
|
return path;
|
|
60
56
|
};
|
|
61
57
|
exports.MountComparePath = MountComparePath;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
const MountThresLine = (target, color) => {
|
|
59
|
+
const thresLineUp = target.root.append('g').attr('class', 'line-clip').attr('clip-path', 'url(#clip)').append('path').attr('class', 'thresholdUp').style('stroke-dasharray', '3, 3').style('fill', 'none').style('stroke', color).style('stroke-width', 1);
|
|
60
|
+
const thresLineDw = target.root.append('g').attr('class', 'line-clip').attr('clip-path', 'url(#clip)').append('path').attr('class', 'thresholdDw').style('stroke-dasharray', '3, 3').style('fill', 'none').style('stroke', color).style('stroke-width', 1);
|
|
65
61
|
return [thresLineUp, thresLineDw];
|
|
66
62
|
};
|
|
67
63
|
exports.MountThresLine = MountThresLine;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
const MountGrid = target => {
|
|
65
|
+
const gridTrans = `translate(0, ${target.h})`;
|
|
66
|
+
const xGrid = target.root.append('g').attr('class', 'x-grid').attr('transform', gridTrans);
|
|
67
|
+
const yGrid = target.root.append('g').attr('class', 'y-grid');
|
|
72
68
|
return {
|
|
73
69
|
x: xGrid,
|
|
74
70
|
y: yGrid
|
|
75
71
|
};
|
|
76
72
|
};
|
|
77
73
|
exports.MountGrid = MountGrid;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
const MountAxis = target => {
|
|
75
|
+
const xAxisTrans = `translate(0, ${target.h})`;
|
|
76
|
+
const xAxis = target.root.append('g').attr('class', 'x-axis').attr('transform', xAxisTrans);
|
|
77
|
+
const yAxis = target.root.append('g').attr('class', 'y-axis');
|
|
82
78
|
return {
|
|
83
79
|
x: xAxis,
|
|
84
80
|
y: yAxis
|
|
85
81
|
};
|
|
86
82
|
};
|
|
87
83
|
exports.MountAxis = MountAxis;
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const MountAxisLabelX = target => {
|
|
85
|
+
const xTrans = `translate(${target.w / 2}, ${target.h + 30})`;
|
|
90
86
|
target.root.append('text').attr('text-anchor', 'middle').attr('transform', xTrans).attr('class', 'xLabel').attr('font-family', 'Helvetica').style('font-size', '12px');
|
|
91
87
|
};
|
|
92
88
|
exports.MountAxisLabelX = MountAxisLabelX;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
const MountAxisLabelY = target => {
|
|
90
|
+
const yR = 'rotate(-90)';
|
|
91
|
+
const yTrans = `translate(${16 - target.margin.l}, ${target.h / 2}) ${yR}`;
|
|
96
92
|
target.root.append('text').attr('text-anchor', 'middle').attr('transform', yTrans).attr('class', 'yLabel').attr('font-family', 'Helvetica').style('font-size', '12px');
|
|
97
93
|
};
|
|
98
94
|
exports.MountAxisLabelY = MountAxisLabelY;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
const MountMarker = (target, color) => {
|
|
96
|
+
const tTrans = `translate(${target.w - 80}, -10)`;
|
|
97
|
+
const lTrans = `translate(${target.w - 200}, -18)`;
|
|
102
98
|
target.root.append('text').attr('text-anchor', 'middle').attr('transform', tTrans).attr('class', 'mark-text').attr('font-family', 'Helvetica');
|
|
103
99
|
target.root.append('rect').attr('transform', lTrans).attr('width', 30).attr('height', 5).attr('class', 'mark-line').style('fill', color);
|
|
104
100
|
};
|
|
105
101
|
exports.MountMarker = MountMarker;
|
|
106
|
-
|
|
102
|
+
const MountClip = target => {
|
|
107
103
|
target.svg.append('defs').append('clipPath').attr('id', 'clip').append('rect').attr('width', target.w).attr('height', target.h).attr('x', 0).attr('y', 0);
|
|
108
104
|
};
|
|
109
105
|
exports.MountClip = MountClip;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
const MountMainFrame = (target, name) => {
|
|
107
|
+
const transFrame = `translate(${target.margin.l}, ${target.margin.t})`;
|
|
108
|
+
const clsName = `${name}-main`;
|
|
113
109
|
target.svg.append('g').attr('class', clsName).attr('transform', transFrame);
|
|
114
110
|
};
|
|
115
111
|
exports.MountMainFrame = MountMainFrame;
|
|
@@ -1,45 +1,40 @@
|
|
|
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.mpyBasicPatterns = exports.groupInterval = exports.getInterval = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var itv = Math.abs(peaks[idx + 1].x - peaks[idx].x);
|
|
15
|
-
itvs = [].concat((0, _toConsumableArray2.default)(itvs), [itv]);
|
|
7
|
+
const mpyBasicPatterns = exports.mpyBasicPatterns = ['s', 'd', 't', 'q', 'quint', 'h', 'sept', 'o', 'n'];
|
|
8
|
+
const getInterval = peaks => {
|
|
9
|
+
let itvs = [];
|
|
10
|
+
for (let idx = 0; idx < peaks.length - 1; idx += 1) {
|
|
11
|
+
const itv = Math.abs(peaks[idx + 1].x - peaks[idx].x);
|
|
12
|
+
itvs = [...itvs, itv];
|
|
16
13
|
}
|
|
17
14
|
return itvs;
|
|
18
15
|
};
|
|
19
16
|
exports.getInterval = getInterval;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
itvs.forEach(
|
|
23
|
-
|
|
24
|
-
gitvs.forEach(
|
|
17
|
+
const groupInterval = itvs => {
|
|
18
|
+
let gitvs = [];
|
|
19
|
+
itvs.forEach(vv => {
|
|
20
|
+
let applied = false;
|
|
21
|
+
gitvs.forEach((gv, idx) => {
|
|
25
22
|
if (applied) return;
|
|
26
23
|
if (Math.abs((gv.c - vv) / gv.c) <= 0.03) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
gitvs = [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
es: es
|
|
34
|
-
}]);
|
|
24
|
+
const c = (gv.c * gv.es.length + vv) / (gv.es.length + 1);
|
|
25
|
+
const es = [...gv.es, vv];
|
|
26
|
+
gitvs = [...gitvs.filter((v, i) => i !== idx), {
|
|
27
|
+
c,
|
|
28
|
+
es
|
|
29
|
+
}];
|
|
35
30
|
applied = true;
|
|
36
31
|
}
|
|
37
32
|
});
|
|
38
33
|
if (!applied) {
|
|
39
|
-
gitvs = [
|
|
34
|
+
gitvs = [...gitvs, {
|
|
40
35
|
c: vv,
|
|
41
36
|
es: [vv]
|
|
42
|
-
}]
|
|
37
|
+
}];
|
|
43
38
|
}
|
|
44
39
|
});
|
|
45
40
|
return gitvs;
|
|
@@ -10,49 +10,42 @@ var _multiplicity = require("./multiplicity");
|
|
|
10
10
|
var _multiplicity_verify_basic = require("./multiplicity_verify_basic");
|
|
11
11
|
/* eslint-disable prefer-object-spread, default-param-last */
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}).sort(function (a, b) {
|
|
17
|
-
return a - b;
|
|
18
|
-
});
|
|
19
|
-
var centIdx = (ps.length - 1) / 2;
|
|
13
|
+
const centerX = (ps, shift) => {
|
|
14
|
+
const pxs = ps.map(p => p.x).sort((a, b) => a - b);
|
|
15
|
+
const centIdx = (ps.length - 1) / 2;
|
|
20
16
|
if (centIdx < 0) return 0;
|
|
21
17
|
return pxs[centIdx] - shift;
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return sum + nxt.x;
|
|
27
|
-
}, 0) / ps.length - shift;
|
|
19
|
+
const calcMpyCenter = (ps, shift, typ) => {
|
|
20
|
+
const count = ps.length;
|
|
21
|
+
const avgX = ps.reduce((sum, nxt) => sum + nxt.x, 0) / ps.length - shift;
|
|
28
22
|
if (typ === 'm') return avgX;
|
|
29
23
|
if (count % 2 === 0) return avgX;
|
|
30
24
|
return centerX(ps, shift);
|
|
31
25
|
};
|
|
32
26
|
exports.calcMpyCenter = calcMpyCenter;
|
|
33
|
-
|
|
27
|
+
const calcMpyJStr = js => {
|
|
34
28
|
if (!Array.isArray(js) || js.length === 0) return ' - ';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}).join(', ');
|
|
38
|
-
return "".concat(cJ);
|
|
29
|
+
const cJ = js.map(j => j.toFixed(3)).join(', ');
|
|
30
|
+
return `${cJ}`;
|
|
39
31
|
};
|
|
40
32
|
exports.calcMpyJStr = calcMpyJStr;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
intervalL
|
|
44
|
-
intervalR
|
|
45
|
-
deltaX
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
const calcMpyPeakWidth = (x, metaSt) => {
|
|
34
|
+
const {
|
|
35
|
+
intervalL,
|
|
36
|
+
intervalR,
|
|
37
|
+
deltaX
|
|
38
|
+
} = metaSt.peaks;
|
|
39
|
+
let idxL = null;
|
|
40
|
+
intervalL.every((l, idx) => {
|
|
48
41
|
if (l.x < x) {
|
|
49
42
|
idxL = idx - 1;
|
|
50
43
|
return false;
|
|
51
44
|
}
|
|
52
45
|
return true;
|
|
53
46
|
});
|
|
54
|
-
|
|
55
|
-
intervalR.every(
|
|
47
|
+
let idxR = null;
|
|
48
|
+
intervalR.every((l, idx) => {
|
|
56
49
|
if (l.x < x) {
|
|
57
50
|
idxR = idx;
|
|
58
51
|
return false;
|
|
@@ -62,43 +55,39 @@ var calcMpyPeakWidth = function calcMpyPeakWidth(x, metaSt) {
|
|
|
62
55
|
if (!idxL || !idxR) return 10 * deltaX;
|
|
63
56
|
return Math.abs(intervalL[idxL].x - intervalR[idxR].x);
|
|
64
57
|
};
|
|
65
|
-
|
|
58
|
+
const calcMpyCoup = (pks, metaSt) => {
|
|
66
59
|
if (pks.length === 0) return {
|
|
67
60
|
type: '',
|
|
68
61
|
js: ''
|
|
69
62
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
var signal = {
|
|
63
|
+
const orderPks = pks.sort((a, b) => b.x - a.x);
|
|
64
|
+
const {
|
|
65
|
+
observeFrequency
|
|
66
|
+
} = metaSt.peaks;
|
|
67
|
+
const peaks = orderPks.map(p => ({
|
|
68
|
+
x: p.x,
|
|
69
|
+
intensity: p.y,
|
|
70
|
+
width: calcMpyPeakWidth(p.x, metaSt)
|
|
71
|
+
}));
|
|
72
|
+
const signal = {
|
|
82
73
|
nbPeaks: peaks.length,
|
|
83
74
|
observe: observeFrequency,
|
|
84
75
|
nucleus: '1H',
|
|
85
|
-
peaks
|
|
76
|
+
peaks
|
|
86
77
|
};
|
|
87
78
|
_jAnalyzer.default.compilePattern(signal);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}).sort() : [];
|
|
92
|
-
var isTPCMatch = (0, _multiplicity_verify_basic.verifyTypePeakCount)(type, peaks);
|
|
79
|
+
const type = signal.multiplicity;
|
|
80
|
+
const js = signal.nmrJs ? signal.nmrJs.map(j => j.coupling).sort() : [];
|
|
81
|
+
const isTPCMatch = (0, _multiplicity_verify_basic.verifyTypePeakCount)(type, peaks);
|
|
93
82
|
if (!isTPCMatch) return {
|
|
94
83
|
type: 'm',
|
|
95
84
|
js: []
|
|
96
85
|
};
|
|
97
86
|
if (['s', 'm'].indexOf(type) >= 0) return {
|
|
98
|
-
type
|
|
99
|
-
js
|
|
87
|
+
type,
|
|
88
|
+
js
|
|
100
89
|
};
|
|
101
|
-
|
|
90
|
+
const oivs = (0, _multiplicity.getInterval)(orderPks);
|
|
102
91
|
if (type === 't') return (0, _multiplicity_verify_basic.verifyTypeT)(type, js, oivs, metaSt);
|
|
103
92
|
if (type === 'q') return (0, _multiplicity_verify_basic.verifyTypeQ)(type, js, oivs, metaSt);
|
|
104
93
|
if (type === 'quint') return (0, _multiplicity_verify_basic.verifyTypeQuint)(type, js, oivs, metaSt);
|
|
@@ -106,8 +95,8 @@ var calcMpyCoup = function calcMpyCoup(pks, metaSt) {
|
|
|
106
95
|
if (type === 'sept') return (0, _multiplicity_verify_basic.verifyTypeSept)(type, js, oivs, metaSt);
|
|
107
96
|
if (type === 'o') return (0, _multiplicity_verify_basic.verifyTypeO)(type, js, oivs, metaSt);
|
|
108
97
|
return {
|
|
109
|
-
type
|
|
110
|
-
js
|
|
98
|
+
type,
|
|
99
|
+
js
|
|
111
100
|
};
|
|
112
101
|
};
|
|
113
102
|
exports.calcMpyCoup = calcMpyCoup;
|