@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,80 +1,67 @@
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.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
7
  var _effects = require("redux-saga/effects");
10
8
  var _action_type = require("../constants/action_type");
11
9
  var _shift = require("../helpers/shift");
12
10
  var _list_shift = require("../constants/list_shift");
13
- var _marked = /*#__PURE__*/_regenerator.default.mark(addVirtualFactor);
14
- var getShift = function getShift(state) {
15
- return state.shift;
16
- };
17
- var getEditPeak = function getEditPeak(state) {
18
- return state.editPeak.present;
19
- };
20
- function addVirtualFactor(action) {
21
- var originShift, origEPeak, payload, curveIdx, peaks, currentOriginPeaks, currentOriginShift, shiftNone, origRef, origApex, _currentOriginPeaks, prevOffset, pos, neg, absOffset, relOffset, nextPos, nextNeg;
22
- return _regenerator.default.wrap(function addVirtualFactor$(_context) {
23
- while (1) switch (_context.prev = _context.next) {
24
- case 0:
25
- _context.next = 2;
26
- return (0, _effects.select)(getShift);
27
- case 2:
28
- originShift = _context.sent;
29
- _context.next = 5;
30
- return (0, _effects.select)(getEditPeak);
31
- case 5:
32
- origEPeak = _context.sent;
33
- payload = action.payload;
34
- curveIdx = payload.curveIdx;
35
- peaks = origEPeak.peaks;
36
- currentOriginPeaks = peaks[curveIdx];
37
- if (currentOriginPeaks === false || currentOriginPeaks === undefined) {
38
- currentOriginPeaks = {
39
- prevOffset: 0,
40
- pos: [],
41
- neg: []
42
- };
43
- }
44
- currentOriginShift = originShift[curveIdx];
45
- if (currentOriginShift === false || currentOriginShift === undefined) {
46
- shiftNone = _list_shift.LIST_SHIFT_1H[0];
47
- currentOriginShift = {
48
- ref: shiftNone,
49
- peak: false,
50
- enable: true
51
- };
52
- }
53
- origRef = currentOriginShift.ref;
54
- origApex = currentOriginShift.peak;
55
- _currentOriginPeaks = currentOriginPeaks, prevOffset = _currentOriginPeaks.prevOffset, pos = _currentOriginPeaks.pos, neg = _currentOriginPeaks.neg;
56
- absOffset = (0, _shift.FromManualToOffset)(origRef, origApex);
57
- relOffset = prevOffset - absOffset;
58
- nextPos = (0, _shift.VirtalPts)(pos, relOffset);
59
- nextNeg = (0, _shift.VirtalPts)(neg, relOffset);
60
- _context.next = 22;
61
- return (0, _effects.put)({
62
- type: _action_type.EDITPEAK.SHIFT,
63
- payload: Object.assign({}, payload, {
64
- // eslint-disable-line
65
- prevOffset: absOffset,
66
- pos: nextPos,
67
- neg: nextNeg
68
- })
69
- });
70
- case 22:
71
- case "end":
72
- return _context.stop();
73
- }
74
- }, _marked);
11
+ const getShift = state => state.shift;
12
+ const getEditPeak = state => state.editPeak.present;
13
+ function* addVirtualFactor(action) {
14
+ const originShift = yield (0, _effects.select)(getShift);
15
+ const origEPeak = yield (0, _effects.select)(getEditPeak);
16
+ const {
17
+ payload
18
+ } = action;
19
+ const {
20
+ curveIdx
21
+ } = payload;
22
+ const {
23
+ peaks
24
+ } = origEPeak;
25
+ let currentOriginPeaks = peaks[curveIdx];
26
+ if (currentOriginPeaks === false || currentOriginPeaks === undefined) {
27
+ currentOriginPeaks = {
28
+ prevOffset: 0,
29
+ pos: [],
30
+ neg: []
31
+ };
32
+ }
33
+ let currentOriginShift = originShift.shifts[curveIdx];
34
+ if (currentOriginShift === false || currentOriginShift === undefined) {
35
+ const shiftNone = _list_shift.LIST_SHIFT_1H[0];
36
+ currentOriginShift = {
37
+ ref: shiftNone,
38
+ peak: false,
39
+ enable: true
40
+ };
41
+ }
42
+ const origRef = currentOriginShift.ref;
43
+ const origApex = currentOriginShift.peak;
44
+ const {
45
+ prevOffset,
46
+ pos,
47
+ neg
48
+ } = currentOriginPeaks;
49
+ const absOffset = (0, _shift.FromManualToOffset)(origRef, origApex);
50
+ const relOffset = prevOffset - absOffset;
51
+ const nextPos = (0, _shift.VirtalPts)(pos, relOffset);
52
+ const nextNeg = (0, _shift.VirtalPts)(neg, relOffset);
53
+ yield (0, _effects.put)({
54
+ type: _action_type.EDITPEAK.SHIFT,
55
+ payload: Object.assign({}, payload, {
56
+ // eslint-disable-line
57
+ prevOffset: absOffset,
58
+ pos: nextPos,
59
+ neg: nextNeg
60
+ })
61
+ });
75
62
  }
76
- var editPeakSagas = [(0, _effects.takeEvery)(_action_type.SHIFT.SET_REF, addVirtualFactor), (0, _effects.takeEvery)(_action_type.SHIFT.SET_PEAK, addVirtualFactor)];
77
- var _default = editPeakSagas;
63
+ const editPeakSagas = [(0, _effects.takeEvery)(_action_type.SHIFT.SET_REF, addVirtualFactor), (0, _effects.takeEvery)(_action_type.SHIFT.SET_PEAK, addVirtualFactor)];
64
+ var _default = exports.default = editPeakSagas;
78
65
  /* LOGIC
79
66
  -no po - tg
80
67
  | picked | another | absoffset | prevOffset | relative | newOffset
@@ -85,5 +72,4 @@ var _default = editPeakSagas;
85
72
  3 | 20 0 +20 -100 -120
86
73
  -------------------------------------------------------------------
87
74
 
88
- */
89
- exports.default = _default;
75
+ */
@@ -1,141 +1,97 @@
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.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
7
  var _effects = require("redux-saga/effects");
10
8
  var _action_type = require("../constants/action_type");
11
- var _marked = /*#__PURE__*/_regenerator.default.mark(resetShift),
12
- _marked2 = /*#__PURE__*/_regenerator.default.mark(resetInitNmr),
13
- _marked3 = /*#__PURE__*/_regenerator.default.mark(resetInitCommonWithIntergation);
14
- var getLayout = function getLayout(state) {
15
- return state.layout;
16
- };
17
- var getCurveSt = function getCurveSt(state) {
18
- return state.curve;
19
- };
20
- var getIntegrationSt = function getIntegrationSt(state) {
21
- return state.integration.present;
22
- };
23
- // const getShiftSt = (state) => state.shift;
24
-
25
- function resetShift(action) {
26
- var layout, payload;
27
- return _regenerator.default.wrap(function resetShift$(_context) {
28
- while (1) switch (_context.prev = _context.next) {
29
- case 0:
30
- _context.next = 2;
31
- return (0, _effects.select)(getLayout);
32
- case 2:
33
- layout = _context.sent;
34
- // const shiftSt = yield select(getShiftSt);
35
- payload = action.payload; // const { shift } = payload;
36
- // console.log(payload);
37
- // console.log(shiftSt);
38
- // const { curveIdx } = curveSt;
39
- // const { shifts } = shiftSt;
40
- // shifts[curveIdx] = shift;
41
- // const newPayload = Object.assign({}, shiftSt, { shifts, selectedIdx: curveIdx })
42
- _context.next = 6;
43
- return (0, _effects.put)({
44
- type: _action_type.MANAGER.RESETSHIFT,
45
- payload: Object.assign(
46
- // eslint-disable-line
47
- {}, payload, {
48
- layout: layout
49
- })
50
- });
51
- case 6:
52
- case "end":
53
- return _context.stop();
54
- }
55
- }, _marked);
9
+ const getLayout = state => state.layout;
10
+ const getCurveSt = state => state.curve;
11
+ const getIntegrationSt = state => state.integration.present;
12
+ function* resetShift(action) {
13
+ const curveSt = yield (0, _effects.select)(getCurveSt);
14
+ const layout = yield (0, _effects.select)(getLayout);
15
+ const {
16
+ payload
17
+ } = action;
18
+ const {
19
+ curveIdx,
20
+ listCurves
21
+ } = curveSt;
22
+ const numberOfCurve = listCurves.length;
23
+ yield (0, _effects.put)({
24
+ type: _action_type.MANAGER.RESETSHIFT,
25
+ payload: Object.assign(
26
+ // eslint-disable-line
27
+ {}, payload, {
28
+ layout,
29
+ curvesInfo: {
30
+ isMultiCurve: numberOfCurve > 0,
31
+ curveIdx,
32
+ numberOfCurve
33
+ }
34
+ })
35
+ });
56
36
  }
57
- function resetInitNmr(action) {
58
- var curveSt, integationSt, curveIdx, _action$payload, integration, simulation, integrations, payload;
59
- return _regenerator.default.wrap(function resetInitNmr$(_context2) {
60
- while (1) switch (_context2.prev = _context2.next) {
61
- case 0:
62
- _context2.next = 2;
63
- return (0, _effects.select)(getCurveSt);
64
- case 2:
65
- curveSt = _context2.sent;
66
- _context2.next = 5;
67
- return (0, _effects.select)(getIntegrationSt);
68
- case 5:
69
- integationSt = _context2.sent;
70
- curveIdx = curveSt.curveIdx;
71
- _action$payload = action.payload, integration = _action$payload.integration, simulation = _action$payload.simulation;
72
- integrations = integationSt.integrations;
73
- integrations[curveIdx] = integration;
74
- payload = Object.assign({}, integationSt, {
75
- integrations: integrations,
76
- selectedIdx: curveIdx
77
- }); // eslint-disable-line
78
- if (!integration) {
79
- _context2.next = 14;
80
- break;
81
- }
82
- _context2.next = 14;
83
- return (0, _effects.put)({
84
- type: _action_type.INTEGRATION.RESET_ALL_RDC,
85
- payload: payload
86
- });
87
- case 14:
88
- if (!simulation) {
89
- _context2.next = 17;
90
- break;
91
- }
92
- _context2.next = 17;
93
- return (0, _effects.put)({
94
- type: _action_type.SIMULATION.RESET_ALL_RDC,
95
- payload: simulation
96
- });
97
- case 17:
98
- case "end":
99
- return _context2.stop();
100
- }
101
- }, _marked2);
37
+ function* resetInitNmr(action) {
38
+ const curveSt = yield (0, _effects.select)(getCurveSt);
39
+ const integationSt = yield (0, _effects.select)(getIntegrationSt);
40
+ const {
41
+ curveIdx
42
+ } = curveSt;
43
+ const {
44
+ integration,
45
+ simulation
46
+ } = action.payload;
47
+ const {
48
+ integrations
49
+ } = integationSt;
50
+ const newArrIntegration = [...integrations];
51
+ newArrIntegration[curveIdx] = integration;
52
+ const payload = Object.assign({}, integationSt, {
53
+ integrations: newArrIntegration,
54
+ selectedIdx: curveIdx
55
+ }); // eslint-disable-line
56
+
57
+ if (integration) {
58
+ yield (0, _effects.put)({
59
+ type: _action_type.INTEGRATION.RESET_ALL_RDC,
60
+ payload
61
+ });
62
+ }
63
+ if (simulation) {
64
+ yield (0, _effects.put)({
65
+ type: _action_type.SIMULATION.RESET_ALL_RDC,
66
+ payload: simulation
67
+ });
68
+ }
102
69
  }
103
- function resetInitCommonWithIntergation(action) {
104
- var curveSt, integationSt, curveIdx, integration, integrations, payload;
105
- return _regenerator.default.wrap(function resetInitCommonWithIntergation$(_context3) {
106
- while (1) switch (_context3.prev = _context3.next) {
107
- case 0:
108
- _context3.next = 2;
109
- return (0, _effects.select)(getCurveSt);
110
- case 2:
111
- curveSt = _context3.sent;
112
- _context3.next = 5;
113
- return (0, _effects.select)(getIntegrationSt);
114
- case 5:
115
- integationSt = _context3.sent;
116
- curveIdx = curveSt.curveIdx;
117
- integration = action.payload.integration;
118
- integrations = integationSt.integrations;
119
- integrations[curveIdx] = integration;
120
- payload = Object.assign({}, integationSt, {
121
- integrations: integrations,
122
- selectedIdx: curveIdx
123
- }); // eslint-disable-line
124
- if (!integration) {
125
- _context3.next = 14;
126
- break;
127
- }
128
- _context3.next = 14;
129
- return (0, _effects.put)({
130
- type: _action_type.INTEGRATION.RESET_ALL_RDC,
131
- payload: payload
132
- });
133
- case 14:
134
- case "end":
135
- return _context3.stop();
136
- }
137
- }, _marked3);
70
+ function* resetInitCommonWithIntergation(action) {
71
+ const curveSt = yield (0, _effects.select)(getCurveSt);
72
+ const integationSt = yield (0, _effects.select)(getIntegrationSt);
73
+ const {
74
+ curveIdx
75
+ } = curveSt;
76
+ const {
77
+ integration
78
+ } = action.payload;
79
+ const {
80
+ integrations
81
+ } = integationSt;
82
+ const newArrIntegration = [...integrations];
83
+ newArrIntegration[curveIdx] = integration;
84
+ const payload = Object.assign({}, integationSt, {
85
+ integrations: newArrIntegration,
86
+ selectedIdx: curveIdx
87
+ }); // eslint-disable-line
88
+
89
+ if (integration) {
90
+ yield (0, _effects.put)({
91
+ type: _action_type.INTEGRATION.RESET_ALL_RDC,
92
+ payload
93
+ });
94
+ }
138
95
  }
139
- var managerSagas = [(0, _effects.takeEvery)(_action_type.MANAGER.RESETALL, resetShift), (0, _effects.takeEvery)(_action_type.MANAGER.RESET_INIT_NMR, resetInitNmr), (0, _effects.takeEvery)(_action_type.MANAGER.RESET_INIT_COMMON_WITH_INTERGATION, resetInitCommonWithIntergation)];
140
- var _default = managerSagas;
141
- exports.default = _default;
96
+ const managerSagas = [(0, _effects.takeEvery)(_action_type.MANAGER.RESETALL, resetShift), (0, _effects.takeEvery)(_action_type.MANAGER.RESET_INIT_NMR, resetInitNmr), (0, _effects.takeEvery)(_action_type.MANAGER.RESET_INIT_COMMON_WITH_INTERGATION, resetInitCommonWithIntergation)];
97
+ var _default = exports.default = managerSagas;
@@ -1,42 +1,36 @@
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.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
7
  var _effects = require("redux-saga/effects");
10
8
  var _action_type = require("../constants/action_type");
11
9
  var _peakInterval = require("../third_party/peakInterval");
12
- var _marked = /*#__PURE__*/_regenerator.default.mark(updateMetaPeaks);
13
- function updateMetaPeaks(action) {
14
- var payload, _getPeakIntervals, intervalL, intervalR, _payload$spectra$, observeFrequency, data, deltaX;
15
- return _regenerator.default.wrap(function updateMetaPeaks$(_context) {
16
- while (1) switch (_context.prev = _context.next) {
17
- case 0:
18
- payload = action.payload;
19
- _getPeakIntervals = (0, _peakInterval.getPeakIntervals)(payload), intervalL = _getPeakIntervals.intervalL, intervalR = _getPeakIntervals.intervalR;
20
- _payload$spectra$ = payload.spectra[0], observeFrequency = _payload$spectra$.observeFrequency, data = _payload$spectra$.data;
21
- deltaX = Math.abs(data[0].x[0] - data[0].x[1]);
22
- _context.next = 6;
23
- return (0, _effects.put)({
24
- type: _action_type.META.UPDATE_PEAKS_RDC,
25
- payload: {
26
- peaks: {
27
- intervalL: intervalL,
28
- intervalR: intervalR,
29
- observeFrequency: observeFrequency,
30
- deltaX: deltaX
31
- }
32
- }
33
- });
34
- case 6:
35
- case "end":
36
- return _context.stop();
10
+ function* updateMetaPeaks(action) {
11
+ const {
12
+ payload
13
+ } = action;
14
+ const {
15
+ intervalL,
16
+ intervalR
17
+ } = (0, _peakInterval.getPeakIntervals)(payload);
18
+ const {
19
+ observeFrequency,
20
+ data
21
+ } = payload.spectra[0];
22
+ const deltaX = Math.abs(data[0].x[0] - data[0].x[1]);
23
+ yield (0, _effects.put)({
24
+ type: _action_type.META.UPDATE_PEAKS_RDC,
25
+ payload: {
26
+ peaks: {
27
+ intervalL,
28
+ intervalR,
29
+ observeFrequency,
30
+ deltaX
31
+ }
37
32
  }
38
- }, _marked);
33
+ });
39
34
  }
40
- var metaSagas = [(0, _effects.takeEvery)(_action_type.META.UPDATE_PEAKS, updateMetaPeaks)];
41
- var _default = metaSagas;
42
- exports.default = _default;
35
+ const metaSagas = [(0, _effects.takeEvery)(_action_type.META.UPDATE_PEAKS, updateMetaPeaks)];
36
+ var _default = exports.default = metaSagas;
@@ -1,85 +1,48 @@
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.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
7
  var _effects = require("redux-saga/effects");
10
8
  var _action_type = require("../constants/action_type");
11
9
  var _list_layout = require("../constants/list_layout");
12
- var _marked = /*#__PURE__*/_regenerator.default.mark(setCyclicVoltametry);
13
10
  /* eslint-disable no-plusplus */
14
- var getCurveSt = function getCurveSt(state) {
15
- return state.curve;
16
- };
17
- var getLayoutSt = function getLayoutSt(state) {
18
- return state.layout;
19
- };
11
+
12
+ const getCurveSt = state => state.curve;
13
+ const getLayoutSt = state => state.layout;
20
14
  function getMaxMinPeak(curve) {
21
15
  return curve.maxminPeak;
22
16
  }
23
- function setCyclicVoltametry(action) {
24
- var layoutSt, curveSt, listCurves, numberOfCurves, index, curve, maxminPeak, pidx, maxPeak, minPeak, pecker;
25
- return _regenerator.default.wrap(function setCyclicVoltametry$(_context) {
26
- while (1) switch (_context.prev = _context.next) {
27
- case 0:
28
- _context.next = 2;
29
- return (0, _effects.select)(getLayoutSt);
30
- case 2:
31
- layoutSt = _context.sent;
32
- if (!(layoutSt !== _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY)) {
33
- _context.next = 5;
34
- break;
35
- }
36
- return _context.abrupt("return");
37
- case 5:
38
- _context.next = 7;
39
- return (0, _effects.select)(getCurveSt);
40
- case 7:
41
- curveSt = _context.sent;
42
- listCurves = curveSt.listCurves;
43
- if (!listCurves) {
44
- _context.next = 38;
45
- break;
46
- }
47
- _context.next = 12;
48
- return (0, _effects.put)({
49
- type: _action_type.CYCLIC_VOLTA_METRY.RESETALL,
50
- payload: null
51
- });
52
- case 12:
53
- numberOfCurves = listCurves.length;
54
- if (!(numberOfCurves <= 0)) {
55
- _context.next = 15;
56
- break;
57
- }
58
- return _context.abrupt("return");
59
- case 15:
60
- index = 0;
61
- case 16:
62
- if (!(index < listCurves.length)) {
63
- _context.next = 38;
64
- break;
65
- }
66
- curve = listCurves[index];
67
- maxminPeak = getMaxMinPeak(curve);
68
- _context.next = 21;
69
- return (0, _effects.put)({
70
- type: _action_type.CYCLIC_VOLTA_METRY.ADD_PAIR_PEAKS,
71
- payload: index
72
- });
73
- case 21:
74
- pidx = 0;
75
- case 22:
76
- if (!(pidx < maxminPeak.max.length)) {
77
- _context.next = 35;
78
- break;
79
- }
80
- maxPeak = maxminPeak.max[pidx];
81
- _context.next = 26;
82
- return (0, _effects.put)({
17
+ function* setCyclicVoltametry(action) {
18
+ // eslint-disable-line
19
+ const layoutSt = yield (0, _effects.select)(getLayoutSt);
20
+ if (layoutSt !== _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY) {
21
+ return;
22
+ }
23
+ const curveSt = yield (0, _effects.select)(getCurveSt);
24
+ const {
25
+ listCurves
26
+ } = curveSt;
27
+ if (listCurves) {
28
+ yield (0, _effects.put)({
29
+ type: _action_type.CYCLIC_VOLTA_METRY.RESETALL,
30
+ payload: null
31
+ });
32
+ const numberOfCurves = listCurves.length;
33
+ if (numberOfCurves <= 0) {
34
+ return;
35
+ }
36
+ for (let index = 0; index < listCurves.length; index++) {
37
+ const curve = listCurves[index];
38
+ const maxminPeak = getMaxMinPeak(curve);
39
+ yield (0, _effects.put)({
40
+ type: _action_type.CYCLIC_VOLTA_METRY.ADD_PAIR_PEAKS,
41
+ payload: index
42
+ });
43
+ for (let pidx = 0; pidx < maxminPeak.max.length; pidx++) {
44
+ const maxPeak = maxminPeak.max[pidx];
45
+ yield (0, _effects.put)({
83
46
  type: _action_type.CYCLIC_VOLTA_METRY.ADD_MAX_PEAK,
84
47
  payload: {
85
48
  peak: maxPeak,
@@ -87,10 +50,8 @@ function setCyclicVoltametry(action) {
87
50
  jcampIdx: index
88
51
  }
89
52
  });
90
- case 26:
91
- minPeak = maxminPeak.min[pidx];
92
- _context.next = 29;
93
- return (0, _effects.put)({
53
+ const minPeak = maxminPeak.min[pidx];
54
+ yield (0, _effects.put)({
94
55
  type: _action_type.CYCLIC_VOLTA_METRY.ADD_MIN_PEAK,
95
56
  payload: {
96
57
  peak: minPeak,
@@ -98,10 +59,8 @@ function setCyclicVoltametry(action) {
98
59
  jcampIdx: index
99
60
  }
100
61
  });
101
- case 29:
102
- pecker = maxminPeak.pecker[pidx];
103
- _context.next = 32;
104
- return (0, _effects.put)({
62
+ const pecker = maxminPeak.pecker[pidx];
63
+ yield (0, _effects.put)({
105
64
  type: _action_type.CYCLIC_VOLTA_METRY.ADD_PECKER,
106
65
  payload: {
107
66
  peak: pecker,
@@ -109,31 +68,9 @@ function setCyclicVoltametry(action) {
109
68
  jcampIdx: index
110
69
  }
111
70
  });
112
- case 32:
113
- pidx++;
114
- _context.next = 22;
115
- break;
116
- case 35:
117
- index++;
118
- _context.next = 16;
119
- break;
120
- case 38:
121
- case "end":
122
- return _context.stop();
71
+ }
123
72
  }
124
- }, _marked);
73
+ }
125
74
  }
126
-
127
- // function* setInitData(action) {
128
- // const layoutSt = yield select(getLayoutSt);
129
- // console.log(layoutSt);
130
- // const curveSt = yield select(getCurveSt);
131
- // const { listCurves } = curveSt;
132
- // console.log(listCurves);
133
- // }
134
-
135
- var multiEntitiesSagas = [(0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setCyclicVoltametry)
136
- // takeEvery(CURVE.SET_ALL_CURVES, setInitData),
137
- ];
138
- var _default = multiEntitiesSagas;
139
- exports.default = _default;
75
+ const multiEntitiesSagas = [(0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setCyclicVoltametry)];
76
+ var _default = exports.default = multiEntitiesSagas;