ronds-metadata 1.2.24 → 1.2.26
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/es/comps/DynamicPorts/graph.js +16 -4
- package/es/comps/DynamicPorts/index.js +21 -2
- package/es/comps/DynamicPorts/interface.d.ts +1 -0
- package/es/comps/DynamicPorts/interface.js +1 -1
- package/es/comps/FormGenerator/index.js +16 -1
- package/es/comps/FormGenerator/transformer.d.ts +1 -1
- package/es/comps/FormGenerator/transformer.js +17 -5
- package/es/comps/MdView/index.less +353 -353
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +34 -4
- package/es/framework/fg/index.d.ts +120 -0
- package/es/framework/fg/index.js +301 -0
- package/es/framework/fg/utils.d.ts +14 -0
- package/es/framework/fg/utils.js +44 -0
- package/es/theme.less +1 -1
- package/es/utils.d.ts +7 -0
- package/es/utils.js +43 -1
- package/package.json +3 -2
|
@@ -107,13 +107,25 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
107
107
|
|
|
108
108
|
if (!targetMagnet || targetMagnet.getAttribute('port-group') !== 'in') {
|
|
109
109
|
return false;
|
|
110
|
+
} // 找到当前输出port
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
var sourcePortId = sourceMagnet.getAttribute('port');
|
|
114
|
+
var sourceNode = sourceView.cell;
|
|
115
|
+
var sourcePort = sourceNode.getPort(sourcePortId);
|
|
116
|
+
// 找到输入port
|
|
117
|
+
var targetPortId = targetMagnet.getAttribute('port');
|
|
118
|
+
var targetNode = targetView.cell;
|
|
119
|
+
var targetPort = targetNode.getPort(targetPortId);
|
|
120
|
+
|
|
121
|
+
// 如果设置输出port类型,则需要校验类型是否相等
|
|
122
|
+
// 只有类型相等才可以联线
|
|
123
|
+
if ((sourcePort === null || sourcePort === void 0 ? void 0 : sourcePort.type) && (targetPort === null || targetPort === void 0 ? void 0 : targetPort.type) && sourcePort.type !== targetPort.type) {
|
|
124
|
+
return false;
|
|
110
125
|
} // 判断目标链接桩是否可连接
|
|
111
126
|
|
|
112
127
|
|
|
113
|
-
|
|
114
|
-
var node = targetView.cell;
|
|
115
|
-
var port = node.getPort(portId);
|
|
116
|
-
return !(port && port.connected);
|
|
128
|
+
return !(targetPort && targetPort.connected);
|
|
117
129
|
}
|
|
118
130
|
},
|
|
119
131
|
scroller: {
|
|
@@ -4,11 +4,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
/*
|
|
5
5
|
* @Author: wangxian
|
|
6
6
|
* @Date: 2022-05-16 18:53:31
|
|
7
|
-
* @LastEditTime:
|
|
7
|
+
* @LastEditTime: 2023-03-16 08:46:09
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { filter } from 'rxjs';
|
|
11
11
|
import { useDrop } from 'react-dnd';
|
|
12
|
+
import ResizeSensor from 'css-element-queries/src/ResizeSensor';
|
|
12
13
|
import './index.less';
|
|
13
14
|
import './comps/shape/connector';
|
|
14
15
|
import { useDPGraph, useUnmountDPGraph } from './graph';
|
|
@@ -33,7 +34,25 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
|
33
34
|
var dpGraphRef = React.useRef();
|
|
34
35
|
var firstLoadRef = React.useRef(true); // 处理画布卸载
|
|
35
36
|
|
|
36
|
-
useUnmountDPGraph();
|
|
37
|
+
useUnmountDPGraph();
|
|
38
|
+
var resizeSensorRef = React.useRef(null);
|
|
39
|
+
|
|
40
|
+
var onResizeStrategy = function onResizeStrategy() {
|
|
41
|
+
var _dpGraphRef$current, _dpGraphRef$current2;
|
|
42
|
+
|
|
43
|
+
(_dpGraphRef$current = dpGraphRef.current) === null || _dpGraphRef$current === void 0 ? void 0 : _dpGraphRef$current.resizeGraph();
|
|
44
|
+
(_dpGraphRef$current2 = dpGraphRef.current) === null || _dpGraphRef$current2 === void 0 ? void 0 : _dpGraphRef$current2.zoomGraphRealSize();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
React.useEffect(function () {
|
|
48
|
+
if (dpGraphRef.current) {
|
|
49
|
+
try {
|
|
50
|
+
resizeSensorRef.current = new ResizeSensor(divRef.current, onResizeStrategy);
|
|
51
|
+
} catch (ex) {
|
|
52
|
+
console.error(ex);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, []); // 渲染画布
|
|
37
56
|
|
|
38
57
|
React.useEffect(function () {
|
|
39
58
|
if (firstLoadRef.current) {
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
/*
|
|
5
5
|
* @Author: wangxian
|
|
6
6
|
* @Date: 2023-02-04 13:45:31
|
|
7
|
-
* @LastEditTime: 2023-
|
|
7
|
+
* @LastEditTime: 2023-03-23 13:53:13
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { DndProvider } from 'react-dnd';
|
|
@@ -18,6 +18,7 @@ import useMemoSubject from '../../framework/rxjs-hooks/useMemoSubject';
|
|
|
18
18
|
import useObservable from '../../framework/rxjs-hooks/useObservable';
|
|
19
19
|
import { streamEventType } from './settings';
|
|
20
20
|
import { transSchema2FG } from './transformer';
|
|
21
|
+
import { FormRobot } from '../../framework/fg/index';
|
|
21
22
|
|
|
22
23
|
var FormGenerator = function FormGenerator(props) {
|
|
23
24
|
var defaultSchema = props.defaultSchema;
|
|
@@ -29,6 +30,20 @@ var FormGenerator = function FormGenerator(props) {
|
|
|
29
30
|
setTypes = _React$useState2[1];
|
|
30
31
|
|
|
31
32
|
var typesRef = React.useRef({});
|
|
33
|
+
React.useEffect(function () {
|
|
34
|
+
var robot = new FormRobot();
|
|
35
|
+
|
|
36
|
+
var name = robot.input('name').label('名称').require().placeholder('请输入名称').valueOf();
|
|
37
|
+
|
|
38
|
+
var age = robot.input('age').label('年龄').defaultValue(1).valueOf();
|
|
39
|
+
var address = robot.textarea('address').label('地址').help('详细地址').valueOf();
|
|
40
|
+
var sex = robot.select('sex').label('性别').valueOf();
|
|
41
|
+
|
|
42
|
+
var birthday = robot.date('birthday').label('出身年月').require().valueOf();
|
|
43
|
+
|
|
44
|
+
var detail = robot.object([name, age], 'detail').valueOf();
|
|
45
|
+
var arr = robot.create([name, age, address, sex, birthday, detail]);
|
|
46
|
+
}, []);
|
|
32
47
|
React.useEffect(function () {
|
|
33
48
|
if (defaultSchema) {
|
|
34
49
|
var defaultValue = transSchema2FG(defaultSchema);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FG } from '../../comps/FormGenerator/index.d';
|
|
2
|
-
export declare const transFG2Schema: (nodes: FG.Node[], settings
|
|
2
|
+
export declare const transFG2Schema: (nodes: FG.Node[], settings?: any, _types?: any, schemaId?: string) => any;
|
|
3
3
|
export declare const transSchema2FG: (schema: any) => {
|
|
4
4
|
nodes: any[];
|
|
5
5
|
settings: {};
|
|
@@ -4,7 +4,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
4
4
|
/*
|
|
5
5
|
* @Author: wangxian
|
|
6
6
|
* @Date: 2023-02-08 14:45:46
|
|
7
|
-
* @LastEditTime: 2023-03-
|
|
7
|
+
* @LastEditTime: 2023-03-22 11:28:46
|
|
8
8
|
*/
|
|
9
9
|
import { deepClone } from '../../utils';
|
|
10
10
|
import { basicComps, complexComps, layoutComps } from './settings';
|
|
@@ -70,11 +70,22 @@ export var transFG2Schema = function transFG2Schema(nodes, settings, _types, sch
|
|
|
70
70
|
schema[0].id = schemaId;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
var __types__ = _types || {};
|
|
74
|
+
|
|
73
75
|
var props = [];
|
|
74
76
|
var types = [];
|
|
75
77
|
|
|
76
78
|
for (var i = 0; i < nodes.length; i++) {
|
|
77
|
-
var
|
|
79
|
+
var _nodes$i, _nodes$i$param;
|
|
80
|
+
|
|
81
|
+
if ((_nodes$i = nodes[i]) === null || _nodes$i === void 0 ? void 0 : (_nodes$i$param = _nodes$i.param) === null || _nodes$i$param === void 0 ? void 0 : _nodes$i$param.types) {
|
|
82
|
+
__types__[nodes[i].id] = {
|
|
83
|
+
id: nodes[i].id,
|
|
84
|
+
nodes: nodes[i].param.types
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var _prop = renderProp(nodes[i], settings ? settings[nodes[i].id] : nodes[i].param.setting);
|
|
78
89
|
|
|
79
90
|
props.push(_prop);
|
|
80
91
|
}
|
|
@@ -87,11 +98,12 @@ export var transFG2Schema = function transFG2Schema(nodes, settings, _types, sch
|
|
|
87
98
|
delete schema[0].fields;
|
|
88
99
|
}
|
|
89
100
|
|
|
90
|
-
if (
|
|
91
|
-
var typeKeys = Object.keys(
|
|
101
|
+
if (__types__) {
|
|
102
|
+
var typeKeys = Object.keys(__types__);
|
|
92
103
|
|
|
93
104
|
for (var _i = 0; _i < typeKeys.length; _i++) {
|
|
94
|
-
var _type = transFG2Schema(
|
|
105
|
+
var _type = transFG2Schema(__types__[typeKeys[_i]].nodes, // 没有传入内部类的情况 不需要传
|
|
106
|
+
_types && settings["".concat(typeKeys[_i], "_ref")], undefined, "".concat(__types__[typeKeys[_i]].id, "_ref"));
|
|
95
107
|
|
|
96
108
|
types.push(_type[0]);
|
|
97
109
|
}
|