@complat/react-spectra-editor 1.7.0 → 1.8.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +21 -662
  3. package/README.md +5 -0
  4. package/dist/__tests__/fixtures/lc_ms_jcamp.js +2329 -0
  5. package/dist/__tests__/fixtures/lc_ms_jcamp_2.js +2874 -0
  6. package/dist/__tests__/fixtures/lc_ms_jcamp_mz_chemstation.js +3242 -0
  7. package/dist/__tests__/fixtures/lc_ms_jcamp_tic_chemstation.js +854 -0
  8. package/dist/__tests__/fixtures/lc_ms_jcamp_tic_neg.js +1233 -0
  9. package/dist/__tests__/fixtures/lc_ms_jcamp_tic_pos.js +1233 -0
  10. package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis.js +48908 -0
  11. package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis_chemstation.js +15424 -0
  12. package/dist/__tests__/units/components/cmd_bar/r05_submit_btn.test.js +158 -3
  13. package/dist/__tests__/units/components/d3_line_rect.test.js +85 -0
  14. package/dist/__tests__/units/components/d3_multi/multi_focus.test.js +43 -0
  15. package/dist/__tests__/units/components/hplc_viewer.test.js +123 -0
  16. package/dist/__tests__/units/components/panel/info.test.js +55 -15
  17. package/dist/__tests__/units/features/lc-ms/parsing/lcmsCategory.test.js +73 -0
  18. package/dist/__tests__/units/features/lc-ms/submit/peaks.test.js +310 -0
  19. package/dist/actions/curve.js +5 -2
  20. package/dist/actions/hplc_ms.js +66 -0
  21. package/dist/actions/integration.js +17 -2
  22. package/dist/actions/ui.js +39 -11
  23. package/dist/app.js +21 -8
  24. package/dist/components/cmd_bar/01_viewer.js +15 -11
  25. package/dist/components/cmd_bar/03_peak.js +25 -16
  26. package/dist/components/cmd_bar/04_integration.js +116 -17
  27. package/dist/components/cmd_bar/08_peak_group.js +83 -0
  28. package/dist/components/cmd_bar/collapsible_toolbar_group.js +101 -0
  29. package/dist/components/cmd_bar/common.js +4 -3
  30. package/dist/components/cmd_bar/index.js +76 -18
  31. package/dist/components/cmd_bar/r01_layout.js +6 -0
  32. package/dist/components/cmd_bar/r02_scan.js +15 -11
  33. package/dist/components/cmd_bar/r03_threshold.js +19 -3
  34. package/dist/components/cmd_bar/r04_submit.js +61 -6
  35. package/dist/components/cmd_bar/r05_submit_btn.js +60 -13
  36. package/dist/components/cmd_bar/r06_predict_btn.js +4 -4
  37. package/dist/components/cmd_bar/r07_wavelength_btn.js +10 -9
  38. package/dist/components/cmd_bar/r09_detector.js +2 -2
  39. package/dist/components/cmd_bar/tri_btn.js +4 -1
  40. package/dist/components/common/draw.js +6 -5
  41. package/dist/components/d3_line/index.js +70 -15
  42. package/dist/components/d3_line/line_focus.js +104 -67
  43. package/dist/components/d3_line_rect/index.js +836 -0
  44. package/dist/components/d3_line_rect/line_focus.js +526 -0
  45. package/dist/components/d3_line_rect/multi_focus.js +433 -0
  46. package/dist/components/d3_line_rect/rect_focus.js +247 -0
  47. package/dist/components/d3_multi/index.js +154 -163
  48. package/dist/components/d3_multi/multi_focus.js +117 -68
  49. package/dist/components/d3_rect/index.js +6 -0
  50. package/dist/components/d3_rect/rect_focus.js +17 -5
  51. package/dist/components/hplc_viewer.js +169 -0
  52. package/dist/components/lc_ms_uv_tools_bar.js +175 -0
  53. package/dist/components/multi_jcamps_viewer.js +17 -5
  54. package/dist/components/panel/compare.js +84 -62
  55. package/dist/components/panel/cyclic_voltamery_data.js +15 -14
  56. package/dist/components/panel/graph_selection.js +32 -30
  57. package/dist/components/panel/index.js +28 -22
  58. package/dist/components/panel/info.js +90 -31
  59. package/dist/constants/action_type.js +23 -2
  60. package/dist/constants/list_graph.js +16 -0
  61. package/dist/constants/list_layout.js +2 -1
  62. package/dist/constants/list_ui.js +5 -2
  63. package/dist/features/lc-ms/entities/extractEntityLCMS.js +187 -0
  64. package/dist/features/lc-ms/parsing/chemstation.js +108 -0
  65. package/dist/features/lc-ms/parsing/index.js +46 -0
  66. package/dist/features/lc-ms/parsing/lcmsCategory.js +44 -0
  67. package/dist/features/lc-ms/parsing/lcmsJcampInfo.js +18 -0
  68. package/dist/features/lc-ms/parsing/lcmsMsPage.js +241 -0
  69. package/dist/features/lc-ms/parsing/pageValue.js +27 -0
  70. package/dist/features/lc-ms/submit/index.js +24 -0
  71. package/dist/features/lc-ms/submit/peaks.js +66 -0
  72. package/dist/features/lc-ms/ui/wavelengthSelect.js +54 -0
  73. package/dist/fn.js +4 -1
  74. package/dist/helpers/brush.js +74 -19
  75. package/dist/helpers/calc.js +4 -2
  76. package/dist/helpers/cfg.js +5 -4
  77. package/dist/helpers/chem.js +449 -71
  78. package/dist/helpers/compass.js +181 -17
  79. package/dist/helpers/extractEntityLCMS.js +24 -0
  80. package/dist/helpers/extractParams.js +118 -33
  81. package/dist/helpers/extractPeaksEdit.js +29 -9
  82. package/dist/helpers/format.js +189 -4
  83. package/dist/helpers/init.js +25 -5
  84. package/dist/helpers/integration.js +130 -17
  85. package/dist/helpers/integration_draft.js +43 -0
  86. package/dist/helpers/integration_focus.js +155 -0
  87. package/dist/helpers/integration_jcamp.js +68 -0
  88. package/dist/helpers/integration_split.js +202 -0
  89. package/dist/helpers/mount.js +8 -1
  90. package/dist/helpers/sweep.js +39 -0
  91. package/dist/index.js +284 -26
  92. package/dist/layer_content.js +17 -3
  93. package/dist/layer_init.js +124 -14
  94. package/dist/layer_prism.js +31 -5
  95. package/dist/reducers/index.js +3 -1
  96. package/dist/reducers/reducer_curve.js +54 -36
  97. package/dist/reducers/reducer_hplc_ms/hydrate.js +289 -0
  98. package/dist/reducers/reducer_hplc_ms/index.js +122 -0
  99. package/dist/reducers/reducer_hplc_ms/persistence.js +74 -0
  100. package/dist/reducers/reducer_hplc_ms/tic.js +70 -0
  101. package/dist/reducers/reducer_hplc_ms/utils.js +70 -0
  102. package/dist/reducers/reducer_hplc_ms/uvvis.js +377 -0
  103. package/dist/reducers/reducer_integration.js +265 -7
  104. package/dist/reducers/reducer_layout.js +1 -1
  105. package/dist/reducers/reducer_submit.js +2 -1
  106. package/dist/reducers/reducer_ui.js +149 -13
  107. package/dist/reducers/undo_redo_config.js +2 -2
  108. package/dist/sagas/saga_lcms_ui.js +85 -0
  109. package/dist/sagas/saga_ui.js +177 -74
  110. package/dist/setupTests.js +5 -5
  111. package/package.json +10 -7
