chem-generic-ui 0.1.15 → 0.1.18-alpha

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.unitConversion = exports.unitConvToBase = exports.toNum = exports.toBool = exports.swapAryEls = exports.storeFlow = exports.showProperties = exports.samOptions = exports.reUnit = exports.molOptions = exports.inputEventVal = exports.genUnitsSystem = exports.genUnits = exports.genUnitSup = exports.genUnit = exports.flowDefault = exports.downloadFile = exports.decorateNode = exports.conFlowEls = exports.clsInputGroup = exports.absOlsTermLabel = exports.absOlsTermId = exports.GenericDummy = void 0;
6
+ exports.uploadFiles = exports.unitConversion = exports.unitConvToBase = exports.toNum = exports.toBool = exports.swapAryEls = exports.storeFlow = exports.showProperties = exports.samOptions = exports.reUnit = exports.molOptions = exports.inputEventVal = exports.genUnitsSystem = exports.genUnits = exports.genUnitSup = exports.genUnit = exports.flowDefault = exports.downloadFile = exports.decorateNode = exports.conFlowEls = exports.clsInputGroup = exports.absOlsTermLabel = exports.absOlsTermId = exports.GenericDummy = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -13,7 +13,9 @@ var _lodash = require("lodash");
13
13
 
14
14
  var _reactFontawesome = require("@fortawesome/react-fontawesome");
15
15
 
16
- var _systemUnits = _interopRequireDefault(require("../../data/systemUnits.json"));
16
+ var _SystemUnits = _interopRequireDefault(require("../../data/SystemUnits"));
17
+
18
+ var _Attachment = _interopRequireDefault(require("../models/Attachment"));
17
19
 
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
@@ -23,9 +25,65 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
23
25
 
24
26
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
27
 
