@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
@@ -5,14 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
8
  var _reduxUndo = _interopRequireDefault(require("redux-undo"));
10
9
  var _action_type = require("../constants/action_type");
11
10
  var _integration = require("../helpers/integration");
12
11
  var _undo_redo_config = require("./undo_redo_config");
13
12
  /* eslint-disable prefer-object-spread, default-param-last */
14
13
 
15
- var initialState = {
14
+ const initialState = {
16
15
  selectedIdx: 0,
17
16
  integrations: [{
18
17
  stack: [],
@@ -22,162 +21,196 @@ var initialState = {
22
21
  edited: false
23
22
  }]
24
23
  };
25
- var defaultEmptyIntegration = {
24
+ const defaultEmptyIntegration = {
26
25
  stack: [],
27
26
  refArea: 1,
28
27
  refFactor: 1,
29
28
  shift: 0,
30
29
  edited: false
31
30
  };
32
- var addToStack = function addToStack(state, action) {
33
- var _action$payload = action.payload,
34
- newData = _action$payload.newData,
35
- curveIdx = _action$payload.curveIdx;
36
- var integrations = state.integrations;
37
- var selectedIntegration = integrations[curveIdx];
31
+ const addToStack = (state, action) => {
32
+ const {
33
+ newData,
34
+ curveIdx
35
+ } = action.payload;
36
+ const {
37
+ integrations
38
+ } = state;
39
+ let selectedIntegration = integrations[curveIdx];
38
40
  if (selectedIntegration === false || selectedIntegration === undefined) {
39
41
  selectedIntegration = defaultEmptyIntegration;
40
42
  }
41
- var _selectedIntegration = selectedIntegration,
42
- stack = _selectedIntegration.stack,
43
- refArea = _selectedIntegration.refArea,
44
- shift = _selectedIntegration.shift;
45
- var xExtent = newData.xExtent,
46
- data = newData.data;
47
- var xL = xExtent.xL,
48
- xU = xExtent.xU;
43
+ const {
44
+ stack,
45
+ refArea,
46
+ shift
47
+ } = selectedIntegration;
48
+ const {
49
+ xExtent,
50
+ data
51
+ } = newData;
52
+ const {
53
+ xL,
54
+ xU
55
+ } = xExtent;
49
56
  if (!xL || !xU || xU - xL === 0) {
50
57
  return state;
51
58
  }
52
- var area = (0, _integration.getArea)(xL, xU, data);
53
- var defaultRefArea = stack.length === 0 ? area : refArea;
54
- var absoluteArea = (0, _integration.getAbsoluteArea)(xL, xU, data); // area depends on y baseline
55
- var newStack = [].concat((0, _toConsumableArray2.default)(stack), [{
59
+ const area = (0, _integration.getArea)(xL, xU, data);
60
+ const defaultRefArea = stack.length === 0 ? area : refArea;
61
+ const absoluteArea = (0, _integration.getAbsoluteArea)(xL, xU, data); // area depends on y baseline
62
+ const newStack = [...stack, {
56
63
  xL: xL + shift,
57
64
  xU: xU + shift,
58
- area: area,
59
- absoluteArea: absoluteArea
60
- }]);
61
- var newIntegration = Object.assign({}, selectedIntegration, {
65
+ area,
66
+ absoluteArea
67
+ }];
68
+ const newIntegration = Object.assign({}, selectedIntegration, {
62
69
  stack: newStack,
63
70
  refArea: defaultRefArea
64
71
  });
65
- integrations[curveIdx] = newIntegration;
72
+ const newArrIntegration = [...integrations];
73
+ newArrIntegration[curveIdx] = newIntegration;
66
74
  return Object.assign({}, state, {
67
- integrations: integrations,
75
+ integrations: newArrIntegration,
68
76
  selectedIdx: curveIdx
69
77
  });
70
78
  };
71
- var rmFromStack = function rmFromStack(state, action) {
72
- var _action$payload2 = action.payload,
73
- dataToRemove = _action$payload2.dataToRemove,
74
- curveIdx = _action$payload2.curveIdx;
75
- var xL = dataToRemove.xL,
76
- xU = dataToRemove.xU,
77
- xExtent = dataToRemove.xExtent;
78
- var integrations = state.integrations;
79
- var selectedIntegration = integrations[curveIdx];
80
- var stack = selectedIntegration.stack;
81
- var txL = 0,
82
- txU = 0;
79
+ const rmFromStack = (state, action) => {
80
+ const {
81
+ dataToRemove,
82
+ curveIdx
83
+ } = action.payload;
84
+ const {
85
+ xL,
86
+ xU,
87
+ xExtent
88
+ } = dataToRemove;
89
+ const {
90
+ integrations
91
+ } = state;
92
+ const selectedIntegration = integrations[curveIdx];
93
+ const {
94
+ stack
95
+ } = selectedIntegration;
96
+ let [txL, txU] = [0, 0];
83
97
  if (xL && xU) {
84
98
  // rm click integration
85
- txL = xL;
86
- txU = xU;
99
+ [txL, txU] = [xL, xU];
87
100
  } else if (xExtent) {
88
101
  // rm click multiplicity
89
- var _ref = [xExtent.xL, xExtent.xU];
90
- txL = _ref[0];
91
- txU = _ref[1];
102
+ [txL, txU] = [xExtent.xL, xExtent.xU];
92
103
  } else {
93
104
  return state;
94
105
  }
95
- var newStack = stack.filter(function (k) {
96
- return k.xL !== txL && k.xU !== txU;
97
- });
98
- var newIntegration = Object.assign({}, selectedIntegration, {
106
+ const newStack = stack.filter(k => k.xL !== txL && k.xU !== txU);
107
+ const newIntegration = Object.assign({}, selectedIntegration, {
99
108
  stack: newStack
100
109
  });
101
- integrations[curveIdx] = newIntegration;
110
+ const newArrIntegration = [...integrations];
111
+ newArrIntegration[curveIdx] = newIntegration;
102
112
  return Object.assign({}, state, {
103
- integrations: integrations,
113
+ integrations: newArrIntegration,
104
114
  selectedIdx: curveIdx
105
115
  });
106
116
  };
107
- var setRef = function setRef(state, action) {
108
- var _action$payload3 = action.payload,
109
- refData = _action$payload3.refData,
110
- curveIdx = _action$payload3.curveIdx;
111
- var integrations = state.integrations;
112
- var selectedIntegration = integrations[curveIdx];
113
- var stack = selectedIntegration.stack;
114
- var xL = refData.xL,
115
- xU = refData.xU;
116
- var ref = stack.filter(function (k) {
117
- return k.xL === xL && k.xU === xU;
118
- })[0];
117
+ const setRef = (state, action) => {
118
+ const {
119
+ refData,
120
+ curveIdx
121
+ } = action.payload;
122
+ const {
123
+ integrations
124
+ } = state;
125
+ const selectedIntegration = integrations[curveIdx];
126
+ const {
127
+ stack
128
+ } = selectedIntegration;
129
+ const {
130
+ xL,
131
+ xU
132
+ } = refData;
133
+ const ref = stack.filter(k => k.xL === xL && k.xU === xU)[0];
119
134
  if (!ref) {
120
135
  return state;
121
136
  }
122
- var refArea = ref.area;
123
- var newIntegration = Object.assign({}, selectedIntegration, {
124
- refArea: refArea
137
+ const refArea = ref.area;
138
+ const newIntegration = Object.assign({}, selectedIntegration, {
139
+ refArea
125
140
  });
126
- integrations[curveIdx] = newIntegration;
141
+ const newArrIntegration = [...integrations];
142
+ newArrIntegration[curveIdx] = newIntegration;
127
143
  return Object.assign({}, state, {
128
- integrations: integrations,
144
+ integrations: newArrIntegration,
129
145
  selectedIdx: curveIdx
130
146
  });
131
147
  };
132
- var setFkr = function setFkr(state, action) {
133
- var payload = action.payload;
134
- var curveIdx = payload.curveIdx,
135
- factor = payload.factor;
136
- var integrations = state.integrations;
137
- var selectedIntegration = integrations[curveIdx];
138
- var val = parseFloat(factor);
139
- var refFactor = val < 0.01 ? 0.01 : val;
140
- var newIntegration = Object.assign({}, selectedIntegration, {
141
- refFactor: refFactor
148
+ const setFkr = (state, action) => {
149
+ const {
150
+ payload
151
+ } = action;
152
+ const {
153
+ curveIdx,
154
+ factor
155
+ } = payload;
156
+ const {
157
+ integrations
158
+ } = state;
159
+ const selectedIntegration = integrations[curveIdx];
160
+ const val = parseFloat(factor);
161
+ const refFactor = val < 0.01 ? 0.01 : val;
162
+ const newIntegration = Object.assign({}, selectedIntegration, {
163
+ refFactor
142
164
  });
143
- integrations[curveIdx] = newIntegration;
165
+ const newArrIntegration = [...integrations];
166
+ newArrIntegration[curveIdx] = newIntegration;
144
167
  return Object.assign({}, state, {
145
- integrations: integrations
168
+ integrations: newArrIntegration
146
169
  });
147
170
  };
148
- var setShift = function setShift(state, action) {
149
- var selectedIdx = state.selectedIdx,
150
- integrations = state.integrations;
151
- var selectedIntegration = integrations[selectedIdx];
152
- var shift = action.payload.prevOffset;
153
- var newIntegration = Object.assign({}, selectedIntegration, {
154
- shift: shift
171
+ const setShift = (state, action) => {
172
+ const {
173
+ selectedIdx,
174
+ integrations
175
+ } = state;
176
+ const selectedIntegration = integrations[selectedIdx];
177
+ const shift = action.payload.prevOffset;
178
+ const newIntegration = Object.assign({}, selectedIntegration, {
179
+ shift
155
180
  });
156
- integrations[selectedIdx] = newIntegration;
181
+ const newArrIntegration = [...integrations];
182
+ newArrIntegration[selectedIdx] = newIntegration;
157
183
  return Object.assign({}, state, {
158
- integrations: integrations
184
+ integrations: newArrIntegration
159
185
  });
160
186
  };
161
- var resetAll = function resetAll(state, action) {
162
- var newState = action.payload;
187
+ const resetAll = (state, action) => {
188
+ const newState = action.payload;
163
189
  return Object.assign({}, state, newState);
164
190
  };
165
- var clearAll = function clearAll(state, action) {
166
- var payload = action.payload;
167
- var curveIdx = payload.curveIdx;
168
- var integrations = state.integrations;
169
- var newIntegration = Object.assign({}, defaultEmptyIntegration, {
191
+ const clearAll = (state, action) => {
192
+ const {
193
+ payload
194
+ } = action;
195
+ const {
196
+ curveIdx
197
+ } = payload;
198
+ const {
199
+ integrations
200
+ } = state;
201
+ const newIntegration = Object.assign({}, defaultEmptyIntegration, {
170
202
  edited: true
171
203
  });
172
- integrations[curveIdx] = newIntegration;
204
+ const newArrIntegration = [...integrations];
205
+ newArrIntegration[curveIdx] = newIntegration;
173
206
  return Object.assign({}, state, {
174
- integrations: integrations,
207
+ integrations: newArrIntegration,
175
208
  selectedIdx: curveIdx
176
209
  });
177
210
  };
178
- var integrationReducer = function integrationReducer() {
179
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
180
- var action = arguments.length > 1 ? arguments[1] : undefined;
211
+ const integrationReducer = function () {
212
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
213
+ let action = arguments.length > 1 ? arguments[1] : undefined;
181
214
  switch (action.type) {
182
215
  case _action_type.UI.SWEEP.SELECT_INTEGRATION:
183
216
  return addToStack(state, action);
@@ -199,6 +232,5 @@ var integrationReducer = function integrationReducer() {
199
232
  return _undo_redo_config.undoRedoActions.indexOf(action.type) >= 0 ? Object.assign({}, state) : state;
200
233
  }
201
234
  };
202
- var undoableIntegrationReducer = (0, _reduxUndo.default)(integrationReducer, _undo_redo_config.undoRedoConfig);
203
- var _default = undoableIntegrationReducer;
204
- exports.default = _default;
235
+ const undoableIntegrationReducer = (0, _reduxUndo.default)(integrationReducer, _undo_redo_config.undoRedoConfig);
236
+ var _default = exports.default = undoableIntegrationReducer;
@@ -1,83 +1,89 @@
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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
7
  var _action_type = require("../constants/action_type");
10
8
  /* eslint-disable prefer-object-spread, default-param-last */
11
9
 
12
- var initialState = {
10
+ const initialState = {
13
11
  selectedIdx: 0,
14
12
  jcamps: [{
15
13
  others: [],
16
14
  addOthersCb: false
17
15
  }]
18
16
  };
19
- var addOthers = function addOthers(state, _ref) {
20
- var others = _ref.others,
21
- addOthersCb = _ref.addOthersCb;
22
- var selectedIdx = state.selectedIdx,
23
- jcamps = state.jcamps;
24
- var selectedJcamp = jcamps[selectedIdx];
17
+ const addOthers = (state, _ref) => {
18
+ let {
19
+ others,
20
+ addOthersCb
21
+ } = _ref;
22
+ const {
23
+ selectedIdx,
24
+ jcamps
25
+ } = state;
26
+ const selectedJcamp = jcamps[selectedIdx];
25
27
  if (selectedJcamp.others.length > 5) return state;
26
- var decoOthers = others.map(function (o) {
27
- return Object.assign({}, o, {
28
- show: true
29
- });
30
- });
31
- var newJcamp = Object.assign({}, selectedJcamp, {
32
- others: [].concat((0, _toConsumableArray2.default)(selectedJcamp.others), (0, _toConsumableArray2.default)(decoOthers)).slice(0, 5),
33
- addOthersCb: addOthersCb
28
+ const decoOthers = others.map(o => Object.assign({}, o, {
29
+ show: true
30
+ }));
31
+ const newJcamp = Object.assign({}, selectedJcamp, {
32
+ others: [...decoOthers].slice(0, 5),
33
+ addOthersCb
34
34
  });
35
35
  jcamps[selectedIdx] = newJcamp;
36
36
  return Object.assign({}, state, {
37
- jcamps: jcamps
37
+ jcamps
38
38
  });
39
39
  };
40
- var rmOthersOne = function rmOthersOne(state, payload) {
41
- var selectedIdx = state.selectedIdx,
42
- jcamps = state.jcamps;
43
- var selectedJcamp = jcamps[selectedIdx];
44
- var idx = payload;
45
- var others = selectedJcamp.others;
46
- var nextOther = others.filter(function (_, i) {
47
- return i !== idx;
48
- });
49
- var newJcamp = Object.assign({}, selectedJcamp, {
40
+ const rmOthersOne = (state, payload) => {
41
+ const {
42
+ selectedIdx,
43
+ jcamps
44
+ } = state;
45
+ const selectedJcamp = jcamps[selectedIdx];
46
+ const idx = payload;
47
+ const {
48
+ others
49
+ } = selectedJcamp;
50
+ const nextOther = others.filter((_, i) => i !== idx);
51
+ const newJcamp = Object.assign({}, selectedJcamp, {
50
52
  others: nextOther
51
53
  });
52
54
  jcamps[selectedIdx] = newJcamp;
53
55
  return Object.assign({}, state, {
54
- jcamps: jcamps
56
+ jcamps
55
57
  });
56
58
  };
57
- var toggleShow = function toggleShow(state, payload) {
58
- var selectedIdx = state.selectedIdx,
59
- jcamps = state.jcamps;
60
- var selectedJcamp = jcamps[selectedIdx];
61
- var idx = payload;
62
- var others = selectedJcamp.others;
63
- var nextOthers = others.map(function (o, i) {
59
+ const toggleShow = (state, payload) => {
60
+ const {
61
+ selectedIdx,
62
+ jcamps
63
+ } = state;
64
+ const selectedJcamp = jcamps[selectedIdx];
65
+ const idx = payload;
66
+ const {
67
+ others
68
+ } = selectedJcamp;
69
+ const nextOthers = others.map((o, i) => {
64
70
  if (i !== idx) return o;
65
- var currentShow = o.show;
71
+ const currentShow = o.show;
66
72
  return Object.assign({}, o, {
67
73
  show: !currentShow
68
74
  });
69
75
  });
70
- var newJcamp = Object.assign({}, selectedJcamp, {
76
+ const newJcamp = Object.assign({}, selectedJcamp, {
71
77
  others: nextOthers
72
78
  });
73
79
  jcamps[selectedIdx] = newJcamp;
74
80
  return Object.assign({}, state, {
75
- jcamps: jcamps
81
+ jcamps
76
82
  });
77
83
  };
78
- var layoutReducer = function layoutReducer() {
79
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
80
- var action = arguments.length > 1 ? arguments[1] : undefined;
84
+ const layoutReducer = function () {
85
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
86
+ let action = arguments.length > 1 ? arguments[1] : undefined;
81
87
  switch (action.type) {
82
88
  case _action_type.JCAMP.ADD_OTHERS:
83
89
  return addOthers(state, action.payload);
@@ -93,5 +99,4 @@ var layoutReducer = function layoutReducer() {
93
99
  return state;
94
100
  }
95
101
  };
96
- var _default = layoutReducer;
97
- exports.default = _default;
102
+ var _default = exports.default = layoutReducer;
@@ -8,10 +8,10 @@ var _action_type = require("../constants/action_type");
8
8
  var _list_layout = require("../constants/list_layout");
9
9
  /* eslint-disable prefer-object-spread, default-param-last */
10
10
 
11
- var initialState = _list_layout.LIST_LAYOUT.C13;
12
- var layoutReducer = function layoutReducer() {
13
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
14
- var action = arguments.length > 1 ? arguments[1] : undefined;
11
+ const initialState = _list_layout.LIST_LAYOUT.C13;
12
+ const layoutReducer = function () {
13
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
14
+ let action = arguments.length > 1 ? arguments[1] : undefined;
15
15
  switch (action.type) {
16
16
  case _action_type.LAYOUT.UPDATE:
17
17
  return action.payload;
@@ -21,5 +21,4 @@ var layoutReducer = function layoutReducer() {
21
21
  return state;
22
22
  }
23
23
  };
24
- var _default = layoutReducer;
25
- exports.default = _default;
24
+ var _default = exports.default = layoutReducer;
@@ -7,14 +7,13 @@ exports.default = void 0;
7
7
  /* eslint-disable prefer-object-spread, default-param-last */
8
8
  // import { MANAGER } from '../constants/action_type';
9
9
 
10
- var initialState = {};
11
- var managerReducer = function managerReducer() {
12
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
13
- var action = arguments.length > 1 ? arguments[1] : undefined;
10
+ const initialState = {};
11
+ const managerReducer = function () {
12
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
13
+ let action = arguments.length > 1 ? arguments[1] : undefined;
14
14
  switch (action.type) {
15
15
  default:
16
16
  return state;
17
17
  }
18
18
  };
19
- var _default = managerReducer;
20
- exports.default = _default;
19
+ var _default = exports.default = managerReducer;
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _action_type = require("../constants/action_type");
8
8
  /* eslint-disable prefer-object-spread, default-param-last */
9
9
 
10
- var initialState = {
10
+ const initialState = {
11
11
  peaks: {
12
12
  intervalL: null,
13
13
  intervalR: null,
@@ -15,9 +15,9 @@ var initialState = {
15
15
  deltaX: null
16
16
  }
17
17
  };
18
- var metaReducer = function metaReducer() {
19
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
20
- var action = arguments.length > 1 ? arguments[1] : undefined;
18
+ const metaReducer = function () {
19
+ let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
20
+ let action = arguments.length > 1 ? arguments[1] : undefined;
21
21
  switch (action.type) {
22
22
  case _action_type.META.UPDATE_PEAKS_RDC:
23
23
  return Object.assign({}, state, action.payload);
@@ -25,5 +25,4 @@ var metaReducer = function metaReducer() {
25
25
  return state;
26
26
  }
27
27
  };
28
- var _default = metaReducer;
29
- exports.default = _default;
28
+ var _default = exports.default = metaReducer;