@complat/react-spectra-editor 1.0.0-alpha.4 → 1.0.0-alpha.6

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.
@@ -309,6 +309,15 @@ var layoutSelect = function layoutSelect(classes, layoutSt, updateLayoutAct) {
309
309
  { className: (0, _classnames2.default)(classes.txtOpt, 'option-sv-bar-layout') },
310
310
  'CV (CYCLIC VOLTAMMETRY)'
311
311
  )
312
+ ),
313
+ _react2.default.createElement(
314
+ _MenuItem2.default,
315
+ { value: _list_layout.LIST_LAYOUT.SEC },
316
+ _react2.default.createElement(
317
+ 'span',
318
+ { className: (0, _classnames2.default)(classes.txtOpt, 'option-sv-bar-layout') },
319
+ 'SEC'
320
+ )
312
321
  )
313
322
  )
314
323
  );
@@ -767,7 +767,7 @@ var LineFocus = function () {
767
767
  }, {
768
768
  key: 'reverseXAxis',
769
769
  value: function reverseXAxis(layoutSt) {
770
- return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY].indexOf(layoutSt) < 0;
770
+ return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.SEC].indexOf(layoutSt) < 0;
771
771
  }
772
772
  }, {
773
773
  key: 'create',
@@ -190,19 +190,27 @@ var MultiFocus = function () {
190
190
  this.jcampIdx = jcampIdx;
191
191
  this.data = [];
192
192
  this.otherLineData = [];
193
+ var filterSubLayoutValue = null;
193
194
  this.entities.forEach(function (entry, idx) {
194
195
  var topic = entry.topic,
195
196
  feature = entry.feature,
196
197
  color = entry.color;
197
198
 
198
199
  var currData = (0, _chem.convertTopic)(topic, layout, feature, 0);
200
+
199
201
  if (idx === _this.jcampIdx) {
200
202
  _this.data = [].concat(_toConsumableArray(currData));
201
203
  _this.pathColor = color;
204
+ filterSubLayoutValue = feature.xUnit;
202
205
  } else {
203
- _this.otherLineData.push({ data: currData, color: color });
206
+ _this.otherLineData.push({ data: currData, color: color, filterSublayout: feature.xUnit });
204
207
  }
205
208
  });
209
+ if (_format2.default.isSECLayout(layout)) {
210
+ this.otherLineData = this.otherLineData.filter(function (data) {
211
+ return data.filterSublayout === filterSubLayoutValue;
212
+ });
213
+ }
206
214
 
207
215
  this.dataPks = [].concat(_toConsumableArray(peaks));
208
216
  this.tTrEndPts = tTrEndPts;
@@ -348,7 +356,8 @@ var MultiFocus = function () {
348
356
  this.dataPks = [];
349
357
  this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt, spectra.list);
350
358
  } else {
351
- this.dataPks = (0, _converter.PksEdit)(this.dataPks, editPeakSt, []);
359
+ var newEditPeaks = Object.assign({}, editPeakSt, { selectedIdx: this.jcampIdx });
360
+ this.dataPks = (0, _converter.PksEdit)(this.dataPks, newEditPeaks, []);
352
361
  }
353
362
 
354
363
  return this.dataPks;
@@ -892,7 +901,7 @@ var MultiFocus = function () {
892
901
  }, {
893
902
  key: 'reverseXAxis',
894
903
  value: function reverseXAxis(layoutSt) {
895
- return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY].indexOf(layoutSt) < 0;
904
+ return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.SEC].indexOf(layoutSt) < 0;
896
905
  }
897
906
  }, {
898
907
  key: 'create',
@@ -63,6 +63,21 @@ var styles = function styles() {
63
63
  };
64
64
  };
65
65
 
