@complat/react-spectra-editor 1.0.0-rc15 → 1.0.0-rc16

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.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  An editor to View and Edit Chemical Spectra data (NMR, IR and MS).
4
4
 
5
+ ![Testing](https://github.com/ComPlat/react-spectra-editor/actions/workflows/testing.yml/badge.svg)
6
+
5
7
  ### Usage
6
8
 
7
9
  #### Installing from npm
@@ -160,7 +160,7 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => {
160
160
  value: _list_layout.LIST_LAYOUT.AIF
161
161
  }, /*#__PURE__*/_react.default.createElement("span", {
162
162
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
163
- }, "AIF")), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
163
+ }, "SOPTION-DESORPTION")), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
164
164
  value: _list_layout.LIST_LAYOUT.EMISSIONS
165
165
  }, /*#__PURE__*/_react.default.createElement("span", {
166
166
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
@@ -169,10 +169,12 @@ const BtnPredict = _ref => {
169
169
  realCount = (0, _carbonFeatures.carbonFeatures)(peaksEdit, multiplicitySt).length;
170
170
  } else {
171
171
  const {
172
- selectedIdx,
172
+ curveIdx
173
+ } = curveSt;
174
+ const {
173
175
  multiplicities
174
176
  } = multiplicitySt;
175
- const selectedMultiplicity = multiplicities[selectedIdx];
177
+ const selectedMultiplicity = multiplicities[curveIdx];
176
178
  const {
177
179
  stack
178
180
  } = selectedMultiplicity;
@@ -199,7 +199,7 @@ const InfoPanel = _ref => {
199
199
  className: (0, _classnames.default)(classes.tTxt, classes.tHead, 'txt-sv-panel-txt')
200
200
  }, "Area under curve (AUC):"), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("span", {
201
201
  className: (0, _classnames.default)(classes.tTxt, classes.tTxtSim, 'txt-sv-panel-txt')
202
- }, aucValue(integration))) : null), /*#__PURE__*/_react.default.createElement(_reactQuill.default, {
202
+ }, aucValue(integration))) : null), !_format.default.isCyclicVoltaLayout(layoutSt) ? /*#__PURE__*/_react.default.createElement(_reactQuill.default, {
203
203
  className: (0, _classnames.default)(classes.quill, 'card-sv-quill'),
204
204
  value: descriptions,
205
205
  modules: {
@@ -207,7 +207,7 @@ const InfoPanel = _ref => {
207
207
  },
208
208
  onChange: onDescriptionChanged,
209
209
  readOnly: canChangeDescription !== undefined ? !canChangeDescription : true
210
- }), /*#__PURE__*/_react.default.createElement("div", null, !editorOnly && _format.default.isNmrLayout(layoutSt) ? /*#__PURE__*/_react.default.createElement("div", {
210
+ }) : null, /*#__PURE__*/_react.default.createElement("div", null, !editorOnly && _format.default.isNmrLayout(layoutSt) ? /*#__PURE__*/_react.default.createElement("div", {
211
211
  className: (0, _classnames.default)(classes.rowRoot, classes.rowOddSim)
212
212
  }, /*#__PURE__*/_react.default.createElement("span", {
213
213
  className: (0, _classnames.default)(classes.tTxt, classes.tHead, 'txt-sv-panel-txt')
@@ -205,7 +205,11 @@ const mpyList = (classes, digits, multiplicitySt, curveSt, clickMpyOneAct, rmMpy
205
205
  const onClick = e => {
206
206
  e.stopPropagation();
207
207
  e.preventDefault();
208
- clickMpyOneAct(xExtent);
208
+ const payload = {
209
+ curveIdx,
210
+ payloadData: xExtent
211
+ };
212
+ clickMpyOneAct(payload);
209
213
  };
210
214
  return createData(idx, xExtent, peaks, shift, smExtext, mpyType, js, onClick, onRefresh);
211
215
  });
package/dist/index.js CHANGED
@@ -640,7 +640,7 @@ class DemoWriteIr extends _react.default.Component {
640
640
  margin: '0 10px 0 10px'
641
641
  },
642
642
  onClick: this.onClick('aif')
643
- }, "AIF"), /*#__PURE__*/_react.default.createElement(_Button.default, {
643
+ }, "SOPTION-DESORPTION"), /*#__PURE__*/_react.default.createElement(_Button.default, {
644
644
  variant: "contained",
645
645
  style: {
646
646
  margin: '0 10px 0 10px'
@@ -48,9 +48,10 @@ const addToPos = (state, action) => {
48
48
  const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
49
49
  neg
50
50
  });
51
- peaks[curveIdx] = newSelectedEditPeaks;
51
+ const newPeaks = [...peaks];
52
+ newPeaks[curveIdx] = newSelectedEditPeaks;
52
53
  return Object.assign({}, state, {
53
- peaks
54
+ peaks: newPeaks
54
55
  });
55
56
  }
56
57
  const idxP = oriPosState.findIndex(p => (0, _calc.almostEqual)(p.x, dataToAdd.x));
@@ -60,9 +61,10 @@ const addToPos = (state, action) => {
60
61
  const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
61
62
  pos
62
63
  });
63
- peaks[curveIdx] = newSelectedEditPeaks;
64
+ const newPeaks = [...peaks];
65
+ newPeaks[curveIdx] = newSelectedEditPeaks;
64
66
  return Object.assign({}, state, {
65
- peaks,
67
+ peaks: newPeaks,
66
68
  selectedIdx: curveIdx
67
69
  });
68
70
  }
@@ -80,9 +82,10 @@ const rmFromPos = (state, action) => {
80
82
  const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
81
83
  pos
82
84
  });
83
- peaks[selectedIdx] = newSelectedEditPeaks;
85
+ const newPeaks = [...peaks];
86
+ newPeaks[selectedIdx] = newSelectedEditPeaks;
84
87
  return Object.assign({}, state, {
85
- peaks
88
+ peaks: newPeaks
86
89
  });
87
90
  };
