@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,15 +1,10 @@
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
  });
8
7
  exports.default = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
8
  var d3 = _interopRequireWildcard(require("d3"));
14
9
  var _init = require("../../helpers/init");
15
10
  var _brush = _interopRequireDefault(require("../../helpers/brush"));
@@ -17,16 +12,17 @@ var _mount = require("../../helpers/mount");
17
12
  var _compass = require("../../helpers/compass");
18
13
  var _converter = require("../../helpers/converter");
19
14
  var _list_layout = require("../../constants/list_layout");
20
- 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); }
21
- 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; }
22
- var RectFocus = /*#__PURE__*/function () {
23
- function RectFocus(props) {
24
- (0, _classCallCheck2.default)(this, RectFocus);
25
- var W = props.W,
26
- H = props.H,
27
- clickUiTargetAct = props.clickUiTargetAct,
28
- selectUiSweepAct = props.selectUiSweepAct,
29
- scrollUiWheelAct = props.scrollUiWheelAct;
15
+ 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); }
16
+ 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; }
17
+ class RectFocus {
18
+ constructor(props) {
19
+ const {
20
+ W,
21
+ H,
22
+ clickUiTargetAct,
23
+ selectUiSweepAct,
24
+ scrollUiWheelAct
25
+ } = props;
30
26
  this.rootKlass = '.d3Rect';
31
27
  this.margin = {
32
28
  t: 5,
@@ -70,203 +66,162 @@ var RectFocus = /*#__PURE__*/function () {
70
66
  this.mergedPeaks = this.mergedPeaks.bind(this);
71
67
  this.isFirefox = typeof InstallTrigger !== 'undefined';
72
68
  }
73
- (0, _createClass2.default)(RectFocus, [{
74
- key: "setTip",
75
- value: function setTip() {
76
- this.tip = (0, _init.InitTip)();
77
- this.root.call(this.tip);
78
- }
79
- }, {
80
- key: "setDataParams",
81
- value: function setDataParams(data, peaks, tTrEndPts, tSfPeaks) {
82
- this.data = (0, _toConsumableArray2.default)(data);
83
- this.dataPks = (0, _toConsumableArray2.default)(peaks);
84
- this.tTrEndPts = tTrEndPts;
85
- this.tSfPeaks = tSfPeaks;
86
- }
87
- }, {
88
- key: "updatePathCall",
89
- value: function updatePathCall(xt, yt) {
90
- this.pathCall = d3.line().x(function (d) {
91
- return xt(d.x);
92
- }).y(function (d) {
93
- return yt(d.y);
94
- });
69
+ setTip() {
70
+ this.tip = (0, _init.InitTip)();
71
+ this.root.call(this.tip);
72
+ }
73
+ setDataParams(data, peaks, tTrEndPts, tSfPeaks) {
74
+ this.data = [...data];
75
+ this.dataPks = [...peaks];
76
+ this.tTrEndPts = tTrEndPts;
77
+ this.tSfPeaks = tSfPeaks;
78
+ }
79
+ updatePathCall(xt, yt) {
80
+ this.pathCall = d3.line().x(d => xt(d.x)).y(d => yt(d.y));
81
+ }
82
+ setConfig(sweepExtentSt) {
83
+ // Domain Calculate
84
+ let {
85
+ xExtent,
86
+ yExtent
87
+ } = sweepExtentSt || {
88
+ xExtent: false,
89
+ yExtent: false
90
+ };
91
+ if (!xExtent || !yExtent) {
92
+ const xes = d3.extent(this.data, d => d.x).sort((a, b) => a - b);
93
+ xExtent = {
94
+ xL: xes[0] - 10,
95
+ xU: xes[1] + 10
96
+ };
97
+ const btm = 0; // MS baseline is always 0.
98
+ const top = d3.max(this.data, d => d.y);
99
+ const height = top - btm;
100
+ yExtent = {
101
+ yL: btm - this.factor * height,
102
+ yU: top + this.factor * height
103
+ };
95
104
  }
96
- }, {
97
- key: "setConfig",
98
- value: function setConfig(sweepExtentSt) {
99
- // Domain Calculate
100
- var _ref = sweepExtentSt || {
101
- xExtent: false,
102
- yExtent: false
103
- },
104
- xExtent = _ref.xExtent,
105
- yExtent = _ref.yExtent;
106
- if (!xExtent || !yExtent) {
107
- var xes = d3.extent(this.data, function (d) {
108
- return d.x;
109
- }).sort(function (a, b) {
110
- return a - b;
111
- });
112
- xExtent = {
113
- xL: xes[0] - 10,
114
- xU: xes[1] + 10
115
- };
116
- var btm = 0; // MS baseline is always 0.
117
- var top = d3.max(this.data, function (d) {
118
- return d.y;
119
- });
120
- var height = top - btm;
121
- yExtent = {
122
- yL: btm - this.factor * height,
123
- yU: top + this.factor * height
124
- };
125
- }
126
- this.scales.x.domain([xExtent.xL, xExtent.xU]);
127
- this.scales.y.domain([yExtent.yL, yExtent.yU]);
105
+ this.scales.x.domain([xExtent.xL, xExtent.xU]);
106
+ this.scales.y.domain([yExtent.yL, yExtent.yU]);
128
107
 
129
- // rescale for zoom
130
- var _TfRescale = (0, _compass.TfRescale)(this),
131
- xt = _TfRescale.xt,
132
- yt = _TfRescale.yt;
108
+ // rescale for zoom
109
+ const {
110
+ xt,
111
+ yt
112
+ } = (0, _compass.TfRescale)(this);
133
113
 
134
- // Axis Call
135
- this.axisCall.x.scale(xt);
136
- this.axisCall.y.scale(yt);
137
- this.currentExtent = {
138
- xExtent: xExtent,
139
- yExtent: yExtent
114
+ // Axis Call
115
+ this.axisCall.x.scale(xt);
116
+ this.axisCall.y.scale(yt);
117
+ this.currentExtent = {
118
+ xExtent,
119
+ yExtent
120
+ };
121
+ }
122
+ posHeight(gnd, val) {
123
+ const h = gnd - val;
124
+ return h >= 0 ? h : 0;
125
+ }
126
+ barColor(y, yRef) {
127
+ return y >= yRef ? 'steelblue' : '#aaa';
128
+ }
129
+ drawBar() {
130
+ const {
131
+ xt,
132
+ yt
133
+ } = (0, _compass.TfRescale)(this);
134
+ this.updatePathCall(xt, yt);
135
+ const yRef = this.tTrEndPts[0].y;
136
+ const bars = this.bars.selectAll('rect').data(this.data);
137
+ bars.exit().attr('class', 'exit').remove();
138
+ const gnd = yt(0);
139
+ bars.enter().append('rect').attr('class', 'enter-bar').attr('width', 1.5).merge(bars).attr('fill', d => this.barColor(d.y, yRef)).attr('height', d => this.posHeight(gnd, yt(d.y))).attr('id', d => `mpp${Math.round(1000 * d.x)}`).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y)})`).on('mouseover', (d, i, n) => {
140
+ d3.select(`#mpp${Math.round(1000 * d.x)}`).attr('stroke-opacity', '1.0');
141
+ d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'blue');
142
+ const tipParams = {
143
+ d,
144
+ layout: this.layout
140
145
  };
146
+ this.tip.show(tipParams, n[i]);
147
+ }).on('mouseout', (d, i, n) => {
148
+ d3.select(`#mpp${Math.round(1000 * d.x)}`).attr('stroke-opacity', '1.0');
149
+ d3.select(`#bpt${Math.round(1000 * d.x)}`).style('fill', 'red');
150
+ const tipParams = {
151
+ d,
152
+ layout: this.layout
153
+ };
154
+ this.tip.hide(tipParams, n[i]);
155
+ });
156
+ }
157
+ drawThres() {
158
+ if (this.tTrEndPts.length > 0) {
159
+ this.thresLine.attr('d', this.pathCall(this.tTrEndPts));
160
+ this.thresLine.attr('visibility', 'visible');
161
+ } else {
162
+ this.thresLine.attr('visibility', 'hidden');
141
163
  }
142
- }, {
143
- key: "posHeight",
144
- value: function posHeight(gnd, val) {
145
- var h = gnd - val;
146
- return h >= 0 ? h : 0;
147
- }
148
- }, {
149
- key: "barColor",
150
- value: function barColor(y, yRef) {
151
- return y >= yRef ? 'steelblue' : '#aaa';
152
- }
153
- }, {
154
- key: "drawBar",
155
- value: function drawBar() {
156
- var _this = this;
157
- var _TfRescale2 = (0, _compass.TfRescale)(this),
158
- xt = _TfRescale2.xt,
159
- yt = _TfRescale2.yt;
160
- this.updatePathCall(xt, yt);
161
- var yRef = this.tTrEndPts[0].y;
162
- var bars = this.bars.selectAll('rect').data(this.data);
163
- bars.exit().attr('class', 'exit').remove();
164
- var gnd = yt(0);
165
- bars.enter().append('rect').attr('class', 'enter-bar').attr('width', 1.5).merge(bars).attr('fill', function (d) {
166
- return _this.barColor(d.y, yRef);
167
- }).attr('height', function (d) {
168
- return _this.posHeight(gnd, yt(d.y));
169
- }).attr('id', function (d) {
170
- return "mpp".concat(Math.round(1000 * d.x));
171
- }).attr('transform', function (d) {
172
- return "translate(".concat(xt(d.x), ", ").concat(yt(d.y), ")");
173
- }).on('mouseover', function (d, i, n) {
174
- d3.select("#mpp".concat(Math.round(1000 * d.x))).attr('stroke-opacity', '1.0');
175
- d3.select("#bpt".concat(Math.round(1000 * d.x))).style('fill', 'blue');
176
- var tipParams = {
177
- d: d,
178
- layout: _this.layout
179
- };
180
- _this.tip.show(tipParams, n[i]);
181
- }).on('mouseout', function (d, i, n) {
182
- d3.select("#mpp".concat(Math.round(1000 * d.x))).attr('stroke-opacity', '1.0');
183
- d3.select("#bpt".concat(Math.round(1000 * d.x))).style('fill', 'red');
184
- var tipParams = {
185
- d: d,
186
- layout: _this.layout
187
- };
188
- _this.tip.hide(tipParams, n[i]);
189
- });
190
- }
191
- }, {
192
- key: "drawThres",
193
- value: function drawThres() {
194
- if (this.tTrEndPts.length > 0) {
195
- this.thresLine.attr('d', this.pathCall(this.tTrEndPts));
196
- this.thresLine.attr('visibility', 'visible');
197
- } else {
198
- this.thresLine.attr('visibility', 'hidden');
199
- }
200
- }
201
- }, {
202
- key: "drawGrid",
203
- value: function drawGrid() {
204
- this.grid.x.call(this.axisCall.x.tickSize(-this.h, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
205
- this.grid.y.call(this.axisCall.y.tickSize(-this.w, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
206
- }
207
- }, {
208
- key: "mergedPeaks",
209
- value: function mergedPeaks(editPeakSt) {
210
- if (!editPeakSt) return this.dataPks;
211
- this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
212
- return this.dataPks;
213
- }
214
- }, {
215
- key: "create",
216
- value: function create(_ref2) {
217
- var filterSeed = _ref2.filterSeed,
218
- filterPeak = _ref2.filterPeak,
219
- tTrEndPts = _ref2.tTrEndPts,
220
- tSfPeaks = _ref2.tSfPeaks,
221
- sweepExtentSt = _ref2.sweepExtentSt,
222
- isUiAddIntgSt = _ref2.isUiAddIntgSt,
223
- isUiNoBrushSt = _ref2.isUiNoBrushSt;
224
- this.svg = d3.select('.d3Svg');
225
- (0, _mount.MountMainFrame)(this, 'focus');
226
- (0, _mount.MountClip)(this);
227
- this.root = d3.select(this.rootKlass).selectAll('.focus-main');
228
- this.setTip();
229
- this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
230
- (0, _compass.MountCompass)(this);
231
- this.axis = (0, _mount.MountAxis)(this);
232
- var _MountThresLine = (0, _mount.MountThresLine)(this, 'green');
233
- var _MountThresLine2 = (0, _slicedToArray2.default)(_MountThresLine, 1);
234
- this.thresLine = _MountThresLine2[0];
235
- this.grid = (0, _mount.MountGrid)(this);
236
- this.ref = (0, _mount.MountRef)(this);
237
- this.bars = (0, _mount.MountBars)(this);
238
- (0, _mount.MountAxisLabelX)(this);
239
- (0, _mount.MountAxisLabelY)(this);
240
- if (this.data && this.data.length > 0) {
241
- this.setConfig(sweepExtentSt);
242
- this.drawBar();
243
- this.drawThres();
244
- this.drawGrid();
245
- }
246
- (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
164
+ }
165
+ drawGrid() {
166
+ this.grid.x.call(this.axisCall.x.tickSize(-this.h, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
167
+ this.grid.y.call(this.axisCall.y.tickSize(-this.w, 0, 0)).selectAll('line').attr('stroke', '#ddd').attr('stroke-opacity', 0.6).attr('fill', 'none');
168
+ }
169
+ mergedPeaks(editPeakSt) {
170
+ if (!editPeakSt) return this.dataPks;
171
+ this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
172
+ return this.dataPks;
173
+ }
174
+ create(_ref) {
175
+ let {
176
+ filterSeed,
177
+ filterPeak,
178
+ tTrEndPts,
179
+ tSfPeaks,
180
+ sweepExtentSt,
181
+ isUiAddIntgSt,
182
+ isUiNoBrushSt
183
+ } = _ref;
184
+ this.svg = d3.select('.d3Svg');
185
+ (0, _mount.MountMainFrame)(this, 'focus');
186
+ (0, _mount.MountClip)(this);
187
+ this.root = d3.select(this.rootKlass).selectAll('.focus-main');
188
+ this.setTip();
189
+ this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
190
+ (0, _compass.MountCompass)(this);
191
+ this.axis = (0, _mount.MountAxis)(this);
192
+ [this.thresLine] = (0, _mount.MountThresLine)(this, 'green');
193
+ this.grid = (0, _mount.MountGrid)(this);
194
+ this.ref = (0, _mount.MountRef)(this);
195
+ this.bars = (0, _mount.MountBars)(this);
196
+ (0, _mount.MountAxisLabelX)(this);
197
+ (0, _mount.MountAxisLabelY)(this);
198
+ if (this.data && this.data.length > 0) {
199
+ this.setConfig(sweepExtentSt);
200
+ this.drawBar();
201
+ this.drawThres();
202
+ this.drawGrid();
247
203
  }
248
- }, {
249
- key: "update",
250
- value: function update(_ref3) {
251
- var filterSeed = _ref3.filterSeed,
252
- filterPeak = _ref3.filterPeak,
253
- tTrEndPts = _ref3.tTrEndPts,
254
- tSfPeaks = _ref3.tSfPeaks,
255
- sweepExtentSt = _ref3.sweepExtentSt,
256
- isUiAddIntgSt = _ref3.isUiAddIntgSt,
257
- isUiNoBrushSt = _ref3.isUiNoBrushSt;
258
- this.root = d3.select(this.rootKlass).selectAll('.focus-main');
259
- this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
260
- if (this.data && this.data.length > 0) {
261
- this.setConfig(sweepExtentSt);
262
- this.drawBar();
263
- this.drawThres();
264
- this.drawGrid();
265
- }
266
- (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
204
+ (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
205
+ }
206
+ update(_ref2) {
207
+ let {
208
+ filterSeed,
209
+ filterPeak,
210
+ tTrEndPts,
211
+ tSfPeaks,
212
+ sweepExtentSt,
213
+ isUiAddIntgSt,
214
+ isUiNoBrushSt
215
+ } = _ref2;
216
+ this.root = d3.select(this.rootKlass).selectAll('.focus-main');
217
+ this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
218
+ if (this.data && this.data.length > 0) {
219
+ this.setConfig(sweepExtentSt);
220
+ this.drawBar();
221
+ this.drawThres();
222
+ this.drawGrid();
267
223
  }
268
- }]);
269
- return RectFocus;
270
- }();
271
- var _default = RectFocus;
272
- exports.default = _default;
224
+ (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
225
+ }
226
+ }
227
+ var _default = exports.default = RectFocus;
@@ -22,7 +22,7 @@ var _section_loading = _interopRequireDefault(require("./section_loading"));
22
22
  /* eslint-disable react/function-component-definition, react/destructuring-assignment,
23
23
  max-len */
24
24
 
25
- var titleStyle = {
25
+ const titleStyle = {
26
26
  backgroundColor: '#f5f5f5',
27
27
  border: '2px solid #e3e3e3',
28
28
  borderRadius: '10px',
@@ -33,17 +33,17 @@ var titleStyle = {
33
33
  textAlign: 'center',
34
34
  width: '70%'
35
35
  };
36
- var txtStyle = {
36
+ const txtStyle = {
37
37
  lineHeight: '20px'
38
38
  };
39
- var TxtLabel = function TxtLabel(classes, label) {
40
- var extClsName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'txt-label';
39
+ const TxtLabel = function (classes, label) {
40
+ let extClsName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'txt-label';
41
41
  return /*#__PURE__*/_react.default.createElement("span", {
42
42
  className: (0, _classnames.default)(classes.txtLabel, extClsName)
43
43
  }, label);
44
44
  };
45
45
  exports.TxtLabel = TxtLabel;
46
- var StatusIcon = function StatusIcon(status) {
46
+ const StatusIcon = status => {
47
47
  switch (status) {
48
48
  case 'accept':
49
49
  return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
@@ -105,16 +105,16 @@ var StatusIcon = function StatusIcon(status) {
105
105
  }
106
106
  };
107
107
  exports.StatusIcon = StatusIcon;
108
- var ConfidenceLabel = function ConfidenceLabel(classes, confidence) {
109
- var extClsName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'txt-label';
108
+ const ConfidenceLabel = function (classes, confidence) {
109
+ let extClsName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'txt-label';
110
110
  if (!confidence) return /*#__PURE__*/_react.default.createElement("span", null, " - - ");
111
- var confidenceDp = parseFloat(Math.round(confidence * 100) / 100).toFixed(2);
111
+ const confidenceDp = parseFloat(Math.round(confidence * 100) / 100).toFixed(2);
112
112
  return /*#__PURE__*/_react.default.createElement("span", {
113
113
  className: (0, _classnames.default)(classes.txtLabel, extClsName)
114
- }, "".concat(confidenceDp, " %"));
114
+ }, `${confidenceDp} %`);
115
115
  };
116
116
  exports.ConfidenceLabel = ConfidenceLabel;
117
- var sectionInput = function sectionInput(classes, molecule, inputFuncCb) {
117
+ const sectionInput = (classes, molecule, inputFuncCb) => {
118
118
  if (!inputFuncCb) return null;
119
119
  return /*#__PURE__*/_react.default.createElement("div", {
120
120
  className: (0, _classnames.default)(classes.inputRoot)
@@ -135,61 +135,53 @@ var sectionInput = function sectionInput(classes, molecule, inputFuncCb) {
135
135
  }))));
136
136
  };
137
137
  exports.sectionInput = sectionInput;
138
- var SectionRunning = function SectionRunning() {
139
- return /*#__PURE__*/_react.default.createElement("div", {
140
- style: titleStyle
141
- }, /*#__PURE__*/_react.default.createElement("h2", {
142
- style: txtStyle
143
- }, /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
144
- style: {
145
- color: 'blue',
146
- fontSize: 50
147
- }
148
- }), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("p", null, "The server is making predictions...")));
149
- };
150
- var SectionMissMatch = function SectionMissMatch() {
151
- return /*#__PURE__*/_react.default.createElement("div", {
152
- style: titleStyle
153
- }, /*#__PURE__*/_react.default.createElement("h2", {
154
- style: txtStyle
155
- }, /*#__PURE__*/_react.default.createElement(_ErrorOutline.default, {
156
- style: {
157
- color: 'red',
158
- fontSize: 50
159
- }
160
- }), /*#__PURE__*/_react.default.createElement("p", {
161
- className: "txt-predict-fail"
162
- }, "Peak & Element count mismatch!"), /*#__PURE__*/_react.default.createElement("p", {
163
- className: "txt-predict-fail"
164
- }, /*#__PURE__*/_react.default.createElement("sup", null, "1"), "H multiplicity count should not be more than the proton group count. Multiplicity must be assigned manulally before predictions."), /*#__PURE__*/_react.default.createElement("p", {
165
- className: "txt-predict-fail"
166
- }, /*#__PURE__*/_react.default.createElement("sup", null, "13"), "C peak count should not be more than the carbon count, and solvent peaks should be excluded.")));
167
- };
168
- var SectionNoService = function SectionNoService() {
169
- return /*#__PURE__*/_react.default.createElement("div", {
170
- style: titleStyle
171
- }, /*#__PURE__*/_react.default.createElement("h2", {
172
- style: txtStyle
173
- }, /*#__PURE__*/_react.default.createElement(_CloudOff.default, {
174
- style: {
175
- color: 'red',
176
- fontSize: 50
177
- }
178
- }), /*#__PURE__*/_react.default.createElement("p", null, "Service is not available."), /*#__PURE__*/_react.default.createElement("p", null, "Please try it again later.")));
179
- };
180
- var SectionUnknown = function SectionUnknown() {
181
- return /*#__PURE__*/_react.default.createElement("div", {
182
- style: titleStyle
183
- }, /*#__PURE__*/_react.default.createElement("h2", {
184
- style: txtStyle
185
- }, /*#__PURE__*/_react.default.createElement(_HelpOutline.default, {
186
- style: {
187
- color: 'purple',
188
- fontSize: 50
189
- }
190
- }), /*#__PURE__*/_react.default.createElement("p", null, "Unknown state.")));
191
- };
192
- var notToRenderAnalysis = function notToRenderAnalysis(pds) {
138
+ const SectionRunning = () => /*#__PURE__*/_react.default.createElement("div", {
139
+ style: titleStyle
140
+ }, /*#__PURE__*/_react.default.createElement("h2", {
141
+ style: txtStyle
142
+ }, /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
143
+ style: {
144
+ color: 'blue',
145
+ fontSize: 50
146
+ }
147
+ }), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("p", null, "The server is making predictions...")));
148
+ const SectionMissMatch = () => /*#__PURE__*/_react.default.createElement("div", {
149
+ style: titleStyle
150
+ }, /*#__PURE__*/_react.default.createElement("h2", {
151
+ style: txtStyle
152
+ }, /*#__PURE__*/_react.default.createElement(_ErrorOutline.default, {
153
+ style: {
154
+ color: 'red',
155
+ fontSize: 50
156
+ }
157
+ }), /*#__PURE__*/_react.default.createElement("p", {
158
+ className: "txt-predict-fail"
159
+ }, "Peak & Element count mismatch!"), /*#__PURE__*/_react.default.createElement("p", {
160
+ className: "txt-predict-fail"
161
+ }, /*#__PURE__*/_react.default.createElement("sup", null, "1"), "H multiplicity count should not be more than the proton group count. Multiplicity must be assigned manulally before predictions."), /*#__PURE__*/_react.default.createElement("p", {
162
+ className: "txt-predict-fail"
163
+ }, /*#__PURE__*/_react.default.createElement("sup", null, "13"), "C peak count should not be more than the carbon count, and solvent peaks should be excluded.")));
164
+ const SectionNoService = () => /*#__PURE__*/_react.default.createElement("div", {
165
+ style: titleStyle
166
+ }, /*#__PURE__*/_react.default.createElement("h2", {
167
+ style: txtStyle
168
+ }, /*#__PURE__*/_react.default.createElement(_CloudOff.default, {
169
+ style: {
170
+ color: 'red',
171
+ fontSize: 50
172
+ }
173
+ }), /*#__PURE__*/_react.default.createElement("p", null, "Service is not available."), /*#__PURE__*/_react.default.createElement("p", null, "Please try it again later.")));
174
+ const SectionUnknown = () => /*#__PURE__*/_react.default.createElement("div", {
175
+ style: titleStyle
176
+ }, /*#__PURE__*/_react.default.createElement("h2", {
177
+ style: txtStyle
178
+ }, /*#__PURE__*/_react.default.createElement(_HelpOutline.default, {
179
+ style: {
180
+ color: 'purple',
181
+ fontSize: 50
182
+ }
183
+ }), /*#__PURE__*/_react.default.createElement("p", null, "Unknown state.")));
184
+ const notToRenderAnalysis = pds => {
193
185
  if (pds.running) return /*#__PURE__*/_react.default.createElement(SectionRunning, null);
194
186
  if (!pds.outline || !pds.outline.code) return /*#__PURE__*/_react.default.createElement("div", null);
195
187
  if (pds.outline.code >= 500) return /*#__PURE__*/_react.default.createElement(SectionNoService, null);
@@ -198,11 +190,11 @@ var notToRenderAnalysis = function notToRenderAnalysis(pds) {
198
190
  return false;
199
191
  };
200
192
  exports.notToRenderAnalysis = notToRenderAnalysis;
201
- var sectionSvg = function sectionSvg(classes, predictions) {
202
- var renderMsg = notToRenderAnalysis(predictions);
193
+ const sectionSvg = (classes, predictions) => {
194
+ const renderMsg = notToRenderAnalysis(predictions);
203
195
  if (renderMsg) return null;
204
196
  if (!predictions.output) return null;
205
- var targetSvg = predictions.output.result[0].svgs[0];
197
+ const targetSvg = predictions.output.result[0].svgs[0];
206
198
  if (!targetSvg) return /*#__PURE__*/_react.default.createElement(_section_loading.default, null);
207
199
  return /*#__PURE__*/_react.default.createElement(_reactSvgFileZoomPan.default, {
208
200
  svg: targetSvg,