@complat/react-spectra-editor 0.10.13-alpha.5

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 (109) hide show
  1. package/LICENSE +662 -0
  2. package/README.md +37 -0
  3. package/dist/actions/edit_peak.js +25 -0
  4. package/dist/actions/forecast.js +41 -0
  5. package/dist/actions/integration.js +33 -0
  6. package/dist/actions/jcamp.js +41 -0
  7. package/dist/actions/layout.js +17 -0
  8. package/dist/actions/manager.js +49 -0
  9. package/dist/actions/meta.js +17 -0
  10. package/dist/actions/multiplicity.js +57 -0
  11. package/dist/actions/scan.js +33 -0
  12. package/dist/actions/shift.js +25 -0
  13. package/dist/actions/status.js +33 -0
  14. package/dist/actions/submit.js +41 -0
  15. package/dist/actions/threshold.js +33 -0
  16. package/dist/actions/ui.js +50 -0
  17. package/dist/app.js +125 -0
  18. package/dist/components/cmd_bar/01_viewer.js +133 -0
  19. package/dist/components/cmd_bar/02_zoom.js +119 -0
  20. package/dist/components/cmd_bar/03_peak.js +176 -0
  21. package/dist/components/cmd_bar/04_integration.js +273 -0
  22. package/dist/components/cmd_bar/05_multiplicity.js +228 -0
  23. package/dist/components/cmd_bar/06_undo_redo.js +137 -0
  24. package/dist/components/cmd_bar/common.js +104 -0
  25. package/dist/components/cmd_bar/index.js +113 -0
  26. package/dist/components/cmd_bar/r01_layout.js +351 -0
  27. package/dist/components/cmd_bar/r02_scan.js +226 -0
  28. package/dist/components/cmd_bar/r03_threshold.js +209 -0
  29. package/dist/components/cmd_bar/r04_submit.js +349 -0
  30. package/dist/components/cmd_bar/r05_submit_btn.js +147 -0
  31. package/dist/components/cmd_bar/r06_predict_btn.js +307 -0
  32. package/dist/components/cmd_bar/tri_btn.js +202 -0
  33. package/dist/components/common/chem.js +115 -0
  34. package/dist/components/common/comps.js +29 -0
  35. package/dist/components/common/draw.js +41 -0
  36. package/dist/components/d3_line/index.js +236 -0
  37. package/dist/components/d3_line/line_focus.js +765 -0
  38. package/dist/components/d3_rect/index.js +200 -0
  39. package/dist/components/d3_rect/rect_focus.js +301 -0
  40. package/dist/components/forecast/comps.js +337 -0
  41. package/dist/components/forecast/ir_comps.js +224 -0
  42. package/dist/components/forecast/ir_viewer.js +172 -0
  43. package/dist/components/forecast/nmr_comps.js +253 -0
  44. package/dist/components/forecast/nmr_viewer.js +170 -0
  45. package/dist/components/forecast/section_loading.js +95 -0
  46. package/dist/components/forecast_viewer.js +190 -0
  47. package/dist/components/panel/compare.js +370 -0
  48. package/dist/components/panel/index.js +191 -0
  49. package/dist/components/panel/info.js +335 -0
  50. package/dist/components/panel/multiplicity.js +405 -0
  51. package/dist/components/panel/multiplicity_coupling.js +195 -0
  52. package/dist/components/panel/multiplicity_select.js +114 -0
  53. package/dist/components/panel/peaks.js +296 -0
  54. package/dist/constants/action_type.js +140 -0
  55. package/dist/constants/list_layout.js +23 -0
  56. package/dist/constants/list_shift.js +480 -0
  57. package/dist/constants/list_ui.js +33 -0
  58. package/dist/fn.js +31 -0
  59. package/dist/helpers/brush.js +109 -0
  60. package/dist/helpers/calc.js +10 -0
  61. package/dist/helpers/carbonFeatures.js +47 -0
  62. package/dist/helpers/cfg.js +89 -0
  63. package/dist/helpers/chem.js +594 -0
  64. package/dist/helpers/compass.js +91 -0
  65. package/dist/helpers/converter.js +74 -0
  66. package/dist/helpers/extractParams.js +77 -0
  67. package/dist/helpers/extractPeaksEdit.js +69 -0
  68. package/dist/helpers/focus.js +15 -0
  69. package/dist/helpers/format.js +403 -0
  70. package/dist/helpers/init.js +80 -0
  71. package/dist/helpers/integration.js +30 -0
  72. package/dist/helpers/mount.js +112 -0
  73. package/dist/helpers/multiplicity.js +44 -0
  74. package/dist/helpers/multiplicity_calc.js +117 -0
  75. package/dist/helpers/multiplicity_complat.js +126 -0
  76. package/dist/helpers/multiplicity_manual.js +94 -0
  77. package/dist/helpers/multiplicity_verify_basic.js +196 -0
  78. package/dist/helpers/shift.js +48 -0
  79. package/dist/helpers/zoom.js +32 -0
  80. package/dist/index.js +705 -0
  81. package/dist/layer_content.js +125 -0
  82. package/dist/layer_init.js +231 -0
  83. package/dist/layer_prism.js +186 -0
  84. package/dist/reducers/index.js +89 -0
  85. package/dist/reducers/reducer_edit_peak.js +111 -0
  86. package/dist/reducers/reducer_forecast.js +113 -0
  87. package/dist/reducers/reducer_integration.js +136 -0
  88. package/dist/reducers/reducer_jcamp.js +74 -0
  89. package/dist/reducers/reducer_layout.js +27 -0
  90. package/dist/reducers/reducer_manager.js +20 -0
  91. package/dist/reducers/reducer_meta.js +30 -0
  92. package/dist/reducers/reducer_multiplicity.js +131 -0
  93. package/dist/reducers/reducer_scan.js +55 -0
  94. package/dist/reducers/reducer_shift.js +99 -0
  95. package/dist/reducers/reducer_simulation.js +30 -0
  96. package/dist/reducers/reducer_status.js +41 -0
  97. package/dist/reducers/reducer_submit.js +54 -0
  98. package/dist/reducers/reducer_threshold.js +34 -0
  99. package/dist/reducers/reducer_ui.js +46 -0
  100. package/dist/reducers/undo_redo_config.js +24 -0
  101. package/dist/sagas/index.js +50 -0
  102. package/dist/sagas/saga_edit_peak.js +84 -0
  103. package/dist/sagas/saga_manager.js +116 -0
  104. package/dist/sagas/saga_meta.js +46 -0
  105. package/dist/sagas/saga_multiplicity.js +387 -0
  106. package/dist/sagas/saga_ui.js +392 -0
  107. package/dist/third_party/jAnalyzer.js +596 -0
  108. package/dist/third_party/peakInterval.js +107 -0
  109. package/package.json +77 -0