88
91
  const addToNeg = (state, action) => {
@@ -108,9 +111,10 @@ const addToNeg = (state, action) => {
108
111
  const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
109
112
  pos
110
113
  });
111
- peaks[curveIdx] = newSelectedEditPeaks;
114
+ const newPeaks = [...peaks];
115
+ newPeaks[curveIdx] = newSelectedEditPeaks;
112
116
  return Object.assign({}, state, {
113
- peaks
117
+ peaks: newPeaks
114
118
  });
115
119
  }
116
120
  const idxN = oriNegState.findIndex(n => n.x === dataToAdd.x);
@@ -119,9 +123,10 @@ const addToNeg = (state, action) => {
119
123
  const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
120
124
  neg
121
125
  });
122
- peaks[curveIdx] = newSelectedEditPeaks;
126
+ const newPeaks = [...peaks];
127
+ newPeaks[curveIdx] = newSelectedEditPeaks;
123
128
  return Object.assign({}, state, {
124
- peaks,
129
+ peaks: newPeaks,
125
130
  selectedIdx: curveIdx
126
131
  });
127
132
  }
@@ -139,9 +144,10 @@ const rmFromNeg = (state, action) => {
139
144
  const newSelectedEditPeaks = Object.assign({}, selectedEditPeaks, {
140
145
  neg
141
146
  });
142
- peaks[selectedIdx] = newSelectedEditPeaks;
147
+ const newPeaks = [...peaks];
148
+ newPeaks[selectedIdx] = newSelectedEditPeaks;
143
149
  return Object.assign({}, state, {
144
- peaks
150
+ peaks: newPeaks
145
151
  });
146
152
  };
147
153
  const processShift = (state, action) => {
@@ -168,9 +174,10 @@ const processShift = (state, action) => {
168
174
  neg,
169
175
  prevOffset
170
176
  });
171
- peaks[curveIdx] = newSelectedEditPeaks;
177
+ const newPeaks = [...peaks];
178
+ newPeaks[curveIdx] = newSelectedEditPeaks;
172
179
  return Object.assign({}, state, {
173
- peaks
180
+ peaks: newPeaks
174
181
  });
175
182
  };
176
183
  const editPeakReducer = function () {
@@ -69,9 +69,10 @@ const addToStack = (state, action) => {
69
69
  stack: newStack,
70
70
  refArea: defaultRefArea
71
71
  });
72
- integrations[curveIdx] = newIntegration;
72
+ const newArrIntegration = [...integrations];
73
+ newArrIntegration[curveIdx] = newIntegration;
73
74
  return Object.assign({}, state, {
74
- integrations,
75
+ integrations: newArrIntegration,
75
76
  selectedIdx: curveIdx
76
77
  });
