chem-generic-ui 0.1.47 → 0.1.48
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/dist/app.js +104 -0
- package/{src → dist}/asserts/main.css +7 -0
- package/{src → dist}/asserts/main.scss +7 -1
- package/dist/components/admin/ElementManager.js +54 -0
- package/dist/components/details/GenDSDetails.js +273 -0
- package/dist/components/details/GenSgDetails.js +566 -0
- package/{src → dist}/components/dnd/DragDropItemTypes.js +8 -1
- package/dist/components/dnd/GenericElDropTarget.js +274 -0
- package/dist/components/dnd/GridDnD.js +77 -0
- package/dist/components/dnd/PanelDnD.js +171 -0
- package/dist/components/fields/ButtonConfirm.js +76 -0
- package/dist/components/fields/ButtonTooltip.js +88 -0
- package/dist/components/fields/FieldLabel.js +38 -0
- package/dist/components/fields/GenDSMisType.js +44 -0
- package/dist/components/fields/GenFormGroupCb.js +31 -0
- package/dist/components/fields/GenProperties.js +83 -0
- package/dist/components/fields/GenPropertiesFields.js +616 -0
- package/dist/components/flow/FlowView.js +88 -0
- package/dist/components/flow/FlowViewerModal.js +83 -0
- package/dist/components/flow/LayerNode.js +59 -0
- package/dist/components/layers/GenPropertiesLayer.js +280 -0
- package/dist/components/layers/LayerModal.js +81 -0
- package/dist/components/layers/LayersLayout.js +88 -0
- package/dist/components/models/Attachment.js +73 -0
- package/dist/components/models/GenericSubField.js +37 -0
- package/dist/components/table/DropLinkRenderer.js +55 -0
- package/dist/components/table/DropRenderer.js +45 -0
- package/dist/components/table/DropTextRenderer.js +45 -0
- package/dist/components/table/GenericElTableDropTarget.js +252 -0
- package/dist/components/table/GridBtn.js +102 -0
- package/dist/components/table/GridEntry.js +163 -0
- package/dist/components/table/SamOption.js +87 -0
- package/dist/components/table/SelectRenderer.js +52 -0
- package/dist/components/table/TableRecord.js +454 -0
- package/dist/components/table/UConverterRenderer.js +41 -0
- package/dist/components/tools/collate.js +103 -0
- package/dist/components/tools/orten.js +294 -0
- package/dist/components/tools/utils.js +593 -0
- package/dist/data/SystemUnits.js +588 -0
- package/{src → dist}/data/systemUnits.json +0 -0
- package/{src → dist}/index.css +0 -0
- package/dist/index.js +38 -0
- package/{src → dist}/logo.svg +0 -0
- package/dist/simulations/SimWF.js +123 -0
- package/dist/simulations/SimuDS.js +118 -0
- package/dist/simulations/SimuSG.js +123 -0
- package/package.json +51 -43
- package/.babelrc +0 -11
- package/.eslintrc +0 -23
- package/.tool-versions +0 -3
- package/chem-generic-ui-v0.1.41.tgz +0 -0
- package/dist/bundle.js +0 -2
- package/dist/bundle.js.LICENSE.txt +0 -70
- package/dist/ds_details.json +0 -57
- package/dist/ds_klass.json +0 -102
- package/dist/ds_props.json +0 -54
- package/dist/index.html +0 -14
- package/dist/sg_details.json +0 -2036
- package/dist/sg_klass.json +0 -850
- package/dist/units_system.json +0 -430
- package/public/ds_details.json +0 -57
- package/public/ds_klass.json +0 -102
- package/public/ds_props.json +0 -54
- package/public/favicon.ico +0 -0
- package/public/images/not_available.svg +0 -1
- package/public/index.html +0 -47
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/public/sg_details.json +0 -2036
- package/public/sg_klass.json +0 -850
- package/public/test/ds_props.json +0 -54
- package/public/units_system.json +0 -430
- package/src/app.js +0 -52
- package/src/asserts/bootstrap-theme.min.css +0 -6
- package/src/asserts/bootstrap.min.css +0 -6
- package/src/components/admin/ElementManager.js +0 -28
- package/src/components/details/GenDSDetails.js +0 -164
- package/src/components/details/GenSgDetails.js +0 -396
- package/src/components/dnd/GenericElDropTarget.js +0 -160
- package/src/components/dnd/GridDnD.js +0 -42
- package/src/components/dnd/PanelDnD.js +0 -85
- package/src/components/fields/ButtonConfirm.js +0 -45
- package/src/components/fields/ButtonTooltip.js +0 -46
- package/src/components/fields/FieldLabel.js +0 -18
- package/src/components/fields/GenDSMisType.js +0 -20
- package/src/components/fields/GenFormGroupCb.js +0 -17
- package/src/components/fields/GenProperties.js +0 -56
- package/src/components/fields/GenPropertiesFields.js +0 -440
- package/src/components/layers/GenPropertiesLayer.js +0 -178
- package/src/components/layers/LayerModal.js +0 -52
- package/src/components/layers/LayersLayout.js +0 -68
- package/src/components/models/Attachment.js +0 -37
- package/src/components/models/GenericSubField.js +0 -10
- package/src/components/table/DropLinkRenderer.js +0 -35
- package/src/components/table/DropRenderer.js +0 -31
- package/src/components/table/DropTextRenderer.js +0 -25
- package/src/components/table/GenericElTableDropTarget.js +0 -131
- package/src/components/table/GridBtn.js +0 -41
- package/src/components/table/GridEntry.js +0 -75
- package/src/components/table/SamOption.js +0 -53
- package/src/components/table/SelectRenderer.js +0 -34
- package/src/components/table/TableRecord.js +0 -254
- package/src/components/table/UConverterRenderer.js +0 -24
- package/src/components/tools/collate.js +0 -65
- package/src/components/tools/orten.js +0 -171
- package/src/components/tools/utils.js +0 -414
- package/src/data/SystemUnits.js +0 -434
- package/src/index.html +0 -1
- package/src/index.js +0 -45
- package/src/simulations/SimuDS.js +0 -52
- package/src/simulations/SimuSG.js +0 -54
- package/webpack.config.js +0 -46
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Button, OverlayTrigger, Popover } from 'react-bootstrap';
|
|
4
|
-
|
|
5
|
-
const ButtonConfirm = (props) => {
|
|
6
|
-
const {
|
|
7
|
-
msg, size, bs, fnClick, fnParams, place, fa, disabled
|
|
8
|
-
} = props;
|
|
9
|
-
const popover = (
|
|
10
|
-
<Popover id="popover-button-confirm">
|
|
11
|
-
{msg} <br />
|
|
12
|
-
<div className="btn-toolbar">
|
|
13
|
-
<Button bsSize="xsmall" bsStyle="danger" aria-hidden="true" onClick={() => fnClick(fnParams)}>
|
|
14
|
-
Yes
|
|
15
|
-
</Button><span> </span>
|
|
16
|
-
<Button bsSize="xsmall" bsStyle="warning">No</Button>
|
|
17
|
-
</div>
|
|
18
|
-
</Popover>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<OverlayTrigger animation placement={place} root trigger="focus" overlay={popover}>
|
|
23
|
-
<Button bsSize={size} bsStyle={bs} disabled={disabled}>
|
|
24
|
-
<i className={`fa ${fa}`} aria-hidden="true" />
|
|
25
|
-
</Button>
|
|
26
|
-
</OverlayTrigger>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
ButtonConfirm.propTypes = {
|
|
31
|
-
msg: PropTypes.string.isRequired,
|
|
32
|
-
fnParams: PropTypes.object.isRequired,
|
|
33
|
-
fnClick: PropTypes.func.isRequired,
|
|
34
|
-
bs: PropTypes.string,
|
|
35
|
-
size: PropTypes.string,
|
|
36
|
-
place: PropTypes.string,
|
|
37
|
-
fa: PropTypes.string,
|
|
38
|
-
disabled: PropTypes.bool,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
ButtonConfirm.defaultProps = {
|
|
42
|
-
bs: 'danger', size: 'xs', place: 'right', fa: 'fa-trash-o', disabled: false
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default ButtonConfirm;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Button, OverlayTrigger, Tooltip } from 'react-bootstrap';
|
|
4
|
-
import { v4 as uuid } from 'uuid';
|
|
5
|
-
|
|
6
|
-
const ButtonTooltip = (props) => {
|
|
7
|
-
const tip = <Tooltip id={uuid()}>{props.tip}</Tooltip>;
|
|
8
|
-
const {
|
|
9
|
-
size, bs, fnClick, element, place, fa, disabled, txt
|
|
10
|
-
} = props;
|
|
11
|
-
const content = txt ? (<span>{txt} </span>) : '';
|
|
12
|
-
if (bs === '') {
|
|
13
|
-
return (
|
|
14
|
-
<OverlayTrigger delayShow={1000} placement={place} overlay={tip} >
|
|
15
|
-
<Button bsSize={size} onClick={() => fnClick(element)} disabled={disabled}>
|
|
16
|
-
{content}<i className={`fa ${fa}`} aria-hidden="true" />
|
|
17
|
-
</Button>
|
|
18
|
-
</OverlayTrigger>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
return (
|
|
22
|
-
<OverlayTrigger delayShow={1000} placement={place} overlay={tip} >
|
|
23
|
-
<Button bsSize={size} bsStyle={bs} onClick={() => fnClick(element)} disabled={disabled}>
|
|
24
|
-
{content}<i className={`fa ${fa}`} aria-hidden="true" />
|
|
25
|
-
</Button>
|
|
26
|
-
</OverlayTrigger>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
ButtonTooltip.propTypes = {
|
|
31
|
-
tip: PropTypes.string.isRequired,
|
|
32
|
-
element: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
|
|
33
|
-
fnClick: PropTypes.func.isRequired,
|
|
34
|
-
bs: PropTypes.string,
|
|
35
|
-
size: PropTypes.string,
|
|
36
|
-
place: PropTypes.string,
|
|
37
|
-
fa: PropTypes.string,
|
|
38
|
-
disabled: PropTypes.bool,
|
|
39
|
-
txt: PropTypes.string,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
ButtonTooltip.defaultProps = {
|
|
43
|
-
bs: '', size: 'xs', place: 'right', fa: 'fa-pencil-square-o', disabled: false, txt: null, element: {}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default ButtonTooltip;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
|
|
4
|
-
import { v4 as uuid } from 'uuid';
|
|
5
|
-
|
|
6
|
-
const FieldLabel = (props) => {
|
|
7
|
-
const { label, desc } = props;
|
|
8
|
-
return (desc && desc !== '') ? (
|
|
9
|
-
<OverlayTrigger placement="top" delayShow={1000} overlay={<Tooltip id={uuid()}>{desc}</Tooltip>}>
|
|
10
|
-
<span>{label}</span>
|
|
11
|
-
</OverlayTrigger>
|
|
12
|
-
) : <span>{label}</span>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
FieldLabel.propTypes = { label: PropTypes.string.isRequired, desc: PropTypes.string };
|
|
16
|
-
FieldLabel.defaultProps = { desc: '' };
|
|
17
|
-
|
|
18
|
-
export default FieldLabel;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
|
|
6
|
-
const GenDSMisType = (props) => {
|
|
7
|
-
const { uiCtrl } = props;
|
|
8
|
-
if (uiCtrl) {
|
|
9
|
-
return (
|
|
10
|
-
<OverlayTrigger placement="top" delay={300} overlay={<Tooltip id="tooltip">Type (Chemical Methods Ontology) has been changed. <br />Please review this Dataset content.</Tooltip>}>
|
|
11
|
-
<span style={{ color: 'red' }}><FontAwesomeIcon icon="fas fa-exclamation-circle" /> </span>
|
|
12
|
-
</OverlayTrigger>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
return null;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
GenDSMisType.propTypes = { uiCtrl: PropTypes.bool.isRequired };
|
|
19
|
-
|
|
20
|
-
export default GenDSMisType;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/prop-types */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Checkbox, FormGroup } from 'react-bootstrap';
|
|
4
|
-
|
|
5
|
-
const GenFormGroupCb = (props) => {
|
|
6
|
-
const {
|
|
7
|
-
label, value, name, onChange
|
|
8
|
-
} = props;
|
|
9
|
-
return (
|
|
10
|
-
<FormGroup className="text_generic_properties">
|
|
11
|
-
{label || '' }
|
|
12
|
-
<Checkbox checked={value} onChange={e => onChange(e, name)} />
|
|
13
|
-
</FormGroup>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default GenFormGroupCb;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GenPropertiesCheckbox,
|
|
3
|
-
GenPropertiesCalculate,
|
|
4
|
-
GenPropertiesSelect,
|
|
5
|
-
GenPropertiesDrop,
|
|
6
|
-
GenPropertiesNumber,
|
|
7
|
-
GenPropertiesSystemDefined,
|
|
8
|
-
GenPropertiesInputGroup,
|
|
9
|
-
GenPropertiesTextArea,
|
|
10
|
-
GenPropertiesUpload,
|
|
11
|
-
GenDummy,
|
|
12
|
-
GenPropertiesTable,
|
|
13
|
-
GenTextFormula,
|
|
14
|
-
GenWFNext,
|
|
15
|
-
GenPropertiesText
|
|
16
|
-
} from './GenPropertiesFields';
|
|
17
|
-
|
|
18
|
-
const GenProperties = (opt) => {
|
|
19
|
-
const fieldProps = { ...opt, dndItems: [] };
|
|
20
|
-
const type = fieldProps.type.split('_');
|
|
21
|
-
if (opt.isSearchCriteria && type[0] === 'drag') type[0] = 'text';
|
|
22
|
-
// if (opt.isPreview && (type[0] === 'drag' || type[0] === 'upload')) type[0] = 'text';
|
|
23
|
-
switch (type[0]) {
|
|
24
|
-
case 'checkbox':
|
|
25
|
-
return GenPropertiesCheckbox(fieldProps);
|
|
26
|
-
case 'formula-field':
|
|
27
|
-
return GenPropertiesCalculate(fieldProps);
|
|
28
|
-
case 'select':
|
|
29
|
-
return GenPropertiesSelect(fieldProps);
|
|
30
|
-
case 'drag':
|
|
31
|
-
fieldProps.dndItems = [...fieldProps.dndItems, type[1]];
|
|
32
|
-
return GenPropertiesDrop(fieldProps);
|
|
33
|
-
case 'integer':
|
|
34
|
-
return GenPropertiesNumber(fieldProps);
|
|
35
|
-
case 'system-defined':
|
|
36
|
-
return GenPropertiesSystemDefined(fieldProps);
|
|
37
|
-
case 'input-group':
|
|
38
|
-
return GenPropertiesInputGroup(fieldProps);
|
|
39
|
-
case 'textarea':
|
|
40
|
-
return GenPropertiesTextArea(fieldProps);
|
|
41
|
-
case 'upload':
|
|
42
|
-
return GenPropertiesUpload(fieldProps);
|
|
43
|
-
case 'dummy':
|
|
44
|
-
return GenDummy();
|
|
45
|
-
case 'table':
|
|
46
|
-
return GenPropertiesTable(fieldProps);
|
|
47
|
-
case 'text-formula':
|
|
48
|
-
return GenTextFormula(fieldProps);
|
|
49
|
-
case 'wf-next':
|
|
50
|
-
return GenWFNext(fieldProps);
|
|
51
|
-
default:
|
|
52
|
-
return GenPropertiesText(fieldProps);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default GenProperties;
|
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
2
|
-
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
3
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
4
|
-
/* eslint-disable no-eval */
|
|
5
|
-
/* eslint-disable no-restricted-globals */
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { Button, Checkbox, FormGroup, FormControl,
|
|
9
|
-
InputGroup, ListGroup, ListGroupItem, OverlayTrigger, Radio, Tooltip } from 'react-bootstrap';
|
|
10
|
-
import Select from 'react-select';
|
|
11
|
-
import Dropzone from 'react-dropzone';
|
|
12
|
-
import { v4 as uuid } from 'uuid';
|
|
13
|
-
import { filter } from 'lodash';
|
|
14
|
-
import FieldLabel from './FieldLabel';
|
|
15
|
-
import { downloadFile, genUnit, genUnitSup, unitConvToBase } from '../tools/utils';
|
|
16
|
-
import GenericElDropTarget from '../dnd/GenericElDropTarget';
|
|
17
|
-
import TableRecord from '../table/TableRecord';
|
|
18
|
-
|
|
19
|
-
const GenPropertiesCalculate = (opt) => {
|
|
20
|
-
const fields = (opt.layer && opt.layer.fields) || [];
|
|
21
|
-
let showVal = 0;
|
|
22
|
-
let showTxt = null;
|
|
23
|
-
let newFormula = opt.formula;
|
|
24
|
-
|
|
25
|
-
const calFields = filter(fields, o => (o.type === 'integer' || o.type === 'system-defined'));
|
|
26
|
-
const regF = /[a-zA-Z0-9]+/gm;
|
|
27
|
-
// eslint-disable-next-line max-len
|
|
28
|
-
const varFields = (opt.formula && opt.formula.match(regF)) ? opt.formula.match(regF).sort((a, b) => b.length - a.length) : [];
|
|
29
|
-
|
|
30
|
-
varFields.forEach((fi) => {
|
|
31
|
-
if (!isNaN(fi)) return;
|
|
32
|
-
|
|
33
|
-
const tmpField = calFields.find(e => e.field === fi);
|
|
34
|
-
if (typeof tmpField === 'undefined' || tmpField == null) {
|
|
35
|
-
newFormula = newFormula.replace(fi, 0);
|
|
36
|
-
} else {
|
|
37
|
-
newFormula = (tmpField.type === 'system-defined') ? newFormula.replace(fi, parseFloat(unitConvToBase(tmpField) || 0)) : newFormula.replace(fi, parseFloat(tmpField.value || 0));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (opt.type === 'formula-field') {
|
|
42
|
-
try {
|
|
43
|
-
showVal = eval(newFormula);
|
|
44
|
-
showTxt = !isNaN(showVal) ? parseFloat(showVal.toFixed(5)) : 0;
|
|
45
|
-
} catch (e) {
|
|
46
|
-
if (e instanceof SyntaxError) {
|
|
47
|
-
showTxt = e.message;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const fieldHeader = opt.label === '' ? null : (<FieldLabel label={opt.label} desc={opt.description} />);
|
|
53
|
-
return (
|
|
54
|
-
<FormGroup>
|
|
55
|
-
{fieldHeader}
|
|
56
|
-
<InputGroup>
|
|
57
|
-
<FormControl
|
|
58
|
-
type="text"
|
|
59
|
-
value={showTxt}
|
|
60
|
-
onChange={opt.onChange}
|
|
61
|
-
className="readonly"
|
|
62
|
-
readOnly="readonly"
|
|
63
|
-
required={false}
|
|
64
|
-
placeholder={opt.placeholder}
|
|
65
|
-
min={0}
|
|
66
|
-
/>
|
|
67
|
-
<InputGroup.Button>
|
|
68
|
-
<OverlayTrigger
|
|
69
|
-
placement="bottom"
|
|
70
|
-
overlay={<Tooltip id="update_calculation_field">adjust</Tooltip>}
|
|
71
|
-
>
|
|
72
|
-
<Button active className="clipboardBtn" onClick={() => opt.onChange(showTxt)}>
|
|
73
|
-
<i className="fa fa-arrow-right" aria-hidden="true" />
|
|
74
|
-
</Button>
|
|
75
|
-
</OverlayTrigger>
|
|
76
|
-
</InputGroup.Button>
|
|
77
|
-
<FormControl
|
|
78
|
-
type="text"
|
|
79
|
-
value={opt.value}
|
|
80
|
-
onChange={opt.onChange}
|
|
81
|
-
required={false}
|
|
82
|
-
placeholder={opt.placeholder}
|
|
83
|
-
min={0}
|
|
84
|
-
/>
|
|
85
|
-
</InputGroup>
|
|
86
|
-
</FormGroup>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const GenPropertiesCheckbox = opt => (
|
|
91
|
-
<FormGroup>
|
|
92
|
-
<Checkbox
|
|
93
|
-
name={opt.field}
|
|
94
|
-
checked={opt.value}
|
|
95
|
-
onChange={opt.onChange}
|
|
96
|
-
disabled={opt.readOnly}
|
|
97
|
-
>
|
|
98
|
-
<FormControl.Static>{opt.label}</FormControl.Static>
|
|
99
|
-
</Checkbox>
|
|
100
|
-
</FormGroup>
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const GenPropertiesDrop = (opt) => {
|
|
104
|
-
const className = opt.isRequired ? 'drop_generic_properties field_required' : 'drop_generic_properties';
|
|
105
|
-
|
|
106
|
-
let createOpt = null;
|
|
107
|
-
if (opt.value.is_new === true) {
|
|
108
|
-
createOpt = (
|
|
109
|
-
<div className="sample_radios">
|
|
110
|
-
<OverlayTrigger placement="top" overlay={<Tooltip id={uuid()}>associate with this sample</Tooltip>}>
|
|
111
|
-
<Radio name={`dropS_${opt.value.el_id}`} disabled={opt.value.isAssoc === true} checked={opt.value.cr_opt === 0} onChange={() => opt.onChange({ ...opt.value, cr_opt: 0 })} inline>Current</Radio>
|
|
112
|
-
</OverlayTrigger>
|
|
113
|
-
<OverlayTrigger placement="top" overlay={<Tooltip id={uuid()}>split from the sample first and then associate with it</Tooltip>}>
|
|
114
|
-
<Radio name={`dropS_${opt.value.el_id}`} checked={opt.value.cr_opt === 1} onChange={() => opt.onChange({ ...opt.value, cr_opt: 1 })} inline>Split</Radio>
|
|
115
|
-
</OverlayTrigger>
|
|
116
|
-
<OverlayTrigger placement="top" overlay={<Tooltip id={uuid()}>duplicate the sample first and then associate with it</Tooltip>}>
|
|
117
|
-
<Radio name={`dropS_${opt.value.el_id}`} checked={opt.value.cr_opt === 2} onChange={() => opt.onChange({ ...opt.value, cr_opt: 2 })} inline>Copy</Radio>
|
|
118
|
-
</OverlayTrigger>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
123
|
-
const defaultIcon = opt.type === 'drag_element' ? <span className="fa fa-link icon_generic_nav indicator" /> : <span className="icon-sample indicator" />;
|
|
124
|
-
const dragTarget = opt.isPreview === true ? <div className="target">{defaultIcon}</div> : <GenericElDropTarget opt={opt} onDrop={opt.onChange} />;
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<FormGroup>
|
|
128
|
-
{fieldHeader}
|
|
129
|
-
<FormControl.Static style={{ paddingBottom: '0px' }}>
|
|
130
|
-
<div className={className}>
|
|
131
|
-
{dragTarget}
|
|
132
|
-
{createOpt}
|
|
133
|
-
<div>
|
|
134
|
-
<OverlayTrigger placement="top" overlay={<Tooltip id={uuid()}>remove</Tooltip>}>
|
|
135
|
-
<Button className="btn_del" bsStyle="danger" bsSize="xsmall" onClick={() => opt.onChange({})} ><i className="fa fa-trash-o" aria-hidden="true" /></Button>
|
|
136
|
-
</OverlayTrigger>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
</FormControl.Static>
|
|
140
|
-
</FormGroup>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const GenDummy = () => (
|
|
145
|
-
<FormGroup className="text_generic_properties">
|
|
146
|
-
<FormControl type="text" className="dummy" readOnly />
|
|
147
|
-
</FormGroup>
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
const GenPropertiesInputGroup = (opt) => {
|
|
151
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
152
|
-
const fLab = e => <div key={uuid()} className="form-control g_input_group_label">{e.value}</div>;
|
|
153
|
-
const fTxt = e => <FormControl className="g_input_group" key={e.id} type={e.type} name={e.id} value={e.value} onChange={o => opt.onSubChange(o, e.id, opt.f_obj)} />;
|
|
154
|
-
const fUnit = e => (
|
|
155
|
-
<span key={`${e.id}_GenPropertiesInputGroup`} className="input-group" style={{ width: '100%' }}>
|
|
156
|
-
<FormControl key={e.id} type="number" name={e.id} value={e.value} onChange={o => opt.onSubChange(o, e.id, opt.f_obj)} min={1} />
|
|
157
|
-
<InputGroup.Button>
|
|
158
|
-
<Button active onClick={() => opt.onSubChange(e, e.id, opt.f_obj)} bsStyle="success">
|
|
159
|
-
{genUnitSup(genUnit(e.option_layers, e.value_system).label) || ''}
|
|
160
|
-
</Button>
|
|
161
|
-
</InputGroup.Button>
|
|
162
|
-
</span>
|
|
163
|
-
);
|
|
164
|
-
const subs = opt.f_obj && opt.f_obj.sub_fields && opt.f_obj.sub_fields.map((e) => {
|
|
165
|
-
if (e.type === 'label') { return fLab(e); } if (e.type === 'system-defined') { return fUnit(e); } return fTxt(e);
|
|
166
|
-
});
|
|
167
|
-
return (
|
|
168
|
-
<FormGroup>
|
|
169
|
-
{fieldHeader}
|
|
170
|
-
<InputGroup style={{ display: 'flex' }}>
|
|
171
|
-
{subs}
|
|
172
|
-
</InputGroup>
|
|
173
|
-
</FormGroup>
|
|
174
|
-
);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const GenPropertiesNumber = (opt) => {
|
|
178
|
-
let className = opt.isEditable ? 'editable' : 'readonly';
|
|
179
|
-
className = opt.isRequired && opt.isEditable ? 'required' : className;
|
|
180
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
181
|
-
return (
|
|
182
|
-
<FormGroup>
|
|
183
|
-
{fieldHeader}
|
|
184
|
-
<FormControl
|
|
185
|
-
type="number"
|
|
186
|
-
value={opt.value}
|
|
187
|
-
onChange={opt.onChange}
|
|
188
|
-
className={className}
|
|
189
|
-
readOnly={opt.readOnly}
|
|
190
|
-
required={opt.isRequired}
|
|
191
|
-
placeholder={opt.placeholder}
|
|
192
|
-
min={1}
|
|
193
|
-
/>
|
|
194
|
-
</FormGroup>
|
|
195
|
-
);
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const GenPropertiesSelect = (opt) => {
|
|
199
|
-
const options = opt.options.map(op => ({ value: op.key, name: op.key, label: op.label }));
|
|
200
|
-
let className = opt.isEditable ? 'select_generic_properties_editable' : 'select_generic_properties_readonly';
|
|
201
|
-
className = opt.isRequired && opt.isEditable ? 'select_generic_properties_required' : className;
|
|
202
|
-
className = `${className} status-select`;
|
|
203
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
204
|
-
const val = options.find(o => o.value === opt.value) || null;
|
|
205
|
-
return (
|
|
206
|
-
<FormGroup>
|
|
207
|
-
{fieldHeader}
|
|
208
|
-
<Select
|
|
209
|
-
isClearable
|
|
210
|
-
menuContainerStyle={{ position: 'absolute' }}
|
|
211
|
-
name={opt.field}
|
|
212
|
-
multi={false}
|
|
213
|
-
options={options}
|
|
214
|
-
value={val}
|
|
215
|
-
onChange={opt.onChange}
|
|
216
|
-
className={className}
|
|
217
|
-
disabled={opt.readOnly}
|
|
218
|
-
/>
|
|
219
|
-
</FormGroup>
|
|
220
|
-
);
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const GenPropertiesSystemDefined = (opt) => {
|
|
224
|
-
let className = opt.isEditable ? 'editable' : 'readonly';
|
|
225
|
-
className = opt.isRequired && opt.isEditable ? 'required' : className;
|
|
226
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
227
|
-
return (
|
|
228
|
-
<FormGroup>
|
|
229
|
-
{fieldHeader}
|
|
230
|
-
<InputGroup>
|
|
231
|
-
<FormControl
|
|
232
|
-
type="number"
|
|
233
|
-
value={opt.value}
|
|
234
|
-
onChange={opt.onChange}
|
|
235
|
-
className={className}
|
|
236
|
-
readOnly={opt.readOnly}
|
|
237
|
-
required={opt.isRequired}
|
|
238
|
-
placeholder={opt.placeholder}
|
|
239
|
-
min={1}
|
|
240
|
-
/>
|
|
241
|
-
<InputGroup.Button>
|
|
242
|
-
<Button disabled={opt.readOnly} active onClick={opt.onClick} bsStyle="success">
|
|
243
|
-
{genUnitSup(genUnit(opt.option_layers, opt.value_system).label) || ''}
|
|
244
|
-
</Button>
|
|
245
|
-
</InputGroup.Button>
|
|
246
|
-
</InputGroup>
|
|
247
|
-
</FormGroup>
|
|
248
|
-
);
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const GenPropertiesTable = (opt) => {
|
|
252
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
253
|
-
return (
|
|
254
|
-
<FormGroup>
|
|
255
|
-
{fieldHeader}
|
|
256
|
-
<TableRecord key={`grid_${opt.f_obj.field}`} opt={opt} />
|
|
257
|
-
</FormGroup>
|
|
258
|
-
);
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const GenPropertiesText = (opt) => {
|
|
262
|
-
let className = opt.isEditable ? 'editable' : 'readonly';
|
|
263
|
-
className = opt.isRequired && opt.isEditable ? 'required' : className;
|
|
264
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
265
|
-
return (
|
|
266
|
-
<FormGroup className="text_generic_properties">
|
|
267
|
-
{fieldHeader}
|
|
268
|
-
<FormControl
|
|
269
|
-
type="text"
|
|
270
|
-
value={opt.value}
|
|
271
|
-
onChange={opt.onChange}
|
|
272
|
-
className={className}
|
|
273
|
-
readOnly={opt.readOnly}
|
|
274
|
-
required={opt.isRequired}
|
|
275
|
-
placeholder={opt.placeholder}
|
|
276
|
-
/>
|
|
277
|
-
</FormGroup>
|
|
278
|
-
);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
const GenPropertiesTextArea = (opt) => {
|
|
282
|
-
let className = opt.isEditable ? 'editable' : 'readonly';
|
|
283
|
-
className = opt.isRequired && opt.isEditable ? 'required' : className;
|
|
284
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
285
|
-
return (
|
|
286
|
-
<FormGroup className="text_generic_properties">
|
|
287
|
-
{fieldHeader}
|
|
288
|
-
<FormControl
|
|
289
|
-
componentClass="textarea"
|
|
290
|
-
value={opt.value}
|
|
291
|
-
onChange={opt.onChange}
|
|
292
|
-
className={className}
|
|
293
|
-
readOnly={opt.readOnly}
|
|
294
|
-
required={opt.isRequired}
|
|
295
|
-
placeholder={opt.placeholder}
|
|
296
|
-
/>
|
|
297
|
-
</FormGroup>
|
|
298
|
-
);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const GenTextFormula = (opt) => {
|
|
302
|
-
const { layers } = opt;
|
|
303
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
304
|
-
const subs = [];
|
|
305
|
-
(opt.f_obj && opt.f_obj.text_sub_fields).map((e) => {
|
|
306
|
-
const { layer, field, separator } = e;
|
|
307
|
-
if (field && field !== '') {
|
|
308
|
-
if (field.includes('[@@]')) {
|
|
309
|
-
const fds = field.split('[@@]');
|
|
310
|
-
if (fds && fds.length === 2) {
|
|
311
|
-
const fdt = ((layers[layer] || {}).fields || []).find(f => f.field === fds[0] && f.type === 'table');
|
|
312
|
-
((fdt && fdt.sub_values) || []).forEach((svv) => {
|
|
313
|
-
if (svv && svv[fds[1]] && svv[fds[1]] !== '') { subs.push(svv[fds[1]]); subs.push(separator); }
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
const fd = ((layers[layer] || {}).fields || []).find(f => f.field === field);
|
|
318
|
-
if (fd && fd.value && fd.value !== '') { subs.push(fd.value); subs.push(separator); }
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return true;
|
|
322
|
-
});
|
|
323
|
-
return (
|
|
324
|
-
<FormGroup className="text_generic_properties">
|
|
325
|
-
{fieldHeader}
|
|
326
|
-
<FormControl
|
|
327
|
-
type="text"
|
|
328
|
-
value={subs.join('')}
|
|
329
|
-
className="readonly"
|
|
330
|
-
readOnly
|
|
331
|
-
required={false}
|
|
332
|
-
/>
|
|
333
|
-
</FormGroup>
|
|
334
|
-
);
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
const renderListGroupItem = (opt, attachment) => {
|
|
338
|
-
const delBtn = (
|
|
339
|
-
<Button bsSize="xsmall" id={attachment.uid} className="button-right" onClick={() => opt.onChange({ ...opt.value, action: 'd', uid: attachment.uid })}>
|
|
340
|
-
<i className="fa fa-times" aria-hidden="true" />
|
|
341
|
-
</Button>
|
|
342
|
-
);
|
|
343
|
-
const filename = attachment.aid ?
|
|
344
|
-
(<a onClick={() => downloadFile({ contents: `/api/v1/attachments/${attachment.aid}`, name: attachment.filename })} style={{ cursor: 'pointer' }}>{attachment.filename}</a>) : attachment.filename;
|
|
345
|
-
return (
|
|
346
|
-
<div className="generic_grid">
|
|
347
|
-
<div>
|
|
348
|
-
<div>{delBtn}</div>
|
|
349
|
-
<div className="generic_grid_row">{filename}</div>
|
|
350
|
-
<div className="generic_grid_row">
|
|
351
|
-
<FormGroup bsSize="small">
|
|
352
|
-
<FormControl
|
|
353
|
-
type="text"
|
|
354
|
-
value={attachment.label || ''}
|
|
355
|
-
onChange={e => opt.onChange({
|
|
356
|
-
...opt.value, action: 'l', uid: attachment.uid, val: e
|
|
357
|
-
})}
|
|
358
|
-
/>
|
|
359
|
-
</FormGroup>
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
</div>
|
|
363
|
-
);
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
const GenPropertiesUpload = (opt) => {
|
|
367
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
368
|
-
const attachments = (opt.value && opt.value.files) || [];
|
|
369
|
-
if (opt.isSearchCriteria) return (<div>(This is an upload)</div>);
|
|
370
|
-
|
|
371
|
-
return (
|
|
372
|
-
<FormGroup className="text_generic_properties">
|
|
373
|
-
{fieldHeader}
|
|
374
|
-
<FormControl.Static style={{ paddingBottom: '0px' }}>
|
|
375
|
-
<Dropzone
|
|
376
|
-
id="dropzone"
|
|
377
|
-
onDrop={e => opt.onChange({
|
|
378
|
-
...opt.value, action: 'f', val: e
|
|
379
|
-
})}
|
|
380
|
-
style={{ height: 30, width: '100%', border: '3px dashed lightgray' }}
|
|
381
|
-
>
|
|
382
|
-
<div style={{ textAlign: 'center', paddingTop: 6, color: 'gray' }}>
|
|
383
|
-
Drop File, or Click to Select.
|
|
384
|
-
</div>
|
|
385
|
-
</Dropzone>
|
|
386
|
-
</FormControl.Static>
|
|
387
|
-
<ListGroup>
|
|
388
|
-
{attachments.map(attachment => (
|
|
389
|
-
<ListGroupItem key={attachment.id} className="generic_files">
|
|
390
|
-
{renderListGroupItem(opt, attachment)}
|
|
391
|
-
</ListGroupItem>
|
|
392
|
-
))}
|
|
393
|
-
</ListGroup>
|
|
394
|
-
</FormGroup>
|
|
395
|
-
);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
const GenWFNext = (opt) => {
|
|
399
|
-
const options = (opt.f_obj.wf_options || []).map((op) => {
|
|
400
|
-
const label = op.label.match(/(.*)\(.*\)/);
|
|
401
|
-
return ({ value: op.key, name: op.key, label: label[1] === '' ? label[0] : label[1] });
|
|
402
|
-
});
|
|
403
|
-
let className = opt.isEditable ? 'select_generic_properties_editable' : 'select_generic_properties_readonly';
|
|
404
|
-
className = opt.isRequired && opt.isEditable ? 'select_generic_properties_required' : className;
|
|
405
|
-
className = `${className} status-select`;
|
|
406
|
-
const fieldHeader = opt.label === '' ? null : <FieldLabel label={opt.label} desc={opt.description} />;
|
|
407
|
-
const val = options.find(o => o.value === opt.value) || null;
|
|
408
|
-
return (
|
|
409
|
-
<FormGroup>
|
|
410
|
-
{fieldHeader}
|
|
411
|
-
<Select
|
|
412
|
-
menuContainerStyle={{ position: 'absolute' }}
|
|
413
|
-
name={opt.field}
|
|
414
|
-
multi={false}
|
|
415
|
-
options={options}
|
|
416
|
-
value={val}
|
|
417
|
-
onChange={opt.onChange}
|
|
418
|
-
className={className}
|
|
419
|
-
disabled={opt.readOnly}
|
|
420
|
-
/>
|
|
421
|
-
</FormGroup>
|
|
422
|
-
);
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
export {
|
|
426
|
-
GenPropertiesCalculate,
|
|
427
|
-
GenPropertiesCheckbox,
|
|
428
|
-
GenPropertiesDrop,
|
|
429
|
-
GenDummy,
|
|
430
|
-
GenTextFormula,
|
|
431
|
-
GenPropertiesInputGroup,
|
|
432
|
-
GenPropertiesNumber,
|
|
433
|
-
GenPropertiesSelect,
|
|
434
|
-
GenPropertiesSystemDefined,
|
|
435
|
-
GenPropertiesTable,
|
|
436
|
-
GenPropertiesText,
|
|
437
|
-
GenPropertiesTextArea,
|
|
438
|
-
GenPropertiesUpload,
|
|
439
|
-
GenWFNext
|
|
440
|
-
};
|