66
+ var seperatingSubLayout = function seperatingSubLayout(entities, featureCondition) {
67
+ var storedDict = {};
68
+ entities.forEach(function (entity) {
69
+ var feature = entity.feature;
70
+
71
+ var keyValue = feature[featureCondition];
72
+ if (keyValue in storedDict) {
73
+ storedDict[keyValue].push(entity);
74
+ } else {
75
+ storedDict[keyValue] = [entity];
76
+ }
77
+ });
78
+ return Object.assign({}, storedDict);
79
+ };
80
+
66
81
  var MultiJcampsViewer = function (_React$Component) {
67
82
  _inherits(MultiJcampsViewer, _React$Component);
68
83
 
@@ -85,6 +100,7 @@ var MultiJcampsViewer = function (_React$Component) {
85
100
 
86
101
  if (!entities || entities.length === 0) return _react2.default.createElement('div', null);
87
102
 
103
+ var seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit');
88
104
  var entity = entities[curvSt.curveIdx];
89
105
  var feature = entity.feature,
90
106
  topic = entity.topic,
@@ -126,6 +142,7 @@ var MultiJcampsViewer = function (_React$Component) {
126
142
  userManualLink: userManualLink,
127
143
  feature: feature,
128
144
  molSvg: molSvg,
145
+ subLayoutsInfo: seperatedSubLayouts,
129
146
  descriptions: '',
130
147
  canChangeDescription: function canChangeDescription() {},
131
148
  onDescriptionChanged: function onDescriptionChanged() {}
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
8
+
7
9
  var _react = require('react');
8
10
 
9
11
  var _react2 = _interopRequireDefault(_react);
@@ -73,7 +75,8 @@ var GraphSelectionPanel = function GraphSelectionPanel(_ref) {
73
75
  var classes = _ref.classes,
74
76
  curveSt = _ref.curveSt,
75
77
  selectCurveAct = _ref.selectCurveAct,
76
- entityFileNames = _ref.entityFileNames;
78
+ entityFileNames = _ref.entityFileNames,
79
+ subLayoutsInfo = _ref.subLayoutsInfo;
77
80
 
78
81
 
79
82
  if (!curveSt) {
@@ -82,11 +85,43 @@ var GraphSelectionPanel = function GraphSelectionPanel(_ref) {
82
85
  var curveIdx = curveSt.curveIdx,
83
86
  listCurves = curveSt.listCurves;
84
87
 
88
+ if (!listCurves) {
89
+ return _react2.default.createElement('span', null);
90
+ }
85
91
 
86
92
  var onChange = function onChange(idx) {
87
93
  selectCurveAct(idx);
88
94
  };
89
95
 
96
+ var subLayoutValues = [];
97
+ if (subLayoutsInfo !== undefined && subLayoutsInfo !== null) {
98
+ subLayoutValues = Object.keys(subLayoutsInfo);
99
+ }
100
+
101
+ var onChangeTabSubLayout = function onChangeTabSubLayout(event, newValue) {
102
+ setSelectedSublayout(newValue);
103
+ };
104
+
105
+ var _useState = (0, _react.useState)(subLayoutValues[0]),
106
+ _useState2 = _slicedToArray(_useState, 2),
107
+ selectedSubLayout = _useState2[0],
108
+ setSelectedSublayout = _useState2[1];
109
+
110
+ var itemsSubLayout = [];
111
+ if (selectedSubLayout && subLayoutValues.length > 1) {
112
+ var subLayout = subLayoutsInfo[selectedSubLayout];
113
+ itemsSubLayout = subLayout.map(function (spectra, idx) {
114
+ var color = spectra.color,
115
+ curveIdx = spectra.curveIdx;
116
+
117
+ var filename = '';
118
+ if (entityFileNames && curveIdx < entityFileNames.length) {
119
+ filename = entityFileNames[curveIdx];
120
+ }
121
+ return { name: idx + 1 + '.', idx: curveIdx, color: color, filename: filename };
122
+ });
123
+ };
124
+
90
125
  var items = listCurves.map(function (spectra, idx) {
91
126
  var color = spectra.color;
92
127
 
@@ -98,12 +133,12 @@ var GraphSelectionPanel = function GraphSelectionPanel(_ref) {
98
133
  });
99
134
 
100
135
  return _react2.default.createElement(
101
- _core.ExpansionPanel,
102
- null,
136
+ _core.Accordion,
137
+ { 'data-testid': 'GraphSelectionPanel' },
103
138
  _react2.default.createElement(
104
- _core.ExpansionPanelSummary,
139
+ _core.AccordionSummary,
105
140
  {
106
- xpandIcon: _react2.default.createElement(_ExpandMore2.default, null),
141
+ expandIcon: _react2.default.createElement(_ExpandMore2.default, null),
107
142
  className: (0, _classnames2.default)(classes.panelSummary)
108
143
  },
109
144
  _react2.default.createElement(
@@ -117,7 +152,64 @@ var GraphSelectionPanel = function GraphSelectionPanel(_ref) {
117
152
  )
118
153
  ),
119
154
  _react2.default.createElement(_Divider2.default, null),
120
- _react2.default.createElement(
155
+ subLayoutValues && subLayoutValues.length > 1 ? _react2.default.createElement(
156
+ 'div',
157
+ null,
158
+ _react2.default.createElement(
159
+ _core.Tabs,
160
+ { value: selectedSubLayout, onChange: onChangeTabSubLayout },
161
+ subLayoutValues.map(function (subLayout, i) {
162
+ var subLayoutName = '';
163
+ switch (subLayout) {
164
+ case 'G/MOL':
165
+ subLayoutName = 'MWD';
166
+ break;
167
+ case 'MILLILITERS':
168
+ subLayoutName = 'ELU';
169
+ break;
170
+ default:
171
+ break;
172
+ }
173
+ return _react2.default.createElement(_core.Tab, { key: i, value: subLayout, label: subLayoutName });
174
+ })
175
+ ),
176
+ _react2.default.createElement(
177
+ _core.List,
178
+ null,
179
+ itemsSubLayout.map(function (item) {
180
+ return _react2.default.createElement(
181
+ _core.ListItem,
182
+ {
183
+ key: item.idx,
184
+ onClick: function onClick() {
185
+ return onChange(item.idx);
186
+ },
187
+ className: (0, _classnames2.default)(item.idx === curveIdx ? classes.curveSelected : classes.curveDefault)
188
+ },
189
+ _react2.default.createElement(
190
+ 'span',
191
+ { className: (0, _classnames2.default)(classes.curve) },
192
+ _react2.default.createElement(
193
+ 'i',
194
+ null,
195
+ item.name
196
+ ),
197
+ _react2.default.createElement(
198
+ 'span',
199
+ { style: { float: "right", width: "95%" } },
200
+ _react2.default.createElement('hr', { className: (0, _classnames2.default)(classes.line), style: { backgroundColor: item.color } }),
201
+ item.filename !== '' ? _react2.default.createElement(
202
+ 'span',
203
+ null,
204
+ 'File: ',
205
+ item.filename
206
+ ) : null
207
+ )
208
+ )
209
+ );
210
+ })
211
+ )
212
+ ) : _react2.default.createElement(
121
213
  _core.List,
122
214
  null,
123
215
  items.map(function (item) {
@@ -178,7 +270,8 @@ GraphSelectionPanel.propTypes = {
178
270
  onExapnd: _propTypes2.default.func.isRequired,
179
271
  curveSt: _propTypes2.default.object.isRequired,
180
272
  selectCurveAct: _propTypes2.default.func.isRequired,
181
- entityFileNames: _propTypes2.default.array.isRequired
273
+ entityFileNames: _propTypes2.default.array.isRequired,
274
+ subLayoutsInfo: _propTypes2.default.array
182
275
  };
183
276
 
184
277
  exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(GraphSelectionPanel));
@@ -131,7 +131,8 @@ var PanelViewer = function (_React$Component) {
131
131
  jcampIdx = _props.jcampIdx,
132
132
  entityFileNames = _props.entityFileNames,
133
133
  curveSt = _props.curveSt,
134
- userManualLink = _props.userManualLink;
134
+ userManualLink = _props.userManualLink,
135
+ subLayoutsInfo = _props.subLayoutsInfo;
135
136
 
136
137
  var onExapndInfo = function onExapndInfo() {
137
138
  return _this2.onExapnd('info');
@@ -164,7 +165,7 @@ var PanelViewer = function (_React$Component) {
164
165
  {
165
166
  theme: theme
166
167
  },
167
- hideGraphSelection ? null : _react2.default.createElement(_graph_selection2.default, { jcampIdx: jcampIdx, entityFileNames: entityFileNames, expand: expand === 'graph', onExapnd: onExapndGraphSelection }),
168
+ hideGraphSelection ? null : _react2.default.createElement(_graph_selection2.default, { jcampIdx: jcampIdx, entityFileNames: entityFileNames, expand: expand === 'graph', onExapnd: onExapndGraphSelection, subLayoutsInfo: subLayoutsInfo }),
168
169
  _react2.default.createElement(_info2.default, {
169
170
  feature: feature,
170
171
  integration: integration,
@@ -213,7 +214,8 @@ PanelViewer.propTypes = {
213
214
  onDescriptionChanged: _propTypes2.default.func,
214
215
  entityFileNames: _propTypes2.default.array,
215
216
  userManualLink: _propTypes2.default.object,
216
- curveSt: _propTypes2.default.object.isRequired
217
+ curveSt: _propTypes2.default.object.isRequired,
218
+ subLayoutsInfo: _propTypes2.default.object
217
219
  };
218
220
 
219
221
  exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(PanelViewer));
@@ -20,13 +20,7 @@ var _reactRedux = require('react-redux');
20
20
 
21
21
  var _redux = require('redux');
22
22
 
23
- var _ExpansionPanel = require('@material-ui/core/ExpansionPanel');
24
-
25
- var _ExpansionPanel2 = _interopRequireDefault(_ExpansionPanel);
26
-
27
- var _ExpansionPanelSummary = require('@material-ui/core/ExpansionPanelSummary');
28
-
29
- var _ExpansionPanelSummary2 = _interopRequireDefault(_ExpansionPanelSummary);
23
+ var _core = require('@material-ui/core');
30
24
 
31
25
  var _ExpandMore = require('@material-ui/icons/ExpandMore');
32
26
 
@@ -66,6 +60,8 @@ var _HighlightOff2 = _interopRequireDefault(_HighlightOff);
66
60
 
67
61
  var _styles = require('@material-ui/core/styles');
68
62
 
63
+ var _chem = require('../../helpers/chem');
64
+
69
65
  var _edit_peak = require('../../actions/edit_peak');
70
66
 
71
67
  var _format = require('../../helpers/format');
@@ -227,22 +223,44 @@ var PeakPanel = function PeakPanel(_ref) {
227
223
  expand = _ref.expand,
228
224
  onExapnd = _ref.onExapnd,
229
225
  rmFromPosListAct = _ref.rmFromPosListAct,
230
- rmFromNegListAct = _ref.rmFromNegListAct;
231
- var neg = editPeakSt.neg,
232
- pos = editPeakSt.pos;
226
+ rmFromNegListAct = _ref.rmFromNegListAct,
227
+ curveSt = _ref.curveSt;
228
+ var curveIdx = curveSt.curveIdx,
229
+ listCurves = curveSt.listCurves;
230
+ var peaks = editPeakSt.peaks;
231
+
232
+ if (curveIdx >= peaks.length) {
233
+ return null;
234
+ }
235
+ var selectedEditPeaks = peaks[curveIdx];
236
+ if (!selectedEditPeaks) {
237
+ return null;
238
+ }
239
+ var pos = selectedEditPeaks.pos;
240
+
241
+
242
+ var selectedCurve = listCurves[curveIdx];
243
+ if (!selectedCurve) {
244
+ return null;
245
+ }
246
+ var feature = selectedCurve.feature;
247
+
248
+ var currentPeakOfCurve = (0, _chem.Convert2Peak)(feature);
249
+
250
+ var peaksData = [].concat(currentPeakOfCurve).concat(pos);
233
251
 
234
252
  var digits = _format2.default.isEmWaveLayout(layoutSt) ? 0 : 4;
235
253
 
236
254
  return _react2.default.createElement(
237
- _ExpansionPanel2.default,
238
- {
255
+ _core.Accordion,
256
+ { 'data-testid': 'PeaksPanelInfo',
239
257
  expanded: expand,
240
258
  onChange: onExapnd,
241
259
  className: (0, _classnames2.default)(classes.panel),
242
260
  TransitionProps: { unmountOnExit: true } // increase ExpansionPanel performance
243
261
  },
244
262
  _react2.default.createElement(
245
- _ExpansionPanelSummary2.default,
263
+ _core.AccordionSummary,
246
264
  {
247
265
  expandIcon: _react2.default.createElement(_ExpandMore2.default, null),
248
266
  className: (0, _classnames2.default)(classes.panelSummary)
@@ -261,8 +279,7 @@ var PeakPanel = function PeakPanel(_ref) {
261
279
  _react2.default.createElement(
262
280
  'div',
263
281
  { className: (0, _classnames2.default)(classes.panelDetail) },
264
- peakList(pos, digits, rmFromPosListAct, classes, true),
265
- peakList(neg, digits, rmFromNegListAct, classes, false)
282
+ peakList(peaksData, digits, rmFromPosListAct, classes, true)
266
283
  )
267
284
  );
268
285
  };
@@ -271,7 +288,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
271
288
  return (// eslint-disable-line
272
289
  {
273
290
  editPeakSt: state.editPeak.present,
274
- layoutSt: state.layout
291
+ layoutSt: state.layout,
292
+ curveSt: state.curve
275
293
  }
276
294
  );
277
295
  };
@@ -290,7 +308,8 @@ PeakPanel.propTypes = {
290
308
  layoutSt: _propTypes2.default.string.isRequired,
291
309
  onExapnd: _propTypes2.default.func.isRequired,
292
310
  rmFromPosListAct: _propTypes2.default.func.isRequired,
293
- rmFromNegListAct: _propTypes2.default.func.isRequired
311
+ rmFromNegListAct: _propTypes2.default.func.isRequired,
312
+ curveSt: _propTypes2.default.object.isRequired
294
313
  };
295
314
 
296
315
  exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(PeakPanel));
@@ -18,7 +18,8 @@ var LIST_LAYOUT = {
18
18
  TGA: 'THERMOGRAVIMETRIC ANALYSIS',
19
19
  XRD: 'X-RAY DIFFRACTION',
20
20
  HPLC_UVVIS: 'HPLC UV/VIS',
21
- CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY'
21
+ CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY',
22
+ SEC: 'SIZE EXCLUSION CHROMATOGRAPHY'
22
23
  };
23
24
 
24
25
  exports.LIST_LAYOUT = LIST_LAYOUT;
@@ -54,7 +54,7 @@ var btnCmdThres = function btnCmdThres(thresVal) {
54
54
 
55
55
  // const hidePanelPeak = layoutSt => Format.isMsLayout(layoutSt);
56
56
  var hidePanelPeak = function hidePanelPeak(layoutSt) {
57
- return true;
57
+ return !_format2.default.isSECLayout(layoutSt);
58
58
  }; // eslint-disable-line
59
59
 
60
60
  var hidePanelMpy = function hidePanelMpy(layoutSt) {
@@ -155,10 +155,12 @@ var Convert2Peak = function Convert2Peak(feature, threshold, offset) {
155
155
  thresRef = feature.thresRef,
156
156
  minY = feature.minY,
157
157
  upperThres = feature.upperThres,
158
- lowerThres = feature.lowerThres;
158
+ lowerThres = feature.lowerThres,
159
+ operation = feature.operation;
160
+ var layout = operation.layout;
159
161
 
160
162
 
161
- if (upperThres || lowerThres) {
163
+ if (!_format2.default.isSECLayout(layout) && (upperThres || lowerThres)) {
162
164
  var upperThresVal = upThreshold || upperThres;
163
165
  if (!upperThresVal) {
164
166
  upperThresVal = 1.0;
@@ -185,7 +187,7 @@ var Convert2Peak = function Convert2Peak(feature, threshold, offset) {
185
187
  return peak;
186
188
  } else {
187
189
  var thresVal = threshold || thresRef;
188
- var yThres = thresVal * maxY / 100.0;
190
+ var yThres = Number.parseFloat((thresVal * maxY / 100.0).toFixed(10));
189
191
  var _corrOffset = offset || 0.0;
190
192
  for (var _i = 0; _i < data.y.length; _i += 1) {
191
193
  var _y = data.y[_i];
@@ -333,6 +335,9 @@ var readLayout = function readLayout(jcamp) {
333
335
  if (dataType.includes('CYCLIC VOLTAMMETRY')) {
334
336
  return _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY;
335
337
  }
338
+ if (dataType.includes('SIZE EXCLUSION CHROMATOGRAPHY')) {
339
+ return _list_layout.LIST_LAYOUT.SEC;
340
+ }
336
341
  }
337
342
  return false;
338
343
  };
@@ -758,7 +763,7 @@ var ExtractJcamp = function ExtractJcamp(source) {
758
763
  features = extrFeaturesMs(jcamp, layout, peakUp);
759
764
  } else if (_format2.default.isXRDLayout(layout)) {
760
765
  features = extrFeaturesXrd(jcamp, layout, peakUp);
761
- } else if (_format2.default.isCyclicVoltaLayout(layout)) {
766
+ } else if (_format2.default.isCyclicVoltaLayout(layout) || _format2.default.isSECLayout(layout)) {
762
767
  features = extrFeaturesCylicVolta(jcamp, layout, peakUp);
763
768
  } else {
764
769
  features = extrFeaturesNi(jcamp, layout, peakUp, spectra);
@@ -30,9 +30,16 @@ var pksRmNeg = function pksRmNeg(dataPks, editPeakSt) {
30
30
  peaks = editPeakSt.peaks;
31
31
 
32
32
  var selectedEditPeaks = peaks[selectedIdx];
33
+ if (!selectedEditPeaks) {
34
+ return dataPks;
35
+ }
33
36
 
34
37
  var neg = selectedEditPeaks.neg;
35
38
 
39
+ if (!neg) {
40
+ return dataPks;
41
+ }
42
+
36
43
  var negXs = neg.map(function (n) {
37
44
  return n.x;
38
45
  });
@@ -52,9 +59,16 @@ var pksAddPos = function pksAddPos(dataPks, editPeakSt) {
52
59
  peaks = editPeakSt.peaks;
53
60
 
54
61
  var selectedEditPeaks = peaks[selectedIdx];
62
+ if (!selectedEditPeaks) {
63
+ return dataPks;
64
+ }
55
65
 
56
66
  var pos = selectedEditPeaks.pos;
57
67
 
68
+ if (!pos) {
69
+ return dataPks;
70
+ }
71
+
58
72
  var posXs = pos.map(function (p) {
59
73
  return p.x;
60
74
  });
@@ -25,6 +25,7 @@ var spectraDigit = function spectraDigit(layout) {
25
25
  case _list_layout.LIST_LAYOUT.TGA:
26
26
  case _list_layout.LIST_LAYOUT.XRD:
27
27
  case _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY:
28
+ case _list_layout.LIST_LAYOUT.SEC:
28
29
  case _list_layout.LIST_LAYOUT.MS:
29
30
  return 0;
30
31
  case _list_layout.LIST_LAYOUT.C13:
@@ -63,9 +64,10 @@ var toPeakStr = function toPeakStr(peaks) {
63
64
  return str;
64
65
  };
65
66
 
66
- var spectraOps = (_spectraOps = {}, _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.PLAIN, { head: '', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.H1, { head: '1H', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.C13, { head: '13C', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.F19, { head: '19F', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.P31, { head: '31P', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.N15, { head: '15N', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.Si29, { head: '29Si', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.IR, { head: 'IR', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.RAMAN, { head: 'RAMAN', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.UVVIS, { head: 'UV-VIS (absorption, solvent), λmax', tail: ' nm' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.HPLC_UVVIS, { head: 'HPLC UV/VIS (transmittance)', tail: '' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.TGA, { head: 'THERMOGRAVIMETRIC ANALYSIS', tail: ' SECONDS' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.MS, { head: 'MASS', tail: ' m/z' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.XRD, { head: 'X-RAY DIFFRACTION', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, { head: 'CYCLIC VOLTAMMETRY', tail: '.' }), _spectraOps);
67
+ var spectraOps = (_spectraOps = {}, _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.PLAIN, { head: '', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.H1, { head: '1H', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.C13, { head: '13C', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.F19, { head: '19F', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.P31, { head: '31P', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.N15, { head: '15N', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.Si29, { head: '29Si', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.IR, { head: 'IR', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.RAMAN, { head: 'RAMAN', tail: ' cm-1' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.UVVIS, { head: 'UV-VIS (absorption, solvent), λmax', tail: ' nm' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.HPLC_UVVIS, { head: 'HPLC UV/VIS (transmittance)', tail: '' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.TGA, { head: 'THERMOGRAVIMETRIC ANALYSIS', tail: ' SECONDS' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.MS, { head: 'MASS', tail: ' m/z' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.XRD, { head: 'X-RAY DIFFRACTION', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, { head: 'CYCLIC VOLTAMMETRY', tail: '.' }), _defineProperty(_spectraOps, _list_layout.LIST_LAYOUT.SEC, { head: 'SIZE EXCLUSION CHROMATOGRAPHY', tail: '.' }), _spectraOps);
67
68
 
68
69
  var rmRef = function rmRef(peaks, shift) {
70
+ if (!shift) return peaks;
69
71
  var refValue = shift.ref.value || shift.peak.x;
70
72
  return peaks.map(function (p) {
71
73
  return (0, _converter.IsSame)(p.x, refValue) ? null : p;
@@ -299,6 +301,9 @@ var peaksBody = function peaksBody(_ref) {
299
301
  if (layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY) {
300
302
  return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
301
303
  }
304
+ if (layout === _list_layout.LIST_LAYOUT.SEC) {
305
+ return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
306
+ }
302
307
  return ordered.map(function (o) {
303
308
  return fixDigit(o.x, decimal);
304
309
  }).join(', ');
@@ -363,6 +368,9 @@ var isXRDLayout = function isXRDLayout(layoutSt) {
363
368
  var isCyclicVoltaLayout = function isCyclicVoltaLayout(layoutSt) {
364
369
  return _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt;
365
370
  };
371
+ var isSECLayout = function isSECLayout(layoutSt) {
372
+ return _list_layout.LIST_LAYOUT.SEC === layoutSt;
373
+ };
366
374
  var isEmWaveLayout = function isEmWaveLayout(layoutSt) {
367
375
  return [_list_layout.LIST_LAYOUT.IR, _list_layout.LIST_LAYOUT.RAMAN, _list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS].indexOf(layoutSt) >= 0;
368
376
  };
@@ -453,6 +461,7 @@ var Format = {
453
461
  isTGALayout: isTGALayout,
454
462
  isXRDLayout: isXRDLayout,
455
463
  isCyclicVoltaLayout: isCyclicVoltaLayout,
464
+ isSECLayout: isSECLayout,
456
465
  isEmWaveLayout: isEmWaveLayout,
457
466
  fixDigit: fixDigit,
458
467
  formatPeaksByPrediction: formatPeaksByPrediction,
package/dist/index.js CHANGED
@@ -134,6 +134,22 @@ var _cyclic_voltammetry_5 = require('./__tests__/fixtures/cyclic_voltammetry_3')
134
134
 
135
135
  var _cyclic_voltammetry_6 = _interopRequireDefault(_cyclic_voltammetry_5);
136
136
 
137
+ var _sec_1_jcamp = require('./__tests__/fixtures/sec_1_jcamp');
138
+
139
+ var _sec_1_jcamp2 = _interopRequireDefault(_sec_1_jcamp);
140
+
141
+ var _sec_2_jcamp = require('./__tests__/fixtures/sec_2_jcamp');
142
+
143
+ var _sec_2_jcamp2 = _interopRequireDefault(_sec_2_jcamp);
144
+
145
+ var _sec_3_jcamp = require('./__tests__/fixtures/sec_3_jcamp');
146
+
147
+ var _sec_3_jcamp2 = _interopRequireDefault(_sec_3_jcamp);
148
+
149
+ var _sec_4_jcamp = require('./__tests__/fixtures/sec_4_jcamp');
150
+
151
+ var _sec_4_jcamp2 = _interopRequireDefault(_sec_4_jcamp);
152
+
137
153
  var _qDescValue = require('./__tests__/fixtures/qDescValue');
138
154
 
139
155
  require('./__tests__/style/svg.css');
@@ -171,6 +187,10 @@ var xrdEntity2 = _app.FN.ExtractJcamp(_xrd_jcamp_4.default);
171
187
  var cyclicVoltaEntity1 = _app.FN.ExtractJcamp(_cyclic_voltammetry_2.default);
172
188
  var cyclicVoltaEntity2 = _app.FN.ExtractJcamp(_cyclic_voltammetry_4.default);
173
189
  var cyclicVoltaEntity3 = _app.FN.ExtractJcamp(_cyclic_voltammetry_6.default);
190
+ var secEntity1 = _app.FN.ExtractJcamp(_sec_1_jcamp2.default);
191
+ var secEntity2 = _app.FN.ExtractJcamp(_sec_2_jcamp2.default);
192
+ var secEntity3 = _app.FN.ExtractJcamp(_sec_3_jcamp2.default);
193
+ var secEntity4 = _app.FN.ExtractJcamp(_sec_4_jcamp2.default);
174
194
 
175
195
  var DemoWriteIr = function (_React$Component) {
176
196
  _inherits(DemoWriteIr, _React$Component);
@@ -466,6 +486,8 @@ var DemoWriteIr = function (_React$Component) {
466
486
  return xrdEntity1;
467
487
  case 'cyclic volta':
468
488
  return cyclicVoltaEntity2;
489
+ case 'sec':
490
+ return secEntity1;
469
491
  case 'ms':
470
492
  default:
471
493
  return msEntity;
@@ -487,6 +509,8 @@ var DemoWriteIr = function (_React$Component) {
487
509
  return [compIr1Entity, compIr2Entity];
488
510
  case 'multi xrd':
489
511
  return [xrdEntity1, xrdEntity2];
512
+ case 'sec':
513
+ return [secEntity1, secEntity2, secEntity3, secEntity4];
490
514
  default:
491
515
  return false;
492
516
  }
@@ -516,6 +540,7 @@ var DemoWriteIr = function (_React$Component) {
516
540
  case 'xrd':
517
541
  case 'ms':
518
542
  case 'cyclic volta':
543
+ case 'sec':
519
544
  default:
520
545
  return false;
521
546
  }
@@ -715,6 +740,15 @@ var DemoWriteIr = function (_React$Component) {
715
740
  },
716
741
  'CV'
717
742
  ),
743
+ _react2.default.createElement(
744
+ _Button2.default,
745
+ {
746
+ variant: 'contained',
747
+ style: { margin: '0 10px 0 10px' },
748
+ onClick: this.onClick('sec')
749
+ },
750
+ 'SEC'
751
+ ),
718
752
  _react2.default.createElement(
719
753
  _Button2.default,
720
754
  {
@@ -35,7 +35,7 @@ var setAllCurves = function setAllCurves(state, action) {
35
35
  var layout = entity.layout;
36
36
  var maxminPeak = (0, _chem.Convert2MaxMinPeak)(layout, feature, 0);
37
37
  var color = _format2.default.mutiEntitiesColors(idx);
38
- return { layout: layout, topic: topic, feature: feature, hasEdit: hasEdit, integration: integration, maxminPeak: maxminPeak, color: color };
38
+ return { layout: layout, topic: topic, feature: feature, hasEdit: hasEdit, integration: integration, maxminPeak: maxminPeak, color: color, curveIdx: idx };
39
39
  });
40
40
 
41
41
  return Object.assign({}, state, { curveIdx: 0, listCurves: entities });
@@ -214,277 +214,283 @@ var getUiSweepType = function getUiSweepType(state) {
214
214
  };
215
215
 
216
216
  function clickUiTarget(action) {
217
- var payload, onPeak, voltammetryPeakIdx, onPecker, jcampIdx, uiSweepType, xExtent, xL, xU;
217
+ var payload, onPeak, voltammetryPeakIdx, onPecker, uiSweepType, curveSt, curveIdx, xExtent, xL, xU;
218
218
  return regeneratorRuntime.wrap(function clickUiTarget$(_context3) {
219
219
  while (1) {
220
220
  switch (_context3.prev = _context3.next) {
221
221
  case 0:
222
- payload = action.payload, onPeak = action.onPeak, voltammetryPeakIdx = action.voltammetryPeakIdx, onPecker = action.onPecker, jcampIdx = action.jcampIdx;
222
+ payload = action.payload, onPeak = action.onPeak, voltammetryPeakIdx = action.voltammetryPeakIdx, onPecker = action.onPecker;
223
223
  _context3.next = 3;
224
224
  return (0, _effects.select)(getUiSweepType);
225
225
 
226
226
  case 3:
227
227
  uiSweepType = _context3.sent;
228
+ _context3.next = 6;
229
+ return (0, _effects.select)(getCurveSt);
230
+
231
+ case 6:
232
+ curveSt = _context3.sent;
233
+ curveIdx = curveSt.curveIdx;
228
234
 
229
235
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_ADD && !onPeak)) {
230
- _context3.next = 9;
236
+ _context3.next = 13;
231
237
  break;
232
238
  }
233
239
 
234
- _context3.next = 7;
240
+ _context3.next = 11;
235
241
  return (0, _effects.put)({
236
242
  type: _action_type.EDITPEAK.ADD_POSITIVE,
237
- payload: { dataToAdd: payload, curveIdx: jcampIdx }
243
+ payload: { dataToAdd: payload, curveIdx: curveIdx }
238
244
  });
239
245
 
240
- case 7:
241
- _context3.next = 84;
246
+ case 11:
247
+ _context3.next = 88;
242
248
  break;
243
249
 
244
- case 9:
250
+ case 13:
245
251
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_DELETE && onPeak)) {
246
- _context3.next = 14;
252
+ _context3.next = 18;
247
253
  break;
248
254
  }
249
255
 
250
- _context3.next = 12;
256
+ _context3.next = 16;
251
257
  return (0, _effects.put)({
252
258
  type: _action_type.EDITPEAK.ADD_NEGATIVE,
253
- payload: { dataToAdd: payload, curveIdx: jcampIdx }
259
+ payload: { dataToAdd: payload, curveIdx: curveIdx }
254
260
  });
255
261
 
256
- case 12:
257
- _context3.next = 84;
262
+ case 16:
263
+ _context3.next = 88;
258
264
  break;
259
265
 
260
- case 14:
266
+ case 18:
261
267
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.ANCHOR_SHIFT && onPeak)) {
262
- _context3.next = 19;
268
+ _context3.next = 23;
263
269
  break;
264
270
  }
265
271
 
266
- _context3.next = 17;
272
+ _context3.next = 21;
267
273
  return (0, _effects.put)({
268
274
  type: _action_type.SHIFT.SET_PEAK,
269
- payload: { dataToSet: payload, curveIdx: jcampIdx }
275
+ payload: { dataToSet: payload, curveIdx: curveIdx }
270
276
  });
271
277
 
272
- case 17:
273
- _context3.next = 84;
278
+ case 21:
279
+ _context3.next = 88;
274
280
  break;
275
281
 
276
- case 19:
282
+ case 23:
277
283
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_RM && onPeak)) {
278
- _context3.next = 24;
284
+ _context3.next = 28;
279
285
  break;
280
286
  }
281
287
 
282
- _context3.next = 22;
288
+ _context3.next = 26;
283
289
  return (0, _effects.put)({
284
290
  type: _action_type.INTEGRATION.RM_ONE,
285
- payload: { dataToRemove: payload, curveIdx: jcampIdx }
291
+ payload: { dataToRemove: payload, curveIdx: curveIdx }
286
292
  });
287
293
 
288
- case 22:
289
- _context3.next = 84;
294
+ case 26:
295
+ _context3.next = 88;
290
296
  break;
291
297
 
292
- case 24:
298
+ case 28:
293
299
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_RM && onPeak)) {
294
- _context3.next = 29;
300
+ _context3.next = 33;
295
301
  break;
296
302
  }
297
303
 
298
- _context3.next = 27;
304
+ _context3.next = 31;
299
305
  return (0, _effects.put)({
300
306
  type: _action_type.INTEGRATION.RM_ONE,
301
- payload: { dataToRemove: payload, curveIdx: jcampIdx }
307
+ payload: { dataToRemove: payload, curveIdx: curveIdx }
302
308
  });
303
309
 
304
- case 27:
305
- _context3.next = 84;
310
+ case 31:
311
+ _context3.next = 88;
306
312
  break;
307
313
 
308
- case 29:
314
+ case 33:
309
315
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF && onPeak)) {
310
- _context3.next = 34;
316
+ _context3.next = 38;
311
317
  break;
312
318
  }
313
319
 
314
- _context3.next = 32;
320
+ _context3.next = 36;
315
321
  return (0, _effects.put)({
316
322
  type: _action_type.INTEGRATION.SET_REF,
317
- payload: { refData: payload, curveIdx: jcampIdx }
323
+ payload: { refData: payload, curveIdx: curveIdx }
318
324
  });
319
325
 
320
- case 32:
321
- _context3.next = 84;
326
+ case 36:
327
+ _context3.next = 88;
322
328
  break;
323
329
 
324
- case 34:
330
+ case 38:
325
331
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_ONE_CLICK && onPeak)) {
326
- _context3.next = 46;
332
+ _context3.next = 50;
327
333
  break;
328
334
  }
329
335
 
330
336
  xExtent = payload.xExtent, xL = payload.xL, xU = payload.xU;
331
337
 
332
338
  if (!xExtent) {
333
- _context3.next = 41;
339
+ _context3.next = 45;
334
340
  break;
335
341
  }
336
342
 
337
- _context3.next = 39;
343
+ _context3.next = 43;
338
344
  return (0, _effects.put)({
339
345
  type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
340
- payload: { payloadData: xExtent, curveIdx: jcampIdx }
346
+ payload: { payloadData: xExtent, curveIdx: curveIdx }
341
347
  });
342
348
 
343
- case 39:
344
- _context3.next = 44;
349
+ case 43:
350
+ _context3.next = 48;
345
351
  break;
346
352
 
347
- case 41:
353
+ case 45:
348
354
  if (!(xL && xU)) {
349
- _context3.next = 44;
355
+ _context3.next = 48;
350
356
  break;
351
357
  }
352
358
 
353
- _context3.next = 44;
359
+ _context3.next = 48;
354
360
  return (0, _effects.put)({
355
361
  type: _action_type.MULTIPLICITY.ONE_CLICK_BY_UI,
356
- payload: { payloadData: { xL: xL, xU: xU }, curveIdx: jcampIdx }
362
+ payload: { payloadData: { xL: xL, xU: xU }, curveIdx: curveIdx }
357
363
  });
358
364
 
359
- case 44:
360
- _context3.next = 84;
365
+ case 48:
366
+ _context3.next = 88;
361
367
  break;
362
368
 
363
- case 46:
369
+ case 50:
364
370
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_ADD)) {
365
- _context3.next = 51;
371
+ _context3.next = 55;
366
372
  break;
367
373
  }
368
374
 
369
- _context3.next = 49;
375
+ _context3.next = 53;
370
376
  return (0, _effects.put)({
371
377
  type: _action_type.MULTIPLICITY.PEAK_ADD_BY_UI_SAG,
372
378
  payload: payload
373
379
  });
374
380
 
375
- case 49:
376
- _context3.next = 84;
381
+ case 53:
382
+ _context3.next = 88;
377
383
  break;
378
384
 
379
- case 51:
385
+ case 55:
380
386
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.MULTIPLICITY_PEAK_RM && onPeak)) {
381
- _context3.next = 56;
387
+ _context3.next = 60;
382
388
  break;
383
389
  }
384
390
 
385
- _context3.next = 54;
391
+ _context3.next = 58;
386
392
  return (0, _effects.put)({
387
393
  type: _action_type.MULTIPLICITY.PEAK_RM_BY_UI,
388
394
  payload: payload
389
395
  });
390
396
 
391
- case 54:
392
- _context3.next = 84;
397
+ case 58:
398
+ _context3.next = 88;
393
399
  break;
394
400
 
395
- case 56:
401
+ case 60:
396
402
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MAX_PEAK && !onPeak)) {
397
- _context3.next = 61;
403
+ _context3.next = 65;
398
404
  break;
399
405
  }
400
406
 
401
- _context3.next = 59;
407
+ _context3.next = 63;
402
408
  return (0, _effects.put)({
403
409
  type: _action_type.CYCLIC_VOLTA_METRY.ADD_MAX_PEAK,
404
- payload: { peak: payload, index: voltammetryPeakIdx, jcampIdx: jcampIdx }
410
+ payload: { peak: payload, index: voltammetryPeakIdx, jcampIdx: curveIdx }
405
411
  });
406
412
 
407
- case 59:
408
- _context3.next = 84;
413
+ case 63:
414
+ _context3.next = 88;
409
415
  break;
410
416
 
411
- case 61:
417
+ case 65:
412
418
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MAX_PEAK && onPeak)) {
413
- _context3.next = 66;
419
+ _context3.next = 70;
414
420
  break;
415
421
  }
416
422
 
417
- _context3.next = 64;
423
+ _context3.next = 68;
418
424
  return (0, _effects.put)({
419
425
  type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_MAX_PEAK,
420
- payload: { index: voltammetryPeakIdx, jcampIdx: jcampIdx }
426
+ payload: { index: voltammetryPeakIdx, jcampIdx: curveIdx }
421
427
  });
422
428
 
423
- case 64:
424
- _context3.next = 84;
429
+ case 68:
430
+ _context3.next = 88;
425
431
  break;
426
432
 
427
- case 66:
433
+ case 70:
428
434
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_MIN_PEAK && !onPeak)) {
429
- _context3.next = 71;
435
+ _context3.next = 75;
430
436
  break;
431
437
  }
432
438
 
433
- _context3.next = 69;
439
+ _context3.next = 73;
434
440
  return (0, _effects.put)({
435
441
  type: _action_type.CYCLIC_VOLTA_METRY.ADD_MIN_PEAK,
436
- payload: { peak: payload, index: voltammetryPeakIdx, jcampIdx: jcampIdx }
442
+ payload: { peak: payload, index: voltammetryPeakIdx, jcampIdx: curveIdx }
437
443
  });
438
444
 
439
- case 69:
440
- _context3.next = 84;
445
+ case 73:
446
+ _context3.next = 88;
441
447
  break;
442
448
 
443
- case 71:
449
+ case 75:
444
450
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_MIN_PEAK && onPeak)) {
445
- _context3.next = 76;
451
+ _context3.next = 80;
446
452
  break;
447
453
  }
448
454
 
449
- _context3.next = 74;
455
+ _context3.next = 78;
450
456
  return (0, _effects.put)({
451
457
  type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_MIN_PEAK,
452
- payload: { index: voltammetryPeakIdx, jcampIdx: jcampIdx }
458
+ payload: { index: voltammetryPeakIdx, jcampIdx: curveIdx }
453
459
  });
454
460
 
455
- case 74:
456
- _context3.next = 84;
461
+ case 78:
462
+ _context3.next = 88;
457
463
  break;
458
464
 
459
- case 76:
465
+ case 80:
460
466
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_ADD_PECKER && !onPecker)) {
461
- _context3.next = 81;
467
+ _context3.next = 85;
462
468
  break;
463
469
  }
464
470
 
465
- _context3.next = 79;
471
+ _context3.next = 83;
466
472
  return (0, _effects.put)({
467
473
  type: _action_type.CYCLIC_VOLTA_METRY.ADD_PECKER,
468
- payload: { peak: payload, index: voltammetryPeakIdx, jcampIdx: jcampIdx }
474
+ payload: { peak: payload, index: voltammetryPeakIdx, jcampIdx: curveIdx }
469
475
  });
470
476
 
471
- case 79:
472
- _context3.next = 84;
477
+ case 83:
478
+ _context3.next = 88;
473
479
  break;
474
480
 
475
- case 81:
481
+ case 85:
476
482
  if (!(uiSweepType === _list_ui.LIST_UI_SWEEP_TYPE.CYCLIC_VOLTA_RM_PECKER && onPecker)) {
477
- _context3.next = 84;
483
+ _context3.next = 88;
478
484
  break;
479
485
  }
480
486
 
481
- _context3.next = 84;
487
+ _context3.next = 88;
482
488
  return (0, _effects.put)({
483
489
  type: _action_type.CYCLIC_VOLTA_METRY.REMOVE_PECKER,
484
- payload: { index: voltammetryPeakIdx, jcampIdx: jcampIdx }
490
+ payload: { index: voltammetryPeakIdx, jcampIdx: curveIdx }
485
491
  });
486
492
 
487
- case 84:
493
+ case 88:
488
494
  case 'end':
489
495
  return _context3.stop();
490
496
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complat/react-spectra-editor",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,6 +13,12 @@
13
13
  "@material-ui/icons": "^4.10.0",
14
14
  "@mdi/js": "^4.7.95",
15
15
  "@mdi/react": "^1.2.1",
16
+ "@testing-library/jest-dom": "^5.16.5",
17
+ "@testing-library/react": "12.1.5",
18
+ "@types/jest": "^29.5.0",
19
+ "@types/node": "^18.15.11",
20
+ "@types/react": "^18.0.34",
21
+ "@types/react-dom": "^18.0.11",
16
22
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
17
23
  "babel-preset-env": "^1.7.0",
18
24
  "babel-preset-react": "^6.24.1",
@@ -34,13 +40,15 @@
34
40
  "redux-saga": "^1.1.3",
35
41
  "redux-undo": "^1.0.1",
36
42
  "regenerator-transform": "^0.13.3",
37
- "reselect": "^4.0.0"
43
+ "reselect": "^4.0.0",
44
+ "typescript": "^5.0.4"
38
45
  },
39
46
  "scripts": {
40
47
  "start": "react-scripts start",
41
48
  "build": "react-scripts build",
42
49
  "compile": "rm -rf dist && NODE_ENV=production babel --ignore tests,stories ./src --out-dir ./dist",
43
50
  "test": "react-scripts test --env=jsdom --verbose --testPathIgnorePatterns=./src/__tests__/fixtures/",
51
+ "test:coverage": "CI=true react-scripts test --env=jsdom --verbose --testPathIgnorePatterns=./src/__tests__/fixtures/ --coverage",
44
52
  "eject": "react-scripts eject",
45
53
  "storybook": "start-storybook -p 3001 -c .storybook",
46
54
  "buildbook": "build-storybook -c .storybook -o .out"
@@ -50,7 +58,7 @@
50
58
  "react-dom": "^17.0.2"
51
59
  },
52
60
  "devDependencies": {
53
- "@storybook/react": "^5.0.0",
61
+ "@storybook/react": "6.1.0",
54
62
  "babel-cli": "^6.26.0",
55
63
  "babel-core": "^6.26.3",
56
64
  "eslint-config-airbnb": "^19.0.4",
@@ -62,7 +70,8 @@
62
70
  "react-dom": "^17.0.2",
63
71
  "react-scripts": "^2.1.1",
64
72
  "react-select": "^4.0.0",
65
- "redux-logger": "^3.0.6"
73
+ "redux-logger": "^3.0.6",
74
+ "redux-mock-store": "^1.5.4"
66
75
  },
67
76
  "main": "dist/app.js",
68
77
  "module": "dist/app.js",