@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.
Files changed (202) hide show
  1. package/README.md +16 -0
  2. package/dist/__tests__/fixtures/aif_jcamp_1.js +136 -0
  3. package/dist/__tests__/fixtures/aif_jcamp_2.js +122 -0
  4. package/dist/__tests__/fixtures/backup/nmr1h_a.js +3518 -0
  5. package/dist/__tests__/fixtures/backup/xrd_jcamp_1.js +10705 -0
  6. package/dist/__tests__/fixtures/cds_jcamp.js +861 -0
  7. package/dist/__tests__/fixtures/compare_ir_1_jcamp.js +585 -0
  8. package/dist/__tests__/fixtures/compare_ir_2_jcamp.js +515 -0
  9. package/dist/__tests__/fixtures/compare_uv_vis_jcamp.js +640 -0
  10. package/dist/__tests__/fixtures/cyclic_voltammetry_1.js +778 -0
  11. package/dist/__tests__/fixtures/cyclic_voltammetry_2.js +758 -0
  12. package/dist/__tests__/fixtures/cyclic_voltammetry_3.js +759 -0
  13. package/dist/__tests__/fixtures/dls_acf_jcamp.js +148 -0
  14. package/dist/__tests__/fixtures/dls_intensity_jcamp.js +151 -0
  15. package/dist/__tests__/fixtures/emissions_jcamp.js +883 -0
  16. package/dist/__tests__/fixtures/hplc_uvvis_jcamp.js +638 -0
  17. package/dist/__tests__/fixtures/hplc_uvvis_jcamp_2.js +221 -0
  18. package/dist/__tests__/fixtures/ir_jcamp.js +148 -0
  19. package/dist/__tests__/fixtures/ir_result.js +46 -0
  20. package/dist/__tests__/fixtures/ir_svg.js +8 -0
  21. package/dist/__tests__/fixtures/ms_jcamp.js +64 -0
  22. package/dist/__tests__/fixtures/nmr13c_dept_jcamp.js +3543 -0
  23. package/dist/__tests__/fixtures/nmr13c_jcamp.js +1229 -0
  24. package/dist/__tests__/fixtures/nmr15n_jcamp.js +7177 -0
  25. package/dist/__tests__/fixtures/nmr19f_jcamp.js +6560 -0
  26. package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +2005 -0
  27. package/dist/__tests__/fixtures/nmr1h_jcamp.js +4516 -0
  28. package/dist/__tests__/fixtures/nmr29si_jcamp.js +3029 -0
  29. package/dist/__tests__/fixtures/nmr31p_jcamp.js +3418 -0
  30. package/dist/__tests__/fixtures/nmr_result.js +68 -0
  31. package/dist/__tests__/fixtures/nmr_svg.js +8 -0
  32. package/dist/__tests__/fixtures/phenylalanin.js +142 -0
  33. package/dist/__tests__/fixtures/qDescValue.js +65 -0
  34. package/dist/__tests__/fixtures/raman_jcamp.js +410 -0
  35. package/dist/__tests__/fixtures/sec_1_jcamp.js +425 -0
  36. package/dist/__tests__/fixtures/sec_2_jcamp.js +407 -0
  37. package/dist/__tests__/fixtures/sec_3_jcamp.js +408 -0
  38. package/dist/__tests__/fixtures/sec_4_jcamp.js +407 -0
  39. package/dist/__tests__/fixtures/tga_jcamp.js +4157 -0
  40. package/dist/__tests__/fixtures/uv_vis_jcamp.js +249 -0
  41. package/dist/__tests__/fixtures/xrd_jcamp_1.js +436 -0
  42. package/dist/__tests__/fixtures/xrd_jcamp_2.js +955 -0
  43. package/dist/__tests__/fixtures/xrd_jcamp_3.js +1871 -0
  44. package/dist/__tests__/units/components/panel/graph_selection.test.js +72 -0
  45. package/dist/__tests__/units/components/panel/peaks.test.js +87 -0
  46. package/dist/actions/curve.js +15 -14
  47. package/dist/actions/cyclic_voltammetry.js +40 -60
  48. package/dist/actions/edit_peak.js +8 -12
  49. package/dist/actions/forecast.js +16 -24
  50. package/dist/actions/integration.js +12 -18
  51. package/dist/actions/jcamp.js +16 -24
  52. package/dist/actions/layout.js +4 -6
  53. package/dist/actions/manager.js +20 -30
  54. package/dist/actions/meta.js +4 -6
  55. package/dist/actions/multiplicity.js +24 -36
  56. package/dist/actions/scan.js +12 -18
  57. package/dist/actions/shift.js +8 -12
  58. package/dist/actions/status.js +12 -18
  59. package/dist/actions/submit.js +16 -24
  60. package/dist/actions/threshold.js +20 -30
  61. package/dist/actions/ui.js +25 -31
  62. package/dist/actions/wavelength.js +4 -6
  63. package/dist/app.js +25 -23
  64. package/dist/components/cmd_bar/01_viewer.js +24 -34
  65. package/dist/components/cmd_bar/02_zoom.js +18 -28
  66. package/dist/components/cmd_bar/03_peak.js +50 -66
  67. package/dist/components/cmd_bar/04_integration.js +70 -84
  68. package/dist/components/cmd_bar/05_multiplicity.js +42 -56
  69. package/dist/components/cmd_bar/06_undo_redo.js +22 -36
  70. package/dist/components/cmd_bar/07_pecker.js +24 -34
  71. package/dist/components/cmd_bar/common.js +11 -7
  72. package/dist/components/cmd_bar/index.js +17 -23
  73. package/dist/components/cmd_bar/r01_layout.js +79 -56
  74. package/dist/components/cmd_bar/r02_scan.js +70 -87
  75. package/dist/components/cmd_bar/r03_threshold.js +54 -68
  76. package/dist/components/cmd_bar/r04_submit.js +71 -83
  77. package/dist/components/cmd_bar/r05_submit_btn.js +64 -72
  78. package/dist/components/cmd_bar/r06_predict_btn.js +142 -152
  79. package/dist/components/cmd_bar/r07_wavelength_btn.js +28 -36
  80. package/dist/components/cmd_bar/tri_btn.js +91 -113
  81. package/dist/components/common/chem.js +2 -3
  82. package/dist/components/common/comps.js +2 -2
  83. package/dist/components/common/draw.js +30 -11
  84. package/dist/components/d3_line/index.js +154 -176
  85. package/dist/components/d3_line/line_focus.js +595 -739
  86. package/dist/components/d3_multi/index.js +153 -174
  87. package/dist/components/d3_multi/multi_focus.js +725 -850
  88. package/dist/components/d3_rect/index.js +112 -134
  89. package/dist/components/d3_rect/rect_focus.js +163 -208
  90. package/dist/components/forecast/comps.js +60 -68
  91. package/dist/components/forecast/ir_comps.js +49 -56
  92. package/dist/components/forecast/ir_viewer.js +61 -68
  93. package/dist/components/forecast/nmr_comps.js +62 -72
  94. package/dist/components/forecast/nmr_viewer.js +59 -68
  95. package/dist/components/forecast/section_loading.js +39 -63
  96. package/dist/components/forecast_viewer.js +109 -119
  97. package/dist/components/multi_jcamps_viewer.js +97 -113
  98. package/dist/components/panel/compare.js +183 -192
  99. package/dist/components/panel/cyclic_voltamery_data.js +149 -165
  100. package/dist/components/panel/graph_selection.js +143 -132
  101. package/dist/components/panel/index.js +112 -144
  102. package/dist/components/panel/info.js +125 -132
  103. package/dist/components/panel/multiplicity.js +215 -223
  104. package/dist/components/panel/multiplicity_coupling.js +108 -136
  105. package/dist/components/panel/multiplicity_select.js +43 -51
  106. package/dist/components/panel/peaks.js +130 -132
  107. package/dist/constants/action_type.js +23 -39
  108. package/dist/constants/list_layout.js +7 -4
  109. package/dist/constants/list_shift.js +117 -103
  110. package/dist/constants/list_ui.js +3 -6
  111. package/dist/constants/list_wavelength.js +7 -8
  112. package/dist/fn.js +2 -3
  113. package/dist/helpers/brush.js +49 -65
  114. package/dist/helpers/calc.js +2 -4
  115. package/dist/helpers/carbonFeatures.js +22 -20
  116. package/dist/helpers/cfg.js +49 -67
  117. package/dist/helpers/chem.js +450 -393
  118. package/dist/helpers/compass.js +92 -83
  119. package/dist/helpers/converter.js +52 -65
  120. package/dist/helpers/extractParams.js +60 -52
  121. package/dist/helpers/extractPeaksEdit.js +29 -25
  122. package/dist/helpers/focus.js +2 -6
  123. package/dist/helpers/format.js +416 -361
  124. package/dist/helpers/init.js +41 -37
  125. package/dist/helpers/integration.js +18 -21
  126. package/dist/helpers/mount.js +57 -61
  127. package/dist/helpers/multiplicity.js +19 -24
  128. package/dist/helpers/multiplicity_calc.js +39 -50
  129. package/dist/helpers/multiplicity_complat.js +21 -47
  130. package/dist/helpers/multiplicity_manual.js +49 -55
  131. package/dist/helpers/multiplicity_verify_basic.js +108 -111
  132. package/dist/helpers/shift.js +15 -23
  133. package/dist/helpers/zoom.js +7 -11
  134. package/dist/index.js +680 -630
  135. package/dist/layer_content.js +40 -43
  136. package/dist/layer_init.js +162 -184
  137. package/dist/layer_prism.js +38 -41
  138. package/dist/reducers/index.js +2 -3
  139. package/dist/reducers/reducer_curve.js +35 -26
  140. package/dist/reducers/reducer_edit_peak.js +122 -98
  141. package/dist/reducers/reducer_forecast.js +57 -44
  142. package/dist/reducers/reducer_integration.js +135 -103
  143. package/dist/reducers/reducer_jcamp.js +49 -44
  144. package/dist/reducers/reducer_layout.js +5 -6
  145. package/dist/reducers/reducer_manager.js +5 -6
  146. package/dist/reducers/reducer_meta.js +5 -6
  147. package/dist/reducers/reducer_multiplicity.js +100 -77
  148. package/dist/reducers/reducer_scan.js +17 -20
  149. package/dist/reducers/reducer_shift.js +115 -70
  150. package/dist/reducers/reducer_simulation.js +7 -8
  151. package/dist/reducers/reducer_status.js +5 -6
  152. package/dist/reducers/reducer_submit.js +12 -15
  153. package/dist/reducers/reducer_threshold.js +5 -6
  154. package/dist/reducers/reducer_ui.js +5 -6
  155. package/dist/reducers/reducer_voltammetry.js +156 -96
  156. package/dist/reducers/reducer_wavelength.js +5 -6
  157. package/dist/reducers/undo_redo_config.js +3 -5
  158. package/dist/sagas/index.js +2 -15
  159. package/dist/sagas/saga_edit_peak.js +54 -68
  160. package/dist/sagas/saga_manager.js +86 -130
  161. package/dist/sagas/saga_meta.js +25 -31
  162. package/dist/sagas/saga_multi_entities.js +40 -103
  163. package/dist/sagas/saga_multiplicity.js +336 -406
  164. package/dist/sagas/saga_ui.js +296 -475
  165. package/dist/setupTests.js +8 -0
  166. package/dist/third_party/jAnalyzer.js +66 -67
  167. package/dist/third_party/peakInterval.js +34 -34
  168. package/package.json +14 -14
  169. package/dist/components/cmd_bar/03_peak_bk.js +0 -139
  170. package/dist/components/cmd_bar/04_integration_bk.js +0 -180
  171. package/dist/components/cmd_bar/05_multiplicity_bk.js +0 -131
  172. package/dist/components/cmd_bar/r01_layout_bk.js +0 -186
  173. package/dist/components/cmd_bar/r06_predict_btn_bk.js +0 -220
  174. package/dist/components/d3_line/line_focus_bk.js +0 -825
  175. package/dist/components/d3_multi/index_bk.js +0 -210
  176. package/dist/components/d3_multi/multi_focus_bk.js +0 -533
  177. package/dist/components/panel/compare_bk.js +0 -256
  178. package/dist/components/panel/cyclic_voltamery_data_bk.js +0 -292
  179. package/dist/components/panel/index_bk.js +0 -178
  180. package/dist/components/panel/info_bk.js +0 -235
  181. package/dist/components/panel/multiplicity_bk.js +0 -280
  182. package/dist/helpers/carbonFeatures_bk.js +0 -45
  183. package/dist/helpers/cfg_bk.js +0 -80
  184. package/dist/helpers/chem_bk.js +0 -787
  185. package/dist/helpers/compass_bk.js +0 -149
  186. package/dist/helpers/converter_bk.js +0 -96
  187. package/dist/helpers/extractPeaksEdit_bk.js +0 -53
  188. package/dist/helpers/format_bk.js +0 -497
  189. package/dist/index_bk.js +0 -640
  190. package/dist/layer_content_bk.js +0 -105
  191. package/dist/layer_init_bk.js +0 -235
  192. package/dist/layer_prism_bk.js +0 -133
  193. package/dist/reducers/reducer_edit_peak_bk.js +0 -108
  194. package/dist/reducers/reducer_integration_bk.js +0 -134
  195. package/dist/reducers/reducer_jcamp_bk.js +0 -71
  196. package/dist/reducers/reducer_multiplicity_bk.js +0 -126
  197. package/dist/reducers/reducer_shift_bk.js +0 -88
  198. package/dist/reducers/reducer_voltammetry_bk.js +0 -287
  199. package/dist/sagas/saga_edit_peak_bk.js +0 -73
  200. package/dist/sagas/saga_multi_entities_bk.js +0 -106
  201. package/dist/sagas/saga_multiplicity_bk.js +0 -351
  202. package/dist/sagas/saga_ui_bk.js +0 -453
