chem-generic-ui 0.1.47 → 0.1.50
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/README.md +0 -0
- package/dist/app.js +105 -0
- package/{src → dist}/asserts/main.css +0 -0
- package/{src → dist}/asserts/main.scss +0 -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.css +7 -0
- package/dist/components/flow/FlowViewerModal.js +83 -0
- package/dist/components/flow/FlowViewerModal.scss +7 -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 +39 -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 +34 -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
|
@@ -0,0 +1,294 @@
|
|
|
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;
|