@@ -226,6 +226,12 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => {
226
226
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout'),
227
227
  children: "MS"
228
228
  })
229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
230
+ value: _list_layout.LIST_LAYOUT.LC_MS,
231
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
232
+ className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout'),
233
+ children: "LC/MS"
234
+ })
229
235
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
230
236
  value: _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY,
231
237
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
@@ -37,11 +37,13 @@ const btnRestore = (classes, hasEdit, isEdit, toggleEditAct) => /*#__PURE__*/(0,
37
37
  className: "txt-sv-tp",
38
38
  children: restoreTp(hasEdit, isEdit)
39
39
  }),
40
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.MuButton, {
41
- className: (0, _classnames.default)('btn-sv-bar-scanrst'),
42
- disabled: !hasEdit,
43
- onClick: toggleEditAct,
44
- children: restoreIcon(classes, hasEdit, isEdit)
40
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
41
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.MuButton, {
42
+ className: (0, _classnames.default)('btn-sv-bar-scanrst'),
43
+ disabled: !hasEdit,
44
+ onClick: toggleEditAct,
45
+ children: restoreIcon(classes, hasEdit, isEdit)
46
+ })
45
47
  })
46
48
  });
47
49
  const btnRrfresh = (classes, disabled, refreshAct) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
@@ -49,12 +51,14 @@ const btnRrfresh = (classes, disabled, refreshAct) => /*#__PURE__*/(0, _jsxRunti
49
51
  className: "txt-sv-tp",
50
52
  children: "Refresh Scan"
51
53
  }),
52
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.MuButton, {
53
- className: (0, _classnames.default)('btn-sv-bar-scanrfs'),
54
- disabled: disabled,
55
- onClick: refreshAct,
56
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RefreshOutlined.default, {
57
- className: classes.icon
54
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.MuButton, {
56
+ className: (0, _classnames.default)('btn-sv-bar-scanrfs'),
57
+ disabled: disabled,
58
+ onClick: refreshAct,
59
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RefreshOutlined.default, {
60
+ className: classes.icon
61
+ })
58
62
  })
