@complat/react-spectra-editor 1.0.0-rc5 → 1.0.0-rc6
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.
|
@@ -34,9 +34,24 @@ const styles = () => Object.assign({
|
|
|
34
34
|
width: 100
|
|
35
35
|
}
|
|
36
36
|
}, _common.commonStyle);
|
|
37
|
-
const shiftSelect = (classes, layoutSt,
|
|
37
|
+
const shiftSelect = (classes, layoutSt, setShiftRefAct, shiftSt, curveSt) => {
|
|
38
38
|
if (_cfg.default.hideSolvent(layoutSt)) return null;
|
|
39
|
-
const onChange = e => setShiftRefAct(e.target.value);
|
|
39
|
+
// const onChange = (e) => setShiftRefAct(e.target.value);
|
|
40
|
+
const {
|
|
41
|
+
curveIdx
|
|
42
|
+
} = curveSt;
|
|
43
|
+
const {
|
|
44
|
+
shifts
|
|
45
|
+
} = shiftSt;
|
|
46
|
+
const selectedShift = shifts[curveIdx];
|
|
47
|
+
const shiftRef = selectedShift.ref;
|
|
48
|
+
const onChange = e => {
|
|
49
|
+
const payload = {
|
|
50
|
+
dataToSet: e.target.value,
|
|
51
|
+
curveIdx
|
|
52
|
+
};
|
|
53
|
+
setShiftRefAct(payload);
|
|
54
|
+
};
|
|
40
55
|
const listShift = (0, _list_shift.getListShift)(layoutSt);
|
|
41
56
|
const content = listShift.map(ref => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
42
57
|
value: ref,
|
|
@@ -50,7 +65,7 @@ const shiftSelect = (classes, layoutSt, shiftRefSt, setShiftRefAct) => {
|
|
|
50
65
|
}, /*#__PURE__*/_react.default.createElement(_InputLabel.default, {
|
|
51
66
|
className: (0, _classnames.default)(classes.selectLabel, 'select-sv-bar-label')
|
|
52
67
|
}, "Solvent"), /*#__PURE__*/_react.default.createElement(_Select.default, {
|
|
53
|
-
value:
|
|
68
|
+
value: shiftRef,
|
|
54
69
|
onChange: onChange,
|
|
55
70
|
input: /*#__PURE__*/_react.default.createElement(_OutlinedInput.default, {
|
|
56
71
|
className: (0, _classnames.default)(classes.selectInput, 'input-sv-bar-shift'),
|
|
@@ -148,13 +163,14 @@ const Layout = _ref => {
|
|
|
148
163
|
feature,
|
|
149
164
|
hasEdit,
|
|
150
165
|
layoutSt,
|
|
151
|
-
shiftRefSt,
|
|
152
166
|
setShiftRefAct,
|
|
153
|
-
updateLayoutAct
|
|
167
|
+
updateLayoutAct,
|
|
168
|
+
curveSt,
|
|
169
|
+
shiftSt
|
|
154
170
|
} = _ref;
|
|
155
171
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
156
172
|
className: classes.groupRight
|
|
157
|
-
}, layoutSelect(classes, layoutSt, updateLayoutAct), shiftSelect(classes, layoutSt,
|
|
173
|
+
}, layoutSelect(classes, layoutSt, updateLayoutAct), shiftSelect(classes, layoutSt, setShiftRefAct, shiftSt, curveSt), /*#__PURE__*/_react.default.createElement(_r02_scan.default, {
|
|
158
174
|
feature: feature,
|
|
159
175
|
hasEdit: hasEdit
|
|
160
176
|
}));
|
|
@@ -163,7 +179,8 @@ const mapStateToProps = (state, props) => (
|
|
|
163
179
|
// eslint-disable-line
|
|
164
180
|
{
|
|
165
181
|
layoutSt: state.layout,
|
|
166
|
-
|
|
182
|
+
curveSt: state.curve,
|
|
183
|
+
shiftSt: state.shift
|
|
167
184
|
});
|
|
168
185
|
const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
|
|
169
186
|
setShiftRefAct: _shift.setShiftRef,
|
|
@@ -174,9 +191,10 @@ Layout.propTypes = {
|
|
|
174
191
|
feature: _propTypes.default.object.isRequired,
|
|
175
192
|
hasEdit: _propTypes.default.bool.isRequired,
|
|
176
193
|
layoutSt: _propTypes.default.string.isRequired,
|
|
177
|
-
shiftRefSt: _propTypes.default.object.isRequired,
|
|
178
194
|
setShiftRefAct: _propTypes.default.func.isRequired,
|
|
179
|
-
updateLayoutAct: _propTypes.default.func.isRequired
|
|
195
|
+
updateLayoutAct: _propTypes.default.func.isRequired,
|
|
196
|
+
curveSt: _propTypes.default.object.isRequired,
|
|
197
|
+
shiftSt: _propTypes.default.object.isRequired
|
|
180
198
|
};
|
|
181
199
|
var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(Layout));
|
|
182
200
|
exports.default = _default;
|
|
@@ -80,16 +80,17 @@ const GraphSelectionPanel = _ref => {
|
|
|
80
80
|
if (selectedSubLayout && subLayoutValues.length > 1) {
|
|
81
81
|
const subLayout = subLayoutsInfo[selectedSubLayout];
|
|
82
82
|
itemsSubLayout = subLayout.map((spectra, idx) => {
|
|
83
|
+
const spectraIdx = spectra.curveIdx;
|
|
83
84
|
const {
|
|
84
85
|
color
|
|
85
86
|
} = spectra;
|
|
86
87
|
let filename = '';
|
|
87
|
-
if (entityFileNames &&
|
|
88
|
-
filename = entityFileNames[
|
|
88
|
+
if (entityFileNames && spectraIdx < entityFileNames.length) {
|
|
89
|
+
filename = entityFileNames[spectraIdx];
|
|
89
90
|
}
|
|
90
91
|
return {
|
|
91
92
|
name: `${idx + 1}.`,
|
|
92
|
-
idx,
|
|
93
|
+
idx: spectraIdx,
|
|
93
94
|
color,
|
|
94
95
|
filename
|
|
95
96
|
};
|
|
@@ -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,39 @@ const resetEnable = payload => {
|
|
|
59
59
|
};
|
|
60
60
|
const resetShift = (state, action) => {
|
|
61
61
|
const {
|
|
62
|
-
|
|
62
|
+
payload
|
|
63
|
+
} = action;
|
|
64
|
+
const {
|
|
65
|
+
curvesInfo
|
|
66
|
+
} = payload;
|
|
67
|
+
const {
|
|
68
|
+
isMultiCurve,
|
|
69
|
+
curveIdx,
|
|
70
|
+
numberOfCurve
|
|
71
|
+
} = curvesInfo;
|
|
72
|
+
const {
|
|
63
73
|
shifts
|
|
64
74
|
} = state;
|
|
65
|
-
let selectedShift = shifts[
|
|
75
|
+
let selectedShift = shifts[curveIdx];
|
|
66
76
|
if (selectedShift === false || selectedShift === undefined) {
|
|
67
77
|
selectedShift = defaultEmptyShift;
|
|
68
78
|
}
|
|
79
|
+
if (isMultiCurve) {
|
|
80
|
+
for (let idx = 0; idx < numberOfCurve; idx += 1) {
|
|
81
|
+
const checkShift = shifts[idx];
|
|
82
|
+
if (!checkShift) {
|
|
83
|
+
shifts[idx] = defaultEmptyShift;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
69
87
|
const newShift = Object.assign({}, selectedShift, {
|
|
70
|
-
ref: resetRef(
|
|
71
|
-
enable: resetEnable(
|
|
88
|
+
ref: resetRef(payload),
|
|
89
|
+
enable: resetEnable(payload)
|
|
72
90
|
});
|
|
73
|
-
shifts[
|
|
91
|
+
shifts[curveIdx] = newShift;
|
|
74
92
|
return Object.assign({}, state, {
|
|
75
93
|
shifts,
|
|
76
|
-
selectedIdx
|
|
94
|
+
selectedIdx: curveIdx
|
|
77
95
|
});
|
|
78
96
|
};
|
|
79
97
|
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
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
}
|