@complat/react-spectra-editor 1.3.5 → 1.4.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 (95) hide show
  1. package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +3199 -1944
  2. package/dist/__tests__/units/components/cmd_bar/01_viewer.test.js +21 -18
  3. package/dist/__tests__/units/components/cmd_bar/02_zoom.test.js +15 -13
  4. package/dist/__tests__/units/components/cmd_bar/03_peak.test.js +35 -26
  5. package/dist/__tests__/units/components/cmd_bar/07_pecker.test.js +17 -14
  6. package/dist/__tests__/units/components/cmd_bar/r08_change_axes.test.js +15 -13
  7. package/dist/__tests__/units/components/common/comps.test.js +9 -8
  8. package/dist/__tests__/units/components/common/draw.test.js +26 -34
  9. package/dist/__tests__/units/components/panel/graph_selection.test.js +25 -22
  10. package/dist/__tests__/units/components/panel/info.test.js +30 -25
  11. package/dist/__tests__/units/components/panel/peaks.test.js +29 -24
  12. package/dist/actions/manager.js +6 -2
  13. package/dist/actions/ui.js +13 -21
  14. package/dist/app.js +45 -45
  15. package/dist/components/cmd_bar/01_viewer.js +38 -31
  16. package/dist/components/cmd_bar/02_zoom.js +34 -27
  17. package/dist/components/cmd_bar/03_peak.js +85 -64
  18. package/dist/components/cmd_bar/04_integration.js +97 -76
  19. package/dist/components/cmd_bar/05_multiplicity.js +94 -67
  20. package/dist/components/cmd_bar/06_undo_redo.js +41 -32
  21. package/dist/components/cmd_bar/07_pecker.js +70 -47
  22. package/dist/components/cmd_bar/common.js +8 -8
  23. package/dist/components/cmd_bar/index.js +20 -21
  24. package/dist/components/cmd_bar/r01_layout.js +201 -137
  25. package/dist/components/cmd_bar/r02_scan.js +63 -51
  26. package/dist/components/cmd_bar/r03_threshold.js +95 -69
  27. package/dist/components/cmd_bar/r04_submit.js +155 -133
  28. package/dist/components/cmd_bar/r05_submit_btn.js +39 -36
  29. package/dist/components/cmd_bar/r06_predict_btn.js +66 -52
  30. package/dist/components/cmd_bar/r07_wavelength_btn.js +35 -31
  31. package/dist/components/cmd_bar/r08_change_axes.js +65 -56
  32. package/dist/components/cmd_bar/r09_detector.js +38 -33
  33. package/dist/components/cmd_bar/tri_btn.js +37 -25
  34. package/dist/components/common/comps.js +5 -6
  35. package/dist/components/d3_line/index.js +2 -1
  36. package/dist/components/d3_line/line_focus.js +32 -34
  37. package/dist/components/d3_multi/index.js +2 -1
  38. package/dist/components/d3_multi/multi_focus.js +60 -37
  39. package/dist/components/d3_rect/index.js +2 -1
  40. package/dist/components/d3_rect/rect_focus.js +18 -20
  41. package/dist/components/forecast/comps.js +169 -132
  42. package/dist/components/forecast/ir_comps.js +88 -69
  43. package/dist/components/forecast/ir_viewer.js +35 -28
  44. package/dist/components/forecast/nmr_comps.js +105 -76
  45. package/dist/components/forecast/nmr_viewer.js +36 -29
  46. package/dist/components/forecast/section_loading.js +22 -17
  47. package/dist/components/forecast_viewer.js +19 -17
  48. package/dist/components/multi_jcamps_viewer.js +44 -38
  49. package/dist/components/panel/compare.js +92 -76
  50. package/dist/components/panel/cyclic_voltamery_data.js +171 -122
  51. package/dist/components/panel/graph_selection.js +113 -90
  52. package/dist/components/panel/index.js +43 -39
  53. package/dist/components/panel/info.js +203 -156
  54. package/dist/components/panel/multiplicity.js +85 -63
  55. package/dist/components/panel/multiplicity_coupling.js +36 -29
  56. package/dist/components/panel/multiplicity_select.js +20 -19
  57. package/dist/components/panel/peaks.js +78 -56
  58. package/dist/constants/action_type.js +2 -1
  59. package/dist/helpers/cfg.js +1 -2
  60. package/dist/helpers/chem.js +5 -13
  61. package/dist/helpers/converter.js +1 -2
  62. package/dist/helpers/extractParams.js +1 -2
  63. package/dist/helpers/extractPeaksEdit.js +3 -6
  64. package/dist/helpers/format.js +28 -63
  65. package/dist/helpers/init.js +5 -9
  66. package/dist/helpers/integration.js +1 -2
  67. package/dist/helpers/mount.js +1 -2
  68. package/dist/index.js +306 -276
  69. package/dist/layer_content.js +14 -14
  70. package/dist/layer_init.js +12 -11
  71. package/dist/layer_prism.js +83 -72
  72. package/dist/reducers/reducer_axes.js +2 -5
  73. package/dist/reducers/reducer_curve.js +8 -6
  74. package/dist/reducers/reducer_detector.js +1 -3
  75. package/dist/reducers/reducer_edit_peak.js +1 -3
  76. package/dist/reducers/reducer_forecast.js +1 -3
  77. package/dist/reducers/reducer_integration.js +1 -3
  78. package/dist/reducers/reducer_jcamp.js +5 -8
  79. package/dist/reducers/reducer_layout.js +1 -3
  80. package/dist/reducers/reducer_manager.js +1 -3
  81. package/dist/reducers/reducer_meta.js +1 -3
  82. package/dist/reducers/reducer_multiplicity.js +3 -3
  83. package/dist/reducers/reducer_scan.js +1 -3
  84. package/dist/reducers/reducer_shift.js +1 -3
  85. package/dist/reducers/reducer_simulation.js +1 -3
  86. package/dist/reducers/reducer_status.js +1 -3
  87. package/dist/reducers/reducer_submit.js +1 -3
  88. package/dist/reducers/reducer_threshold.js +199 -29
  89. package/dist/reducers/reducer_ui.js +1 -3
  90. package/dist/reducers/reducer_voltammetry.js +3 -7
  91. package/dist/reducers/reducer_wavelength.js +1 -3
  92. package/dist/sagas/saga_multi_entities.js +35 -14
  93. package/dist/sagas/saga_multiplicity.js +1 -2
  94. package/dist/third_party/jAnalyzer.js +1 -1
  95. package/package.json +18 -1