59
63
  })
60
64
  });
@@ -16,6 +16,7 @@ var _CloudDoneOutlined = _interopRequireDefault(require("@mui/icons-material/Clo
16
16
  var _HowToRegOutlined = _interopRequireDefault(require("@mui/icons-material/HowToRegOutlined"));
17
17
  var _RefreshOutlined = _interopRequireDefault(require("@mui/icons-material/RefreshOutlined"));
18
18
  var _cfg = _interopRequireDefault(require("../../helpers/cfg"));
19
+ var _format = _interopRequireDefault(require("../../helpers/format"));
19
20
  var _threshold = require("../../actions/threshold");
20
21
  var _common = require("./common");
21
22
  var _jsxRuntime = require("react/jsx-runtime");
@@ -95,11 +96,19 @@ const Threshold = ({
95
96
  thresValSt,
96
97
  isEditSt,
97
98
  curveSt,
99
+ hplcMsSt,
100
+ layoutSt,
98
101
  updateThresholdValueAct,
99
102
  resetThresholdValueAct,
100
103
  toggleThresholdIsEditAct
101
104
  }) => {
102
- const thresVal = thresValSt || feature.thresRef;
105
+ const isLcMs = _format.default.isLCMsLayout(layoutSt);
106
+ let thresVal;
107
+ if (isLcMs) {
108
+ thresVal = hplcMsSt?.threshold?.value != null ? hplcMsSt.threshold.value : feature?.thresRef ?? thresValSt ?? 5;
109
+ } else {
110
+ thresVal = thresValSt || (feature ? feature.thresRef : hplcMsSt?.threshold?.value);
111
+ }
103
112
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
104
113
  className: classes.groupRight,
105
114
  children: [setThreshold(classes, thresVal, updateThresholdValueAct, curveSt), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
@@ -139,7 +148,9 @@ const mapStateToProps = (state, props) => (
139
148
  hideThresSt: _cfg.default.hideCmdThres(state.layout),
140
149
  isEditSt: state.threshold.list[state.curve.curveIdx].isEdit,
141
150
  thresValSt: parseFloat(state.threshold.list[state.curve.curveIdx].value) || 0,
142
- curveSt: state.curve
151
+ curveSt: state.curve,
152
+ hplcMsSt: state.hplcMs,
153
+ layoutSt: state.layout
143
154
  });
144
155
  const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
145
156
  updateThresholdValueAct: _threshold.updateThresholdValue,
@@ -156,6 +167,11 @@ Threshold.propTypes = {
156
167
  curveSt: _propTypes.default.object.isRequired,
157
168
  updateThresholdValueAct: _propTypes.default.func.isRequired,
158
169
  resetThresholdValueAct: _propTypes.default.func.isRequired,
159
- toggleThresholdIsEditAct: _propTypes.default.func.isRequired
170
+ toggleThresholdIsEditAct: _propTypes.default.func.isRequired,
171
+ hplcMsSt: _propTypes.default.object.isRequired,
172
+ layoutSt: _propTypes.default.string
173
+ };
174
+ Threshold.defaultProps = {
175
+ layoutSt: undefined
160
176
  };
161
177
  var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(Threshold));
@@ -13,10 +13,12 @@ var _redux = require("redux");
13
13
  var _material = require("@mui/material");
14
14
  var _styles = require("@mui/styles");
15
15
  var _submit = require("../../actions/submit");
16
+ var _hplc_ms = require("../../actions/hplc_ms");
16
17
  var _r05_submit_btn = _interopRequireDefault(require("./r05_submit_btn"));
17
18
  var _r06_predict_btn = _interopRequireDefault(require("./r06_predict_btn"));
18
19
  var _common = require("./common");
19
20
  var _format = _interopRequireDefault(require("../../helpers/format"));
21
+ var _list_layout = require("../../constants/list_layout");
20
22
  var _jsxRuntime = require("react/jsx-runtime");
21
23
  /* eslint-disable prefer-object-spread, function-paren-newline,
22
24
  react/function-component-definition */
@@ -31,6 +33,10 @@ const styles = () => Object.assign({
31
33
  fieldDecimal: {
32
34
  width: 80
33
35
  },
36
+ fieldLcmsIntegrationsExport: {
37
+ width: 148,
38
+ minWidth: 148
39
+ },
34
40
  fieldOpertaion: {
35
41
  width: 120
36
42
  }
@@ -142,6 +148,44 @@ const decimalSelect = (classes, hideSwitch, decimalSt, updateDecimalAct) => {
142
148
  })]
143
149
  });
144
150
  };