@@ -0,0 +1,405 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require('react');
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _propTypes = require('prop-types');
12
+
13
+ var _propTypes2 = _interopRequireDefault(_propTypes);
14
+
15
+ var _classnames = require('classnames');
16
+
17
+ var _classnames2 = _interopRequireDefault(_classnames);
18
+
19
+ var _reactRedux = require('react-redux');
20
+
21
+ var _redux = require('redux');
22
+
23
+ var _ExpansionPanel = require('@material-ui/core/ExpansionPanel');
24
+
25
+ var _ExpansionPanel2 = _interopRequireDefault(_ExpansionPanel);
26
+
27
+ var _ExpansionPanelSummary = require('@material-ui/core/ExpansionPanelSummary');
28
+
29
+ var _ExpansionPanelSummary2 = _interopRequireDefault(_ExpansionPanelSummary);
30
+
31
+ var _ExpandMore = require('@material-ui/icons/ExpandMore');
32
+
33
+ var _ExpandMore2 = _interopRequireDefault(_ExpandMore);
34
+
35
+ var _Divider = require('@material-ui/core/Divider');
36
+
37
+ var _Divider2 = _interopRequireDefault(_Divider);
38
+
39
+ var _Typography = require('@material-ui/core/Typography');
40
+
41
+ var _Typography2 = _interopRequireDefault(_Typography);
42
+
43
+ var _Table = require('@material-ui/core/Table');
44
+
45
+ var _Table2 = _interopRequireDefault(_Table);
46
+
47
+ var _TableBody = require('@material-ui/core/TableBody');
48
+
49
+ var _TableBody2 = _interopRequireDefault(_TableBody);
50
+
51
+ var _TableCell = require('@material-ui/core/TableCell');
52
+
53
+ var _TableCell2 = _interopRequireDefault(_TableCell);
54
+
55
+ var _TableRow = require('@material-ui/core/TableRow');
56
+
57
+ var _TableRow2 = _interopRequireDefault(_TableRow);
58
+
59
+ var _HighlightOff = require('@material-ui/icons/HighlightOff');
60
+
61
+ var _HighlightOff2 = _interopRequireDefault(_HighlightOff);
62
+
63
+ var _styles = require('@material-ui/core/styles');
64
+
65
+ var _Checkbox = require('@material-ui/core/Checkbox');
66
+
67
+ var _Checkbox2 = _interopRequireDefault(_Checkbox);
68
+
69
+ var _Button = require('@material-ui/core/Button');
70
+
71
+ var _Button2 = _interopRequireDefault(_Button);
72
+
73
+ var _Tooltip = require('@material-ui/core/Tooltip');
74
+
75
+ var _Tooltip2 = _interopRequireDefault(_Tooltip);
76
+
77
+ var _RefreshOutlined = require('@material-ui/icons/RefreshOutlined');
78
+
79
+ var _RefreshOutlined2 = _interopRequireDefault(_RefreshOutlined);
80
+
81
+ var _multiplicity = require('../../actions/multiplicity');
82
+
83
+ var _multiplicity_select = require('./multiplicity_select');
84
+
85
+ var _multiplicity_select2 = _interopRequireDefault(_multiplicity_select);
86
+
87
+ var _multiplicity_coupling = require('./multiplicity_coupling');
88
+
89
+ var _multiplicity_coupling2 = _interopRequireDefault(_multiplicity_coupling);
90
+
91
+ var _multiplicity_calc = require('../../helpers/multiplicity_calc');
92
+
93
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
94
+
95
+ var styles = function styles(theme) {
96
+ return {
97
+ panel: {
98
+ backgroundColor: '#eee',
99
+ display: 'table-row'
100
+ },
101
+ panelSummary: {
102
+ backgroundColor: '#eee',
103
+ height: 32
104
+ },
105
+ txtBadge: {},
106
+ panelDetail: {
107
+ backgroundColor: '#fff',
108
+ maxHeight: 'calc(90vh - 220px)', // ROI
109
+ overflow: 'auto'
110
+ },
111
+ table: {
112
+ width: '100%'
113
+ },
114
+ tRowHeadPos: {
115
+ backgroundColor: '#2196f3',
116
+ height: 32
117
+ },
118
+ tRowHeadNeg: {
119
+ backgroundColor: '#fa004f',
120
+ height: 32
121
+ },
122
+ tTxtHead: {
123
+ color: 'white',
124
+ padding: '4px 0 4px 5px'
125
+ },
126
+ tTxtHeadXY: {
127
+ color: 'white',
128
+ padding: '4px 0 4px 90px'
129
+ },
130
+ tTxt: {
131
+ padding: 0
132
+ },
133
+ tRow: {
134
+ height: 28,
135
+ '&:nth-of-type(even)': {
136
+ backgroundColor: theme.palette.background.default
137
+ }
138
+ },
139
+ rmBtn: {
140
+ color: 'red',
141
+ '&:hover': {
142
+ borderRadius: 12,
143
+ backgroundColor: 'red',
144
+ color: 'white'
145
+ }
146
+ },
147
+ moCard: {
148
+ textAlign: 'left'
149
+ },
150
+ moCardHead: {
151
+ backgroundColor: '#999',
152
+ color: 'white'
153
+ },
154
+ moExtId: {
155
+ border: '2px solid white',
156
+ borderRadius: 12,
157
+ color: 'white',
158
+ margin: '0 5px 0 5px',
159
+ padding: '0 5px 0 5px'
160
+ },
161
+ moExtTxt: {
162
+ margin: '0 5px 0 5x',
163
+ fontSize: '0.8rem',
164
+ fontFamily: 'Helvetica'
165
+ },
166
+ moSelect: {
167
+ margin: '0 5x 0 5px',
168
+ fontSize: '0.8rem',
169
+ fontFamily: 'Helvetica'
170
+ },
171
+ moCBox: {
172
+ marginLeft: 24,
173
+ padding: '4px 0 4px 4px'
174
+ },
175
+ btnRf: {
176
+ color: '#fff',
177
+ float: 'right',
178
+ minWidth: 40,
179
+ right: 15
180
+ }
181
+ };
182
+ };
183
+
184
+ var cBoxStyle = function cBoxStyle() {
185
+ return {
186
+ root: {
187
+ color: 'white',
188
+ '&$checked': {
189
+ color: 'white'
190
+ }
191
+ },
192
+ checked: {}
193
+ };
194
+ };
195
+ var MUCheckbox = (0, _styles.withStyles)(cBoxStyle)(_Checkbox2.default);
196
+
197
+ var createData = function createData(idx, xExtent, peaks, shift, smExtext, mpyType, js, onClick, onRefresh) {
198
+ return {
199
+ idx: idx + 1,
200
+ xExtent: xExtent,
201
+ onClick: onClick,
202
+ onRefresh: onRefresh,
203
+ peaks: peaks,
204
+ center: (0, _multiplicity_calc.calcMpyCenter)(peaks, shift, mpyType),
205
+ jStr: (0, _multiplicity_calc.calcMpyJStr)(js),
206
+ mpyType: mpyType,
207
+ isCheck: smExtext.xL === xExtent.xL && smExtext.xU === xExtent.xU
208
+ };
209
+ };
210
+
211
+ var pkList = function pkList(classes, row, shift, digits, rmMpyPeakByPanelAct) {
212
+ return row.peaks.map(function (pk) {
213
+ var xExtent = row.xExtent;
214
+
215
+ var cb = function cb() {
216
+ return rmMpyPeakByPanelAct({ peak: pk, xExtent: xExtent });
217
+ };
218
+ var rmBtn = _react2.default.createElement(_HighlightOff2.default, { onClick: cb, className: classes.rmBtn });
219
+
220
+ return _react2.default.createElement(
221
+ _TableRow2.default,
222
+ { key: pk.x, className: classes.tRow, hover: true },
223
+ _react2.default.createElement(
224
+ _TableCell2.default,
225
+ { align: 'right', className: (0, _classnames2.default)(classes.tTxt, 'txt-sv-panel-txt') },
226
+ '(' + (pk.x - shift).toFixed(digits) + ', ' + pk.y.toExponential(2) + ')'
227
+ ),
228
+ _react2.default.createElement(
229
+ _TableCell2.default,
230
+ { align: 'right', className: (0, _classnames2.default)(classes.tTxt, 'txt-sv-panel-txt') },
231
+ rmBtn
232
+ )
233
+ );
234
+ });
235
+ };
236
+
237
+ var refreshBtn = function refreshBtn(classes, onRefresh) {
238
+ return _react2.default.createElement(
239
+ _Tooltip2.default,
240
+ {
241
+ placement: 'left',
242
+ title: _react2.default.createElement(
243
+ 'span',
244
+ { className: 'txt-sv-tp' },
245
+ 'Calculate Multiplicity'
246
+ )
247
+ },
248
+ _react2.default.createElement(
249
+ _Button2.default,
250
+ {
251
+ className: classes.btnRf,
252
+ onClick: onRefresh
253
+ },
254
+ _react2.default.createElement(_RefreshOutlined2.default, null)
255
+ )
256
+ );
257
+ };
258
+
259
+ var mpyList = function mpyList(classes, digits, multiplicitySt, clickMpyOneAct, rmMpyPeakByPanelAct, resetMpyOneAct) {
260
+ var stack = multiplicitySt.stack,
261
+ shift = multiplicitySt.shift,
262
+ smExtext = multiplicitySt.smExtext;
263
+
264
+ var rows = stack.map(function (k, idx) {
265
+ var peaks = k.peaks,
266
+ xExtent = k.xExtent,
267
+ mpyType = k.mpyType,
268
+ js = k.js;
269
+
270
+ var onRefresh = function onRefresh() {
271
+ return resetMpyOneAct(xExtent);
272
+ };
273
+ var onClick = function onClick(e) {
274
+ e.stopPropagation();
275
+ e.preventDefault();
276
+ clickMpyOneAct(xExtent);
277
+ };
278
+ return createData(idx, xExtent, peaks, shift, smExtext, mpyType, js, onClick, onRefresh);
279
+ });
280
+
281
+ return _react2.default.createElement(
282
+ 'div',
283
+ null,
284
+ rows.map(function (row) {
285
+ return _react2.default.createElement(
286
+ 'div',
287
+ { className: classes.moCard, key: row.idx },
288
+ _react2.default.createElement(
289
+ 'div',
290
+ { className: classes.moCardHead },
291
+ _react2.default.createElement(
292
+ 'div',
293
+ null,
294
+ _react2.default.createElement(MUCheckbox, {
295
+ className: classes.moCBox,
296
+ checked: row.isCheck,
297
+ onChange: row.onClick
298
+ }),
299
+ _react2.default.createElement(
300
+ 'span',
301
+ { className: (0, _classnames2.default)(classes.moExtTxt, classes.moExtId, 'txt-sv-panel-head') },
302
+ row.idx
303
+ ),
304
+ _react2.default.createElement(
305
+ 'span',
306
+ { className: (0, _classnames2.default)(classes.moExtTxt, 'txt-sv-panel-head') },
307
+ row.center.toFixed(3) + ' (ppm)'
308
+ ),
309
+ _react2.default.createElement(
310
+ 'span',
311
+ { className: (0, _classnames2.default)(classes.moSelect, 'txt-sv-panel-head') },
312
+ _react2.default.createElement(_multiplicity_select2.default, { target: row })
313
+ ),
314
+ refreshBtn(classes, row.onRefresh)
315
+ ),
316
+ _react2.default.createElement(_multiplicity_coupling2.default, {
317
+ row: row
318
+ })
319
+ ),
320
+ _react2.default.createElement(
321
+ _Table2.default,
322
+ { className: classes.table },
323
+ _react2.default.createElement(
324
+ _TableBody2.default,
325
+ null,
326
+ pkList(classes, row, shift, digits, rmMpyPeakByPanelAct)
327
+ )
328
+ )
329
+ );
330
+ })
331
+ );
332
+ };
333
+
334
+ var MultiplicityPanel = function MultiplicityPanel(_ref) {
335
+ var classes = _ref.classes,
336
+ expand = _ref.expand,
337
+ onExapnd = _ref.onExapnd,
338
+ multiplicitySt = _ref.multiplicitySt,
339
+ clickMpyOneAct = _ref.clickMpyOneAct,
340
+ rmMpyPeakByPanelAct = _ref.rmMpyPeakByPanelAct,
341
+ resetMpyOneAct = _ref.resetMpyOneAct;
342
+
343
+ var digits = 4;
344
+
345
+ return _react2.default.createElement(
346
+ _ExpansionPanel2.default,
347
+ {
348
+ expanded: expand,
349
+ onChange: onExapnd,
350
+ className: (0, _classnames2.default)(classes.panel),
351
+ TransitionProps: { unmountOnExit: true } // increase ExpansionPanel performance
352
+ },
353
+ _react2.default.createElement(
354
+ _ExpansionPanelSummary2.default,
355
+ {
356
+ expandIcon: _react2.default.createElement(_ExpandMore2.default, null),
357
+ className: (0, _classnames2.default)(classes.panelSummary)
358
+ },
359
+ _react2.default.createElement(
360
+ _Typography2.default,
361
+ { className: 'txt-panel-header' },
362
+ _react2.default.createElement(
363
+ 'span',
364
+ { className: (0, _classnames2.default)(classes.txtBadge, 'txt-sv-panel-title') },
365
+ 'Multiplicity'
366
+ )
367
+ )
368
+ ),
369
+ _react2.default.createElement(_Divider2.default, null),
370
+ _react2.default.createElement(
371
+ 'div',
372
+ { className: (0, _classnames2.default)(classes.panelDetail) },
373
+ mpyList(classes, digits, multiplicitySt, clickMpyOneAct, rmMpyPeakByPanelAct, resetMpyOneAct)
374
+ )
375
+ );
376
+ };
377
+
378
+ var mapStateToProps = function mapStateToProps(state, props) {
379
+ return (// eslint-disable-line
380
+ {
381
+ integrationSt: state.integration.present,
382
+ multiplicitySt: state.multiplicity.present
383
+ }
384
+ );
385
+ };
386
+
387
+ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
388
+ return (0, _redux.bindActionCreators)({
389
+ clickMpyOneAct: _multiplicity.clickMpyOne,
390
+ rmMpyPeakByPanelAct: _multiplicity.rmMpyPeakByPanel,
391
+ resetMpyOneAct: _multiplicity.resetMpyOne
392
+ }, dispatch);
393
+ };
394
+
395
+ MultiplicityPanel.propTypes = {
396
+ classes: _propTypes2.default.object.isRequired,
397
+ expand: _propTypes2.default.bool.isRequired,
398
+ onExapnd: _propTypes2.default.func.isRequired,
399
+ multiplicitySt: _propTypes2.default.object.isRequired,
400
+ clickMpyOneAct: _propTypes2.default.func.isRequired,
401
+ rmMpyPeakByPanelAct: _propTypes2.default.func.isRequired,
402
+ resetMpyOneAct: _propTypes2.default.func.isRequired
403
+ };
404
+
405
+ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(MultiplicityPanel));
@@ -0,0 +1,195 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ var _react = require('react');
10
+
11
+ var _react2 = _interopRequireDefault(_react);
12
+
13
+ var _reactRedux = require('react-redux');
14
+
15
+ var _redux = require('redux');
16
+
17
+ var _classnames = require('classnames');
18
+
19
+ var _classnames2 = _interopRequireDefault(_classnames);
20
+
21
+ var _propTypes = require('prop-types');
22
+
23
+ var _propTypes2 = _interopRequireDefault(_propTypes);
24
+
25
+ var _styles = require('@material-ui/core/styles');
26
+
27
+ var _TextField = require('@material-ui/core/TextField');
28
+
29
+ var _TextField2 = _interopRequireDefault(_TextField);
30
+
31
+ var _InputAdornment = require('@material-ui/core/InputAdornment');
32
+
33
+ var _InputAdornment2 = _interopRequireDefault(_InputAdornment);
34
+
35
+ var _multiplicity = require('../../actions/multiplicity');
36
+
37
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
+
39
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40
+
41
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
42
+
43
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
44
+
45
+ var styles = function styles() {
46
+ return {
47
+ jDiv: {
48
+ height: 28
49
+ },
50
+ jTxt: {
51
+ margin: '0 5px 4px 60px'
52
+ },
53
+ moExtTxt: {
54
+ margin: '0 5px 0 5x',
55
+ fontSize: '0.8rem',
56
+ fontFamily: 'Helvetica'
57
+ },
58
+ txtField: {
59
+ width: 260,
60
+ margin: '0 3px 0 3px'
61
+ },
62
+ txtInput: {
63
+ color: 'white',
64
+ fontSize: '0.9rem',
65
+ fontFamily: 'Helvetica',
66
+ height: 24
67
+ }
68
+ };
69
+ };
70
+
71
+ var txtJ = function txtJ() {
72
+ return _react2.default.createElement(
73
+ _InputAdornment2.default,
74
+ { position: 'start' },
75
+ _react2.default.createElement(
76
+ 'span',
77
+ { className: 'txt-cmd-j' },
78
+ 'J\xA0='
79
+ )
80
+ );
81
+ };
82
+
83
+ var txtHz = function txtHz() {
84
+ return _react2.default.createElement(
85
+ _InputAdornment2.default,
86
+ { position: 'end' },
87
+ _react2.default.createElement(
88
+ 'span',
89
+ { className: 'txt-cmd-hz' },
90
+ 'Hz'
91
+ )
92
+ );
93
+ };
94
+
95
+ var MpyCoupling = function (_React$Component) {
96
+ _inherits(MpyCoupling, _React$Component);
97
+
98
+ function MpyCoupling(props) {
99
+ _classCallCheck(this, MpyCoupling);
100
+
101
+ var _this = _possibleConstructorReturn(this, (MpyCoupling.__proto__ || Object.getPrototypeOf(MpyCoupling)).call(this, props));
102
+
103
+ _this.state = {
104
+ focus: false,
105
+ tmpVal: false
106
+ };
107
+
108
+ _this.onFocus = _this.onFocus.bind(_this);
109
+ _this.onBlur = _this.onBlur.bind(_this);
110
+ _this.onChange = _this.onChange.bind(_this);
111
+ return _this;
112
+ }
113
+
114
+ _createClass(MpyCoupling, [{
115
+ key: 'onFocus',
116
+ value: function onFocus() {
117
+ this.setState({ focus: true });
118
+ }
119
+ }, {
120
+ key: 'onBlur',
121
+ value: function onBlur() {
122
+ var _props = this.props,
123
+ row = _props.row,
124
+ updateMpyJAct = _props.updateMpyJAct;
125
+ var tmpVal = this.state.tmpVal;
126
+ var xExtent = row.xExtent;
127
+
128
+ this.setState({ focus: false, tmpVal: false });
129
+ updateMpyJAct({ xExtent: xExtent, value: tmpVal });
130
+ }
131
+ }, {
132
+ key: 'onChange',
133
+ value: function onChange(e) {
134
+ this.setState({ tmpVal: e.target.value });
135
+ }
136
+ }, {
137
+ key: 'render',
138
+ value: function render() {
139
+ var _props2 = this.props,
140
+ classes = _props2.classes,
141
+ row = _props2.row;
142
+ var _state = this.state,
143
+ focus = _state.focus,
144
+ tmpVal = _state.tmpVal;
145
+
146
+ var value = focus && (tmpVal || tmpVal === '') ? tmpVal : row.jStr;
147
+
148
+ return _react2.default.createElement(
149
+ 'div',
150
+ { className: (0, _classnames2.default)(classes.jDiv) },
151
+ _react2.default.createElement(
152
+ 'span',
153
+ { className: (0, _classnames2.default)(classes.moExtTxt, classes.jTxt, 'txt-sv-panel-head') },
154
+ _react2.default.createElement(_TextField2.default, {
155
+ className: (0, _classnames2.default)(classes.txtField, 'txt-cmd-field'),
156
+ placeholder: '-',
157
+ value: value,
158
+ margin: 'none',
159
+ InputProps: {
160
+ startAdornment: txtJ(),
161
+ endAdornment: txtHz(),
162
+ className: (0, _classnames2.default)(classes.txtInput, 'txt-sv-input-label')
163
+ },
164
+ onChange: this.onChange,
165
+ onFocus: this.onFocus,
166
+ onBlur: this.onBlur,
167
+ variant: 'outlined'
168
+ })
169
+ )
170
+ );
171
+ }
172
+ }]);
173
+
174
+ return MpyCoupling;
175
+ }(_react2.default.Component);
176
+
177
+ var mapStateToProps = function mapStateToProps(state, props) {
178
+ return (// eslint-disable-line
179
+ {}
180
+ );
181
+ };
182
+
183
+ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
184
+ return (0, _redux.bindActionCreators)({
185
+ updateMpyJAct: _multiplicity.updateMpyJ
186
+ }, dispatch);
187
+ };
188
+
189
+ MpyCoupling.propTypes = {
190
+ classes: _propTypes2.default.object.isRequired,
191
+ row: _propTypes2.default.object.isRequired,
192
+ updateMpyJAct: _propTypes2.default.func.isRequired
193
+ };
194
+
195
+ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(MpyCoupling));
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require('react');
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ var _propTypes = require('prop-types');
12
+
13
+ var _propTypes2 = _interopRequireDefault(_propTypes);
14
+
15
+ var _classnames = require('classnames');
16
+
17
+ var _classnames2 = _interopRequireDefault(_classnames);
18
+
19
+ var _reactRedux = require('react-redux');
20
+
21
+ var _redux = require('redux');
22
+
23
+ var _FormControl = require('@material-ui/core/FormControl');
24
+
25
+ var _FormControl2 = _interopRequireDefault(_FormControl);
26
+
27
+ var _TextField = require('@material-ui/core/TextField');
28
+
29
+ var _TextField2 = _interopRequireDefault(_TextField);
30
+
31
+ var _styles = require('@material-ui/core/styles');
32
+
33
+ var _multiplicity = require('../../actions/multiplicity');
34
+
35
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
+
37
+ var Styles = function Styles() {
38
+ return {
39
+ formControl: {
40
+ minWidth: 50,
41
+ margin: '2px 3px 0 3px'
42
+ },
43
+ txtField: {
44
+ width: 120,
45
+ margin: '3px 3px 3px 3px'
46
+ },
47
+ txtInput: {
48
+ height: 24,
49
+ fontSize: '0.9rem',
50
+ fontFamily: 'Helvetica',
51
+ color: 'white'
52
+ }
53
+ };
54
+ };
55
+
56
+ var MpySelect = function MpySelect(_ref) {
57
+ var classes = _ref.classes,
58
+ target = _ref.target,
59
+ selectMpyTypeAct = _ref.selectMpyTypeAct;
60
+ var mpyType = target.mpyType,
61
+ xExtent = target.xExtent;
62
+
63
+ var onBlur = function onBlur(e) {
64
+ return selectMpyTypeAct({ xExtent: xExtent, mpyType: e.target.value });
65
+ };
66
+ var onChange = function onChange(e) {
67
+ return selectMpyTypeAct({ xExtent: xExtent, mpyType: e.target.value });
68
+ };
69
+ var onEnterPress = function onEnterPress(e) {
70
+ if (e.key === 'Enter') {
71
+ selectMpyTypeAct({ xExtent: xExtent, mpyType: e.target.value });
72
+ }
73
+ };
74
+
75
+ return _react2.default.createElement(
76
+ _FormControl2.default,
77
+ {
78
+ className: (0, _classnames2.default)(classes.formControl),
79
+ variant: 'outlined'
80
+ },
81
+ _react2.default.createElement(_TextField2.default, {
82
+ className: (0, _classnames2.default)(classes.txtField, 'txt-cmd-field'),
83
+ value: mpyType,
84
+ margin: 'none',
85
+ variant: 'outlined',
86
+ InputProps: {
87
+ className: (0, _classnames2.default)(classes.txtInput, 'txt-sv-input-label')
88
+ },
89
+ onChange: onChange,
90
+ onBlur: onBlur,
91
+ onKeyPress: onEnterPress
92
+ })
93
+ );
94
+ };
95
+
96
+ var mapStateToProps = function mapStateToProps(state, props) {
97
+ return (// eslint-disable-line
98
+ {}
99
+ );
100
+ };
101
+
102
+ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
103
+ return (0, _redux.bindActionCreators)({
104
+ selectMpyTypeAct: _multiplicity.selectMpyType
105
+ }, dispatch);
106
+ };
107
+
108
+ MpySelect.propTypes = {
109
+ classes: _propTypes2.default.object.isRequired,
110
+ target: _propTypes2.default.object.isRequired,
111
+ selectMpyTypeAct: _propTypes2.default.func.isRequired
112
+ };
113
+
114
+ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(Styles)(MpySelect));