@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,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(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;
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: xt,
19
- yt: yt
17
+ xt,
18
+ yt
20
19
  };
21
20
  };
22
21
  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);
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
- 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;
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
- 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);
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
- 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;
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
- var pt = fetchFreePt(focus, xt, yt);
74
+ const pt = fetchFreePt(focus, xt, yt);
69
75
  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, ")"));
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', "translate(".concat(tx, ",", 10, ")")).text(pt.x.toFixed(3));
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', "translate(".concat(tx, ",", 20, ")")).text("".concat((pt.x * freq).toFixed(3), " Hz"));
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
- 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
+ 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
- var dValue = 0.0;
95
+ let dValue = 0.0;
90
96
  if (wavelength) {
91
- dValue = (0, _chem.Convert2DValue)(_pt.x, wavelength.value).toExponential(2);
97
+ dValue = (0, _chem.Convert2DValue)(pt.x, wavelength.value).toExponential(2);
92
98
  } else {
93
- dValue = (0, _chem.Convert2DValue)(_pt.x).toExponential(2);
99
+ dValue = (0, _chem.Convert2DValue)(pt.x).toExponential(2);
94
100
  }
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));
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', "translate(".concat(_tx, ",", 10, ")")).text(_pt.x.toFixed(3));
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', "translate(".concat(_tx, ",", 20, ")")).text("".concat((_pt.x * freq).toFixed(3), " Hz"));
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
- var ClickCompass = function ClickCompass(focus) {
114
+ const ClickCompass = focus => {
109
115
  d3.event.stopPropagation();
110
116
  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;
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
- var onPeak = false;
129
+ const onPeak = false;
121
130
  if (cyclicvoltaSt) {
122
- var spectraList = cyclicvoltaSt.spectraList;
123
- var spectra = spectraList[jcampIdx];
124
- var voltammetryPeakIdx = spectra.selectedIdx;
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
- var MountCompass = function MountCompass(focus) {
135
- var root = focus.root,
136
- w = focus.w,
137
- h = focus.h;
138
- var compass = root.append('g').attr('class', 'compass');
139
- var cursor = root.append('g').attr('class', 'cursor');
140
- var overlay = root.append('rect').attr('class', 'overlay-focus').attr('width', w).attr('height', h).attr('opacity', 0.0);
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', function () {
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
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var ToXY = function ToXY(data) {
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
- var peaks = [];
13
- var i = 0;
10
+ let peaks = [];
11
+ let i = 0;
14
12
  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]]);
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
- var IsSame = function IsSame(one, two) {
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
- var pksRmNeg = function pksRmNeg(dataPks, editPeakSt) {
28
- var selectedIdx = editPeakSt.selectedIdx,
29
- peaks = editPeakSt.peaks;
30
- var selectedEditPeaks = peaks[selectedIdx];
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
- var neg = selectedEditPeaks.neg;
33
+ const {
34
+ neg
35
+ } = selectedEditPeaks;
35
36
  if (!neg) {
36
37
  return dataPks;
37
38
  }
38
- var negXs = neg.map(function (n) {
39
- return n.x;
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(function (r) {
47
- return r != null;
48
- });
43
+ }).filter(r => r != null);
49
44
  return result;
50
45
  };
51
- var pksAddPos = function pksAddPos(dataPks, editPeakSt) {
52
- var selectedIdx = editPeakSt.selectedIdx,
53
- peaks = editPeakSt.peaks;
54
- var selectedEditPeaks = peaks[selectedIdx];
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
- var pos = selectedEditPeaks.pos;
55
+ const {
56
+ pos
57
+ } = selectedEditPeaks;
59
58
  if (!pos) {
60
59
  return dataPks;
61
60
  }
62
- var posXs = pos.map(function (p) {
63
- return p.x;
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(function (r) {
71
- return r != null;
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
- var PksEdit = function PksEdit(dataPks, editPeakSt) {
77
- var voltammetryPeak = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
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
- var _modDataPks = [];
80
- voltammetryPeak.forEach(function (peak) {
72
+ let modDataPks = [];
73
+ voltammetryPeak.forEach(peak => {
81
74
  if (peak.max) {
82
- _modDataPks = [].concat((0, _toConsumableArray2.default)(_modDataPks), [peak.max]);
75
+ modDataPks = [...modDataPks, peak.max];
83
76
  }
84
77
  if (peak.min) {
85
- _modDataPks = [].concat((0, _toConsumableArray2.default)(_modDataPks), [peak.min]);
78
+ modDataPks = [...modDataPks, peak.min];
86
79
  }
87
80
  });
88
- _modDataPks = _modDataPks.sort(function (a, b) {
89
- return a.x - b.x;
90
- });
91
- return _modDataPks;
81
+ modDataPks = modDataPks.sort((a, b) => a.x - b.x);
82
+ return modDataPks;
92
83
  }
93
- var modDataPks = pksAddPos(dataPks, editPeakSt);
84
+ let modDataPks = pksAddPos(dataPks, editPeakSt);
94
85
  modDataPks = pksRmNeg(modDataPks, editPeakSt);
95
- modDataPks = modDataPks.sort(function (a, b) {
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
- var PeckersEdit = function PeckersEdit(voltammetryPeak) {
102
- var modDataPeckers = [];
103
- voltammetryPeak.forEach(function (peak) {
90
+ const PeckersEdit = voltammetryPeak => {
91
+ let modDataPeckers = [];
92
+ voltammetryPeak.forEach(peak => {
104
93
  if (peak.pecker) {
105
- modDataPeckers = [].concat((0, _toConsumableArray2.default)(modDataPeckers), [peak.pecker]);
94
+ modDataPeckers = [...modDataPeckers, peak.pecker];
106
95
  }
107
96
  });
108
- modDataPeckers = modDataPeckers.sort(function (a, b) {
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
- var getScanIdx = function getScanIdx(entity, scanSt) {
10
- var target = scanSt.target,
11
- isAuto = scanSt.isAuto;
12
- var features = entity.features,
13
- spectra = entity.spectra;
14
- var defaultFeat = features.editPeak || features.autoPeak || features[0];
15
- var hasEdit = !!defaultFeat.scanEditTarget;
16
- var defaultIdx = isAuto || !hasEdit ? defaultFeat.scanAutoTarget : defaultFeat.scanEditTarget;
17
- var defaultCount = +spectra.length;
18
- var idx = +(target || defaultIdx || 0);
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
- var extrShare = function extrShare(entity, thresSt) {
25
- var scanIdx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
26
- var spectra = entity.spectra,
27
- features = entity.features;
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
- var autoPeak = features.autoPeak || features[scanIdx] || features[0];
30
- var editPeak = features.editPeak || features[scanIdx] || features[0];
31
- var hasEdit = editPeak && editPeak.data ? editPeak.data[0].x.length > 0 : false;
32
- var feature = hasEdit && thresSt.isEdit ? editPeak : autoPeak;
33
- var integration = features.integration,
34
- multiplicity = features.multiplicity;
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: spectra,
37
- feature: feature,
38
- hasEdit: hasEdit,
39
- integration: integration,
40
- multiplicity: multiplicity
44
+ spectra,
45
+ feature,
46
+ hasEdit,
47
+ integration,
48
+ multiplicity
41
49
  };
42
50
  };
43
- var extrMs = function extrMs(entity, thresSt, scanSt) {
44
- var scanIdx = getScanIdx(entity, scanSt);
45
- var _extrShare = extrShare(entity, thresSt, scanIdx),
46
- spectra = _extrShare.spectra,
47
- feature = _extrShare.feature,
48
- hasEdit = _extrShare.hasEdit;
49
- var topic = spectra[scanIdx].data[0];
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: topic,
52
- feature: feature,
53
- hasEdit: hasEdit
60
+ topic,
61
+ feature,
62
+ hasEdit
54
63
  };
55
64
  };
56
- var extrNi = function extrNi(entity, thresSt) {
57
- var scanIdx = 0;
58
- var _extrShare2 = extrShare(entity, thresSt, scanIdx),
59
- spectra = _extrShare2.spectra,
60
- feature = _extrShare2.feature,
61
- hasEdit = _extrShare2.hasEdit,
62
- integration = _extrShare2.integration,
63
- multiplicity = _extrShare2.multiplicity;
64
- var topic = spectra[0].data[0];
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: topic,
67
- feature: feature,
68
- hasEdit: hasEdit,
69
- integration: integration,
70
- multiplicity: multiplicity
76
+ topic,
77
+ feature,
78
+ hasEdit,
79
+ integration,
80
+ multiplicity
71
81
  };
72
82
  };
73
- var extractParams = function extractParams(entity, thresSt, scanSt) {
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
- var niOffset = function niOffset(shiftSt) {
14
- var atIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
15
- var shifts = shiftSt.shifts;
16
- var selectedShift = shifts[atIndex];
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
- var ref = selectedShift.ref,
21
- peak = selectedShift.peak;
22
- var offset = (0, _shift.FromManualToOffset)(ref, peak);
22
+ const {
23
+ ref,
24
+ peak
25
+ } = selectedShift;
26
+ const offset = (0, _shift.FromManualToOffset)(ref, peak);
23
27
  return offset;
24
28
  };
25
- var msOffset = function msOffset() {
26
- return 0;
27
- };
28
- var extractPeaksEdit = function extractPeaksEdit(feature, editPeakSt, thresSt, shiftSt, layoutSt) {
29
- var atIndex = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
30
- var offset = _format.default.isMsLayout(layoutSt) ? msOffset() : niOffset(shiftSt, atIndex);
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
- var getAUCValue = function getAUCValue(integrationSt, layoutSt) {
37
- var refArea = integrationSt.refArea,
38
- refFactor = integrationSt.refFactor,
39
- stack = integrationSt.stack;
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
- var data = stack.at(-1);
42
- var ignoreRef = _format.default.isHplcUvVisLayout(layoutSt);
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
- var extractAreaUnderCurve = function extractAreaUnderCurve(allIntegrationSt, presentIntegrationSt, layoutSt) {
51
+ const extractAreaUnderCurve = (allIntegrationSt, presentIntegrationSt, layoutSt) => {
48
52
  if (_format.default.isHplcUvVisLayout(layoutSt) && Array.isArray(allIntegrationSt) && presentIntegrationSt) {
49
- var results = [];
50
- allIntegrationSt.forEach(function (inte) {
51
- var aucVal = getAUCValue(inte, layoutSt);
53
+ const results = [];
54
+ allIntegrationSt.forEach(inte => {
55
+ const aucVal = getAUCValue(inte, layoutSt);
52
56
  results.push(aucVal);
53
57
  });
54
58
  return results;
@@ -4,11 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mpyIdTag = exports.itgIdTag = void 0;
7
- var itgIdTag = function itgIdTag(d) {
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
- var mpyIdTag = function mpyIdTag(d) {
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;