151
+ const lcmsIntegrationsExportSelect = (classes, layoutSt, value, onChange) => {
152
+ if (layoutSt !== _list_layout.LIST_LAYOUT.LC_MS) return null;
153
+ const v = ['percent', 'area', 'both'].includes(value) ? value : 'percent';
154
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
155
+ className: (0, _classnames.default)(classes.fieldLcmsIntegrationsExport),
156
+ variant: "outlined",
157
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
158
+ id: "select-lcms-intg-export-label",
159
+ className: (0, _classnames.default)(classes.selectLabel, 'select-sv-bar-label'),
160
+ children: "Integrations text"
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Select, {
162
+ labelId: "select-lcms-intg-export-label",
163
+ label: "Integrations text",
164
+ value: v,
165
+ onChange: onChange,
166
+ className: (0, _classnames.default)(classes.selectInput, 'input-sv-bar-lcms-intg-export'),
167
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
168
+ value: "percent",
169
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
170
+ className: (0, _classnames.default)(classes.txtOpt),
171
+ children: "Percent only"
172
+ })
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
174
+ value: "area",
175
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
176
+ className: (0, _classnames.default)(classes.txtOpt),
177
+ children: "Area (AUC) only"
178
+ })
179
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
180
+ value: "both",
181
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
182
+ className: (0, _classnames.default)(classes.txtOpt),
183
+ children: "Percent and area"
184
+ })
185
+ })]
186
+ })]
187
+ });
188
+ };
145
189
  const operationSelect = (classes, operations, operation, onChangeSelect) => {
146
190
  const options = operations.map(o => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
147
191
  value: o.name,
@@ -150,7 +194,8 @@ const operationSelect = (classes, operations, operation, onChangeSelect) => {
150
194
  children: o.name
151
195
  })
152
196
  }, o.name));
153
- const selectedValue = operation.name || operations[0].name;
197
+ const operationNames = operations.map(o => o.name);
198
+ const selectedValue = operationNames.includes(operation?.name) ? operation.name : operations[0].name;
154
199
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
155
200
  className: (0, _classnames.default)(classes.fieldOpertaion),
156
201
  variant: "outlined",
