@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,499 +1,320 @@
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_ui = require("../constants/list_ui");
12
10
  var _list_layout = require("../constants/list_layout");
13
- var _marked = /*#__PURE__*/_regenerator.default.mark(selectUiSweep),
14
- _marked2 = /*#__PURE__*/_regenerator.default.mark(scrollUiWheel),
15
- _marked3 = /*#__PURE__*/_regenerator.default.mark(clickUiTarget);
16
- var getUiSt = function getUiSt(state) {
17
- return state.ui;
18
- };
19
- var getCurveSt = function getCurveSt(state) {
20
- return state.curve;
21
- };
22
- var calcPeaks = function calcPeaks(payload) {
23
- var xExtent = payload.xExtent,
24
- yExtent = payload.yExtent,
25
- dataPks = payload.dataPks;
11
+ const getUiSt = state => state.ui;
12
+ const getCurveSt = state => state.curve;
13
+ const calcPeaks = payload => {
14
+ const {
15
+ xExtent,
16
+ yExtent,
17
+ dataPks
18
+ } = payload;
26
19
  if (!dataPks) return [];
27
- var xL = xExtent.xL,
28
- xU = xExtent.xU;
29
- var yL = yExtent.yL,
30
- yU = yExtent.yU;
31
- var peaks = dataPks.filter(function (p) {
32
- return xL <= p.x && p.x <= xU && yL <= p.y && p.y <= yU;
33
- });
20
+ const {
21
+ xL,
22
+ xU
23
+ } = xExtent;
24
+ const {
25
+ yL,
26
+ yU
27
+ } = yExtent;
28
+ const peaks = dataPks.filter(p => xL <= p.x && p.x <= xU && yL <= p.y && p.y <= yU);
34
29
  return peaks;
35
30
  };
36
- function selectUiSweep(action) {
37
- var uiSt, payload, curveSt, curveIdx, peaks, newPayload;
38
- return _regenerator.default.wrap(function selectUiSweep$(_context) {
39
- while (1) switch (_context.prev = _context.next) {
40
- case 0:
41
- _context.next = 2;
42
- return (0, _effects.select)(getUiSt);
43
- case 2:
44
- uiSt = _context.sent;
45
- payload = action.payload;
46
- _context.next = 6;
47
- return (0, _effects.select)(getCurveSt);
48
- case 6:
49
- curveSt = _context.sent;
50
- curveIdx = curveSt.curveIdx;
51
- _context.t0 = uiSt.sweepType;
52
- _context.next = _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.ZOOMIN ? 11 : _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.ZOOMRESET ? 14 : _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD ? 17 : _context.t0 === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_SWEEP_ADD ? 20 : 29;
53
- break;
54
- case 11:
55
- _context.next = 13;
56
- return (0, _effects.put)({
57
- type: _action_type.UI.SWEEP.SELECT_ZOOMIN,
58
- payload: payload
59
- });
60
- case 13:
61
- return _context.abrupt("break", 30);
62
- case 14:
63
- _context.next = 16;
64
- return (0, _effects.put)({
65
- type: _action_type.UI.SWEEP.SELECT_ZOOMRESET,
66
- payload: payload
67
- });
68
- case 16:
69
- return _context.abrupt("break", 30);
70
- case 17:
71
- _context.next = 19;
72
- return (0, _effects.put)({
73
- type: _action_type.UI.SWEEP.SELECT_INTEGRATION,
74
- payload: {
75
- newData: payload,
76
- curveIdx: curveIdx
77
- }
78
- });
79
- case 19:
80
- return _context.abrupt("break", 30);
81
- case 20:
82
- peaks = calcPeaks(payload); // eslint-disable-line
83
- if (!(peaks.length === 0)) {
84
- _context.next = 23;
85
- break;
31
+ function* selectUiSweep(action) {
32
+ const uiSt = yield (0, _effects.select)(getUiSt);
33
+ const {
34
+ payload
35
+ } = action;
36
+ const curveSt = yield (0, _effects.select)(getCurveSt);
37
+ const {
38
+ curveIdx
39
+ } = curveSt;
40
+ switch (uiSt.sweepType) {
41
+ case _list_ui.LIST_UI_SWEEP_TYPE.ZOOMIN:
42
+ yield (0, _effects.put)({
43
+ type: _action_type.UI.SWEEP.SELECT_ZOOMIN,
44
+ payload
45
+ });
46
+ break;
47
+ case _list_ui.LIST_UI_SWEEP_TYPE.ZOOMRESET:
48
+ yield (0, _effects.put)({
49
+ type: _action_type.UI.SWEEP.SELECT_ZOOMRESET,
50
+ payload
51
+ });
52
+ break;
53
+ case _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD:
54
+ yield (0, _effects.put)({
55
+ type: _action_type.UI.SWEEP.SELECT_INTEGRATION,
56
+ payload: {
57
+ newData: payload,
58
+ curveIdx
86
59
  }
87
- return _context.abrupt("break", 30);
88
- case 23:
89
- newPayload = Object.assign({}, payload, {
90
- peaks: peaks
91
- }); // eslint-disable-line
92
- _context.next = 26;
93
- return (0, _effects.put)({
94
- type: _action_type.UI.SWEEP.SELECT_INTEGRATION,
95
- payload: {
96
- newData: newPayload,
97
- curveIdx: curveIdx
98
- }
99
- });
100
- case 26:
101
- _context.next = 28;
102
- return (0, _effects.put)({
103
- type: _action_type.UI.SWEEP.SELECT_MULTIPLICITY,
104
- payload: {
105
- newData: newPayload,
106
- curveIdx: curveIdx
107
- }
108
- });
109
- case 28:
110
- return _context.abrupt("break", 30);
111
- case 29:
112
- return _context.abrupt("break", 30);
113
- case 30:
114
- return _context.abrupt("return", null);
115
- case 31:
116
- case "end":
117
- return _context.stop();
118
- }
119
- }, _marked);
120
- }
121
- var getLayoutSt = function getLayoutSt(state) {
122
- return state.layout;
123
- };
124
- function scrollUiWheel(action) {
125
- var layoutSt, payload, xExtent, yExtent, direction, yL, yU, yeL, yeU, scale, nextExtent, nyeL, nyeU, h, nytL, nytU;
126
- return _regenerator.default.wrap(function scrollUiWheel$(_context2) {
127
- while (1) switch (_context2.prev = _context2.next) {
128
- case 0:
129
- _context2.next = 2;
130
- return (0, _effects.select)(getLayoutSt);
131
- case 2:
132
- layoutSt = _context2.sent;
133
- payload = action.payload;
134
- xExtent = payload.xExtent, yExtent = payload.yExtent, direction = payload.direction;
135
- yL = yExtent.yL, yU = yExtent.yU;
136
- yeL = yL + (yU - yL) * 0.1, yeU = yU - (yU - yL) * 0.1;
137
- scale = direction ? 0.8 : 1.25;
138
- nextExtent = {
139
- xExtent: false,
140
- yExtent: false
141
- };
142
- nyeL = 0, nyeU = 1, h = 1, nytL = 0, nytU = 1;
143
- _context2.t0 = layoutSt;
144
- _context2.next = _context2.t0 === _list_layout.LIST_LAYOUT.IR ? 13 : _context2.t0 === _list_layout.LIST_LAYOUT.RAMAN ? 13 : _context2.t0 === _list_layout.LIST_LAYOUT.MS ? 20 : _context2.t0 === _list_layout.LIST_LAYOUT.UVVIS ? 27 : _context2.t0 === _list_layout.LIST_LAYOUT.HPLC_UVVIS ? 27 : _context2.t0 === _list_layout.LIST_LAYOUT.TGA ? 27 : _context2.t0 === _list_layout.LIST_LAYOUT.XRD ? 27 : 27;
60
+ });
61
+ break;
62
+ case _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_SWEEP_ADD:
63
+ const peaks = calcPeaks(payload); // eslint-disable-line
64
+ if (peaks.length === 0) {
145
65
  break;
146
- case 13:
147
- nyeL = yeL + (yeU - yeL) * (1 - scale);
148
- nyeU = yeU;
149
- h = nyeU - nyeL;
150
- nytL = nyeL - 0.125 * h;
151
- nytU = nyeU + 0.125 * h;
152
- nextExtent = {
153
- xExtent: xExtent,
154
- yExtent: {
155
- yL: nytL,
156
- yU: nytU
157
- }
158
- };
159
- return _context2.abrupt("break", 34);
160
- case 20:
161
- nyeL = 0;
162
- nyeU = yeL + (yeU - yeL) * scale;
163
- h = nyeU - nyeL;
164
- nytL = nyeL - 0.125 * h;
165
- nytU = nyeU + 0.125 * h;
166
- nextExtent = {
167
- xExtent: xExtent,
168
- yExtent: {
169
- yL: nytL,
170
- yU: nytU
171
- }
172
- };
173
- return _context2.abrupt("break", 34);
174
- case 27:
175
- nyeL = yeL;
176
- nyeU = yeL + (yeU - yeL) * scale;
177
- h = nyeU - nyeL;
178
- nytL = nyeL - 0.125 * h;
179
- nytU = nyeU + 0.125 * h;
180
- nextExtent = {
181
- xExtent: xExtent,
182
- yExtent: {
183
- yL: nytL,
184
- yU: nytU
185
- }
186
- };
187
- return _context2.abrupt("break", 34);
188
- case 34:
189
- _context2.next = 36;
190
- return (0, _effects.put)({
191
- type: _action_type.UI.SWEEP.SELECT_ZOOMIN,
192
- payload: nextExtent
193
- });
194
- case 36:
195
- case "end":
196
- return _context2.stop();
197
- }
198
- }, _marked2);
199
- }
200
- var getUiSweepType = function getUiSweepType(state) {
201
- return state.ui.sweepType;
202
- };
203
- function clickUiTarget(action) {
204
- var payload, onPeak, voltammetryPeakIdx, onPecker, uiSweepType, curveSt, curveIdx, xExtent, xL, xU;
205
- return _regenerator.default.wrap(function clickUiTarget$(_context3) {
206
- while (1) switch (_context3.prev = _context3.next) {
207
- case 0:
208
- payload = action.payload, onPeak = action.onPeak, voltammetryPeakIdx = action.voltammetryPeakIdx, onPecker = action.onPecker;
209
- _context3.next = 3;
210
- return (0, _effects.select)(getUiSweepType);
211
- case 3:
212
- uiSweepType = _context3.sent;
213
- _context3.next = 6;
214
- return (0, _effects.select)(getCurveSt);
215
- case 6:
216
- curveSt = _context3.sent;
217
- curveIdx = curveSt.curveIdx;
218
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_ADD && !onPeak)) {
219
- _context3.next = 13;
220
- break;
221
- }
222
- _context3.next = 11;
223
- return (0, _effects.put)({
224
- type: _action_type.EDITPEAK.ADD_POSITIVE,
225
- payload: {
226
- dataToAdd: payload,
227
- curveIdx: curveIdx
228
- }
229
- });
230
- case 11:
231
- _context3.next = 93;
232
- break;
233
- case 13:
234
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_DELETE && onPeak)) {
235
- _context3.next = 18;
236
- break;
237
- }
238
- _context3.next = 16;
239
- return (0, _effects.put)({
240
- type: _action_type.EDITPEAK.ADD_NEGATIVE,
241
- payload: {
242
- dataToAdd: payload,
243
- curveIdx: curveIdx
244
- }
245
- });
246
- case 16:
247
- _context3.next = 93;
248
- break;
249
- case 18:
250
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT && onPeak)) {
251
- _context3.next = 23;
252
- break;
253
- }
254
- _context3.next = 21;
255
- return (0, _effects.put)({
256
- type: _action_type.SHIFT.SET_PEAK,
257
- payload: {
258
- dataToSet: payload,
259
- curveIdx: curveIdx
260
- }
261
- });
262
- case 21:
263
- _context3.next = 93;
264
- break;
265
- case 23:
266
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_RM && onPeak)) {
267
- _context3.next = 28;
268
- break;
269
- }
270
- _context3.next = 26;
271
- return (0, _effects.put)({
272
- type: _action_type.INTEGRATION.RM_ONE,
273
- payload: {
274
- dataToRemove: payload,
275
- curveIdx: curveIdx
276
- }
277
- });
278
- case 26:
279
- _context3.next = 93;
280
- break;
281
- case 28:
282
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_RM && onPeak)) {
283
- _context3.next = 33;
284
- break;
285
- }
286
- _context3.next = 31;
287
- return (0, _effects.put)({
288
- type: _action_type.INTEGRATION.RM_ONE,
289
- payload: {
290
- dataToRemove: payload,
291
- curveIdx: curveIdx
292
- }
293
- });
294
- case 31:
295
- _context3.next = 93;
296
- break;
297
- case 33:
298
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF && onPeak)) {
299
- _context3.next = 38;
300
- break;
301
- }
302
- _context3.next = 36;
303
- return (0, _effects.put)({
304
- type: _action_type.INTEGRATION.SET_REF,
305
- payload: {
306
- refData: payload,
307
- curveIdx: curveIdx
308
- }
309
- });
310
- case 36:
311
- _context3.next = 93;
312
- break;
313
- case 38:
314
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_CLICK && onPeak)) {
315
- _context3.next = 50;
316
- break;
317
- }
318
- xExtent = payload.xExtent, xL = payload.xL, xU = payload.xU;
319
- if (!xExtent) {
320
- _context3.next = 45;
321
- break;
322
- }
323
- _context3.next = 43;
324
- return (0, _effects.put)({
325
- type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
326
- payload: {
327
- payloadData: xExtent,
328
- curveIdx: curveIdx
329
- }
330
- });
331
- case 43:
332
- _context3.next = 48;
333
- break;
334
- case 45:
335
- if (!(xL && xU)) {
336
- _context3.next = 48;
337
- break;
338
- }
339
- _context3.next = 48;
340
- return (0, _effects.put)({
341
- type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
342
- payload: {
343
- payloadData: {
344
- xL: xL,
345
- xU: xU
346
- },
347
- curveIdx: curveIdx
348
- }
349
- });
350
- case 48:
351
- _context3.next = 93;
352
- break;
353
- case 50:
354
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_ADD)) {
355
- _context3.next = 55;
356
- break;
357
- }
358
- _context3.next = 53;
359
- return (0, _effects.put)({
360
- type: _action_type.MULTIPLICITY.PEAK_ADD_BY_UI_SAG,
361
- payload: payload
362
- });
363
- case 53:
364
- _context3.next = 93;
365
- break;
366
- case 55:
367
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_RM && onPeak)) {
368
- _context3.next = 60;
369
- break;
370
- }
371
- _context3.next = 58;
372
- return (0, _effects.put)({
373
- type: _action_type.MULTIPLICITY.PEAK_RM_BY_UI,
374
- payload: payload
375
- });
376
- case 58:
377
- _context3.next = 93;
378
- break;
379
- case 60:
380
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MAX_PEAK && !onPeak)) {
381
- _context3.next = 65;
382
- break;
66
+ }
67
+ const newPayload = Object.assign({}, payload, {
68
+ peaks
69
+ }); // eslint-disable-line
70
+
71
+ yield (0, _effects.put)({
72
+ type: _action_type.UI.SWEEP.SELECT_INTEGRATION,
73
+ payload: {
74
+ newData: newPayload,
75
+ curveIdx
383
76
  }
384
- _context3.next = 63;
385
- return (0, _effects.put)({
386
- type: _action_type.CYCLIC_VOLTA_METRY.ADD_MAX_PEAK,
387
- payload: {
388
- peak: payload,
389
- index: voltammetryPeakIdx,
390
- jcampIdx: curveIdx
391
- }
392
- });
393
- case 63:
394
- _context3.next = 93;
395
- break;
396
- case 65:
397
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MAX_PEAK && onPeak)) {
398
- _context3.next = 70;
399
- break;
77
+ });
78
+ yield (0, _effects.put)({
79
+ type: _action_type.UI.SWEEP.SELECT_MULTIPLICITY,
80
+ payload: {
81
+ newData: newPayload,
82
+ curveIdx
400
83
  }
401
- _context3.next = 68;
402
- return (0, _effects.put)({
403
- type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_MAX_PEAK,
404
- payload: {
405
- index: voltammetryPeakIdx,
406
- jcampIdx: curveIdx
407
- }
408
- });
409
- case 68:
410
- _context3.next = 93;
411
- break;
412
- case 70:
413
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MIN_PEAK && !onPeak)) {
414
- _context3.next = 75;
415
- break;
84
+ });
85
+ break;
86
+ default:
87
+ break;
88
+ }
89
+ return null;
90
+ }
91
+ const getLayoutSt = state => state.layout;
92
+ function* scrollUiWheel(action) {
93
+ const layoutSt = yield (0, _effects.select)(getLayoutSt);
94
+ const {
95
+ payload
96
+ } = action;
97
+ const {
98
+ xExtent,
99
+ yExtent,
100
+ direction
101
+ } = payload;
102
+ const {
103
+ yL,
104
+ yU
105
+ } = yExtent;
106
+ const [yeL, yeU] = [yL + (yU - yL) * 0.1, yU - (yU - yL) * 0.1];
107
+ const scale = direction ? 0.8 : 1.25;
108
+ let nextExtent = {
109
+ xExtent: false,
110
+ yExtent: false
111
+ };
112
+ let [nyeL, nyeU, h, nytL, nytU] = [0, 1, 1, 0, 1];
113
+ switch (layoutSt) {
114
+ case _list_layout.LIST_LAYOUT.IR:
115
+ case _list_layout.LIST_LAYOUT.RAMAN:
116
+ [nyeL, nyeU] = [yeL + (yeU - yeL) * (1 - scale), yeU];
117
+ h = nyeU - nyeL;
118
+ [nytL, nytU] = [nyeL - 0.125 * h, nyeU + 0.125 * h];
119
+ nextExtent = {
120
+ xExtent,
121
+ yExtent: {
122
+ yL: nytL,
123
+ yU: nytU
416
124
  }
417
- _context3.next = 73;
418
- return (0, _effects.put)({
419
- type: _action_type.CYCLIC_VOLTA_METRY.ADD_MIN_PEAK,
420
- payload: {
421
- peak: payload,
422
- index: voltammetryPeakIdx,
423
- jcampIdx: curveIdx
424
- }
425
- });
426
- case 73:
427
- _context3.next = 93;
428
- break;
429
- case 75:
430
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK && onPeak)) {
431
- _context3.next = 80;
432
- break;
125
+ };
126
+ break;
127
+ case _list_layout.LIST_LAYOUT.MS:
128
+ [nyeL, nyeU] = [0, yeL + (yeU - yeL) * scale];
129
+ h = nyeU - nyeL;
130
+ [nytL, nytU] = [nyeL - 0.125 * h, nyeU + 0.125 * h];
131
+ nextExtent = {
132
+ xExtent,
133
+ yExtent: {
134
+ yL: nytL,
135
+ yU: nytU
433
136
  }
434
- _context3.next = 78;
435
- return (0, _effects.put)({
436
- type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_MIN_PEAK,
437
- payload: {
438
- index: voltammetryPeakIdx,
439
- jcampIdx: curveIdx
440
- }
441
- });
442
- case 78:
443
- _context3.next = 93;
444
- break;
445
- case 80:
446
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_PECKER && !onPecker)) {
447
- _context3.next = 85;
448
- break;
137
+ };
138
+ break;
139
+ case _list_layout.LIST_LAYOUT.UVVIS:
140
+ case _list_layout.LIST_LAYOUT.HPLC_UVVIS:
141
+ case _list_layout.LIST_LAYOUT.TGA:
142
+ case _list_layout.LIST_LAYOUT.XRD:
143
+ default:
144
+ [nyeL, nyeU] = [yeL, yeL + (yeU - yeL) * scale];
145
+ h = nyeU - nyeL;
146
+ [nytL, nytU] = [nyeL - 0.125 * h, nyeU + 0.125 * h];
147
+ nextExtent = {
148
+ xExtent,
149
+ yExtent: {
150
+ yL: nytL,
151
+ yU: nytU
449
152
  }
450
- _context3.next = 83;
451
- return (0, _effects.put)({
452
- type: _action_type.CYCLIC_VOLTA_METRY.ADD_PECKER,
453
- payload: {
454
- peak: payload,
455
- index: voltammetryPeakIdx,
456
- jcampIdx: curveIdx
457
- }
458
- });
459
- case 83:
460
- _context3.next = 93;
461
- break;
462
- case 85:
463
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER && onPecker)) {
464
- _context3.next = 90;
465
- break;
153
+ };
154
+ break;
155
+ }
156
+ yield (0, _effects.put)({
157
+ type: _action_type.UI.SWEEP.SELECT_ZOOMIN,
158
+ payload: nextExtent
159
+ });
160
+ }
161
+ const getUiSweepType = state => state.ui.sweepType;
162
+ function* clickUiTarget(action) {
163
+ const {
164
+ payload,
165
+ onPeak,
166
+ voltammetryPeakIdx,
167
+ onPecker
168
+ } = action;
169
+ const uiSweepType = yield (0, _effects.select)(getUiSweepType);
170
+ const curveSt = yield (0, _effects.select)(getCurveSt);
171
+ const {
172
+ curveIdx
173
+ } = curveSt;
174
+ if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_ADD && !onPeak) {
175
+ yield (0, _effects.put)({
176
+ type: _action_type.EDITPEAK.ADD_POSITIVE,
177
+ payload: {
178
+ dataToAdd: payload,
179
+ curveIdx
180
+ }
181
+ });
182
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_DELETE && onPeak) {
183
+ yield (0, _effects.put)({
184
+ type: _action_type.EDITPEAK.ADD_NEGATIVE,
185
+ payload: {
186
+ dataToAdd: payload,
187
+ curveIdx
188
+ }
189
+ });
190
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT && onPeak) {
191
+ yield (0, _effects.put)({
192
+ type: _action_type.SHIFT.SET_PEAK,
193
+ payload: {
194
+ dataToSet: payload,
195
+ curveIdx
196
+ }
197
+ });
198
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_RM && onPeak) {
199
+ yield (0, _effects.put)({
200
+ type: _action_type.INTEGRATION.RM_ONE,
201
+ payload: {
202
+ dataToRemove: payload,
203
+ curveIdx
204
+ }
205
+ });
206
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_RM && onPeak) {
207
+ yield (0, _effects.put)({
208
+ type: _action_type.INTEGRATION.RM_ONE,
209
+ payload: {
210
+ dataToRemove: payload,
211
+ curveIdx
212
+ }
213
+ });
214
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF && onPeak) {
215
+ yield (0, _effects.put)({
216
+ type: _action_type.INTEGRATION.SET_REF,
217
+ payload: {
218
+ refData: payload,
219
+ curveIdx
220
+ }
221
+ });
222
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_CLICK && onPeak) {
223
+ const {
224
+ xExtent,
225
+ xL,
226
+ xU
227
+ } = payload;
228
+ if (xExtent) {
229
+ yield (0, _effects.put)({
230
+ type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
231
+ payload: {
232
+ payloadData: xExtent,
233
+ curveIdx
466
234
  }
467
- _context3.next = 88;
468
- return (0, _effects.put)({
469
- type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_PECKER,
470
- payload: {
471
- index: voltammetryPeakIdx,
472
- jcampIdx: curveIdx
473
- }
474
- });
475
- case 88:
476
- _context3.next = 93;
477
- break;
478
- case 90:
479
- if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF && onPeak)) {
480
- _context3.next = 93;
481
- break;
235
+ });
236
+ } else if (xL && xU) {
237
+ yield (0, _effects.put)({
238
+ type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
239
+ payload: {
240
+ payloadData: {
241
+ xL,
242
+ xU
243
+ },
244
+ curveIdx
482
245
  }
483
- _context3.next = 93;
484
- return (0, _effects.put)({
485
- type: _action_type.CYCLIC_VOLTA_METRY.SET_REF,
486
- payload: {
487
- index: voltammetryPeakIdx,
488
- jcampIdx: curveIdx
489
- }
490
- });
491
- case 93:
492
- case "end":
493
- return _context3.stop();
246
+ });
494
247
  }