77
78
  };
@@ -106,9 +107,10 @@ const rmFromStack = (state, action) => {
106
107
  const newIntegration = Object.assign({}, selectedIntegration, {
107
108
  stack: newStack
108
109
  });
109
- integrations[curveIdx] = newIntegration;
110
+ const newArrIntegration = [...integrations];
111
+ newArrIntegration[curveIdx] = newIntegration;
110
112
  return Object.assign({}, state, {
111
- integrations,
113
+ integrations: newArrIntegration,
112
114
  selectedIdx: curveIdx
113
115
  });
114
116
  };
@@ -136,9 +138,10 @@ const setRef = (state, action) => {
136
138
  const newIntegration = Object.assign({}, selectedIntegration, {
137
139
  refArea
138
140
  });
139
- integrations[curveIdx] = newIntegration;
141
+ const newArrIntegration = [...integrations];
142
+ newArrIntegration[curveIdx] = newIntegration;
140
143
  return Object.assign({}, state, {
141
- integrations,
144
+ integrations: newArrIntegration,
142
145
  selectedIdx: curveIdx
143
146
  });
144
147
  };
@@ -159,9 +162,10 @@ const setFkr = (state, action) => {
159
162
  const newIntegration = Object.assign({}, selectedIntegration, {
160
163
  refFactor
161
164
  });
162
- integrations[curveIdx] = newIntegration;
165
+ const newArrIntegration = [...integrations];
166
+ newArrIntegration[curveIdx] = newIntegration;
163
167
  return Object.assign({}, state, {
164
- integrations
168
+ integrations: newArrIntegration
165
169
  });
166
170
  };
