@complat/react-spectra-editor 1.0.0-rc4.alpha.0 → 1.0.0-rc6.alpha.0

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.
@@ -89,7 +89,7 @@ const GraphSelectionPanel = _ref => {
89
89
  }
90
90
  return {
91
91
  name: `${idx + 1}.`,
92
- idx: curveIdx,
92
+ idx,
93
93
  color,
94
94
  filename
95
95
  };
@@ -89,7 +89,8 @@ const INTEGRATION = {
89
89
  SET_REF: 'INTEGRATION_SET_REF',
90
90
  SET_FKR: 'INTEGRATION_SET_FKR',
91
91
  RESET_ALL_RDC: 'INTEGRATION_RESET_ALL_RDC',
92
- CLEAR_ALL: 'INTEGRATION_CLEAR_ALL'
92
+ CLEAR_ALL: 'INTEGRATION_CLEAR_ALL',
93
+ SWEEP: 'INTEGRATION_SWEEP'
93
94
  };
94
95
  exports.INTEGRATION = INTEGRATION;
95
96
  const SIMULATION = {
@@ -59,21 +59,36 @@ const resetEnable = payload => {
59
59
  };
60
60
  const resetShift = (state, action) => {
61
61
  const {
62
- selectedIdx,
62
+ payload
63
+ } = action;
64
+ const {
65
+ isMultiCurve,
66
+ curveIdx,
67
+ numberOfCurve
68
+ } = payload;
69
+ const {
63
70
  shifts
64
71
  } = state;
65
- let selectedShift = shifts[selectedIdx];
72
+ let selectedShift = shifts[curveIdx];
66
73
  if (selectedShift === false || selectedShift === undefined) {
67
74
  selectedShift = defaultEmptyShift;
68
75
  }
76
+ if (isMultiCurve) {
77
+ for (let idx = 0; idx < numberOfCurve; idx += 1) {
78
+ const checkShift = shifts[idx];
79
+ if (checkShift === false || checkShift === undefined) {
80
+ shifts[idx] = defaultEmptyShift;
81
+ }
82
+ }
83
+ }
69
84
  const newShift = Object.assign({}, selectedShift, {
70
- ref: resetRef(action.payload),
71
- enable: resetEnable(action.payload)
85
+ ref: resetRef(payload),
86
+ enable: resetEnable(payload)
72
87
  });
73
- shifts[selectedIdx] = newShift;
88
+ shifts[curveIdx] = newShift;
74
89
  return Object.assign({}, state, {
75
90
  shifts,
76
- selectedIdx
91
+ selectedIdx: curveIdx
77
92
  });
78
93
  };
79
94
  const updateShift = (state, action) => {
@@ -9,31 +9,28 @@ var _action_type = require("../constants/action_type");
9
9
  const getLayout = state => state.layout;
10
10
  const getCurveSt = state => state.curve;
11
11
  const getIntegrationSt = state => state.integration.present;
12
- // const getShiftSt = (state) => state.shift;
13
-
14
12
  function* resetShift(action) {
15
- // const curveSt = yield select(getCurveSt);
13
+ const curveSt = yield (0, _effects.select)(getCurveSt);
16
14
  const layout = yield (0, _effects.select)(getLayout);
17
- // const shiftSt = yield select(getShiftSt);
18
-
19
15
  const {
20
16
  payload
21
17
  } = action;
22
- // const { shift } = payload;
23
- // console.log(payload);
24
- // console.log(shiftSt);
25
- // const { curveIdx } = curveSt;
26
- // const { shifts } = shiftSt;
27
- // shifts[curveIdx] = shift;
28
-
29
- // const newPayload = Object.assign({}, shiftSt, { shifts, selectedIdx: curveIdx })
30
-
18
+ const {
19
+ curveIdx,
20
+ listCurves
21
+ } = curveSt;
22
+ const numberOfCurve = listCurves.length;
31
23
  yield (0, _effects.put)({
32
24
  type: _action_type.MANAGER.RESETSHIFT,
33
25
  payload: Object.assign(
34
26
  // eslint-disable-line
35
27
  {}, payload, {
36
- layout
28
+ layout,
29
+ curvesInfo: {
30
+ isMultiCurve: numberOfCurve > 0,
31
+ curveIdx,
32
+ numberOfCurve
33
+ }
37
34
  })
38
35
  });
39
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complat/react-spectra-editor",
3
- "version": "1.0.0-rc4.alpha.0",
3
+ "version": "1.0.0-rc6.alpha.0",
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",