@complat/react-spectra-editor 1.7.1 → 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.
- package/CHANGELOG.md +28 -0
- package/LICENSE +21 -662
- package/README.md +5 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp.js +2329 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_2.js +2874 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_mz_chemstation.js +3242 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_chemstation.js +854 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_neg.js +1233 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_pos.js +1233 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis.js +48908 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis_chemstation.js +15424 -0
- package/dist/__tests__/units/components/cmd_bar/r05_submit_btn.test.js +158 -3
- package/dist/__tests__/units/components/d3_line_rect.test.js +85 -0
- package/dist/__tests__/units/components/d3_multi/multi_focus.test.js +43 -0
- package/dist/__tests__/units/components/hplc_viewer.test.js +123 -0
- package/dist/__tests__/units/components/panel/info.test.js +55 -15
- package/dist/__tests__/units/features/lc-ms/parsing/lcmsCategory.test.js +73 -0
- package/dist/__tests__/units/features/lc-ms/submit/peaks.test.js +310 -0
- package/dist/actions/curve.js +5 -2
- package/dist/actions/hplc_ms.js +66 -0
- package/dist/actions/integration.js +17 -2
- package/dist/actions/ui.js +39 -11
- package/dist/app.js +21 -8
- package/dist/components/cmd_bar/01_viewer.js +15 -11
- package/dist/components/cmd_bar/03_peak.js +25 -16
- package/dist/components/cmd_bar/04_integration.js +116 -17
- package/dist/components/cmd_bar/08_peak_group.js +83 -0
- package/dist/components/cmd_bar/collapsible_toolbar_group.js +101 -0
- package/dist/components/cmd_bar/common.js +4 -3
- package/dist/components/cmd_bar/index.js +76 -18
- package/dist/components/cmd_bar/r01_layout.js +6 -0
- package/dist/components/cmd_bar/r02_scan.js +15 -11
- package/dist/components/cmd_bar/r03_threshold.js +19 -3
- package/dist/components/cmd_bar/r04_submit.js +61 -6
- package/dist/components/cmd_bar/r05_submit_btn.js +60 -13
- package/dist/components/cmd_bar/r06_predict_btn.js +4 -4
- package/dist/components/cmd_bar/r07_wavelength_btn.js +10 -9
- package/dist/components/cmd_bar/r09_detector.js +2 -2
- package/dist/components/cmd_bar/tri_btn.js +4 -1
- package/dist/components/common/draw.js +6 -5
- package/dist/components/d3_line/index.js +70 -15
- package/dist/components/d3_line/line_focus.js +104 -67
- package/dist/components/d3_line_rect/index.js +836 -0
- package/dist/components/d3_line_rect/line_focus.js +526 -0
- package/dist/components/d3_line_rect/multi_focus.js +433 -0
- package/dist/components/d3_line_rect/rect_focus.js +247 -0
- package/dist/components/d3_multi/index.js +154 -163
- package/dist/components/d3_multi/multi_focus.js +117 -68
- package/dist/components/d3_rect/index.js +6 -0
- package/dist/components/d3_rect/rect_focus.js +17 -5
- package/dist/components/hplc_viewer.js +169 -0
- package/dist/components/lc_ms_uv_tools_bar.js +175 -0
- package/dist/components/multi_jcamps_viewer.js +17 -5
- package/dist/components/panel/compare.js +84 -62
- package/dist/components/panel/cyclic_voltamery_data.js +15 -14
- package/dist/components/panel/graph_selection.js +32 -30
- package/dist/components/panel/index.js +28 -22
- package/dist/components/panel/info.js +75 -26
- package/dist/constants/action_type.js +23 -2
- package/dist/constants/list_graph.js +16 -0
- package/dist/constants/list_layout.js +2 -1
- package/dist/constants/list_ui.js +5 -2
- package/dist/features/lc-ms/entities/extractEntityLCMS.js +187 -0
- package/dist/features/lc-ms/parsing/chemstation.js +108 -0
- package/dist/features/lc-ms/parsing/index.js +46 -0
- package/dist/features/lc-ms/parsing/lcmsCategory.js +44 -0
- package/dist/features/lc-ms/parsing/lcmsJcampInfo.js +18 -0
- package/dist/features/lc-ms/parsing/lcmsMsPage.js +241 -0
- package/dist/features/lc-ms/parsing/pageValue.js +27 -0
- package/dist/features/lc-ms/submit/index.js +24 -0
- package/dist/features/lc-ms/submit/peaks.js +66 -0
- package/dist/features/lc-ms/ui/wavelengthSelect.js +54 -0
- package/dist/fn.js +4 -1
- package/dist/helpers/brush.js +74 -19
- package/dist/helpers/calc.js +4 -2
- package/dist/helpers/cfg.js +5 -4
- package/dist/helpers/chem.js +449 -71
- package/dist/helpers/compass.js +181 -17
- package/dist/helpers/extractEntityLCMS.js +24 -0
- package/dist/helpers/extractParams.js +118 -33
- package/dist/helpers/extractPeaksEdit.js +29 -9
- package/dist/helpers/format.js +189 -4
- package/dist/helpers/init.js +25 -5
- package/dist/helpers/integration.js +130 -17
- package/dist/helpers/integration_draft.js +43 -0
- package/dist/helpers/integration_focus.js +155 -0
- package/dist/helpers/integration_jcamp.js +68 -0
- package/dist/helpers/integration_split.js +202 -0
- package/dist/helpers/mount.js +8 -1
- package/dist/helpers/sweep.js +39 -0
- package/dist/index.js +284 -26
- package/dist/layer_content.js +17 -3
- package/dist/layer_init.js +124 -14
- package/dist/layer_prism.js +31 -5
- package/dist/reducers/index.js +3 -1
- package/dist/reducers/reducer_curve.js +54 -36
- package/dist/reducers/reducer_hplc_ms/hydrate.js +289 -0
- package/dist/reducers/reducer_hplc_ms/index.js +122 -0
- package/dist/reducers/reducer_hplc_ms/persistence.js +74 -0
- package/dist/reducers/reducer_hplc_ms/tic.js +70 -0
- package/dist/reducers/reducer_hplc_ms/utils.js +70 -0
- package/dist/reducers/reducer_hplc_ms/uvvis.js +377 -0
- package/dist/reducers/reducer_integration.js +265 -7
- package/dist/reducers/reducer_layout.js +1 -1
- package/dist/reducers/reducer_submit.js +2 -1
- package/dist/reducers/reducer_ui.js +149 -13
- package/dist/reducers/undo_redo_config.js +2 -2
- package/dist/sagas/saga_lcms_ui.js +85 -0
- package/dist/sagas/saga_ui.js +177 -74
- package/dist/setupTests.js +5 -5
- package/package.json +10 -7
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
6
6
|
var _material = require("@mui/material");
|
|
7
7
|
var _reactQuill = _interopRequireDefault(require("react-quill"));
|
|
8
8
|
var _app = require("./app");
|
|
9
|
+
var _extractEntityLCMS = require("./helpers/extractEntityLCMS");
|
|
10
|
+
var _utils = require("./reducers/reducer_hplc_ms/utils");
|
|
9
11
|
var _nmr1h_jcamp = _interopRequireDefault(require("./__tests__/fixtures/nmr1h_jcamp"));
|
|
10
12
|
var _nmr1h_2_jcamp = _interopRequireDefault(require("./__tests__/fixtures/nmr1h_2_jcamp"));
|
|
11
13
|
var _nmr13c_dept_jcamp = _interopRequireDefault(require("./__tests__/fixtures/nmr13c_dept_jcamp"));
|
|
@@ -19,6 +21,14 @@ var _compare_ir_1_jcamp = _interopRequireDefault(require("./__tests__/fixtures/c
|
|
|
19
21
|
var _compare_ir_2_jcamp = _interopRequireDefault(require("./__tests__/fixtures/compare_ir_2_jcamp"));
|
|
20
22
|
var _raman_jcamp = _interopRequireDefault(require("./__tests__/fixtures/raman_jcamp"));
|
|
21
23
|
var _ms_jcamp = _interopRequireDefault(require("./__tests__/fixtures/ms_jcamp"));
|
|
24
|
+
var _lc_ms_jcamp = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp"));
|
|
25
|
+
var _lc_ms_jcamp_ = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_2"));
|
|
26
|
+
var _lc_ms_jcamp_tic_pos = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_tic_pos"));
|
|
27
|
+
var _lc_ms_jcamp_tic_neg = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_tic_neg"));
|
|
28
|
+
var _lc_ms_jcamp_uvvis = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_uvvis"));
|
|
29
|
+
var _lc_ms_jcamp_tic_chemstation = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_tic_chemstation"));
|
|
30
|
+
var _lc_ms_jcamp_mz_chemstation = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_mz_chemstation"));
|
|
31
|
+
var _lc_ms_jcamp_uvvis_chemstation = _interopRequireDefault(require("./__tests__/fixtures/lc_ms_jcamp_uvvis_chemstation"));
|
|
22
32
|
var _nmr_result = _interopRequireDefault(require("./__tests__/fixtures/nmr_result"));
|
|
23
33
|
var _ir_result = _interopRequireDefault(require("./__tests__/fixtures/ir_result"));
|
|
24
34
|
var _phenylalanin = _interopRequireDefault(require("./__tests__/fixtures/phenylalanin"));
|
|
@@ -82,6 +92,14 @@ const compIr1Entity = _app.FN.ExtractJcamp(_compare_ir_1_jcamp.default);
|
|
|
82
92
|
const compIr2Entity = _app.FN.ExtractJcamp(_compare_ir_2_jcamp.default);
|
|
83
93
|
const ramanEntity = _app.FN.ExtractJcamp(_raman_jcamp.default);
|
|
84
94
|
const msEntity = _app.FN.ExtractJcamp(_ms_jcamp.default);
|
|
95
|
+
const lcmsEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp.default);
|
|
96
|
+
const lcmsEntity2 = _app.FN.ExtractJcamp(_lc_ms_jcamp_.default);
|
|
97
|
+
const hplcMsTicPosEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp_tic_pos.default);
|
|
98
|
+
const hplcMsTicNegEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp_tic_neg.default);
|
|
99
|
+
const hplcMsUvvisEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp_uvvis.default);
|
|
100
|
+
const hplcMsTicChemstationEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp_tic_chemstation.default);
|
|
101
|
+
const hplcMsMzChemstationEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp_mz_chemstation.default);
|
|
102
|
+
const hplcMsUvvisChemstationEntity = _app.FN.ExtractJcamp(_lc_ms_jcamp_uvvis_chemstation.default);
|
|
85
103
|
const uvVisEntity = _app.FN.ExtractJcamp(_uv_vis_jcamp.default);
|
|
86
104
|
const compUvVisEntity = _app.FN.ExtractJcamp(_compare_uv_vis_jcamp.default);
|
|
87
105
|
const hplcUVVisEntity = _app.FN.ExtractJcamp(_hplc_uvvis_jcamp.default);
|
|
@@ -106,6 +124,140 @@ const gcEntity3 = _app.FN.ExtractJcamp(_gc_3_jcamp.default);
|
|
|
106
124
|
const emissionsEntity = _app.FN.ExtractJcamp(_emissions_jcamp.default);
|
|
107
125
|
const dlsAcfEntity = _app.FN.ExtractJcamp(_dls_acf_jcamp.default);
|
|
108
126
|
const dlsIntensityEntity = _app.FN.ExtractJcamp(_dls_intensity_jcamp.default);
|
|
127
|
+
const cloneData = value => JSON.parse(JSON.stringify(value));
|
|
128
|
+
const parseNumericPage = feature => {
|
|
129
|
+
const candidates = [feature?.pageValue, feature?.page, feature?.pageSymbol];
|
|
130
|
+
for (let i = 0; i < candidates.length; i += 1) {
|
|
131
|
+
const raw = candidates[i];
|
|
132
|
+
if (raw != null) {
|
|
133
|
+
if (typeof raw === 'number' && Number.isFinite(raw)) return raw;
|
|
134
|
+
const text = String(raw).split('\n')[0].trim();
|
|
135
|
+
const match = text.match(/[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/);
|
|
136
|
+
if (match) {
|
|
137
|
+
const value = Number(match[0]);
|
|
138
|
+
if (Number.isFinite(value)) return value;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
};
|
|
144
|
+
const getCurveFeatures = curve => {
|
|
145
|
+
if (Array.isArray(curve?.features)) return curve.features;
|
|
146
|
+
if (curve?.features && typeof curve.features === 'object') {
|
|
147
|
+
return Object.values(curve.features);
|
|
148
|
+
}
|
|
149
|
+
return [];
|
|
150
|
+
};
|
|
151
|
+
const selectClosestMsFeature = (retentionTime, polarity) => {
|
|
152
|
+
const featurePool = [...getCurveFeatures(lcmsEntity).map(feature => ({
|
|
153
|
+
curve: lcmsEntity,
|
|
154
|
+
feature
|
|
155
|
+
})), ...getCurveFeatures(lcmsEntity2).map(feature => ({
|
|
156
|
+
curve: lcmsEntity2,
|
|
157
|
+
feature
|
|
158
|
+
}))].filter(entry => Number.isFinite(parseNumericPage(entry.feature)));
|
|
159
|
+
if (featurePool.length === 0) return null;
|
|
160
|
+
const normalizedPolarity = polarity ? String(polarity).toLowerCase() : null;
|
|
161
|
+
const filteredPool = normalizedPolarity ? featurePool.filter(entry => (0, _extractEntityLCMS.getLcMsInfo)(entry.curve).polarity === normalizedPolarity) : featurePool;
|
|
162
|
+
const pool = filteredPool.length > 0 ? filteredPool : featurePool;
|
|
163
|
+
if (pool.length === 0) return null;
|
|
164
|
+
if (!Number.isFinite(retentionTime)) return pool[0];
|
|
165
|
+
return pool.reduce((best, entry) => {
|
|
166
|
+
const bestRt = parseNumericPage(best.feature);
|
|
167
|
+
const currentRt = parseNumericPage(entry.feature);
|
|
168
|
+
if (!Number.isFinite(bestRt)) return entry;
|
|
169
|
+
if (!Number.isFinite(currentRt)) return best;
|
|
170
|
+
return Math.abs(currentRt - retentionTime) < Math.abs(bestRt - retentionTime) ? entry : best;
|
|
171
|
+
}, pool[0]);
|
|
172
|
+
};
|
|
173
|
+
const buildLcmsStandaloneMultiEntities = (retentionTime, polarity) => {
|
|
174
|
+
const selected = selectClosestMsFeature(retentionTime, polarity);
|
|
175
|
+
const selectedMsCurve = selected?.curve || lcmsEntity;
|
|
176
|
+
const allFeatures = getCurveFeatures(selectedMsCurve);
|
|
177
|
+
const msCurve = cloneData(selectedMsCurve);
|
|
178
|
+
const spectrArr = Array.isArray(msCurve.spectra) ? msCurve.spectra : [];
|
|
179
|
+
const nFeat = allFeatures.length;
|
|
180
|
+
const nSpec = spectrArr.length;
|
|
181
|
+
const primaryIdx = selected?.feature != null && allFeatures.indexOf(selected.feature) >= 0 ? allFeatures.indexOf(selected.feature) : 0;
|
|
182
|
+
let rawLen = Math.min(nFeat, nSpec);
|
|
183
|
+
if (primaryIdx >= rawLen) {
|
|
184
|
+
rawLen = Math.min(primaryIdx + 1, nFeat, nSpec);
|
|
185
|
+
}
|
|
186
|
+
const safePrimary = Math.min(primaryIdx, Math.max(0, rawLen - 1));
|
|
187
|
+
const allIndices = Array.from({
|
|
188
|
+
length: rawLen
|
|
189
|
+
}, (_, i) => i);
|
|
190
|
+
const orderedIdx = [safePrimary, ...allIndices.filter(i => i !== safePrimary)];
|
|
191
|
+
msCurve.features = orderedIdx.map(i => cloneData(allFeatures[i]));
|
|
192
|
+
msCurve.spectra = orderedIdx.map(i => cloneData(spectrArr[i]));
|
|
193
|
+
const multi = [cloneData(hplcMsTicPosEntity), cloneData(hplcMsTicNegEntity), cloneData(hplcMsUvvisEntity), msCurve];
|
|
194
|
+
const pol = polarity ? String(polarity).toLowerCase() : 'positive';
|
|
195
|
+
const ticEntityForPolarity = pol === 'negative' ? multi[1] : multi[0];
|
|
196
|
+
const ticXs = ticEntityForPolarity?.features?.[0]?.data?.[0]?.x || [];
|
|
197
|
+
const rtNum = Number.isFinite(retentionTime) ? retentionTime : parseNumericPage({
|
|
198
|
+
pageValue: retentionTime,
|
|
199
|
+
page: retentionTime,
|
|
200
|
+
pageSymbol: retentionTime
|
|
201
|
+
});
|
|
202
|
+
const snapped = Array.isArray(ticXs) && ticXs.length > 0 && Number.isFinite(rtNum) ? (0, _utils.snapRtToAxis)(rtNum, ticXs) : null;
|
|
203
|
+
if (snapped != null && Number.isFinite(snapped)) {
|
|
204
|
+
if (msCurve.features[0]) {
|
|
205
|
+
msCurve.features[0].pageValue = snapped;
|
|
206
|
+
msCurve.features[0].page = String(snapped);
|
|
207
|
+
msCurve.features[0].pageSymbol = String(snapped);
|
|
208
|
+
}
|
|
209
|
+
if (msCurve.spectra?.[0]) {
|
|
210
|
+
msCurve.spectra[0].pageValue = snapped;
|
|
211
|
+
msCurve.spectra[0].page = String(snapped);
|
|
212
|
+
msCurve.spectra[0].pageSymbol = String(snapped);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return multi;
|
|
216
|
+
};
|
|
217
|
+
const getInitialLcmsRetentionTime = () => {
|
|
218
|
+
const ticX = hplcMsTicPosEntity?.features?.[0]?.data?.[0]?.x;
|
|
219
|
+
return Array.isArray(ticX) && Number.isFinite(ticX[0]) ? ticX[0] : null;
|
|
220
|
+
};
|
|
221
|
+
const selectClosestChemstationMzFeature = retentionTime => {
|
|
222
|
+
const allFeatures = getCurveFeatures(hplcMsMzChemstationEntity);
|
|
223
|
+
if (allFeatures.length === 0) return null;
|
|
224
|
+
if (!Number.isFinite(retentionTime)) return allFeatures[0];
|
|
225
|
+
return allFeatures.reduce((best, feature) => {
|
|
226
|
+
const bestRt = parseNumericPage(best);
|
|
227
|
+
const currentRt = parseNumericPage(feature);
|
|
228
|
+
if (!Number.isFinite(bestRt)) return feature;
|
|
229
|
+
if (!Number.isFinite(currentRt)) return best;
|
|
230
|
+
return Math.abs(currentRt - retentionTime) < Math.abs(bestRt - retentionTime) ? feature : best;
|
|
231
|
+
}, allFeatures[0]);
|
|
232
|
+
};
|
|
233
|
+
const buildChemstationStandaloneMultiEntities = retentionTime => {
|
|
234
|
+
const allFeatures = getCurveFeatures(hplcMsMzChemstationEntity);
|
|
235
|
+
const selectedFeature = selectClosestChemstationMzFeature(retentionTime);
|
|
236
|
+
const featureIdx = selectedFeature != null && allFeatures.indexOf(selectedFeature) >= 0 ? allFeatures.indexOf(selectedFeature) : 0;
|
|
237
|
+
const msCurve = cloneData(hplcMsMzChemstationEntity);
|
|
238
|
+
const spectrArr = Array.isArray(msCurve.spectra) ? msCurve.spectra : [];
|
|
239
|
+
const safeIdx = Math.min(featureIdx, Math.max(allFeatures.length - 1, 0));
|
|
240
|
+
msCurve.features = [cloneData(allFeatures[safeIdx])];
|
|
241
|
+
msCurve.spectra = spectrArr[safeIdx] ? [cloneData(spectrArr[safeIdx])] : [cloneData(allFeatures[safeIdx])];
|
|
242
|
+
const ticXs = hplcMsTicChemstationEntity?.features?.[0]?.data?.[0]?.x || [];
|
|
243
|
+
const rtNum = Number.isFinite(retentionTime) ? retentionTime : parseNumericPage(msCurve.features[0]);
|
|
244
|
+
const snapped = Array.isArray(ticXs) && ticXs.length > 0 && Number.isFinite(rtNum) ? (0, _utils.snapRtToAxis)(rtNum, ticXs) : null;
|
|
245
|
+
if (snapped != null && Number.isFinite(snapped)) {
|
|
246
|
+
msCurve.features[0].pageValue = snapped;
|
|
247
|
+
msCurve.features[0].page = String(snapped);
|
|
248
|
+
msCurve.features[0].pageSymbol = String(snapped);
|
|
249
|
+
if (msCurve.spectra[0]) {
|
|
250
|
+
msCurve.spectra[0].pageValue = snapped;
|
|
251
|
+
msCurve.spectra[0].page = String(snapped);
|
|
252
|
+
msCurve.spectra[0].pageSymbol = String(snapped);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return [cloneData(hplcMsTicChemstationEntity), msCurve, cloneData(hplcMsUvvisChemstationEntity)];
|
|
256
|
+
};
|
|
257
|
+
const getInitialChemstationRetentionTime = () => {
|
|
258
|
+
const ticX = hplcMsTicChemstationEntity?.features?.[0]?.data?.[0]?.x;
|
|
259
|
+
return Array.isArray(ticX) && Number.isFinite(ticX[0]) ? ticX[0] : null;
|
|
260
|
+
};
|
|
109
261
|
class DemoWriteIr extends _react.default.Component {
|
|
110
262
|
constructor(props) {
|
|
111
263
|
super(props);
|
|
@@ -115,7 +267,9 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
115
267
|
predictions: false,
|
|
116
268
|
molecule: '',
|
|
117
269
|
showOthers: false,
|
|
118
|
-
descChanged: ''
|
|
270
|
+
descChanged: '',
|
|
271
|
+
lcmsDynamicMultiEntities: null,
|
|
272
|
+
lcmsChemstationDynamicMultiEntities: null
|
|
119
273
|
};
|
|
120
274
|
this.onClick = this.onClick.bind(this);
|
|
121
275
|
this.writeMpy = this.writeMpy.bind(this);
|
|
@@ -131,16 +285,8 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
131
285
|
this.loadOthers = this.loadOthers.bind(this);
|
|
132
286
|
this.onDescriptionChanged = this.onDescriptionChanged.bind(this);
|
|
133
287
|
this.loadMultiEntities = this.loadMultiEntities.bind(this);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return () => {
|
|
137
|
-
this.setState({
|
|
138
|
-
typ,
|
|
139
|
-
desc: '',
|
|
140
|
-
predictions: false,
|
|
141
|
-
molecule: ''
|
|
142
|
-
});
|
|
143
|
-
};
|
|
288
|
+
this.handleLcmsPageRequest = this.handleLcmsPageRequest.bind(this);
|
|
289
|
+
this.lcmsRequestCounter = 0;
|
|
144
290
|
}
|
|
145
291
|
onShowOthers(jcamp) {
|
|
146
292
|
// eslint-disable-line
|
|
@@ -154,6 +300,82 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
154
300
|
descChanged: content
|
|
155
301
|
});
|
|
156
302
|
}
|
|
303
|
+
componentDidUpdate(_prevProps, prevState) {
|
|
304
|
+
const {
|
|
305
|
+
typ
|
|
306
|
+
} = this.state;
|
|
307
|
+
const {
|
|
308
|
+
typ: prevTyp
|
|
309
|
+
} = prevState;
|
|
310
|
+
if (typ === 'lcms' && prevTyp !== 'lcms') {
|
|
311
|
+
const initialRt = getInitialLcmsRetentionTime();
|
|
312
|
+
this.handleLcmsPageRequest({
|
|
313
|
+
retentionTime: initialRt,
|
|
314
|
+
polarity: 'positive',
|
|
315
|
+
trigger: 'initial_load'
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (typ === 'lcms chemstation' && prevTyp !== 'lcms chemstation') {
|
|
319
|
+
const initialRt = getInitialChemstationRetentionTime();
|
|
320
|
+
this.handleLcmsPageRequest({
|
|
321
|
+
retentionTime: initialRt,
|
|
322
|
+
polarity: 'positive',
|
|
323
|
+
trigger: 'initial_load'
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
handleLcmsPageRequest(request) {
|
|
328
|
+
const {
|
|
329
|
+
typ
|
|
330
|
+
} = this.state;
|
|
331
|
+
if (typ !== 'lcms' && typ !== 'lcms chemstation') return;
|
|
332
|
+
const retentionTime = request?.retentionTime;
|
|
333
|
+
const polarity = request?.polarity;
|
|
334
|
+
const trigger = request?.trigger || 'unknown';
|
|
335
|
+
this.lcmsRequestCounter += 1;
|
|
336
|
+
const requestId = this.lcmsRequestCounter;
|
|
337
|
+
if (typeof window !== 'undefined') {
|
|
338
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
339
|
+
const history = Array.isArray(window.__lcmsDemoRequests) ? window.__lcmsDemoRequests : [];
|
|
340
|
+
history.push({
|
|
341
|
+
requestId,
|
|
342
|
+
retentionTime,
|
|
343
|
+
polarity,
|
|
344
|
+
trigger,
|
|
345
|
+
createdAt: Date.now()
|
|
346
|
+
});
|
|
347
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
348
|
+
window.__lcmsDemoRequests = history;
|
|
349
|
+
}
|
|
350
|
+
setTimeout(() => {
|
|
351
|
+
if (requestId !== this.lcmsRequestCounter) return;
|
|
352
|
+
if (typ === 'lcms chemstation') {
|
|
353
|
+
this.setState({
|
|
354
|
+
lcmsChemstationDynamicMultiEntities: buildChemstationStandaloneMultiEntities(retentionTime)
|
|
355
|
+
});
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.setState({
|
|
359
|
+
lcmsDynamicMultiEntities: buildLcmsStandaloneMultiEntities(retentionTime, polarity)
|
|
360
|
+
});
|
|
361
|
+
}, 250);
|
|
362
|
+
}
|
|
363
|
+
onClick(typ) {
|
|
364
|
+
return () => {
|
|
365
|
+
const isLcms = typ === 'lcms';
|
|
366
|
+
const isChemstation = typ === 'lcms chemstation';
|
|
367
|
+
const initialRt = getInitialLcmsRetentionTime();
|
|
368
|
+
const initialChemstationRt = getInitialChemstationRetentionTime();
|
|
369
|
+
this.setState({
|
|
370
|
+
typ,
|
|
371
|
+
desc: '',
|
|
372
|
+
predictions: false,
|
|
373
|
+
molecule: '',
|
|
374
|
+
lcmsDynamicMultiEntities: isLcms ? buildLcmsStandaloneMultiEntities(initialRt) : null,
|
|
375
|
+
lcmsChemstationDynamicMultiEntities: isChemstation ? buildChemstationStandaloneMultiEntities(initialChemstationRt) : null
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
}
|
|
157
379
|
loadEntity() {
|
|
158
380
|
const {
|
|
159
381
|
typ
|
|
@@ -204,14 +426,22 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
204
426
|
case 'gc':
|
|
205
427
|
return gcEntity1;
|
|
206
428
|
case 'ms':
|
|
429
|
+
return msEntity;
|
|
430
|
+
case 'lcms':
|
|
431
|
+
return lcmsEntity;
|
|
432
|
+
case 'lcms chemstation':
|
|
433
|
+
return hplcMsUvvisChemstationEntity;
|
|
207
434
|
default:
|
|
208
435
|
return msEntity;
|
|
209
436
|
}
|
|
210
437
|
}
|
|
211
438
|
loadMultiEntities() {
|
|
212
439
|
const {
|
|
213
|
-
typ
|
|
440
|
+
typ,
|
|
441
|
+
lcmsDynamicMultiEntities,
|
|
442
|
+
lcmsChemstationDynamicMultiEntities
|
|
214
443
|
} = this.state;
|
|
444
|
+
const chemstationMultiEntities = lcmsChemstationDynamicMultiEntities || buildChemstationStandaloneMultiEntities(getInitialChemstationRetentionTime());
|
|
215
445
|
switch (typ) {
|
|
216
446
|
case 'cyclic volta':
|
|
217
447
|
return [cyclicVoltaEntity1, cyclicVoltaEntity2, cyclicVoltaEntity3];
|
|
@@ -229,8 +459,12 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
229
459
|
return [aifEntity1, aifEntity2];
|
|
230
460
|
case 'gc':
|
|
231
461
|
return [gcEntity1, gcEntity2, gcEntity3];
|
|
462
|
+
case 'lcms':
|
|
463
|
+
return lcmsDynamicMultiEntities || buildLcmsStandaloneMultiEntities(getInitialLcmsRetentionTime());
|
|
464
|
+
case 'lcms chemstation':
|
|
465
|
+
return chemstationMultiEntities;
|
|
232
466
|
default:
|
|
233
|
-
return
|
|
467
|
+
return [];
|
|
234
468
|
}
|
|
235
469
|
}
|
|
236
470
|
loadQuill() {
|
|
@@ -257,6 +491,8 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
257
491
|
case 'dsc':
|
|
258
492
|
case 'xrd':
|
|
259
493
|
case 'ms':
|
|
494
|
+
case 'lcms':
|
|
495
|
+
case 'lcms chemstation':
|
|
260
496
|
case 'cyclic volta':
|
|
261
497
|
case 'cds':
|
|
262
498
|
case 'sec':
|
|
@@ -324,7 +560,8 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
324
560
|
boundary,
|
|
325
561
|
integration,
|
|
326
562
|
waveLength,
|
|
327
|
-
temperature
|
|
563
|
+
temperature,
|
|
564
|
+
hplcMsSt: _app.store.getState().hplcMs
|
|
328
565
|
});
|
|
329
566
|
const wrapper = _app.FN.peaksWrapper(safeLayout, shiftForFormatting);
|
|
330
567
|
let desc = this.rmDollarSign(wrapper.head) + body + wrapper.tail;
|
|
@@ -492,10 +729,7 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
492
729
|
shift,
|
|
493
730
|
isAscend,
|
|
494
731
|
decimal,
|
|
495
|
-
analysis,
|
|
496
732
|
isIntensity,
|
|
497
|
-
integration,
|
|
498
|
-
multiplicity,
|
|
499
733
|
waveLength
|
|
500
734
|
} = pickSelectedSpectrumFromPayload(payload);
|
|
501
735
|
const entity = this.loadEntity();
|
|
@@ -524,18 +758,20 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
524
758
|
isIntensity,
|
|
525
759
|
boundary,
|
|
526
760
|
waveLength,
|
|
527
|
-
temperature
|
|
761
|
+
temperature,
|
|
762
|
+
hplcMsSt: _app.store.getState().hplcMs
|
|
528
763
|
});
|
|
529
764
|
/*eslint-disable */
|
|
530
|
-
|
|
531
|
-
console.log(integration);
|
|
532
|
-
console.log(multiplicity);
|
|
765
|
+
let message = `Peaks: ${body}\n`;
|
|
533
766
|
if (shift?.ref?.label) {
|
|
534
767
|
const label = this.rmDollarSign(shift.ref.label);
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
alert(`Peaks: ${body}` + '\n');
|
|
768
|
+
message += '- - - - - - - - - - -\n';
|
|
769
|
+
message += `Shift solvent = ${label}, ${shift.ref.value}ppm\n`;
|
|
538
770
|
}
|
|
771
|
+
console.info(message); // eslint-disable-line no-console
|
|
772
|
+
this.setState({
|
|
773
|
+
desc: message
|
|
774
|
+
});
|
|
539
775
|
/*eslint-disable */
|
|
540
776
|
}
|
|
541
777
|
predictOp({
|
|
@@ -608,7 +844,9 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
608
844
|
value: this.writeMpy
|
|
609
845
|
}, ...operations];
|
|
610
846
|
}
|
|
611
|
-
const refreshCb = () =>
|
|
847
|
+
const refreshCb = () => {
|
|
848
|
+
console.info('Refresh simulation requested.'); // eslint-disable-line no-console
|
|
849
|
+
};
|
|
612
850
|
const forecast = {
|
|
613
851
|
btnCb: this.predictOp,
|
|
614
852
|
refreshCb,
|
|
@@ -796,6 +1034,20 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
796
1034
|
},
|
|
797
1035
|
onClick: this.onClick('ms'),
|
|
798
1036
|
children: "MS"
|
|
1037
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
1038
|
+
variant: "contained",
|
|
1039
|
+
style: {
|
|
1040
|
+
margin: '0 10px 0 10px'
|
|
1041
|
+
},
|
|
1042
|
+
onClick: this.onClick('lcms'),
|
|
1043
|
+
children: "LC/MS OpenLab"
|
|
1044
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
1045
|
+
variant: "contained",
|
|
1046
|
+
style: {
|
|
1047
|
+
margin: '0 10px 0 10px'
|
|
1048
|
+
},
|
|
1049
|
+
onClick: this.onClick('lcms chemstation'),
|
|
1050
|
+
children: "LC/MS Chemstation"
|
|
799
1051
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
800
1052
|
variant: "contained",
|
|
801
1053
|
style: {
|
|
@@ -828,6 +1080,7 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
828
1080
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_app.SpectraEditor, {
|
|
829
1081
|
entity: entity,
|
|
830
1082
|
multiEntities: multiEntities,
|
|
1083
|
+
onLcmsPageRequest: this.handleLcmsPageRequest,
|
|
831
1084
|
others: others,
|
|
832
1085
|
editorOnly: false,
|
|
833
1086
|
descriptions: desc,
|
|
@@ -874,4 +1127,9 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
874
1127
|
}
|
|
875
1128
|
|
|
876
1129
|
// - - - DOM - - -
|
|
877
|
-
_reactDom.default.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(DemoWriteIr, {}), document.getElementById('root'));
|
|
1130
|
+
_reactDom.default.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(DemoWriteIr, {}), document.getElementById('root'));
|
|
1131
|
+
if (typeof window !== 'undefined') {
|
|
1132
|
+
window.__spectraStore = _app.store;
|
|
1133
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
1134
|
+
window.__lcmsDemoRequests = [];
|
|
1135
|
+
}
|
package/dist/layer_content.js
CHANGED
|
@@ -17,9 +17,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
/* eslint-disable prefer-object-spread, default-param-last, react/function-component-definition */
|
|
18
18
|
|
|
19
19
|
const extractLayout = (forecast, layoutSt) => {
|
|
20
|
-
const
|
|
20
|
+
const safeForecast = forecast && typeof forecast === 'object' ? forecast : {};
|
|
21
|
+
const isEmpty = Object.keys(safeForecast).length === 0 && safeForecast.constructor === Object;
|
|
21
22
|
const isNmr = _format.default.isNmrLayout(layoutSt);
|
|
22
23
|
const isMs = _format.default.isMsLayout(layoutSt);
|
|
24
|
+
const isLCMs = _format.default.isLCMsLayout(layoutSt);
|
|
23
25
|
const isIr = _format.default.isIrLayout(layoutSt);
|
|
24
26
|
const isUvvis = _format.default.isUvVisLayout(layoutSt) || _format.default.isHplcUvVisLayout(layoutSt);
|
|
25
27
|
const isXRD = _format.default.isXRDLayout(layoutSt);
|
|
@@ -30,7 +32,8 @@ const extractLayout = (forecast, layoutSt) => {
|
|
|
30
32
|
isIr,
|
|
31
33
|
isMs,
|
|
32
34
|
isUvvis,
|
|
33
|
-
isXRD
|
|
35
|
+
isXRD,
|
|
36
|
+
isLCMs
|
|
34
37
|
};
|
|
35
38
|
};
|
|
36
39
|
const Content = ({
|
|
@@ -49,7 +52,8 @@ const Content = ({
|
|
|
49
52
|
isIr,
|
|
50
53
|
isMs,
|
|
51
54
|
isUvvis,
|
|
52
|
-
isXRD
|
|
55
|
+
isXRD,
|
|
56
|
+
isLCMs
|
|
53
57
|
} = extractLayout(forecast, layoutSt);
|
|
54
58
|
if (showForecast) {
|
|
55
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_forecast_viewer.default, {
|
|
@@ -76,6 +80,16 @@ const Content = ({
|
|
|
76
80
|
isHidden: false
|
|
77
81
|
});
|
|
78
82
|
}
|
|
83
|
+
if (isLCMs) {
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.default, {
|
|
85
|
+
topic: topic,
|
|
86
|
+
cLabel: cLabel,
|
|
87
|
+
xLabel: xLabel,
|
|
88
|
+
yLabel: yLabel,
|
|
89
|
+
feature: feature,
|
|
90
|
+
isHidden: false
|
|
91
|
+
});
|
|
92
|
+
}
|
|
79
93
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {
|
|
80
94
|
topic: topic,
|
|
81
95
|
cLabel: cLabel,
|