@@ -199,16 +244,20 @@ const Submit = ({
199
244
  operationSt,
200
245
  decimalSt,
201
246
  isEmWaveSt,
247
+ layoutSt,
248
+ lcmsIntegrationsExportSt,
202
249
  toggleIsAscendAct,
203
250
  toggleIsIntensityAct,
204
251
  updateOperationAct,
205
- updateDecimalAct
252
+ updateDecimalAct,
253
+ setLcmsIntegrationsExportAct
206
254
  }) => {
207
255
  const onChangeSelect = e => selectOperation(e.target.value, operations, updateOperationAct);
256
+ const onLcmsIntegrationsExport = e => setLcmsIntegrationsExportAct(e.target.value);
208
257
  if (!operations || operations.length === 0) return null;
209
258
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
210
259
  className: classes.groupRightMost,
211
- children: [ascendSelect(classes, hideSwitch, isAscendSt, toggleIsAscendAct), intensitySelect(classes, hideSwitch || !isEmWaveSt, isIntensitySt, toggleIsIntensityAct), decimalSelect(classes, hideSwitch, decimalSt, updateDecimalAct), editorOnly ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_r06_predict_btn.default, {
260
+ children: [ascendSelect(classes, hideSwitch, isAscendSt, toggleIsAscendAct), intensitySelect(classes, hideSwitch || !isEmWaveSt, isIntensitySt, toggleIsIntensityAct), decimalSelect(classes, hideSwitch, decimalSt, updateDecimalAct), lcmsIntegrationsExportSelect(classes, layoutSt, lcmsIntegrationsExportSt, onLcmsIntegrationsExport), editorOnly ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_r06_predict_btn.default, {
212
261
  feature: feature,
213
262
  forecast: forecast
214
263
  }), operationSelect(classes, operations, operationSt, onChangeSelect), /*#__PURE__*/(0, _jsxRuntime.jsx)(_r05_submit_btn.default, {
@@ -223,17 +272,20 @@ const Submit = ({
223
272
  const mapStateToProps = (state, props) => (
224
273
  // eslint-disable-line
225
274
  {
275
+ layoutSt: state.layout,
226
276
  isEmWaveSt: _format.default.isEmWaveLayout(state.layout),
227
277
  isAscendSt: state.submit.isAscend,
228
278
  isIntensitySt: state.submit.isIntensity,
229
279
  decimalSt: state.submit.decimal,
230
- operationSt: state.submit.operation
280
+ operationSt: state.submit.operation,
281
+ lcmsIntegrationsExportSt: state.hplcMs?.lcmsIntegrationsExport || 'percent'
231
282
  });
232
283
  const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
233
284
  toggleIsAscendAct: _submit.toggleIsAscend,
234
285
  toggleIsIntensityAct: _submit.toggleIsIntensity,
235
286
  updateOperationAct: _submit.updateOperation,
236
- updateDecimalAct: _submit.updateDecimal
287
+ updateDecimalAct: _submit.updateDecimal,
288
+ setLcmsIntegrationsExportAct: _hplc_ms.setLcmsIntegrationsExport
237
289
  }, dispatch);
238
290
  Submit.propTypes = {
239
291
  classes: _propTypes.default.object.isRequired,
@@ -251,6 +303,9 @@ Submit.propTypes = {
251
303
  toggleIsAscendAct: _propTypes.default.func.isRequired,
252
304
  toggleIsIntensityAct: _propTypes.default.func.isRequired,
253
305
  updateOperationAct: _propTypes.default.func.isRequired,
254
- updateDecimalAct: _propTypes.default.func.isRequired
306
+ updateDecimalAct: _propTypes.default.func.isRequired,
307
+ layoutSt: _propTypes.default.string.isRequired,
308
+ lcmsIntegrationsExportSt: _propTypes.default.string.isRequired,
309
+ setLcmsIntegrationsExportAct: _propTypes.default.func.isRequired
255
310
  };
256
311
  var _default = exports.default = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps), (0, _styles.withStyles)(styles))(Submit);
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.default = exports.computeCvYScaleFactor = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _reactRedux = require("react-redux");
@@ -59,23 +59,36 @@ const computeCvYScaleFactor = (feature, cyclicvoltaSt) => {
59
59
  const rawArea = (cyclicvoltaSt.areaValue === '' ? 1.0 : cyclicvoltaSt.areaValue) || 1.0;
60
60
  const areaUnit = cyclicvoltaSt.areaUnit || 'cm²';
61
61
  const safeArea = rawArea > 0 ? rawArea : 1.0;
62
+ // areaInCm2 already converts mm² → cm², so factor is A/cm². Do NOT divide by 100 again.
62
63
  const areaInCm2 = areaUnit === 'mm²' ? safeArea / 100.0 : safeArea;
63
64
  let factor = 1.0 / areaInCm2;
64
65
  const baseY = feature && feature.yUnit ? String(feature.yUnit) : 'A';
65
66
  if (/mA/i.test(baseY)) {
66
67
  factor *= 1000.0;
67
68
  }
68
- if (areaUnit === 'mm²') {
69
- factor /= 100.0;
70
- }
71
69
  return factor;
72
70
  };
71
+ exports.computeCvYScaleFactor = computeCvYScaleFactor;
73
72
  const defaultThreshold = {
74
73
  isEdit: true,
75
74
  value: false,
76
75
  upper: false,
77
76
  lower: false
78
77
  };
78
+ const LCMS_INTEGRATIONS_EXPORT_MODES = ['percent', 'area', 'both'];
79
+ const isLcmsIntegrationsExportMode = v => LCMS_INTEGRATIONS_EXPORT_MODES.includes(v);
80
+ const resolveLcmsIntegrationsExportForSubmit = (analysis, hplcMsSt) => {
81
+ if (isLcmsIntegrationsExportMode(analysis?.lcmsIntegrationsExport)) {
82
+ return analysis.lcmsIntegrationsExport;
83
+ }
84
+ if (analysis?.lcmsIncludeIntegrationArea === true) {
85
+ return 'both';
86
+ }
87
+ if (isLcmsIntegrationsExportMode(hplcMsSt?.lcmsIntegrationsExport)) {
88
+ return hplcMsSt.lcmsIntegrationsExport;
89
+ }
90
+ return 'percent';
91
+ };
79
92
  const pickFromList = (list, index, fallback = null) => Array.isArray(list) && list[index] !== undefined ? list[index] : fallback;
80
93
  const hasBoolean = value => typeof value === 'boolean';
81
94
  const resolveOptionalBooleanFlags = analysis => {
@@ -156,17 +169,36 @@ const buildSpectrumPayload = ({
156
169
  ...optionalBooleanFlags
157
170
  };
158
171
  };
159
- const onClickCb = (operationValue, isAscend, isIntensity, layoutSt, shiftSt, analysis, decimalSt, integrationSt, multiplicitySt, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, dscMetaData, curveList, editPeakSt, thresList, scanSt, feature) => () => {
172
+ const onClickCb = (operationValue, isAscend, isIntensity, layoutSt, shiftSt, analysis, decimalSt, integrationSt, multiplicitySt, waveLengthSt, cyclicvoltaSt, curveSt, axesUnitsSt, detectorSt, dscMetaData, curveList, editPeakSt, thresList, scanSt, feature, hplcMsSt) => () => {
160
173
  const defaultCurves = feature ? [{
161
174
  feature
162
175
  }] : [];
163
- const curves = Array.isArray(curveList) && curveList.length > 0 ? curveList : defaultCurves;
176
+ let curves = Array.isArray(curveList) && curveList.length > 0 ? curveList : defaultCurves;
177
+ if (layoutSt === 'LC/MS') {
178
+ curves = curves.filter(c => c.lcmsKind === 'uvvis');
179
+ if (curves.length === 0) curves = defaultCurves;
180
+ }
164
181
  const fallbackIdx = Number.isFinite(curveSt?.curveIdx) ? curveSt.curveIdx : 0;
165
182
  const indicesToSend = curves.length > 0 ? curves.map((_, index) => index) : [fallbackIdx];
183
+ let lcmsGlobalFields = null;
184
+ if (layoutSt === 'LC/MS') {
185
+ const lcmsIntegrationsExport = resolveLcmsIntegrationsExportForSubmit(analysis, hplcMsSt);
186
+ lcmsGlobalFields = {
187
+ lcms_peaks: (0, _extractPeaksEdit.formatLcmsPeaksForBackend)(hplcMsSt),
188
+ lcms_integrals: (0, _extractPeaksEdit.formatLcmsIntegralsForBackend)(hplcMsSt),
189
+ lcms_integrations_export: lcmsIntegrationsExport,
190
+ lcms_peaks_text: _format.default.formatedLCMS(hplcMsSt, isAscend, decimalSt, {
191
+ lcmsIntegrationsExport
192
+ }),
193
+ lcms_uvvis_wavelength: hplcMsSt?.uvvis?.selectedWaveLength ?? null,
194
+ lcms_mz_page: hplcMsSt?.tic?.currentPageValue ?? null,
195
+ lcms_mz_page_data: (0, _extractPeaksEdit.getLcmsMzPageData)(hplcMsSt)
196
+ };
197
+ }
166
198
  const spectraList = indicesToSend.map(curveIdx => {
167
199
  const curve = curves[curveIdx] || {};
168
200
  const curveFeature = curve.feature || feature;
169
- return buildSpectrumPayload({
201
+ const spectrumPayload = buildSpectrumPayload({
170
202
  feature: curveFeature,
171
203
  curveIdx,
172
204
  editPeakSt,
@@ -186,10 +218,20 @@ const onClickCb = (operationValue, isAscend, isIntensity, layoutSt, shiftSt, ana
186
218
  analysis,
187
219
  decimalSt
188
220
  });
221
+ if (lcmsGlobalFields && curve.lcmsKind === 'uvvis') {
222
+ return {
223
+ ...spectrumPayload,
224
+ ...lcmsGlobalFields
225
+ };
226
+ }
227
+ return spectrumPayload;
189
228
  });
190
229
  const payload = {
191
230
  spectra_list: spectraList
192
231
  };
232
+ if (lcmsGlobalFields) {
233
+ Object.assign(payload, lcmsGlobalFields);
234
+ }
193
235
  if (Number.isFinite(curveSt?.curveIdx)) {
194
236
  payload.curveSt = {
195
237
  curveIdx: curveSt.curveIdx
@@ -218,7 +260,8 @@ const BtnSubmit = ({
218
260
  curveList,
219
261
  axesUnitsSt,
220
262
  detectorSt,
221
- metaSt
263
+ metaSt,
264
+ hplcMsSt
222
265
  }) => {
223
266
  // const disBtn = peaksEdit.length === 0 || statusSt.btnSubmit || disabled;
224
267
  const {
@@ -252,7 +295,7 @@ const BtnSubmit = ({
252
295
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.MuButton, {
253
296
  className: (0, _classnames.default)('btn-sv-bar-submit'),
254
297
  color: "primary",
255
- onClick: onClickCb(operation.value, isAscend, isIntensity, layoutSt, shiftSt, forecastSt.predictions, decimalSt, integrationSt, multiplicitySt, waveLengthSt, cyclicvoltaPayload, curveSt, axesUnitsSt, detectorSt, dscMetaData, curveList, editPeakSt, thresList, scanSt, feature),
298
+ onClick: onClickCb(operation.value, isAscend, isIntensity, layoutSt, shiftSt, forecastSt.predictions, decimalSt, integrationSt, multiplicitySt, waveLengthSt, cyclicvoltaPayload, curveSt, axesUnitsSt, detectorSt, dscMetaData, curveList, editPeakSt, thresList, scanSt, feature, hplcMsSt),
256
299
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlayCircleOutline.default, {
257
300
  className: classes.icon
258
301
  })
@@ -277,9 +320,9 @@ const mapStateToProps = (state, props) => (
277
320
  curveList: state.curve.listCurves,
278
321
  axesUnitsSt: state.axesUnits,
279
322
  detectorSt: state.detector,
280
- metaSt: state.meta
323
+ metaSt: state.meta,
324
+ hplcMsSt: state.hplcMs
281
325
  });
282
- const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({}, dispatch);
283
326
  BtnSubmit.propTypes = {
284
327
  classes: _propTypes.default.object.isRequired,
285
328
  feature: _propTypes.default.object.isRequired,
@@ -301,6 +344,10 @@ BtnSubmit.propTypes = {
301
344
  curveList: _propTypes.default.array.isRequired,
302
345
  axesUnitsSt: _propTypes.default.object.isRequired,
303
346
  detectorSt: _propTypes.default.object.isRequired,
304
- metaSt: _propTypes.default.object.isRequired
347
+ metaSt: _propTypes.default.object.isRequired,
348
+ hplcMsSt: _propTypes.default.object
349
+ };
350
+ BtnSubmit.defaultProps = {
351
+ hplcMsSt: {}
305
352
  };
306
- var _default = exports.default = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps), (0, _styles.withStyles)(styles))(BtnSubmit);
353
+ var _default = exports.default = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, null), (0, _styles.withStyles)(styles))(BtnSubmit);
@@ -82,7 +82,7 @@ const onClickReady = (forecast, peaksEdit, layoutSt, scan, shiftSt, thres, analy
82
82
  });
83
83
  };
84
84
  };
85
- const onClicUnknown = (feature, forecast, peaksEdit, layoutSt, scan, shiftSt, thres, analysis, integrationSt, multiplicitySt, curveSt) => {
85
+ const onClickUnknown = (feature, forecast, peaksEdit, layoutSt, scan, shiftSt, thres, analysis, integrationSt, multiplicitySt, curveSt) => {
86
86
  const {
87
87
  refreshCb
88
88
  } = forecast;
@@ -170,7 +170,7 @@ const BtnPredict = ({
170
170
  if (!(is13Cor1H || isIr)) return null;
171
171
  const oriPeaksEdit = (0, _extractPeaksEdit.extractPeaksEdit)(feature, editPeakSt, thresSt, shiftSt, layoutSt);
172
172
  const peaksEdit = _format.default.rmShiftFromPeaks(oriPeaksEdit, shiftSt);
173
- const scan = (0, _chem.Convert2Scan)(feature, scanSt);
173
+ const scan = _format.default.isMsLayout(layoutSt) ? (0, _chem.Convert2Scan)(feature, scanSt) : 0;
174
174
  const thres = (0, _chem.Convert2Thres)(feature, thresSt);
175
175
  const simuCount = simulationSt.nmrSimPeaks.length;
176
176
  const uniqCount = [...new Set(simulationSt.nmrSimPeaks)].length;
@@ -191,7 +191,7 @@ const BtnPredict = ({
191
191
  realCount = stack.length;
192
192
  }
193
193
  if (is13Cor1H && simuCount === 0) {
194
- const onClickUnknownCb = onClicUnknown(feature, forecast, peaksEdit, layoutSt, scan, shiftSt, thres, forecast.predictions, integrationSt, multiplicitySt, curveSt);
194
+ const onClickUnknownCb = onClickUnknown(feature, forecast, peaksEdit, layoutSt, scan, shiftSt, thres, forecast.predictions, integrationSt, multiplicitySt, curveSt);
195
195
  return renderBtnUnknown(classes, onClickUnknownCb);
196
196
  }
197
197
  const predictable = isIr || simuCount >= realCount && realCount > 0;
@@ -221,7 +221,7 @@ BtnPredict.propTypes = {
221
221
  feature: _propTypes.default.object.isRequired,
222
222
  forecast: _propTypes.default.object.isRequired,
223
223
  layoutSt: _propTypes.default.string.isRequired,
224
- simulationSt: _propTypes.default.array.isRequired,
224
+ simulationSt: _propTypes.default.object.isRequired,
225
225
  editPeakSt: _propTypes.default.object.isRequired,
226
226
  scanSt: _propTypes.default.object.isRequired,
227
227
  shiftSt: _propTypes.default.object.isRequired,
@@ -28,33 +28,34 @@ const styles = () => Object.assign({
28
28
  width: 100
29
29
  }
30
30
  }, _common.commonStyle);
31
- const wavelengthSelect = (classes, waveLengthSt, layoutSt, updateWaveLengthAct) => {
31
+ const wavelengthSelect = (classes, waveLengthSt, layoutSt, updateWavelengthAct) => {
32
32
  if (!_format.default.isXRDLayout(layoutSt)) {
33
33
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {});
34
34
  }
35
- const onChange = e => updateWaveLengthAct(e.target.value);
35
+ const onChange = e => updateWavelengthAct(e.target.value);
36
36
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
37
37
  className: (0, _classnames.default)(classes.fieldLayout),
38
38
  variant: "outlined",
39
39
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
40
40
  id: "select-wavelength-label",
41
41
  className: (0, _classnames.default)(classes.selectLabel, 'select-sv-bar-label'),
42
- children: "Wavelength"
42
+ children: "Wavelength (nm)"
43
43
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
44
44
  labelId: "select-wavelength-label",
45
45
  label: "Wavelength",
46
46
  value: waveLengthSt,
47
47
  onChange: onChange,
48
48
  className: (0, _classnames.default)(classes.selectInput, 'input-sv-bar-layout'),
49
- children: _list_wavelength.LIST_WAVE_LENGTH.map(item => {
49
+ children: _list_wavelength.LIST_WAVE_LENGTH.map((item, idx) => {
50
50
  // eslint-disable-line
51
+ const itemKey = `${item.label}-${item.value}-${item.unit}-${idx}`;
51
52
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
52
53
  value: item,
53
54
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
54
55
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout'),
55
56
  children: [item.label, " (", item.value, " ", item.unit, ")"]
56
57
  })
57
- });
58
+ }, itemKey);
58
59
  })
59
60
  })]
60
61
  });
@@ -63,10 +64,10 @@ const Wavelength = ({
63
64
  classes,
64
65
  waveLengthSt,
65
66
  layoutSt,
66
- updateWaveLengthAct
67
+ updateWavelengthAct
67
68
  }) => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
68
69
  className: classes.groupRight,
69
- children: wavelengthSelect(classes, waveLengthSt, layoutSt, updateWaveLengthAct)
70
+ children: wavelengthSelect(classes, waveLengthSt, layoutSt, updateWavelengthAct)
70
71
  });
71
72
  const mapStateToProps = (state, props) => (
72
73
  // eslint-disable-line
@@ -75,12 +76,12 @@ const mapStateToProps = (state, props) => (
75
76
  layoutSt: state.layout
76
77
  });
77
78
  const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
78
- updateWaveLengthAct: _wavelength.updateWaveLength
79
+ updateWavelengthAct: _wavelength.updateWaveLength
79
80
  }, dispatch);
80
81
  Wavelength.propTypes = {
81
82
  classes: _propTypes.default.object.isRequired,
82
83
  layoutSt: _propTypes.default.string.isRequired,
83
84
  waveLengthSt: _propTypes.default.object.isRequired,
84
- updateWaveLengthAct: _propTypes.default.func.isRequired
85
+ updateWavelengthAct: _propTypes.default.func.isRequired
85
86
  };
86
87
  var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _withStyles.default)(styles)(Wavelength));