26
- // move from GenPropertiesLayer.js
28
+ // move from GenericElCommon.js
29
+ var uploadFiles = function uploadFiles(properties, event, field, layer) {
30
+ var files = [];
31
+ var fieldObj = properties.layers["".concat(layer)].fields.find(function (e) {
32
+ return e.field === field;
33
+ }) || {};
34
+ var value = fieldObj.value || {};
35
+
36
+ switch (event.action) {
37
+ case 'l':
38
+ {
39
+ var valIdx = (0, _lodash.findIndex)(value.files || [], function (o) {
40
+ return o.uid === event.uid;
41
+ });
42
+ var label = event && event.val && event.val.target && event.val.target.value;
43
+ if (value.files[valIdx] && label) value.files[valIdx].label = label;
44
+ break;
45
+ }
46
+
47
+ case 'f':
48
+ {
49
+ (event.val || []).forEach(function (file) {
50
+ var uid = _uuid.v4.v4();
51
+
52
+ if (typeof value.files === 'undefined' || value.files === null) value.files = [];
53
+ value.files.push({
54
+ uid: uid,
55
+ filename: file.name
56
+ });
57
+ files.push({
58
+ uid: uid,
59
+ filename: file.name,
60
+ file: _Attachment.default.fromFile(file)
61
+ });
62
+ });
63
+ break;
64
+ }
65
+
66
+ case 'd':
67
+ {
68
+ var _valIdx = (0, _lodash.findIndex)(value.files || [], function (o) {
69
+ return o.uid === event.uid;
70
+ });
71
+
72
+ if (_valIdx >= 0 && value.files && value.files.length > 0) value.files.splice(_valIdx, 1);
73
+ return [value, files, event.uid];
74
+ }
75
+
76
+ default:
77
+ console.log(event);
78
+ }
79
+
80
+ return [value, files];
81
+ }; // move from GenPropertiesLayer.js
82
+
83
+
84
+ exports.uploadFiles = uploadFiles;
85
+
27
86
  var showProperties = function showProperties(fObj, layers) {
28
- console.log('showProperties');
29
87
  var showField = true;
30
88
 
31
89
  if (fObj && fObj.cond_fields && fObj.cond_fields.length > 0) {
@@ -143,17 +201,7 @@ var toBool = function toBool(val) {
143
201
  exports.toBool = toBool;
144
202
 
145
203
  var genUnitsSystem = function genUnitsSystem() {
146
- console.log(_systemUnits.default);
147
- return (_systemUnits.default || {}).fields || []; // fetch('units_system.json', { headers: { 'Content-Type': 'application/json', Accept: 'application/json' } })
148
- // .then(response => response.json()).then((json) => {
149
- // const units = json;
150
- // console.log(units);
151
- // return (units || {}).fields || [];
152
- // })
153
- // .catch((errorMessage) => {
154
- // console.log(errorMessage);
155
- // return [];
156
- // });
204
+ return (_SystemUnits.default.SYSTEM_UNITS || {}).fields || [];
157
205
  };
158
206
 
159
207
  exports.genUnitsSystem = genUnitsSystem;
@@ -0,0 +1,588 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ SYSTEM_UNITS: {
9
+ fields: [{
10
+ type: 'numeric',
11
+ field: 'acceleration',
12
+ label: 'Acceleration',
13
+ default: '',
14
+ position: 10,
15
+ placeholder: 'acceleration',
16
+ units: [{
17
+ key: 'mm_s2',
18
+ label: 'mm/s<sup>2</sup>'
19
+ }]
20
+ }, {
21
+ type: 'numeric',
22
+ field: 'agitation',
23
+ label: 'Agitation',
24
+ default: '',
25
+ position: 20,
26
+ placeholder: 'agitation',
27
+ units: [{
28
+ key: 'rpm',
29
+ label: 'rpm'
30
+ }]
31
+ }, {
32
+ type: 'numeric',
33
+ field: 'amount_enzyme',
34
+ label: 'Amount enzyme as nmol/min',
35
+ default: '',
36
+ position: 30,
37
+ placeholder: 'amount enzyme as nmol/min',
38
+ units: [{
39
+ key: 'u',
40
+ label: 'U',
41
+ nm: 1
42
+ }, {
43
+ key: 'mu',
44
+ label: 'mU',
45
+ nm: 1000
46
+ }]
47
+ }, {
48
+ type: 'numeric',
49
+ field: 'molarity',
50
+ label: 'Chem. concentration (Molarity)',
51
+ default: '',
52
+ position: 40,
53
+ placeholder: 'molarity',
54
+ units: [{
55
+ key: 'mol_l',
56
+ label: 'mol/L (M)',
57
+ nm: 1
58
+ }, {
59
+ key: 'mmol_l',
60
+ label: 'mmol/L (mM)',
61
+ nm: 1000
62
+ }, {
63
+ key: 'nmol_l',
64
+ label: 'nmol/L (nM)',
65
+ nm: 1000000
66
+ }, {
67
+ key: 'pmol_l',
68
+ label: 'pmol/L (pM)',
69
+ nm: 1000000000
70
+ }]
71
+ }, {
72
+ type: 'numeric',
73
+ field: 'chem_distances',
74
+ label: 'Chem. distances',
75
+ default: '',
76
+ position: 50,
77
+ placeholder: 'Chem. distances',
78
+ units: [{
79
+ key: 'angstrom',
80
+ label: 'Å'
81
+ }]
82
+ }, {
83
+ type: 'numeric',
84
+ field: 'concentration',
85
+ label: 'Concentration',
86
+ default: '',
87
+ position: 60,
88
+ placeholder: 'concentration',
89
+ units: [{
90
+ key: 'ng_l',
91
+ label: 'ng/L',
92
+ nm: 1000000
93
+ }, {
94
+ key: 'mg_l',
95
+ label: 'mg/L',
96
+ nm: 1000
97
+ }, {
98
+ key: 'g_l',
99
+ label: 'g/L',
100
+ nm: 1
101
+ }]
102
+ }, {
103
+ type: 'numeric',
104
+ field: 'conductivity',
105
+ label: 'Conductivity',
106
+ default: '',
107
+ position: 66,
108
+ placeholder: 'conductivity',
109
+ units: [{
110
+ key: 's_m',
111
+ label: 'S/m',
112
+ nm: 1
113
+ }]
114
+ }, {
115
+ type: 'numeric',
116
+ field: 'current',
117
+ label: 'Current',
118
+ default: '',
119
+ position: 60,
120
+ placeholder: 'Current',
121
+ units: [{
122
+ key: 'A',
123
+ label: 'A',
124
+ nm: 1
125
+ }, {
126
+ key: 'mA',
127
+ label: 'mA',
128
+ nm: 1000
129
+ }, {
130
+ key: 'uA',
131
+ label: 'µA',
132
+ nm: 1000000
133
+ }, {
134
+ key: 'nA',
135
+ label: 'nA',
136
+ nm: 1000000000
137
+ }]
138
+ }, {
139
+ type: 'numeric',
140
+ field: 'degree',
141
+ label: 'Degree',
142
+ default: '',
143
+ position: 70,
144
+ placeholder: 'degree',
145
+ units: [{
146
+ key: 'degree',
147
+ label: '°'
148
+ }]
149
+ }, {
150
+ type: 'numeric',
151
+ field: 'density',
152
+ label: 'Density',
153
+ default: '',
154
+ position: 75,
155
+ placeholder: 'density',
156
+ units: [{
157
+ key: 'g_cm3',
158
+ label: 'g/cm<sup>3</sup>',
159
+ nm: 1
160
+ }, {
161
+ key: 'kg_l',
162
+ label: 'kg/l',
163
+ nm: 1
164
+ }]
165
+ }, {
166
+ type: 'numeric',
167
+ field: 'duration',
168
+ label: 'Duration',
169
+ default: '',
170
+ position: 80,
171
+ placeholder: 'duration',
172
+ units: [{
173
+ key: 'd',
174
+ label: 'd',
175
+ nm: 1
176
+ }, {
177
+ key: 'h',
178
+ label: 'h',
179
+ nm: 24
180
+ }, {
181
+ key: 'min',
182
+ label: 'm',
183
+ nm: 1440
184
+ }, {
185
+ key: 's',
186
+ label: 's',
187
+ nm: 86400
188
+ }]
189
+ }, {
190
+ type: 'numeric',
191
+ field: 'elastic_modulus',
192
+ label: 'Elastic modulus',
193
+ default: '',
194
+ position: 86,
195
+ placeholder: 'Elastic modulus',
196
+ units: [{
197
+ key: 'm_pa',
198
+ label: 'MPa',
199
+ nm: 1
200
+ }, {
201
+ key: 'k_pa',
202
+ label: 'kPa',
203
+ nm: 1000
204
+ }, {
205
+ key: 'pa',
206
+ label: 'Pa',
207
+ nm: 1000000
208
+ }]
209
+ }, {
210
+ type: 'numeric',
211
+ field: 'electric_field',
212
+ label: 'Electric field',
213
+ default: '',
214
+ position: 86,
215
+ placeholder: 'Electric field',
216
+ units: [{
217
+ key: 'v_m',
218
+ label: 'V/m',
219
+ nm: 1
220
+ }]
221
+ }, {
222
+ type: 'numeric',
223
+ field: 'energy',
224
+ label: 'Energy',
225
+ default: '',
226
+ position: 88,
227
+ placeholder: 'Joule',
228
+ units: [{
229
+ key: 'j',
230
+ label: 'J',
231
+ nm: 1000
232
+ }, {
233
+ key: 'k_j',
234
+ label: 'kJ',
235
+ nm: 1
236
+ }]
237
+ }, {
238
+ type: 'numeric',
239
+ field: 'enzyme_activity',
240
+ label: 'Enzyme activity',
241
+ default: '',
242
+ position: 90,
243
+ placeholder: 'Enzyme activity',
244
+ units: [{
245
+ key: 'u_l',
246
+ label: 'U/L',
247
+ nm: 1
248
+ }, {
249
+ key: 'u_ml',
250
+ label: 'U/mL',
251
+ nm: 1000
252
+ }]
253
+ }, {
254
+ type: 'numeric',
255
+ field: 'flow_rate',
256
+ label: 'Flow rate',
257
+ default: '',
258
+ position: 100,
259
+ placeholder: 'Flow rate',
260
+ units: [{
261
+ key: 'ul_min',
262
+ label: 'µl/min',
263
+ nm: 1000000
264
+ }, {
265
+ key: 'ml_min',
266
+ label: 'ml/min',
267
+ nm: 1000
268
+ }, {
269
+ key: 'l_m',
270
+ label: 'l/m',
271
+ nm: 1
272
+ }]
273
+ }, {
274
+ type: 'numeric',
275
+ field: 'frequency',
276
+ label: 'Frequency',
277
+ default: '',
278
+ position: 100,
279
+ placeholder: 'frequency',
280
+ units: [{
281
+ key: 'hz',
282
+ label: 'Hz',
283
+ nm: 1000
284
+ }, {
285
+ key: 'khz',
286
+ label: 'kHz',
287
+ nm: 1
288
+ }]
289
+ }, {
290
+ type: 'numeric',
291
+ field: 'heating_rate',
292
+ label: 'Heating rate',
293
+ default: '',
294
+ position: 106,
295
+ placeholder: 'heating rate',
296
+ units: [{
297
+ key: 'k_min',
298
+ label: 'K/min',
299
+ nm: 1
300
+ }]
301
+ }, {
302
+ type: 'numeric',
303
+ field: 'length',
304
+ label: 'Length',
305
+ default: '',
306
+ position: 110,
307
+ placeholder: 'length',
308
+ units: [{
309
+ key: 'pm',
310
+ label: 'pm',
311
+ nm: 100000
312
+ }, {
313
+ key: 'nm',
314
+ label: 'nm',
315
+ nm: 10000
316
+ }, {
317
+ key: 'mm',
318
+ label: 'mm',
319
+ nm: 1000
320
+ }, {
321
+ key: 'cm',
322
+ label: 'cm',
323
+ nm: 100
324
+ }, {
325
+ key: 'm',
326
+ label: 'm',
327
+ nm: 1
328
+ }]
329
+ }, {
330
+ type: 'numeric',
331
+ field: 'magnetic_flux_density',
332
+ label: 'Magnetic flux density/inductivity',
333
+ default: '',
334
+ position: 120,
335
+ placeholder: '',
336
+ units: [{
337
+ key: 'T',
338
+ label: 'T',
339
+ nm: 1
340
+ }]
341
+ }, {
342
+ type: 'numeric',
343
+ field: 'mass',
344
+ label: 'Mass',
345
+ default: '',
346
+ position: 120,
347
+ placeholder: 'mass',
348
+ units: [{
349
+ key: 'g',
350
+ label: 'g',
351
+ nm: 1
352
+ }, {
353
+ key: 'mg',
354
+ label: 'mg',
355
+ nm: 1000
356
+ }, {
357
+ key: 'ug',
358
+ label: 'µg',
359
+ nm: 1000000
360
+ }]
361
+ }, {
362
+ type: 'numeric',
363
+ field: 'mass_molecule',
364
+ label: 'Mass of molecule',
365
+ default: '',
366
+ position: 126,
367
+ placeholder: 'mass of molecule',
368
+ units: [{
369
+ key: 'dalton',
370
+ label: 'D',
371
+ nm: 1000
372
+ }, {
373
+ key: 'kilo_dalton',
374
+ label: 'kD',
375
+ nm: 1
376
+ }]
377
+ }, {
378
+ type: 'numeric',
379
+ field: 'molecular_weight',
380
+ label: 'Molecular weight',
381
+ default: '',
382
+ position: 130,
383
+ placeholder: 'Molecular weight',
384
+ units: [{
385
+ key: 'g_mol',
386
+ label: 'g/mol'
387
+ }]
388
+ }, {
389
+ type: 'numeric',
390
+ field: 'percentage',
391
+ label: 'Percentage',
392
+ default: '',
393
+ position: 136,
394
+ placeholder: 'percentage',
395
+ units: [{
396
+ key: 'p',
397
+ label: '%',
398
+ nm: 1
399
+ }]
400
+ }, {
401
+ type: 'numeric',
402
+ field: 'pressure',
403
+ label: 'Pressure',
404
+ default: '',
405
+ position: 140,
406
+ placeholder: 'pressure',
407
+ units: [{
408
+ key: 'atm',
409
+ label: 'atm',
410
+ nm: 1
411
+ }, {
412
+ key: 'pa',
413
+ label: 'Pa',
414
+ nm: 101325
415
+ }, {
416
+ key: 'torr',
417
+ label: 'Torr',
418
+ nm: 760
419
+ }]
420
+ }, {
421
+ type: 'numeric',
422
+ field: 'reaction_rate',
423
+ label: 'Reaction rate',
424
+ default: '',
425
+ position: 150,
426
+ placeholder: 'Reaction rate',
427
+ units: [{
428
+ key: 'mol_lmin',
429
+ label: 'mol/Lmin',
430
+ nm: 1
431
+ }, {
432
+ key: 'mol_lsec',
433
+ label: 'mol/Ls',
434
+ nm: 60
435
+ }]
436
+ }, {
437
+ type: 'numeric',
438
+ field: 'specific_volume',
439
+ label: 'Specific Volume',
440
+ default: '',
441
+ position: 160,
442
+ placeholder: 'Specific Volume',
443
+ units: [{
444
+ key: 'cm3_g',
445
+ label: 'cm<sup>3</sup>/g',
446
+ nm: 1
447
+ }]
448
+ }, {
449
+ type: 'numeric',
450
+ field: 'speed',
451
+ label: 'Speed',
452
+ default: '',
453
+ position: 165,
454
+ placeholder: 'speed',
455
+ units: [{
456
+ key: 'cm_s',
457
+ label: 'cm/s',
458
+ nm: 1
459
+ }, {
460
+ key: 'mm_s',
461
+ label: 'mm/s',
462
+ nm: 10
463
+ }, {
464
+ key: 'cm_h',
465
+ label: 'cm/h',
466
+ nm: 3600
467
+ }, {
468
+ key: 'mm_h',
469
+ label: 'mm/h',
470
+ nm: 36000
471
+ }]
472
+ }, {
473
+ type: 'numeric',
474
+ field: 'surface',
475
+ label: 'Surface',
476
+ default: '',
477
+ position: 170,
478
+ placeholder: 'surface',
479
+ units: [{
480
+ key: 'a_2',
481
+ label: 'A<sup>2</sup>'
482
+ }, {
483
+ key: 'mm_2',
484
+ label: 'mm<sup>2</sup>'
485
+ }, {
486
+ key: 'cm_2',
487
+ label: 'cm<sup>2</sup>'
488
+ }]
489
+ }, {
490
+ type: 'numeric',
491
+ field: 'temperature',
492
+ label: 'Temperature',
493
+ default: '',
494
+ position: 180,
495
+ placeholder: 'temperature',
496
+ units: [{
497
+ key: 'C',
498
+ label: '°C'
499
+ }, {
500
+ key: 'F',
501
+ label: '°F'
502
+ }, {
503
+ key: 'K',
504
+ label: '°K'
505
+ }]
506
+ }, {
507
+ type: 'numeric',
508
+ field: 'turnover_number',
509
+ label: 'Turnover number',
510
+ default: '',
511
+ position: 190,
512
+ placeholder: 'Turnover number',
513
+ units: [{
514
+ key: '1_s',
515
+ label: '1/s'
516
+ }]
517
+ }, {
518
+ type: 'numeric',
519
+ field: 'viscosity',
520
+ label: 'Dynamic Viscosity',
521
+ default: '',
522
+ position: 200,
523
+ placeholder: 'Dynamic Viscosity',
524
+ units: [{
525
+ key: 'pas',
526
+ label: 'Pas',
527
+ nm: 1
528
+ }, {
529
+ key: 'mpas',
530
+ label: 'mPas',
531
+ nm: 1000
532
+ }]
533
+ }, {
534
+ type: 'numeric',
535
+ field: 'kinematic_viscosity',
536
+ label: 'Kinematic Viscosity',
537
+ default: '',
538
+ position: 205,
539
+ placeholder: 'Kinematic Viscosity',
540
+ units: [{
541
+ key: 'm2_s',
542
+ label: 'm<sup>2</sup>/s',
543
+ nm: 1
544
+ }]
545
+ }, {
546
+ type: 'numeric',
547
+ field: 'voltage',
548
+ label: 'Voltage',
549
+ default: '',
550
+ position: 200,
551
+ placeholder: 'voltage',
552
+ units: [{
553
+ key: 'mv',
554
+ label: 'mV',
555
+ nm: 1000
556
+ }, {
557
+ key: 'v',
558
+ label: 'V',
559
+ nm: 1
560
+ }]
561
+ }, {
562
+ type: 'numeric',
563
+ field: 'volumes',
564
+ label: 'Volumes',
565
+ default: '',
566
+ position: 210,
567
+ placeholder: 'volume',
568
+ units: [{
569
+ key: 'l',
570
+ label: 'l',
571
+ nm: 1
572
+ }, {
573
+ key: 'ml',
574
+ label: 'ml',
575
+ nm: 1000
576
+ }, {
577
+ key: 'ul',
578
+ label: 'µl',
579
+ nm: 1000000
580
+ }, {
581
+ key: 'nl',
582
+ label: 'nl',
583
+ nm: 1000000000
584
+ }]
585
+ }]
586
+ }
587
+ };
588
+ exports.default = _default;
package/dist/index.js CHANGED
@@ -8,7 +8,9 @@ require("./index.css");
8
8
 
9
9
  var _app = require("./app");
10
10
 
11
- var _Simulate = _interopRequireDefault(require("./Simulate"));
11
+ var _SimuDS = _interopRequireDefault(require("./simulations/SimuDS"));
12
+
13
+ var _SimuSG = _interopRequireDefault(require("./simulations/SimuSG"));
12
14
 
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
 
@@ -24,7 +26,7 @@ _reactDom.default.render( /*#__PURE__*/_react.default.createElement("div", null,
24
26
  element: {}
25
27
  }), /*#__PURE__*/_react.default.createElement(_app.GenDSMisType, {
26
28
  uiCtrl: true
27
- }), /*#__PURE__*/_react.default.createElement(_Simulate.default, null)), document.getElementById('root')); // function App() {
29
+ }), /*#__PURE__*/_react.default.createElement(_SimuDS.default, null), /*#__PURE__*/_react.default.createElement(_SimuSG.default, null)), document.getElementById('root')); // function App() {
28
30
  // return (
29
31
  // <div>
30
32
  // Project A