@complat/react-spectra-editor 1.0.0-rc11 → 1.0.0-rc13.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.
@@ -33,12 +33,8 @@ const styles = () => Object.assign({
33
33
  txtIcon: {}
34
34
  }, _common.commonStyle);
35
35
  const iconSize = '16px';
36
- const setFactor = (classes, isDisable, refFactor, setIntegrationFkrAct, curveIdx) => {
37
- const onBlur = e => setIntegrationFkrAct({
38
- factor: e.target.value,
39
- curveIdx
40
- });
41
- const onChange = e => setIntegrationFkrAct({
36
+ const setFactor = (classes, isDisable, integrationSt, setIntegrationFkrAct, curveIdx) => {
37
+ const onFactorChanged = e => setIntegrationFkrAct({
42
38
  factor: e.target.value,
43
39
  curveIdx
44
40
  });
@@ -50,12 +46,20 @@ const setFactor = (classes, isDisable, refFactor, setIntegrationFkrAct, curveIdx
50
46
  });
51
47
  }
52
48
  };
49
+ let refFactor = 1.00;
50
+ const {
51
+ integrations
52
+ } = integrationSt;
53
+ if (integrations && curveIdx < integrations.length) {
54
+ const selectedIntegration = integrations[curveIdx];
55
+ refFactor = selectedIntegration.refFactor || 1.00;
56
+ }
53
57
  return /*#__PURE__*/_react.default.createElement(_TextField.default, {
54
58
  className: classes.field,
55
59
  disabled: isDisable,
56
60
  id: "intg-factor-name",
57
61
  type: "number",
58
- value: refFactor || 1.00,
62
+ value: refFactor,
59
63
  margin: "none",
60
64
  InputProps: {
61
65
  className: (0, _classnames.default)(classes.txtInput, 'txtfield-sv-bar-input')
@@ -63,9 +67,9 @@ const setFactor = (classes, isDisable, refFactor, setIntegrationFkrAct, curveIdx
63
67
  label: /*#__PURE__*/_react.default.createElement("span", {
64
68
  className: (0, _classnames.default)(classes.txtLabel, 'txtfield-sv-bar-label')
65
69
  }, "Ref Area"),
66
- onChange: onChange,
67
- onBlur: onBlur,
68
- onKeyPress: onEnterPress,
70
+ onChange: onFactorChanged,
71
+ onBlur: onFactorChanged,
72
+ onKeyUp: onEnterPress,
69
73
  variant: "outlined"
70
74
  });
71
75
  };
@@ -73,7 +77,6 @@ const iconColor = criteria => criteria ? '#fff' : '#000';
73
77
  const Integration = _ref => {
74
78
  let {
75
79
  classes,
76
- refFactorSt,
77
80
  ignoreRef,
78
81
  isDisableSt,
79
82
  isFocusAddIntgSt,
@@ -82,7 +85,8 @@ const Integration = _ref => {
82
85
  setUiSweepTypeAct,
83
86
  setIntegrationFkrAct,
84
87
  clearIntegrationAllAct,
85
- curveSt
88
+ curveSt,
89
+ integrationSt
86
90
  } = _ref;
87
91
  const onSweepIntegtAdd = () => setUiSweepTypeAct(_list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD);
88
92
  const onSweepIntegtRm = () => setUiSweepTypeAct(_list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_RM);
@@ -138,7 +142,7 @@ const Integration = _ref => {
138
142
  size: iconSize,
139
143
  color: iconColor(isFocusSetRefSt || isDisableSt),
140
144
  className: (0, _classnames.default)(classes.iconMdi, 'icon-sv-bar-refint')
141
- })))), !ignoreRef ? setFactor(classes, isDisableSt, refFactorSt, setIntegrationFkrAct, curveIdx) : null, /*#__PURE__*/_react.default.createElement(_tri_btn.default, {
145
+ })))), !ignoreRef ? setFactor(classes, isDisableSt, integrationSt, setIntegrationFkrAct, curveIdx) : null, /*#__PURE__*/_react.default.createElement(_tri_btn.default, {
142
146
  content: {
143
147
  tp: 'Clear All Integration'
144
148
  },
@@ -159,9 +163,9 @@ const mapStateToProps = (state, props) => (
159
163
  isFocusAddIntgSt: state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_ADD,
160
164
  isFocusRmIntgSt: state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_RM,
161
165
  isFocusSetRefSt: state.ui.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.INTEGRATION_SET_REF,
162
- refFactorSt: state.integration.present.refFactor,
163
166
  ignoreRef: _format.default.isHplcUvVisLayout(state.layout),
164
- curveSt: state.curve
167
+ curveSt: state.curve,
168
+ integrationSt: state.integration.present
165
169
  });
166
170
  const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
167
171
  setUiSweepTypeAct: _ui.setUiSweepType,
@@ -174,12 +178,12 @@ Integration.propTypes = {
174
178
  isFocusAddIntgSt: _propTypes.default.bool.isRequired,
175
179
  isFocusRmIntgSt: _propTypes.default.bool.isRequired,
176
180
  isFocusSetRefSt: _propTypes.default.bool.isRequired,
177
- refFactorSt: _propTypes.default.number.isRequired,
178
181
  ignoreRef: _propTypes.default.bool.isRequired,
179
182
  setUiSweepTypeAct: _propTypes.default.func.isRequired,
180
183
  setIntegrationFkrAct: _propTypes.default.func.isRequired,
181
184
  clearIntegrationAllAct: _propTypes.default.func.isRequired,
182
- curveSt: _propTypes.default.object.isRequired
185
+ curveSt: _propTypes.default.object.isRequired,
186
+ integrationSt: _propTypes.default.object.isRequired
183
187
  };
184
188
  var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(Integration));
185
189
  exports.default = _default;
@@ -188,7 +188,14 @@ const editPeakReducer = function () {
188
188
  case _action_type.EDITPEAK.SHIFT:
189
189
  return processShift(state, action);
190
190
  case _action_type.MANAGER.RESETALL:
191
- return initialState;
191
+ return {
192
+ selectedIdx: 0,
193
+ peaks: [{
194
+ prevOffset: 0,
195
+ pos: [],
196
+ neg: []
197
+ }]
198
+ };
192
199
  default:
193
200
  return _undo_redo_config.undoRedoActions.indexOf(action.type) >= 0 ? Object.assign({}, state) : state;
194
201
  }
@@ -84,7 +84,7 @@ const resetShift = (state, action) => {
84
84
  }
85
85
  }
86
86
  }
87
- const newShift = Object.assign({}, selectedShift, {
87
+ const newShift = Object.assign({}, defaultEmptyShift, {
88
88
  ref: resetRef(payload),
89
89
  enable: resetEnable(payload)
90
90
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complat/react-spectra-editor",
3
- "version": "1.0.0-rc11",
3
+ "version": "1.0.0-rc13.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",