@@ -64,13 +64,13 @@ const detectorSelect = (classes, detectorSt, curveSt, layoutSt, updateDetectorAc
64
64
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
65
65
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
66
66
  })
67
- }), _list_detectors.LIST_DETECTORS.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
67
+ }, "detector-empty"), _list_detectors.LIST_DETECTORS.map((item, idx) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
68
68
  value: item,
69
69
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
70
70
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout'),
71
71
  children: item.name
72
72
  })
73
- }))]
73
+ }, item?.name || item?.id || `detector-${idx}`))]
74
74
  })]
75
75
  });
76
76
  };
@@ -126,6 +126,9 @@ TriBtn.propTypes = {
126
126
  content: _propTypes.default.object.isRequired,
127
127
  cb: _propTypes.default.func.isRequired,
128
128
  children: _propTypes.default.node.isRequired,
129
- isClearAllDisabled: _propTypes.default.bool.isRequired
129
+ isClearAllDisabled: _propTypes.default.bool
130
+ };
131
+ TriBtn.defaultProps = {
132
+ isClearAllDisabled: false
130
133
  };
131
134
  var _default = exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(TriBtn));
@@ -5,16 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.drawMain = exports.drawLabel = exports.drawDisplay = exports.drawDestroy = exports.drawArrowOnCurve = void 0;
7
7
  const d3 = require('d3');