495
- }, _marked3);
248
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_ADD) {
249
+ yield (0, _effects.put)({
250
+ type: _action_type.MULTIPLICITY.PEAK_ADD_BY_UI_SAG,
251
+ payload
252
+ });
253
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_RM && onPeak) {
254
+ yield (0, _effects.put)({
255
+ type: _action_type.MULTIPLICITY.PEAK_RM_BY_UI,
256
+ payload
257
+ });
258
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MAX_PEAK && !onPeak) {
259
+ yield (0, _effects.put)({
260
+ type: _action_type.CYCLIC_VOLTA_METRY.ADD_MAX_PEAK,
261
+ payload: {
262
+ peak: payload,
263
+ index: voltammetryPeakIdx,
264
+ jcampIdx: curveIdx
265
+ }
266
+ });
267
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MAX_PEAK && onPeak) {
268
+ yield (0, _effects.put)({
269
+ type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_MAX_PEAK,
270
+ payload: {
271
+ index: voltammetryPeakIdx,
272
+ jcampIdx: curveIdx
273
+ }
274
+ });
275
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MIN_PEAK && !onPeak) {
276
+ yield (0, _effects.put)({
277
+ type: _action_type.CYCLIC_VOLTA_METRY.ADD_MIN_PEAK,
278
+ payload: {
279
+ peak: payload,
280
+ index: voltammetryPeakIdx,
281
+ jcampIdx: curveIdx
282
+ }
283
+ });
284
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK && onPeak) {
285
+ yield (0, _effects.put)({
286
+ type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_MIN_PEAK,
287
+ payload: {
288
+ index: voltammetryPeakIdx,
289
+ jcampIdx: curveIdx
290
+ }
291
+ });
292
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_PECKER && !onPecker) {
293
+ yield (0, _effects.put)({
294
+ type: _action_type.CYCLIC_VOLTA_METRY.ADD_PECKER,
295
+ payload: {
296
+ peak: payload,
297
+ index: voltammetryPeakIdx,
298
+ jcampIdx: curveIdx
299
+ }
300
+ });
301
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER && onPecker) {
302
+ yield (0, _effects.put)({
303
+ type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_PECKER,
304
+ payload: {
305
+ index: voltammetryPeakIdx,
306
+ jcampIdx: curveIdx
307
+ }
308
+ });
309
+ } else if (uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_SET_REF && onPeak) {
310
+ yield (0, _effects.put)({
311
+ type: _action_type.CYCLIC_VOLTA_METRY.SET_REF,
312
+ payload: {
313
+ index: voltammetryPeakIdx,
314
+ jcampIdx: curveIdx
315
+ }
316
+ });
317
+ }
496
318
  }
497
- var managerSagas = [(0, _effects.takeEvery)(_action_type.UI.CLICK_TARGET, clickUiTarget), (0, _effects.takeEvery)(_action_type.UI.SWEEP.SELECT, selectUiSweep), (0, _effects.takeEvery)(_action_type.UI.WHEEL.SCROLL, scrollUiWheel)];
498
- var _default = managerSagas;
499
- exports.default = _default;
319
+ const managerSagas = [(0, _effects.takeEvery)(_action_type.UI.CLICK_TARGET, clickUiTarget), (0, _effects.takeEvery)(_action_type.UI.SWEEP.SELECT, selectUiSweep), (0, _effects.takeEvery)(_action_type.UI.WHEEL.SCROLL, scrollUiWheel)];
320
+ var _default = exports.default = managerSagas;