167
171
  const setShift = (state, action) => {
@@ -174,9 +178,10 @@ const setShift = (state, action) => {
174
178
  const newIntegration = Object.assign({}, selectedIntegration, {
175
179
  shift
176
180
  });
177
- integrations[selectedIdx] = newIntegration;
181
+ const newArrIntegration = [...integrations];
182
+ newArrIntegration[selectedIdx] = newIntegration;
178
183
  return Object.assign({}, state, {
179
- integrations
184
+ integrations: newArrIntegration
180
185
  });
181
186
  };
182
187
  const resetAll = (state, action) => {
@@ -196,9 +201,10 @@ const clearAll = (state, action) => {
196
201
  const newIntegration = Object.assign({}, defaultEmptyIntegration, {
197
202
  edited: true
198
203
  });
199
- integrations[curveIdx] = newIntegration;
204
+ const newArrIntegration = [...integrations];
205
+ newArrIntegration[curveIdx] = newIntegration;
200
206
  return Object.assign({}, state, {
201
- integrations,
207
+ integrations: newArrIntegration,
202
208
  selectedIdx: curveIdx
203
209
  });
204
210
  };
@@ -35,9 +35,10 @@ const setShift = (state, action) => {
35
35
  const newSelectedMulti = Object.assign({}, selectedMulti, {
36
36
  shift
37
37
  });
38
- multiplicities[selectedIdx] = newSelectedMulti;
38
+ const newMultiplicities = [...multiplicities];
39
+ newMultiplicities[selectedIdx] = newSelectedMulti;
39
40
  return Object.assign({}, state, {
40
- multiplicities
41
+ multiplicities: newMultiplicities
41
42
  });
42
43
  };
43
44
  const rmFromStack = (state, action) => {
@@ -76,9 +77,10 @@ const rmFromStack = (state, action) => {
76
77
  stack: newStack,
77
78
  smExtext: newSmExtext
78
79
  });
79
- multiplicities[curveIdx] = newSelectedMulti;
80
+ const newMultiplicities = [...multiplicities];
81
+ newMultiplicities[curveIdx] = newSelectedMulti;
80
82
  return Object.assign({}, state, {
81
- multiplicities,
83
+ multiplicities: newMultiplicities,
82
84
  selectedIdx: curveIdx
83
85
  });
84
86
  };
@@ -115,9 +117,10 @@ const updateMpyJ = (state, action) => {
115
117
  const newSelectedMulti = Object.assign({}, selectedMulti, {
116
118
  stack: newStack
117
119
  });
118
- multiplicities[selectedIdx] = newSelectedMulti;
120
+ const newMultiplicities = [...multiplicities];
121
+ newMultiplicities[selectedIdx] = newSelectedMulti;
119
122
  return Object.assign({}, state, {
120
- multiplicities
123
+ multiplicities: newMultiplicities
121
124
  });
122
125
  };
123
126
  const clickMpyOne = (state, action) => {
@@ -135,9 +138,10 @@ const clickMpyOne = (state, action) => {
135
138
  const newSelectedMulti = Object.assign({}, selectedMulti, {
136
139
  smExtext: payloadData
137
140
  });
138
- multiplicities[curveIdx] = newSelectedMulti;
141
+ const newMultiplicities = [...multiplicities];
142
+ newMultiplicities[curveIdx] = newSelectedMulti;
139
143
  return Object.assign({}, state, {
140
- multiplicities,
144
+ multiplicities: newMultiplicities,
141
145
  selectedIdx: curveIdx
142
146
  });
143
147
  };
@@ -154,9 +158,10 @@ const clearAll = (state, action) => {
154
158
  const newSelectedMulti = Object.assign({}, defaultEmptyMultiplicity, {
155
159
  edited: true
156
160
  });
157
- multiplicities[curveIdx] = newSelectedMulti;
161
+ const newMultiplicities = [...multiplicities];
162
+ newMultiplicities[curveIdx] = newSelectedMulti;
158
163
  return Object.assign({}, state, {
159
- multiplicities
164
+ multiplicities: newMultiplicities
160
165
  });
161
166
  };
162
167
  const multiplicityReducer = function () {
@@ -47,9 +47,10 @@ function* resetInitNmr(action) {
47
47
  const {
48
48
  integrations
49
49
  } = integationSt;
50
- integrations[curveIdx] = integration;
50
+ const newArrIntegration = [...integrations];
51
+ newArrIntegration[curveIdx] = integration;
51
52
  const payload = Object.assign({}, integationSt, {
52
- integrations,
53
+ integrations: newArrIntegration,
53
54
  selectedIdx: curveIdx
54
55
  }); // eslint-disable-line
55
56
 
@@ -78,9 +79,10 @@ function* resetInitCommonWithIntergation(action) {
78
79
  const {
79
80
  integrations
80
81
  } = integationSt;
81
- integrations[curveIdx] = integration;
82
+ const newArrIntegration = [...integrations];
83
+ newArrIntegration[curveIdx] = integration;
82
84
  const payload = Object.assign({}, integationSt, {
83
- integrations,
85
+ integrations: newArrIntegration,
84
86
  selectedIdx: curveIdx
85
87
  }); // eslint-disable-line
86
88
 
@@ -72,17 +72,6 @@ function* setCyclicVoltametry(action) {
72
72
  }
73
73
  }
74
74
  }
75
-
76
- // function* setInitData(action) {
77
- // const layoutSt = yield select(getLayoutSt);
78
- // console.log(layoutSt);
79
- // const curveSt = yield select(getCurveSt);
80
- // const { listCurves } = curveSt;
81
- // console.log(listCurves);
82
- // }
83
-
84
- const multiEntitiesSagas = [(0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setCyclicVoltametry)
85
- // takeEvery(CURVE.SET_ALL_CURVES, setInitData),
86
- ];
75
+ const multiEntitiesSagas = [(0, _effects.takeEvery)(_action_type.CURVE.SET_ALL_CURVES, setCyclicVoltametry)];
87
76
  var _default = multiEntitiesSagas;
88
77
  exports.default = _default;
@@ -71,11 +71,12 @@ function* selectMpy(action) {
71
71
  stack: newStack,
72
72
  smExtext: newXExtemt
73
73
  });
74
- multiplicities[curveIdx] = newSelectedMulti;
74
+ const newMultiplicities = [...multiplicities];
75
+ newMultiplicities[curveIdx] = newSelectedMulti;
75
76
  const payload = Object.assign(
76
77
  // eslint-disable-line
77
78
  {}, mpySt, {
78
- multiplicities,
79
+ multiplicities: newMultiplicities,
79
80
  selectedIdx: curveIdx
80
81
  });
81
82
  yield (0, _effects.put)({
@@ -138,9 +139,10 @@ function* addUiPeakToStack(action) {
138
139
  const newSelectedMulti = Object.assign({}, selectedMulti, {
139
140
  stack: newStack
140
141
  }); // eslint-disable-line
141
- multiplicities[curveIdx] = newSelectedMulti;
142
+ const newMultiplicities = [...multiplicities];
143
+ newMultiplicities[curveIdx] = newSelectedMulti;
142
144
  const payload = Object.assign({}, mpySt, {
143
- multiplicities
145
+ multiplicities: newSelectedMulti
144
146
  }); // eslint-disable-line
145
147
 
146
148
  yield (0, _effects.put)({
@@ -193,9 +195,10 @@ const rmPeakFromStack = function (action, metaSt, mpySt) {
193
195
  stack: newStack,
194
196
  smExtext: newSmExtext
195
197
  }); // eslint-disable-line
196
- multiplicities[curveIdx] = newSelectedMulti;
198
+ const newMultiplicities = [...multiplicities];
199
+ newMultiplicities[curveIdx] = newSelectedMulti;
197
200
  return Object.assign({}, mpySt, {
198
- multiplicities
201
+ multiplicities: newMultiplicities
199
202
  }); // eslint-disable-line
200
203
  };
201
204
 
@@ -250,9 +253,10 @@ function* resetInitNmr(action) {
250
253
  const {
251
254
  multiplicities
252
255
  } = mpySt;
253
- multiplicities[curveIdx] = multiplicity;
256
+ const newMultiplicities = [...multiplicities];
257
+ newMultiplicities[curveIdx] = multiplicity;
254
258
  const payload = Object.assign({}, mpySt, {
255
- multiplicities,
259
+ multiplicities: newMultiplicities,
256
260
  selectedIdx: curveIdx
257
261
  }); // eslint-disable-line
258
262
 
@@ -327,9 +331,10 @@ function* resetOne(action) {
327
331
  const newSelectedMulti = Object.assign({}, selectedMulti, {
328
332
  stack: newStack
329
333
  }); // eslint-disable-line
330
- multiplicities[curveIdx] = newSelectedMulti;
334
+ const newMultiplicities = [...multiplicities];
335
+ newMultiplicities[curveIdx] = newSelectedMulti;
331
336
  const payload = Object.assign({}, mpySt, {
332
- multiplicities
337
+ multiplicities: newMultiplicities
333
338
  }); // eslint-disable-line
334
339
  yield (0, _effects.put)({
335
340
  type: _action_type.MULTIPLICITY.RESET_ONE_RDC,
@@ -362,9 +367,10 @@ function* selectMpyType(action) {
362
367
  const newSelectedMulti = Object.assign({}, selectedMulti, {
363
368
  stack: newStack
364
369
  }); // eslint-disable-line
365
- multiplicities[curveIdx] = newSelectedMulti;
370
+ const newMultiplicities = [...multiplicities];
371
+ newMultiplicities[curveIdx] = newSelectedMulti;
366
372
  const payload = Object.assign({}, mpySt, {
367
- multiplicities
373
+ multiplicities: newMultiplicities
368
374
  }); // eslint-disable-line
369
375
 
370
376
  yield (0, _effects.put)({
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  var _enzyme = _interopRequireDefault(require("enzyme"));
5
- var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));
5
+ var _enzymeAdapterReact = _interopRequireDefault(require("@wojtekmaj/enzyme-adapter-react-17"));
6
6
  _enzyme.default.configure({
7
7
  adapter: new _enzymeAdapterReact.default()
8
8
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complat/react-spectra-editor",
3
- "version": "1.0.0-rc15",
3
+ "version": "1.0.0-rc16",
4
4
  "description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS, CV, UIVIS, XRD).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "react-svg-inline": "^2.1.1",
39
39
  "redux": "^4.1.1",
40
40
  "redux-saga": "^1.1.3",
41
- "redux-undo": "^1.0.1",
41
+ "redux-undo": "^1.1.0",
42
42
  "regenerator-transform": "^0.13.3",
43
43
  "reselect": "^4.0.0",
44
44
  "typescript": "^5.0.4"
@@ -64,9 +64,9 @@
64
64
  "@babel/preset-react": "^7.18.6",
65
65
  "@storybook/react": "7.0.7",
66
66
  "@types/enzyme": "^3.10.13",
67
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
67
68
  "babel-loader": "8.2.5",
68
69
  "enzyme": "^3.11.0",
69
- "enzyme-adapter-react-16": "^1.15.7",
70
70
  "enzyme-to-json": "^3.6.2",
71
71
  "eslint-config-airbnb": "^19.0.4",
72
72
  "eslint-plugin-import": "^2.25.0",