@@ -1,149 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.TfRescale = exports.MouseMove = exports.MountCompass = exports.ClickCompass = void 0;
9
- var d3 = _interopRequireWildcard(require("d3"));
10
- var _format = _interopRequireDefault(require("./format"));
11
- var _chem = require("./chem");
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- var TfRescale = function TfRescale(focus) {
15
- var xt = focus.scales.x;
16
- var yt = focus.scales.y;
17
- return {
18
- xt: xt,
19
- yt: yt
20
- };
21
- };
22
- exports.TfRescale = TfRescale;
23
- var fetchPt = function fetchPt(focus, xt) {
24
- var rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
25
- ? d3.event.offsetX : d3.mouse(focus.root.node())[0];
26
- var mouseX = xt.invert(rawMouseX);
27
- var bisectDate = d3.bisector(function (d) {
28
- return +d.x;
29
- }).left;
30
- var dt = focus.data;
31
- var ls = dt.length;
32
- var sortData = ls > 0 && dt[0].x > dt[ls - 1].x ? dt.reverse() : dt;
33
- var idx = bisectDate(sortData, +mouseX);
34
- return sortData[idx];
35
- };
36
- var fetchFreePt = function fetchFreePt(focus, xt, yt) {
37
- var rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
38
- ? d3.event.offsetX : d3.mouse(focus.root.node())[0];
39
- var rawMouseY = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
40
- ? d3.event.offsetY : d3.mouse(focus.root.node())[1];
41
- var mouseX = xt.invert(rawMouseX);
42
- var mouseY = yt.invert(rawMouseY);
43
- var distance2 = function distance2(x1, x2, y1, y2) {
44
- var dx = x1 - x2;
45
- var dy = y1 - y2;
46
- return dx * dx + dy * dy;
47
- };
48
- var minDistance = Number.MAX_VALUE;
49
- var dt = focus.data;
50
- var selectPoint = null;
51
- dt.forEach(function (pt) {
52
- var distance = distance2(pt.x, mouseX, pt.y, mouseY);
53
- if (minDistance > distance) {
54
- minDistance = distance;
55
- selectPoint = pt;
56
- }
57
- });
58
- return selectPoint;
59
- };
60
- var MouseMove = function MouseMove(focus) {
61
- var _TfRescale = TfRescale(focus),
62
- xt = _TfRescale.xt,
63
- yt = _TfRescale.yt;
64
- var freq = focus.freq,
65
- layout = focus.layout,
66
- wavelength = focus.wavelength;
67
- if (_format.default.isCyclicVoltaLayout(layout)) {
68
- var pt = fetchFreePt(focus, xt, yt);
69
- if (pt) {
70
- var tx = xt(pt.x);
71
- var ty = yt(pt.y);
72
- focus.root.select('.compass').attr('transform', "translate(".concat(tx, ",").concat(ty, ")"));
73
- focus.root.select('.x-hover-line').attr('y1', 0 - ty).attr('y2', focus.h - ty);
74
- focus.root.select('.cursor-txt').attr('transform', "translate(".concat(tx, ",", 10, ")")).text(pt.x.toFixed(3));
75
- if (freq) {
76
- focus.root.select('.cursor-txt-hz').attr('transform', "translate(".concat(tx, ",", 20, ")")).text("".concat((pt.x * freq).toFixed(3), " Hz"));
77
- } else {
78
- focus.root.select('.cursor-txt-hz').text('');
79
- }
80
- }
81
- } else {
82
- var _pt = fetchPt(focus, xt);
83
- if (_pt) {
84
- var _tx = xt(_pt.x);
85
- var _ty = yt(_pt.y);
86
- focus.root.select('.compass').attr('transform', "translate(".concat(_tx, ",").concat(_ty, ")"));
87
- focus.root.select('.x-hover-line').attr('y1', 0 - _ty).attr('y2', focus.h - _ty);
88
- if (_format.default.isXRDLayout(layout)) {
89
- var dValue = 0.0;
90
- if (wavelength) {
91
- dValue = (0, _chem.Convert2DValue)(_pt.x, wavelength.value).toExponential(2);
92
- } else {
93
- dValue = (0, _chem.Convert2DValue)(_pt.x).toExponential(2);
94
- }
95
- focus.root.select('.cursor-txt-hz').attr('transform', "translate(".concat(_tx, ",").concat(_ty - 30, ")")).text("2Theta: ".concat(_pt.x.toExponential(2), ", d-value: ").concat(dValue));
96
- } else {
97
- focus.root.select('.cursor-txt').attr('transform', "translate(".concat(_tx, ",", 10, ")")).text(_pt.x.toFixed(3));
98
- if (freq) {
99
- focus.root.select('.cursor-txt-hz').attr('transform', "translate(".concat(_tx, ",", 20, ")")).text("".concat((_pt.x * freq).toFixed(3), " Hz"));
100
- } else {
101
- focus.root.select('.cursor-txt-hz').text('');
102
- }
103
- }
104
- }
105
- }
106
- };
107
- exports.MouseMove = MouseMove;
108
- var ClickCompass = function ClickCompass(focus) {
109
- d3.event.stopPropagation();
110
- d3.event.preventDefault();
111
- var _TfRescale2 = TfRescale(focus),
112
- xt = _TfRescale2.xt,
113
- yt = _TfRescale2.yt;
114
- var pt = fetchPt(focus, xt);
115
- var layout = focus.layout,
116
- cyclicvoltaSt = focus.cyclicvoltaSt,
117
- jcampIdx = focus.jcampIdx;
118
- if (_format.default.isCyclicVoltaLayout(layout)) {
119
- pt = fetchFreePt(focus, xt, yt);
120
- }
121
- var onPeak = false;
122
- if (cyclicvoltaSt) {
123
- var spectraList = cyclicvoltaSt.spectraList;
124
- var spectra = spectraList[jcampIdx];
125
- var voltammetryPeakIdx = spectra.selectedIdx;
126
- focus.clickUiTargetAct(pt, onPeak, voltammetryPeakIdx, jcampIdx);
127
- } else {
128
- focus.clickUiTargetAct(pt, onPeak);
129
- }
130
- };
131
- exports.ClickCompass = ClickCompass;
132
- var MountCompass = function MountCompass(focus) {
133
- var root = focus.root,
134
- w = focus.w,
135
- h = focus.h;
136
- var compass = root.append('g').attr('class', 'compass');
137
- var cursor = root.append('g').attr('class', 'cursor');
138
- var overlay = root.append('rect').attr('class', 'overlay-focus').attr('width', w).attr('height', h).attr('opacity', 0.0);
139
- compass.append('line').attr('class', 'x-hover-line hover-line').attr('stroke', '#777').attr('stroke-width', 1).attr('stroke-dasharray', 2, 2);
140
- compass.append('circle').attr('r', 4).attr('fill', 'none').attr('stroke', '#777').attr('stroke-width', 2);
141
- cursor.append('text').attr('class', 'cursor-txt').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle');
142
- cursor.append('text').attr('class', 'cursor-txt-hz').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').style('fill', '#D68910');
143
- overlay.on('mousemove', function () {
144
- return MouseMove(focus);
145
- }).on('click', function () {
146
- return ClickCompass(focus);
147
- });
148
- };
149
- exports.MountCompass = MountCompass;
@@ -1,96 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ToXY = exports.PksEdit = exports.PeckersEdit = exports.IsSame = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var ToXY = function ToXY(data) {
10
- var length = data ? data.length : 0;
11
- if (length === 0) return [];
12
- var peaks = [];
13
- var i = 0;
14
- for (i = 0; i < length; i += 1) {
15
- var _data$i = data[i],
16
- x = _data$i.x,
17
- y = _data$i.y;
18
- peaks = [].concat((0, _toConsumableArray2.default)(peaks), [[x, y]]);
19
- }
20
- return peaks;
21
- };
22
- exports.ToXY = ToXY;
23
- var IsSame = function IsSame(one, two) {
24
- return Math.abs((one - two) * 10000000) < 1.0;
25
- };
26
- exports.IsSame = IsSame;
27
- var pksRmNeg = function pksRmNeg(dataPks, editPeakSt) {
28
- var neg = editPeakSt.neg;
29
- var negXs = neg.map(function (n) {
30
- return n.x;
31
- });
32
- var result = dataPks.map(function (p) {
33
- var idx = negXs.findIndex(function (nx) {
34
- return IsSame(nx, p.x);
35
- });
36
- return idx >= 0 ? null : p;
37
- }).filter(function (r) {
38
- return r != null;
39
- });
40
- return result;
41
- };
42
- var pksAddPos = function pksAddPos(dataPks, editPeakSt) {
43
- var pos = editPeakSt.pos;
44
- var posXs = pos.map(function (p) {
45
- return p.x;
46
- });
47
- var posPks = dataPks.map(function (p) {
48
- var idx = posXs.findIndex(function (px) {
49
- return px === p.x;
50
- });
51
- return idx >= 0 ? null : p;
52
- }).filter(function (r) {
53
- return r != null;
54
- });
55
- var result = [].concat((0, _toConsumableArray2.default)(posPks), (0, _toConsumableArray2.default)(pos));
56
- return result;
57
- };
58
- var PksEdit = function PksEdit(dataPks, editPeakSt) {
59
- var voltammetryPeak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
60
- if (voltammetryPeak && voltammetryPeak.length > 0) {
61
- var modDataPks = [];
62
- voltammetryPeak.forEach(function (peak) {
63
- if (peak.max) {
64
- modDataPks = [].concat((0, _toConsumableArray2.default)(modDataPks), [peak.max]);
65
- }
66
- if (peak.min) {
67
- modDataPks = [].concat((0, _toConsumableArray2.default)(modDataPks), [peak.min]);
68
- }
69
- });
70
- modDataPks = modDataPks.sort(function (a, b) {
71
- return a.x - b.x;
72
- });
73
- return modDataPks;
74
- } else {
75
- var _modDataPks = pksAddPos(dataPks, editPeakSt);
76
- _modDataPks = pksRmNeg(_modDataPks, editPeakSt);
77
- _modDataPks = _modDataPks.sort(function (a, b) {
78
- return a.x - b.x;
79
- });
80
- return _modDataPks;
81
- }
82
- };
83
- exports.PksEdit = PksEdit;
84
- var PeckersEdit = function PeckersEdit(voltammetryPeak) {
85
- var modDataPeckers = [];
86
- voltammetryPeak.forEach(function (peak) {
87
- if (peak.pecker) {
88
- modDataPeckers = [].concat((0, _toConsumableArray2.default)(modDataPeckers), [peak.pecker]);
89
- }
90
- });
91
- modDataPeckers = modDataPeckers.sort(function (a, b) {
92
- return a.x - b.x;
93
- });
94
- return modDataPeckers;
95
- };
96
- exports.PeckersEdit = PeckersEdit;
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.extractPeaksEdit = exports.extractAreaUnderCurve = void 0;
8
- var _converter = require("./converter");
9
- var _chem = require("./chem");
10
- var _shift = require("./shift");
11
- var _format = _interopRequireDefault(require("./format"));
12
- var _integration = require("./integration");
13
- var niOffset = function niOffset(shiftSt) {
14
- var ref = shiftSt.ref,
15
- peak = shiftSt.peak;
16
- var offset = (0, _shift.FromManualToOffset)(ref, peak);
17
- return offset;
18
- };
19
- var msOffset = function msOffset() {
20
- return 0;
21
- };
22
- var extractPeaksEdit = function extractPeaksEdit(feature, editPeakSt, thresSt, shiftSt, layoutSt) {
23
- var offset = _format.default.isMsLayout(layoutSt) ? msOffset() : niOffset(shiftSt);
24
- var peaks = (0, _chem.Convert2Peak)(feature, thresSt.value, offset);
25
- var peaksEdit = (0, _converter.PksEdit)(peaks, editPeakSt);
26
- return peaksEdit;
27
- };
28
- exports.extractPeaksEdit = extractPeaksEdit;
29
- var getAUCValue = function getAUCValue(integrationSt, layoutSt) {
30
- var refArea = integrationSt.refArea,
31
- refFactor = integrationSt.refFactor,
32
- stack = integrationSt.stack;
33
- if (Array.isArray(stack) && stack.length > 0) {
34
- var data = stack.at(-1);
35
- var ignoreRef = _format.default.isHplcUvVisLayout(layoutSt);
36
- return (0, _integration.calcArea)(data, refArea, refFactor, ignoreRef);
37
- }
38
- return 0;
39
- };
40
- var extractAreaUnderCurve = function extractAreaUnderCurve(allIntegrationSt, presentIntegrationSt, layoutSt) {
41
- if (_format.default.isHplcUvVisLayout(layoutSt) && Array.isArray(allIntegrationSt) && presentIntegrationSt) {
42
- var results = [];
43
- allIntegrationSt.forEach(function (inte) {
44
- var aucVal = getAUCValue(inte, layoutSt);
45
- results.push(aucVal);
46
- });
47
- return results;
48
- }
49
- return null;
50
- };
51
-
52
- // eslint-disable-line
53
- exports.extractAreaUnderCurve = extractAreaUnderCurve;