chem-generic-ui 0.1.34 → 0.1.37
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/.babelrc +17 -0
- package/.eslintrc +23 -0
- package/.tool-versions +3 -0
- package/package.json +55 -38
- package/public/ds_details.json +57 -0
- package/public/ds_klass.json +102 -0
- package/public/ds_props.json +54 -0
- package/public/favicon.ico +0 -0
- package/public/images/not_available.svg +1 -0
- package/public/index.html +47 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/sg_details.json +2036 -0
- package/public/sg_klass.json +850 -0
- package/public/test/ds_props.json +54 -0
- package/{dist/data/systemUnits.json → public/units_system.json} +0 -0
- package/src/app.js +50 -0
- package/{dist → src}/asserts/main.css +0 -7
- package/{dist → src}/asserts/main.scss +1 -7
- package/src/components/admin/ElementManager.js +28 -0
- package/src/components/details/GenDSDetails.js +164 -0
- package/src/components/details/GenSgDetails.js +396 -0
- package/{dist → src}/components/dnd/DragDropItemTypes.js +1 -8
- package/src/components/dnd/GenericElDropTarget.js +160 -0
- package/src/components/dnd/GridDnD.js +42 -0
- package/src/components/dnd/PanelDnD.js +85 -0
- package/src/components/fields/ButtonConfirm.js +45 -0
- package/src/components/fields/ButtonTooltip.js +46 -0
- package/src/components/fields/FieldLabel.js +18 -0
- package/src/components/fields/GenDSMisType.js +20 -0
- package/src/components/fields/GenFormGroupCb.js +17 -0
- package/src/components/fields/GenProperties.js +56 -0
- package/src/components/fields/GenPropertiesFields.js +318 -0
- package/src/components/layers/GenPropertiesLayer.js +176 -0
- package/src/components/layers/LayerModal.js +52 -0
- package/src/components/layers/LayersLayout.js +68 -0
- package/src/components/models/Attachment.js +37 -0
- package/src/components/models/GenericSubField.js +10 -0
- package/src/components/table/DropLinkRenderer.js +35 -0
- package/src/components/table/DropRenderer.js +31 -0
- package/src/components/table/DropTextRenderer.js +25 -0
- package/src/components/table/GenericElTableDropTarget.js +131 -0
- package/src/components/table/GridBtn.js +41 -0
- package/src/components/table/GridEntry.js +75 -0
- package/src/components/table/SamOption.js +53 -0
- package/src/components/table/SelectRenderer.js +34 -0
- package/src/components/table/TableRecord.js +254 -0
- package/src/components/table/UConverterRenderer.js +24 -0
- package/src/components/tools/collate.js +65 -0
- package/src/components/tools/orten.js +171 -0
- package/src/components/tools/utils.js +414 -0
- package/src/data/SystemUnits.js +434 -0
- package/src/data/systemUnits.json +430 -0
- package/{dist → src}/index.css +0 -0
- package/src/index.html +1 -0
- package/src/index.js +45 -0
- package/{dist → src}/logo.svg +0 -0
- package/src/simulations/SimuDS.js +52 -0
- package/src/simulations/SimuSG.js +54 -0
- package/webpack.config.js +52 -0
- package/dist/app.js +0 -105
- package/dist/components/admin/ElementManager.js +0 -54
- package/dist/components/details/GenDSDetails.js +0 -273
- package/dist/components/details/GenSgDetails.js +0 -566
- package/dist/components/dnd/GenericElDropTarget.js +0 -274
- package/dist/components/dnd/GridDnD.js +0 -77
- package/dist/components/dnd/PanelDnD.js +0 -171
- package/dist/components/fields/ButtonConfirm.js +0 -76
- package/dist/components/fields/ButtonTooltip.js +0 -88
- package/dist/components/fields/FieldLabel.js +0 -38
- package/dist/components/fields/GenDSMisType.js +0 -44
- package/dist/components/fields/GenFormGroupCb.js +0 -31
- package/dist/components/fields/GenProperties.js +0 -83
- package/dist/components/fields/GenPropertiesFields.js +0 -616
- package/dist/components/flow/FlowView.js +0 -88
- package/dist/components/flow/FlowViewerModal.js +0 -81
- package/dist/components/flow/LayerNode.js +0 -59
- package/dist/components/layers/GenPropertiesLayer.js +0 -280
- package/dist/components/layers/LayerModal.js +0 -81
- package/dist/components/layers/LayersLayout.js +0 -88
- package/dist/components/models/Attachment.js +0 -73
- package/dist/components/models/GenericSubField.js +0 -37
- package/dist/components/table/DropLinkRenderer.js +0 -55
- package/dist/components/table/DropRenderer.js +0 -45
- package/dist/components/table/DropTextRenderer.js +0 -45
- package/dist/components/table/GenericElTableDropTarget.js +0 -252
- package/dist/components/table/GridBtn.js +0 -102
- package/dist/components/table/GridEntry.js +0 -163
- package/dist/components/table/SamOption.js +0 -87
- package/dist/components/table/SelectRenderer.js +0 -52
- package/dist/components/table/TableRecord.js +0 -454
- package/dist/components/table/UConverterRenderer.js +0 -41
- package/dist/components/tools/collate.js +0 -103
- package/dist/components/tools/orten.js +0 -294
- package/dist/components/tools/utils.js +0 -593
- package/dist/data/SystemUnits.js +0 -588
- package/dist/index.js +0 -39
- package/dist/simulations/SimWF.js +0 -123
- package/dist/simulations/SimuDS.js +0 -118
- package/dist/simulations/SimuSG.js +0 -123
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.removeFromObject = exports.reformCondFields = exports.orgLayerObject = exports.getWFNode = exports.getFlowLayer = exports.buildInitWF = exports.addToObject = void 0;
|
|
7
|
-
|
|
8
|
-
var _lodash = require("lodash");
|
|
9
|
-
|
|
10
|
-
var _uuid = require("uuid");
|
|
11
|
-
|
|
12
|
-
/* eslint-disable no-param-reassign */
|
|
13
|
-
|
|
14
|
-
/* eslint-disable import/prefer-default-export */
|
|
15
|
-
var getWFNode = function getWFNode(_flow, nodeId) {
|
|
16
|
-
return _flow.elements.filter(function (e) {
|
|
17
|
-
return e.id === nodeId;
|
|
18
|
-
})[0];
|
|
19
|
-
}; // full-flow, node id
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
exports.getWFNode = getWFNode;
|
|
23
|
-
|
|
24
|
-
var getFlowLayer = function getFlowLayer(templateFlow, nodeId, sourceLayer, sIdx) {
|
|
25
|
-
var flow = (0, _lodash.cloneDeep)(templateFlow);
|
|
26
|
-
var nd = flow.elements.filter(function (e) {
|
|
27
|
-
return e.id === nodeId;
|
|
28
|
-
}); // fetch node
|
|
29
|
-
|
|
30
|
-
if (nd.length < 1) return null;
|
|
31
|
-
var layer = nd[0].data.layer;
|
|
32
|
-
var ls = flow.elements.filter(function (e) {
|
|
33
|
-
return e.animated;
|
|
34
|
-
}); // lines
|
|
35
|
-
|
|
36
|
-
var ns = flow.elements.filter(function (e) {
|
|
37
|
-
return e.type === 'default' && e.data;
|
|
38
|
-
}); // nodes - Start - End
|
|
39
|
-
|
|
40
|
-
var ndNs = ls.filter(function (e) {
|
|
41
|
-
return e.source === nodeId;
|
|
42
|
-
}).map(function (e) {
|
|
43
|
-
return e.target;
|
|
44
|
-
}); // next nodes' id
|
|
45
|
-
|
|
46
|
-
var wfOpts = ns.filter(function (n) {
|
|
47
|
-
return ndNs.includes(n.id);
|
|
48
|
-
}).map(function (e) {
|
|
49
|
-
return {
|
|
50
|
-
key: e.id,
|
|
51
|
-
label: "".concat(e.data.layer.label, "(").concat(e.data.layer.key, ")")
|
|
52
|
-
};
|
|
53
|
-
}); // next nodes
|
|
54
|
-
|
|
55
|
-
if (wfOpts.length > 0) {
|
|
56
|
-
var position = (layer.fields || []).length + 1;
|
|
57
|
-
layer.fields.push({
|
|
58
|
-
type: 'wf-next',
|
|
59
|
-
default: '',
|
|
60
|
-
field: '_wf_next',
|
|
61
|
-
label: 'Next',
|
|
62
|
-
required: false,
|
|
63
|
-
sub_fields: [],
|
|
64
|
-
text_sub_fields: [],
|
|
65
|
-
position: position,
|
|
66
|
-
wf_options: wfOpts
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
layer.wf_info = {
|
|
71
|
-
node_id: nodeId,
|
|
72
|
-
source_layer: sourceLayer
|
|
73
|
-
};
|
|
74
|
-
layer.wf_position = sIdx + 1;
|
|
75
|
-
return layer;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
exports.getFlowLayer = getFlowLayer;
|
|
79
|
-
|
|
80
|
-
var orgLayerObject = function orgLayerObject() {
|
|
81
|
-
var _layers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
82
|
-
|
|
83
|
-
var layers = _layers;
|
|
84
|
-
return layers.reduce(function (alles, name) {
|
|
85
|
-
var all = alles;
|
|
86
|
-
var ok = Object.keys(all);
|
|
87
|
-
|
|
88
|
-
if (ok.includes(name.key)) {
|
|
89
|
-
var cnt = ok.filter(function (e) {
|
|
90
|
-
return e === name.key || e.startsWith("".concat(name.key, "."));
|
|
91
|
-
}).length;
|
|
92
|
-
var nName = "".concat(name.key, ".").concat(cnt);
|
|
93
|
-
name.key = nName;
|
|
94
|
-
all[nName] = name;
|
|
95
|
-
} else {
|
|
96
|
-
all[name.key] = name;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return all;
|
|
100
|
-
}, {});
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
exports.orgLayerObject = orgLayerObject;
|
|
104
|
-
|
|
105
|
-
var reformCondFields = function reformCondFields(_layer, _oKey) {
|
|
106
|
-
var layer = _layer;
|
|
107
|
-
layer.fields.map(function (_f) {
|
|
108
|
-
var f = _f;
|
|
109
|
-
var conds = f.cond_fields; // no cond_fields
|
|
110
|
-
|
|
111
|
-
if (!conds || conds.length < 1 || conds.filter(function (o) {
|
|
112
|
-
return !o.field || o.field === '';
|
|
113
|
-
}).length === conds.length) return f;
|
|
114
|
-
conds = conds.filter(function (o) {
|
|
115
|
-
return o.layer === _oKey;
|
|
116
|
-
}); // no same layer, remove cond_fields
|
|
117
|
-
|
|
118
|
-
if (conds.length < 1) {
|
|
119
|
-
delete f.cond_fields;
|
|
120
|
-
return f;
|
|
121
|
-
} // rename layer
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
conds = conds.map(function (o) {
|
|
125
|
-
var n = o;
|
|
126
|
-
n.layer = layer.key;
|
|
127
|
-
return n;
|
|
128
|
-
});
|
|
129
|
-
f.cond_fields = conds;
|
|
130
|
-
return f;
|
|
131
|
-
});
|
|
132
|
-
return layer.fields;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
exports.reformCondFields = reformCondFields;
|
|
136
|
-
|
|
137
|
-
var addToObject = function addToObject(obj, key, addAfter) {
|
|
138
|
-
var temp = {};
|
|
139
|
-
var ok = Object.keys(obj);
|
|
140
|
-
Object.keys(obj).forEach(function (e) {
|
|
141
|
-
if (Object.prototype.hasOwnProperty.call(obj, e)) {
|
|
142
|
-
temp[e] = obj[e];
|
|
143
|
-
|
|
144
|
-
if (e === key) {
|
|
145
|
-
var srcPosition = temp[e].position;
|
|
146
|
-
var cnt = ok.filter(function (o) {
|
|
147
|
-
return o === addAfter.key || o.startsWith("".concat(addAfter.key, "."));
|
|
148
|
-
}).length;
|
|
149
|
-
|
|
150
|
-
if (cnt === 0) {
|
|
151
|
-
temp[addAfter.key] = addAfter;
|
|
152
|
-
temp[addAfter.key].position = srcPosition;
|
|
153
|
-
} else {
|
|
154
|
-
var oKey = addAfter.key;
|
|
155
|
-
temp["".concat(addAfter.key, ".").concat(cnt)] = addAfter;
|
|
156
|
-
temp["".concat(addAfter.key, ".").concat(cnt)].position = srcPosition;
|
|
157
|
-
temp["".concat(addAfter.key, ".").concat(cnt)].key = "".concat(addAfter.key, ".").concat(cnt);
|
|
158
|
-
temp[addAfter.key].fields = reformCondFields(addAfter, oKey);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
if (Object.keys(obj).length === 0) temp[addAfter.key] = addAfter;
|
|
164
|
-
return temp;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
exports.addToObject = addToObject;
|
|
168
|
-
|
|
169
|
-
var traverseToRemove = function traverseToRemove(layers, rmKey) {
|
|
170
|
-
var rms = [];
|
|
171
|
-
Object.keys(layers).forEach(function (e) {
|
|
172
|
-
if (Object.prototype.hasOwnProperty.call(layers, e)) {
|
|
173
|
-
if (layers[e].key === rmKey) rms = rms.concat(rmKey);else if (layers[e].wf_info && layers[e].wf_info.source_layer === rmKey) {
|
|
174
|
-
rms = rms.concat(traverseToRemove(layers, layers[e].key));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
return rms;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
var removeFromObject = function removeFromObject() {
|
|
182
|
-
var _propertiesLayers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
183
|
-
|
|
184
|
-
var srcLayer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
185
|
-
var rmNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
186
|
-
var layers = _propertiesLayers;
|
|
187
|
-
var rmLayer = rmNode.data && rmNode.data.layer ? rmNode.data.layer.key : null;
|
|
188
|
-
if (!rmLayer) return [];
|
|
189
|
-
var rms = [];
|
|
190
|
-
Object.keys(layers).forEach(function (e) {
|
|
191
|
-
if (Object.prototype.hasOwnProperty.call(layers, e)) {
|
|
192
|
-
var wf = layers[e].wf_info;
|
|
193
|
-
|
|
194
|
-
if (wf && wf.source_layer === srcLayer && wf.node_id === rmNode.id) {
|
|
195
|
-
rms = rms.concat(traverseToRemove(layers, layers[e].key));
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
rms.forEach(function (e) {
|
|
200
|
-
return delete layers[e];
|
|
201
|
-
});
|
|
202
|
-
return layers;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
exports.removeFromObject = removeFromObject;
|
|
206
|
-
|
|
207
|
-
var buildInitWF = function buildInitWF(template) {
|
|
208
|
-
var orig = (0, _lodash.cloneDeep)(template);
|
|
209
|
-
var layers = orig.layers,
|
|
210
|
-
flow = orig.flow;
|
|
211
|
-
var sortedLayers = (0, _lodash.sortBy)(layers, function (l) {
|
|
212
|
-
return l.position;
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
if (flow && flow.elements.filter(function (e) {
|
|
216
|
-
return !['input', 'output'].includes(e.type).length > 0;
|
|
217
|
-
})) {
|
|
218
|
-
// id = 1 Start, id = 2 End
|
|
219
|
-
var nls = flow.elements; // nodes + lines
|
|
220
|
-
|
|
221
|
-
var ls = nls.filter(function (e) {
|
|
222
|
-
return e.animated;
|
|
223
|
-
}); // lines
|
|
224
|
-
|
|
225
|
-
var ns = nls.filter(function (e) {
|
|
226
|
-
return e.type === 'default' && e.data;
|
|
227
|
-
}); // nodes - Start - End
|
|
228
|
-
|
|
229
|
-
var nNs = ls.filter(function (e) {
|
|
230
|
-
return e.source === '1';
|
|
231
|
-
}).map(function (e) {
|
|
232
|
-
return e.target;
|
|
233
|
-
}); // get target ids from Start
|
|
234
|
-
|
|
235
|
-
var nextNodes = ns.filter(function (n) {
|
|
236
|
-
return nNs.includes(n.id);
|
|
237
|
-
}); // target nodes
|
|
238
|
-
|
|
239
|
-
var result = [];
|
|
240
|
-
sortedLayers.forEach(function (sortedLayer) {
|
|
241
|
-
var fLayer = sortedLayer;
|
|
242
|
-
|
|
243
|
-
if (fLayer.wf) {
|
|
244
|
-
var position = (fLayer.fields || []).length + 1;
|
|
245
|
-
var passen = nextNodes.filter(function (n) {
|
|
246
|
-
return n.data.layer.key === fLayer.key;
|
|
247
|
-
});
|
|
248
|
-
passen.forEach(function (pas) {
|
|
249
|
-
var nextOptions = ls.filter(function (e) {
|
|
250
|
-
return e.source === pas.id && e.source !== e.target;
|
|
251
|
-
}).map(function (e) {
|
|
252
|
-
return e.target;
|
|
253
|
-
});
|
|
254
|
-
var wfOpts = ns.filter(function (n) {
|
|
255
|
-
return nextOptions.includes(n.id);
|
|
256
|
-
}).map(function (e) {
|
|
257
|
-
return {
|
|
258
|
-
key: e.id,
|
|
259
|
-
label: "".concat(e.data.layer.label, "(").concat(e.data.layer.key, ")")
|
|
260
|
-
};
|
|
261
|
-
}); // next nodes
|
|
262
|
-
|
|
263
|
-
fLayer.fields.push({
|
|
264
|
-
type: 'wf-next',
|
|
265
|
-
default: '',
|
|
266
|
-
field: '_wf_next',
|
|
267
|
-
label: 'Next',
|
|
268
|
-
required: false,
|
|
269
|
-
sub_fields: [],
|
|
270
|
-
text_sub_fields: [],
|
|
271
|
-
position: position,
|
|
272
|
-
wf_options: wfOpts
|
|
273
|
-
});
|
|
274
|
-
fLayer.wf_info = {
|
|
275
|
-
node_id: pas.id
|
|
276
|
-
};
|
|
277
|
-
fLayer.wf_position = 1;
|
|
278
|
-
fLayer.wf_uuid = (0, _uuid.v4)();
|
|
279
|
-
result.push(fLayer);
|
|
280
|
-
});
|
|
281
|
-
} else {
|
|
282
|
-
result.push(fLayer);
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
var ll = orgLayerObject(result);
|
|
286
|
-
orig.layers = ll;
|
|
287
|
-
} else {
|
|
288
|
-
orig.layers = layers;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return orig;
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
exports.buildInitWF = buildInitWF;
|