8
- const drawMain = (klass, w, h) => {
9
- d3.select(klass).append('svg').attr('class', 'd3Svg').attr('preserveAspectRatio', 'xMinYMin meet').attr('viewBox', `0 0 ${w} ${h}`);
8
+ const {
9
+ LIST_BRUSH_SVG_GRAPH
10
+ } = require('../../constants/list_graph');
11
+ const drawMain = (klass, w, h, d3svgClass = LIST_BRUSH_SVG_GRAPH.LINE) => {
12
+ d3.select(klass).append('svg').attr('class', d3svgClass).attr('preserveAspectRatio', 'xMinYMin meet').attr('viewBox', `0 0 ${w} ${h}`);
10
13
  };
11
14
  exports.drawMain = drawMain;
12
15
  const drawLabel = (klass, cLabel, xLabel, yLabel) => {
13
16
  d3.select(klass).selectAll('.xLabel').text(xLabel);
14
17
  d3.select(klass).selectAll('.yLabel').text(yLabel);
15
- if (cLabel) {
16
- d3.select(klass).selectAll('.mark-text').text(cLabel);
17
- }
18
+ d3.select(klass).selectAll('.mark-text').text(cLabel || '');
18
19
  };
19
20
  exports.drawLabel = drawLabel;
20
21
  const drawDisplay = (klass, isHidden) => {