@@ -598,23 +598,22 @@ class LineFocus {
598
598
  reverseXAxis(layoutSt) {
599
599
  return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.DLS_ACF, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.GC, _list_layout.LIST_LAYOUT.EMISSIONS, _list_layout.LIST_LAYOUT.DLS_INTENSITY].indexOf(layoutSt) < 0;
600
600
  }
601
- create(_ref) {
602
- let {
603
- filterSeed,
604
- filterPeak,
605
- tTrEndPts,
606
- tSfPeaks,
607
- freq,
608
- comparisons,
609
- editPeakSt,
610
- layoutSt,
611
- integationSt,
612
- mtplySt,
613
- sweepExtentSt,
614
- isUiAddIntgSt,
615
- isUiNoBrushSt,
616
- wavelength
617
- } = _ref;
601
+ create({
602
+ filterSeed,
603
+ filterPeak,
604
+ tTrEndPts,
605
+ tSfPeaks,
606
+ freq,
607
+ comparisons,
608
+ editPeakSt,
609
+ layoutSt,
610
+ integationSt,
611
+ mtplySt,
612
+ sweepExtentSt,
613
+ isUiAddIntgSt,
614
+ isUiNoBrushSt,
615
+ wavelength
616
+ }) {
618
617
  this.svg = d3.select('.d3Svg');
619
618
  (0, _mount.MountMainFrame)(this, 'focus');
620
619
  (0, _mount.MountClip)(this);
@@ -645,23 +644,22 @@ class LineFocus {
645
644
  (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
646
645
  this.resetShouldUpdate(editPeakSt, integationSt, mtplySt);
647
646
  }
648
- update(_ref2) {
649
- let {
650
- filterSeed,
651
- filterPeak,
652
- tTrEndPts,
653
- tSfPeaks,
654
- freq,
655
- comparisons,
656
- editPeakSt,
657
- layoutSt,
658
- integationSt,
659
- mtplySt,
660
- sweepExtentSt,
661
- isUiAddIntgSt,
662
- isUiNoBrushSt,
663
- wavelength
664
- } = _ref2;
647
+ update({
648
+ filterSeed,
649
+ filterPeak,
650
+ tTrEndPts,
651
+ tSfPeaks,
652
+ freq,
653
+ comparisons,
654
+ editPeakSt,
655
+ layoutSt,
656
+ integationSt,
657
+ mtplySt,
658
+ sweepExtentSt,
659
+ isUiAddIntgSt,
660
+ isUiNoBrushSt,
661
+ wavelength
662
+ }) {
665
663
  this.root = d3.select(this.rootKlass).selectAll('.focus-main');
666
664
  this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
667
665
  this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, freq, layoutSt, wavelength);
@@ -16,6 +16,7 @@ var _list_ui = require("../../constants/list_ui");
16
16
  var _cyclic_voltammetry = require("../../actions/cyclic_voltammetry");
17
17
  var _multi_focus = _interopRequireDefault(require("./multi_focus"));
18
18
  var _draw = require("../common/draw");
19
+ var _jsxRuntime = require("react/jsx-runtime");
19
20
  /* eslint-disable no-mixed-operators, react/require-default-props,
20
21
  react/no-unused-prop-types */
21
22
 
@@ -191,7 +192,7 @@ class ViewerMulti extends _react.default.Component {
191
192
  }
192
193
  }
193
194
  render() {
194
- return /*#__PURE__*/_react.default.createElement("div", {
195
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
195
196
  className: "d3Line"
196
197
  });
197
198
  }
@@ -19,7 +19,7 @@ var _integration = require("../../helpers/integration");
19
19
  var _multiplicity_calc = require("../../helpers/multiplicity_calc");
20
20
  var _calc = require("../../helpers/calc");
21
21
  /* eslint-disable no-unused-vars, prefer-object-spread, no-mixed-operators,
22
- no-unneeded-ternary, arrow-body-style */
22
+ no-unneeded-ternary, arrow-body-style, max-len */
23
23
 
24
24
  const d3 = require('d3');
25
25
  class MultiFocus {
@@ -51,6 +51,8 @@ class MultiFocus {
51
51
  this.brushX = d3.brushX();
52
52
  this.axis = null;
53
53
  this.path = null;
54
+ this.thresLineUp = null;
55
+ this.thresLineDw = null;
54
56
  this.grid = null;
55
57
  this.tags = null;
56
58
  this.ref = null;
@@ -79,6 +81,7 @@ class MultiFocus {
79
81
  this.update = this.update.bind(this);
80
82
  this.setConfig = this.setConfig.bind(this);
81
83
  this.drawLine = this.drawLine.bind(this);
84
+ this.drawThres = this.drawThres.bind(this);
82
85
  this.drawOtherLines = this.drawOtherLines.bind(this);
83
86
  this.drawGrid = this.drawGrid.bind(this);
84
87
  this.drawPeaks = this.drawPeaks.bind(this);
@@ -155,8 +158,7 @@ class MultiFocus {
155
158
  this.tip = (0, _init.InitTip)();
156
159
  this.root.call(this.tip);
157
160
  }
158
- setDataParams(peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt) {
159
- let jcampIdx = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
161
+ setDataParams(filterSeed, peaks, tTrEndPts, tSfPeaks, layout, cyclicvoltaSt, jcampIdx = 0) {
160
162
  this.data = [];
161
163
  this.otherLineData = [];
162
164
  let filterSubLayoutValue = null;
@@ -167,8 +169,11 @@ class MultiFocus {
167
169
  color
168
170
  } = entry;
169
171
  const offset = (0, _chem.GetCyclicVoltaPreviousShift)(cyclicvoltaSt, jcampIdx);
170
- const currData = (0, _chem.convertTopic)(topic, layout, feature, offset);
172
+ let currData = (0, _chem.convertTopic)(topic, layout, feature, offset);
171
173
  if (idx === jcampIdx) {
174
+ if (!_format.default.isCyclicVoltaLayout(layout)) {
175
+ currData = filterSeed;
176
+ }
172
177
  this.data = [...currData];
173
178
  this.pathColor = color;
174
179
  filterSubLayoutValue = _format.default.isSECLayout(layout) ? feature.xUnit : feature.yUnit;
@@ -258,6 +263,23 @@ class MultiFocus {
258
263
  this.path.attr('marker-mid', 'url(#arrow-left)');
259
264
  }
260
265
  }
266
+ drawThres() {
267
+ if (this.tTrEndPts.length > 0) {
268
+ this.thresLineUp.attr('d', this.pathCall(this.tTrEndPts));
269
+ this.thresLineUp.attr('visibility', 'visible');
270
+ const [left, right] = this.tTrEndPts;
271
+ const dwMirrorEndPts = [Object.assign({}, left, {
272
+ y: -left.y
273
+ }), Object.assign({}, right, {
274
+ y: -right.y
275
+ })];
276
+ this.thresLineDw.attr('d', this.pathCall(dwMirrorEndPts));
277
+ this.thresLineDw.attr('visibility', 'visible');
278
+ } else {
279
+ this.thresLineUp.attr('visibility', 'hidden');
280
+ this.thresLineDw.attr('visibility', 'hidden');
281
+ }
282
+ }
261
283
  drawOtherLines(layout) {
262
284
  d3.selectAll('.line-clip-compare').remove();
263
285
  if (!this.otherLineData) return null;
@@ -788,21 +810,20 @@ class MultiFocus {
788
810
  reverseXAxis(layoutSt) {
789
811
  return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.DSC, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.GC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) < 0;
790
812
  }
791
- create(_ref) {
792
- let {
793
- curveSt,
794
- filterSeed,
795
- filterPeak,
796
- tTrEndPts,
797
- tSfPeaks,
798
- editPeakSt,
799
- layoutSt,
800
- sweepExtentSt,
801
- isUiNoBrushSt,
802
- cyclicvoltaSt,
803
- integationSt,
804
- mtplySt
805
- } = _ref;
813
+ create({
814
+ curveSt,
815
+ filterSeed,
816
+ filterPeak,
817
+ tTrEndPts,
818
+ tSfPeaks,
819
+ editPeakSt,
820
+ layoutSt,
821
+ sweepExtentSt,
822
+ isUiNoBrushSt,
823
+ cyclicvoltaSt,
824
+ integationSt,
825
+ mtplySt
826
+ }) {
806
827
  this.svg = d3.select(this.rootKlass).select('.d3Svg');
807
828
  (0, _mount.MountMainFrame)(this, 'focus');
808
829
  (0, _mount.MountClip)(this);
@@ -815,10 +836,11 @@ class MultiFocus {
815
836
  this.root = d3.select(this.rootKlass).selectAll('.focus-main');
816
837
  this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
817
838
  this.setTip();
818
- this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
839
+ this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
819
840
  (0, _compass.MountCompass)(this);
820
841
  this.axis = (0, _mount.MountAxis)(this);
821
842
  this.path = (0, _mount.MountPath)(this, this.pathColor);
843
+ [this.thresLineUp, this.thresLineDw] = (0, _mount.MountThresLine)(this, 'green');
822
844
  this.grid = (0, _mount.MountGrid)(this);
823
845
  this.tags = (0, _mount.MountTags)(this);
824
846
  this.ref = (0, _mount.MountRef)(this);
@@ -827,6 +849,7 @@ class MultiFocus {
827
849
  if (this.data && this.data.length > 0) {
828
850
  this.setConfig(sweepExtentSt);
829
851
  this.drawLine();
852
+ this.drawThres();
830
853
  this.drawGrid();
831
854
  this.drawOtherLines(layoutSt);
832
855
  this.drawPeaks(editPeakSt);
@@ -838,22 +861,21 @@ class MultiFocus {
838
861
  (0, _brush.default)(this, false, isUiNoBrushSt);
839
862
  this.resetShouldUpdate(editPeakSt);
840
863
  }
841
- update(_ref2) {
842
- let {
843
- entities,
844
- curveSt,
845
- filterSeed,
846
- filterPeak,
847
- tTrEndPts,
848
- tSfPeaks,
849
- editPeakSt,
850
- layoutSt,
851
- sweepExtentSt,
852
- isUiNoBrushSt,
853
- cyclicvoltaSt,
854
- integationSt,
855
- mtplySt
856
- } = _ref2;
864
+ update({
865
+ entities,
866
+ curveSt,
867
+ filterSeed,
868
+ filterPeak,
869
+ tTrEndPts,
870
+ tSfPeaks,
871
+ editPeakSt,
872
+ layoutSt,
873
+ sweepExtentSt,
874
+ isUiNoBrushSt,
875
+ cyclicvoltaSt,
876
+ integationSt,
877
+ mtplySt
878
+ }) {
857
879
  this.root = d3.select(this.rootKlass).selectAll('.focus-main');
858
880
  this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
859
881
  const {
@@ -863,11 +885,12 @@ class MultiFocus {
863
885
  const jcampIdx = curveIdx;
864
886
  this.isShowAllCurves = isShowAllCurve;
865
887
  this.entities = entities;
866
- this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
888
+ this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
867
889
  if (this.data && this.data.length > 0) {
868
890
  this.setConfig(sweepExtentSt);
869
891
  this.getShouldUpdate(editPeakSt);
870
892
  this.drawLine();
893
+ this.drawThres();
871
894
  this.drawGrid();
872
895
  this.drawOtherLines(layoutSt);
873
896
  this.drawPeaks(editPeakSt);
@@ -15,6 +15,7 @@ var _ui = require("../../actions/ui");
15
15
  var _rect_focus = _interopRequireDefault(require("./rect_focus"));
16
16
  var _draw = require("../common/draw");
17
17
  var _list_ui = require("../../constants/list_ui");
18
+ var _jsxRuntime = require("react/jsx-runtime");
18
19
  /* eslint-disable no-mixed-operators */
19
20
 
20
21
  const W = Math.round(window.innerWidth * 0.90 * 9 / 12); // ROI
@@ -110,7 +111,7 @@ class ViewerRect extends _react.default.Component {
110
111
  }
111
112
  }
112
113
  render() {
113
- return /*#__PURE__*/_react.default.createElement("div", {
114
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
114
115
  className: "d3Rect"
115
116
  });
116
117
  }
@@ -169,16 +169,15 @@ class RectFocus {
169
169
  this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt);
170
170
  return this.dataPks;
171
171
  }
172
- create(_ref) {
173
- let {
174
- filterSeed,
175
- filterPeak,
176
- tTrEndPts,
177
- tSfPeaks,
178
- sweepExtentSt,
179
- isUiAddIntgSt,
180
- isUiNoBrushSt
181
- } = _ref;
172
+ create({
173
+ filterSeed,
174
+ filterPeak,
175
+ tTrEndPts,
176
+ tSfPeaks,
177
+ sweepExtentSt,
178
+ isUiAddIntgSt,
179
+ isUiNoBrushSt
180
+ }) {
182
181
  this.svg = d3.select('.d3Svg');
183
182
  (0, _mount.MountMainFrame)(this, 'focus');
184
183
  (0, _mount.MountClip)(this);
@@ -201,16 +200,15 @@ class RectFocus {
201
200
  }
202
201
  (0, _brush.default)(this, isUiAddIntgSt, isUiNoBrushSt);
203
202
  }
204
- update(_ref2) {
205
- let {
206
- filterSeed,
207
- filterPeak,
208
- tTrEndPts,
209
- tSfPeaks,
210
- sweepExtentSt,
211
- isUiAddIntgSt,
212
- isUiNoBrushSt
213
- } = _ref2;
203
+ update({
204
+ filterSeed,
205
+ filterPeak,
206
+ tTrEndPts,
207
+ tSfPeaks,
208
+ sweepExtentSt,
209
+ isUiAddIntgSt,
210
+ isUiNoBrushSt
211
+ }) {
214
212
  this.root = d3.select(this.rootKlass).selectAll('.focus-main');
215
213
  this.setDataParams(filterSeed, filterPeak, tTrEndPts, tSfPeaks);
216
214
  if (this.data && this.data.length > 0) {