ronds-metadata 1.1.4 → 1.1.7
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/comps/NodeElement.d.ts +6 -0
- package/es/comps/DynamicPorts/comps/NodeElement.js +26 -0
- package/es/comps/DynamicPorts/comps/shape/connector.d.ts +1 -0
- package/es/comps/DynamicPorts/comps/shape/connector.js +19 -0
- package/es/comps/DynamicPorts/comps/shape/edge.css +4 -0
- package/es/comps/DynamicPorts/comps/shape/edge.d.ts +10 -0
- package/es/comps/DynamicPorts/comps/shape/edge.js +91 -0
- package/es/comps/DynamicPorts/comps/shape/node.d.ts +11 -0
- package/es/comps/DynamicPorts/comps/shape/node.js +190 -0
- package/es/comps/DynamicPorts/constant/index.d.ts +7 -0
- package/es/comps/DynamicPorts/constant/index.js +19 -0
- package/es/comps/DynamicPorts/index.css +159 -0
- package/es/comps/DynamicPorts/index.d.ts +4 -0
- package/es/comps/DynamicPorts/index.js +187 -0
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +5 -3
- package/es/comps/MetadataForm/DataCell/Ref.js +59 -22
- package/es/comps/MetadataForm/DataCell/Select.js +9 -24
- package/es/framework/graph/index.d.ts +1 -0
- package/es/framework/graph/index.js +0 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/package.json +3 -1
- package/es/comps/RzGraph/index.d.ts +0 -2
- package/es/comps/RzGraph/index.js +0 -7
@@ -0,0 +1,26 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* @Author: wangxian
|
5
|
+
* @Date: 2022-05-24 08:50:16
|
6
|
+
* @LastEditTime: 2022-05-24 11:58:52
|
7
|
+
*/
|
8
|
+
import { GlobalOutlined } from '@ant-design/icons';
|
9
|
+
import "../index.css";
|
10
|
+
|
11
|
+
var NodeElement = function NodeElement(props) {
|
12
|
+
var node = props.node;
|
13
|
+
var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
|
14
|
+
var name = data.name;
|
15
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
16
|
+
className: "node-element"
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
18
|
+
className: 'icon'
|
19
|
+
}, /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
|
20
|
+
className: "notation"
|
21
|
+
}, /*#__PURE__*/React.createElement("div", {
|
22
|
+
className: "name"
|
23
|
+
}, name))));
|
24
|
+
};
|
25
|
+
|
26
|
+
export default NodeElement;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2022-05-24 10:53:37
|
4
|
+
* @LastEditTime: 2022-05-24 10:53:41
|
5
|
+
*/
|
6
|
+
import { Graph } from '@antv/x6';
|
7
|
+
Graph.registerConnector('pai', function (s, t) {
|
8
|
+
var offset = 4;
|
9
|
+
var control = 80;
|
10
|
+
var v1 = {
|
11
|
+
x: s.x,
|
12
|
+
y: s.y + offset + control
|
13
|
+
};
|
14
|
+
var v2 = {
|
15
|
+
x: t.x,
|
16
|
+
y: t.y - offset - control
|
17
|
+
};
|
18
|
+
return "M ".concat(s.x, " ").concat(s.y, "\n L ").concat(s.x, " ").concat(s.y + offset, "\n C ").concat(v1.x, " ").concat(v1.y, " ").concat(v2.x, " ").concat(v2.y, " ").concat(t.x, " ").concat(t.y - offset, "\n L ").concat(t.x, " ").concat(t.y, "\n ");
|
19
|
+
}, true);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Shape } from '@antv/x6';
|
2
|
+
import './edge.less';
|
3
|
+
export declare class BaseEdge extends Shape.Edge {
|
4
|
+
isGroupEdge(): boolean;
|
5
|
+
}
|
6
|
+
export declare class DPEdge extends BaseEdge {
|
7
|
+
}
|
8
|
+
export declare class DPGroupEdge extends DPEdge {
|
9
|
+
isGroupEdge(): boolean;
|
10
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
5
|
+
|
6
|
+
/*
|
7
|
+
* @Author: wangxian
|
8
|
+
* @Date: 2022-05-24 09:18:34
|
9
|
+
* @LastEditTime: 2022-05-24 10:43:18
|
10
|
+
*/
|
11
|
+
import { Shape, Edge } from '@antv/x6';
|
12
|
+
import "./edge.css";
|
13
|
+
export var BaseEdge = /*#__PURE__*/function (_Shape$Edge) {
|
14
|
+
_inherits(BaseEdge, _Shape$Edge);
|
15
|
+
|
16
|
+
var _super = _createSuper(BaseEdge);
|
17
|
+
|
18
|
+
function BaseEdge() {
|
19
|
+
_classCallCheck(this, BaseEdge);
|
20
|
+
|
21
|
+
return _super.apply(this, arguments);
|
22
|
+
}
|
23
|
+
|
24
|
+
_createClass(BaseEdge, [{
|
25
|
+
key: "isGroupEdge",
|
26
|
+
value: // eslint-disable-next-line class-methods-use-this
|
27
|
+
function isGroupEdge() {
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
}]);
|
31
|
+
|
32
|
+
return BaseEdge;
|
33
|
+
}(Shape.Edge);
|
34
|
+
export var DPEdge = /*#__PURE__*/function (_BaseEdge) {
|
35
|
+
_inherits(DPEdge, _BaseEdge);
|
36
|
+
|
37
|
+
var _super2 = _createSuper(DPEdge);
|
38
|
+
|
39
|
+
function DPEdge() {
|
40
|
+
_classCallCheck(this, DPEdge);
|
41
|
+
|
42
|
+
return _super2.apply(this, arguments);
|
43
|
+
}
|
44
|
+
|
45
|
+
return DPEdge;
|
46
|
+
}(BaseEdge);
|
47
|
+
DPEdge.config({
|
48
|
+
shape: 'DPEdge',
|
49
|
+
connector: {
|
50
|
+
name: 'pai'
|
51
|
+
},
|
52
|
+
zIndex: 2,
|
53
|
+
attrs: {
|
54
|
+
line: {
|
55
|
+
stroke: '#808080',
|
56
|
+
strokeWidth: 1,
|
57
|
+
targetMarker: {
|
58
|
+
stroke: 'none',
|
59
|
+
fill: 'none'
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
});
|
64
|
+
export var DPGroupEdge = /*#__PURE__*/function (_DPEdge) {
|
65
|
+
_inherits(DPGroupEdge, _DPEdge);
|
66
|
+
|
67
|
+
var _super3 = _createSuper(DPGroupEdge);
|
68
|
+
|
69
|
+
function DPGroupEdge() {
|
70
|
+
_classCallCheck(this, DPGroupEdge);
|
71
|
+
|
72
|
+
return _super3.apply(this, arguments);
|
73
|
+
}
|
74
|
+
|
75
|
+
_createClass(DPGroupEdge, [{
|
76
|
+
key: "isGroupEdge",
|
77
|
+
value: // eslint-disable-next-line class-methods-use-this
|
78
|
+
function isGroupEdge() {
|
79
|
+
return true;
|
80
|
+
}
|
81
|
+
}]);
|
82
|
+
|
83
|
+
return DPGroupEdge;
|
84
|
+
}(DPEdge);
|
85
|
+
DPGroupEdge.config({
|
86
|
+
shape: 'DPGroupEdge'
|
87
|
+
});
|
88
|
+
Edge.registry.register({
|
89
|
+
DPEdge: DPEdge,
|
90
|
+
DPGroupEdge: DPGroupEdge
|
91
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ReactShape } from '@antv/x6-react-shape';
|
2
|
+
export declare class BaseNode extends ReactShape {
|
3
|
+
isGroup(): boolean;
|
4
|
+
}
|
5
|
+
export declare class DPNode extends BaseNode {
|
6
|
+
getInPorts(): import("@antv/x6/lib/model/port").PortManager.PortMetadata[];
|
7
|
+
getOutPorts(): import("@antv/x6/lib/model/port").PortManager.PortMetadata[];
|
8
|
+
}
|
9
|
+
export declare class DPGroupNode extends BaseNode {
|
10
|
+
isGroup(): boolean;
|
11
|
+
}
|
@@ -0,0 +1,190 @@
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
5
|
+
import { Dom, Node } from '@antv/x6';
|
6
|
+
import { ReactShape } from '@antv/x6-react-shape';
|
7
|
+
import { NODE_WIDTH, NODE_HEIGHT } from '../../constant';
|
8
|
+
export var BaseNode = /*#__PURE__*/function (_ReactShape) {
|
9
|
+
_inherits(BaseNode, _ReactShape);
|
10
|
+
|
11
|
+
var _super = _createSuper(BaseNode);
|
12
|
+
|
13
|
+
function BaseNode() {
|
14
|
+
_classCallCheck(this, BaseNode);
|
15
|
+
|
16
|
+
return _super.apply(this, arguments);
|
17
|
+
}
|
18
|
+
|
19
|
+
_createClass(BaseNode, [{
|
20
|
+
key: "isGroup",
|
21
|
+
value: // eslint-disable-next-line class-methods-use-this
|
22
|
+
function isGroup() {
|
23
|
+
return false;
|
24
|
+
}
|
25
|
+
}]);
|
26
|
+
|
27
|
+
return BaseNode;
|
28
|
+
}(ReactShape);
|
29
|
+
export var DPNode = /*#__PURE__*/function (_BaseNode) {
|
30
|
+
_inherits(DPNode, _BaseNode);
|
31
|
+
|
32
|
+
var _super2 = _createSuper(DPNode);
|
33
|
+
|
34
|
+
function DPNode() {
|
35
|
+
_classCallCheck(this, DPNode);
|
36
|
+
|
37
|
+
return _super2.apply(this, arguments);
|
38
|
+
}
|
39
|
+
|
40
|
+
_createClass(DPNode, [{
|
41
|
+
key: "getInPorts",
|
42
|
+
value: function getInPorts() {
|
43
|
+
return this.getPortsByGroup('in');
|
44
|
+
}
|
45
|
+
}, {
|
46
|
+
key: "getOutPorts",
|
47
|
+
value: function getOutPorts() {
|
48
|
+
return this.getPortsByGroup('out');
|
49
|
+
}
|
50
|
+
}]);
|
51
|
+
|
52
|
+
return DPNode;
|
53
|
+
}(BaseNode);
|
54
|
+
Node.registry.register('rz-rect-port', DPNode);
|
55
|
+
DPNode.config({
|
56
|
+
width: NODE_WIDTH,
|
57
|
+
height: NODE_HEIGHT,
|
58
|
+
shape: 'rz-rect-port',
|
59
|
+
ports: {
|
60
|
+
groups: {
|
61
|
+
in: {
|
62
|
+
position: {
|
63
|
+
name: 'top'
|
64
|
+
},
|
65
|
+
zIndex: 2
|
66
|
+
},
|
67
|
+
out: {
|
68
|
+
position: {
|
69
|
+
name: 'bottom'
|
70
|
+
},
|
71
|
+
zIndex: 2
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
attrs: {
|
76
|
+
body: {
|
77
|
+
magnet: false,
|
78
|
+
fill: 'none',
|
79
|
+
stroke: 'none',
|
80
|
+
refWidth: '100%',
|
81
|
+
refHeight: '100%',
|
82
|
+
zIndex: 1
|
83
|
+
}
|
84
|
+
},
|
85
|
+
portMarkup: [{
|
86
|
+
tagName: 'foreignObject',
|
87
|
+
selector: 'fo',
|
88
|
+
attrs: {
|
89
|
+
width: 6,
|
90
|
+
height: 6,
|
91
|
+
x: -3,
|
92
|
+
y: -3,
|
93
|
+
zIndex: 10,
|
94
|
+
// magnet决定是否可交互
|
95
|
+
magnet: 'true'
|
96
|
+
},
|
97
|
+
children: [{
|
98
|
+
ns: Dom.ns.xhtml,
|
99
|
+
tagName: 'body',
|
100
|
+
selector: 'foBody',
|
101
|
+
attrs: {
|
102
|
+
xmlns: Dom.ns.xhtml
|
103
|
+
},
|
104
|
+
style: {
|
105
|
+
width: '100%',
|
106
|
+
height: '100%'
|
107
|
+
},
|
108
|
+
children: [{
|
109
|
+
tagName: 'div',
|
110
|
+
selector: 'content',
|
111
|
+
style: {
|
112
|
+
width: '100%',
|
113
|
+
height: '100%'
|
114
|
+
}
|
115
|
+
}]
|
116
|
+
}]
|
117
|
+
}]
|
118
|
+
});
|
119
|
+
export var DPGroupNode = /*#__PURE__*/function (_BaseNode2) {
|
120
|
+
_inherits(DPGroupNode, _BaseNode2);
|
121
|
+
|
122
|
+
var _super3 = _createSuper(DPGroupNode);
|
123
|
+
|
124
|
+
function DPGroupNode() {
|
125
|
+
_classCallCheck(this, DPGroupNode);
|
126
|
+
|
127
|
+
return _super3.apply(this, arguments);
|
128
|
+
}
|
129
|
+
|
130
|
+
_createClass(DPGroupNode, [{
|
131
|
+
key: "isGroup",
|
132
|
+
value: // eslint-disable-next-line class-methods-use-this
|
133
|
+
function isGroup() {
|
134
|
+
return true;
|
135
|
+
}
|
136
|
+
}]);
|
137
|
+
|
138
|
+
return DPGroupNode;
|
139
|
+
}(BaseNode);
|
140
|
+
DPGroupNode.config({
|
141
|
+
ports: {
|
142
|
+
groups: {
|
143
|
+
in: {
|
144
|
+
position: {
|
145
|
+
name: 'top'
|
146
|
+
},
|
147
|
+
zIndex: 2
|
148
|
+
},
|
149
|
+
out: {
|
150
|
+
position: {
|
151
|
+
name: 'bottom'
|
152
|
+
},
|
153
|
+
zIndex: 2
|
154
|
+
}
|
155
|
+
}
|
156
|
+
},
|
157
|
+
portMarkup: [{
|
158
|
+
tagName: 'foreignObject',
|
159
|
+
selector: 'fo',
|
160
|
+
attrs: {
|
161
|
+
width: 6,
|
162
|
+
height: 6,
|
163
|
+
x: -3,
|
164
|
+
y: -3,
|
165
|
+
zIndex: 10,
|
166
|
+
// magnet决定是否可交互
|
167
|
+
magnet: 'true'
|
168
|
+
},
|
169
|
+
children: [{
|
170
|
+
ns: Dom.ns.xhtml,
|
171
|
+
tagName: 'body',
|
172
|
+
selector: 'foBody',
|
173
|
+
attrs: {
|
174
|
+
xmlns: Dom.ns.xhtml
|
175
|
+
},
|
176
|
+
style: {
|
177
|
+
width: '100%',
|
178
|
+
height: '100%'
|
179
|
+
},
|
180
|
+
children: [{
|
181
|
+
tagName: 'span',
|
182
|
+
selector: 'content',
|
183
|
+
style: {
|
184
|
+
width: '100%',
|
185
|
+
height: '100%'
|
186
|
+
}
|
187
|
+
}]
|
188
|
+
}]
|
189
|
+
}]
|
190
|
+
});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export declare const GROUP_HORIZONTAL__PADDING = 24;
|
2
|
+
export declare const GROUP_VERTICAL__PADDING = 40;
|
3
|
+
export declare const NODE_WIDTH = 180;
|
4
|
+
export declare const NODE_HEIGHT = 32;
|
5
|
+
export declare const RERENDER_EVENT = "RERENDER_EVENT";
|
6
|
+
export declare const DRAGGABLE_ALGO_COMPONENT = "ALGO_COMPONENT";
|
7
|
+
export declare const DRAGGABLE_MODEL = "MODEL";
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2022-05-24 08:48:57
|
4
|
+
* @LastEditTime: 2022-05-24 08:49:24
|
5
|
+
*/
|
6
|
+
export var GROUP_HORIZONTAL__PADDING = 24; // 分组横向 padding
|
7
|
+
|
8
|
+
export var GROUP_VERTICAL__PADDING = 40; // 分组纵向 padding
|
9
|
+
|
10
|
+
export var NODE_WIDTH = 180;
|
11
|
+
export var NODE_HEIGHT = 32; // 触发画布重新渲染事件
|
12
|
+
|
13
|
+
export var RERENDER_EVENT = 'RERENDER_EVENT';
|
14
|
+
/*
|
15
|
+
* 以下是拖拽相关
|
16
|
+
*/
|
17
|
+
|
18
|
+
export var DRAGGABLE_ALGO_COMPONENT = 'ALGO_COMPONENT';
|
19
|
+
export var DRAGGABLE_MODEL = 'MODEL';
|
@@ -0,0 +1,159 @@
|
|
1
|
+
.node-element {
|
2
|
+
display: flex;
|
3
|
+
align-items: center;
|
4
|
+
box-sizing: border-box;
|
5
|
+
width: 180px;
|
6
|
+
height: 32px;
|
7
|
+
overflow: hidden;
|
8
|
+
background-color: #fff;
|
9
|
+
border-radius: 4px;
|
10
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.08);
|
11
|
+
}
|
12
|
+
.node-element.selected,
|
13
|
+
.node-element:hover {
|
14
|
+
background-color: rgba(243, 249, 255, 0.92);
|
15
|
+
border: 1px solid #1890ff;
|
16
|
+
box-shadow: 0 0 3px 3px rgba(64, 169, 255, 0.2);
|
17
|
+
}
|
18
|
+
.node-element.selected .icon,
|
19
|
+
.node-element:hover .icon {
|
20
|
+
width: 32px;
|
21
|
+
height: 30px;
|
22
|
+
margin: 0 1px 0 -1px;
|
23
|
+
}
|
24
|
+
.node-element > * {
|
25
|
+
flex-grow: 1;
|
26
|
+
}
|
27
|
+
.node-element .icon {
|
28
|
+
display: inline-flex;
|
29
|
+
flex-grow: 0;
|
30
|
+
align-items: center;
|
31
|
+
justify-content: center;
|
32
|
+
width: 32px;
|
33
|
+
height: 32px;
|
34
|
+
background-color: rgba(229, 238, 255, 0.85);
|
35
|
+
border-radius: 4px 0 0 4px;
|
36
|
+
}
|
37
|
+
.node-element .notation {
|
38
|
+
display: inline-flex;
|
39
|
+
align-items: center;
|
40
|
+
width: calc(100% - 32px);
|
41
|
+
padding: 0 8px;
|
42
|
+
user-select: none;
|
43
|
+
}
|
44
|
+
.node-element .notation > * {
|
45
|
+
flex-grow: 1;
|
46
|
+
}
|
47
|
+
.node-element .notation .name {
|
48
|
+
overflow-x: hidden;
|
49
|
+
color: rgba(0, 0, 0, 0.65);
|
50
|
+
font-size: 12px;
|
51
|
+
white-space: nowrap;
|
52
|
+
text-overflow: ellipsis;
|
53
|
+
vertical-align: middle;
|
54
|
+
}
|
55
|
+
.node-element .notation .statusIcon {
|
56
|
+
display: inline-flex;
|
57
|
+
flex-grow: 0;
|
58
|
+
align-items: center;
|
59
|
+
font-size: 14px;
|
60
|
+
transform: translateZ(0);
|
61
|
+
}
|
62
|
+
.x6-node [magnet='true'] {
|
63
|
+
cursor: crosshair;
|
64
|
+
transition: none;
|
65
|
+
}
|
66
|
+
.x6-node [magnet='true']:hover {
|
67
|
+
opacity: 1;
|
68
|
+
}
|
69
|
+
.x6-node [magnet='true'][port-group='in'] {
|
70
|
+
cursor: move;
|
71
|
+
stroke: none;
|
72
|
+
}
|
73
|
+
.x6-port-body > span {
|
74
|
+
display: block;
|
75
|
+
}
|
76
|
+
.dp-port {
|
77
|
+
width: 100%;
|
78
|
+
height: 100%;
|
79
|
+
border: 1px solid #808080;
|
80
|
+
border-radius: 100%;
|
81
|
+
background: #fff;
|
82
|
+
display: block;
|
83
|
+
}
|
84
|
+
.dp-port.connected {
|
85
|
+
width: 0;
|
86
|
+
height: 0;
|
87
|
+
margin-top: 3px;
|
88
|
+
margin-left: -1px;
|
89
|
+
border-width: 5px 4px 0;
|
90
|
+
border-style: solid;
|
91
|
+
border-color: #808080 transparent transparent;
|
92
|
+
border-radius: 0;
|
93
|
+
background-color: transparent;
|
94
|
+
}
|
95
|
+
.x6-port-body.available {
|
96
|
+
overflow: visible;
|
97
|
+
}
|
98
|
+
.x6-port-body.available body {
|
99
|
+
overflow: visible;
|
100
|
+
}
|
101
|
+
.x6-port-body.available span {
|
102
|
+
overflow: visible;
|
103
|
+
display: block;
|
104
|
+
}
|
105
|
+
.x6-port-body.available body > span::before {
|
106
|
+
content: ' ';
|
107
|
+
float: left;
|
108
|
+
width: 20px;
|
109
|
+
height: 20px;
|
110
|
+
margin-top: -6px;
|
111
|
+
margin-left: -6px;
|
112
|
+
border-radius: 50%;
|
113
|
+
background-color: rgba(57, 202, 116, 0.6);
|
114
|
+
box-sizing: border-box;
|
115
|
+
}
|
116
|
+
.x6-port-body.available body > span::after {
|
117
|
+
content: ' ';
|
118
|
+
float: left;
|
119
|
+
clear: both;
|
120
|
+
width: 10px;
|
121
|
+
height: 10px;
|
122
|
+
margin-top: -15px;
|
123
|
+
margin-left: -1px;
|
124
|
+
border-radius: 50%;
|
125
|
+
background-color: #fff;
|
126
|
+
border: 1px solid #39ca74;
|
127
|
+
z-index: 10;
|
128
|
+
box-sizing: border-box;
|
129
|
+
}
|
130
|
+
.x6-port-body.adsorbed {
|
131
|
+
overflow: visible;
|
132
|
+
}
|
133
|
+
.x6-port-body.adsorbed body {
|
134
|
+
overflow: visible;
|
135
|
+
}
|
136
|
+
.x6-port-body.adsorbed body > span::before {
|
137
|
+
content: ' ';
|
138
|
+
float: left;
|
139
|
+
width: 28px;
|
140
|
+
height: 28px;
|
141
|
+
margin-top: -9px;
|
142
|
+
margin-left: -10px;
|
143
|
+
border-radius: 50%;
|
144
|
+
background-color: rgba(57, 202, 116, 0.6);
|
145
|
+
box-sizing: border-box;
|
146
|
+
}
|
147
|
+
.x6-port-body.adsorbed body > span::after {
|
148
|
+
content: ' ';
|
149
|
+
float: left;
|
150
|
+
clear: both;
|
151
|
+
width: 10px;
|
152
|
+
height: 10px;
|
153
|
+
margin-top: -19px;
|
154
|
+
border-radius: 50%;
|
155
|
+
background-color: #fff;
|
156
|
+
border: 1px solid #39ca74;
|
157
|
+
z-index: 10;
|
158
|
+
box-sizing: border-box;
|
159
|
+
}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
import "antd/es/tooltip/style";
|
2
|
+
import _Tooltip from "antd/es/tooltip";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* @Author: wangxian
|
6
|
+
* @Date: 2022-05-16 18:53:31
|
7
|
+
* @LastEditTime: 2022-05-24 12:09:46
|
8
|
+
*/
|
9
|
+
import { Graph, Markup } from '@antv/x6';
|
10
|
+
import React from 'react';
|
11
|
+
import NodeElement from './comps/NodeElement';
|
12
|
+
import { DPGroupEdge } from './comps/shape/edge';
|
13
|
+
import { DPNode } from './comps/shape/node';
|
14
|
+
import ReactDOM from 'react-dom';
|
15
|
+
import "./index.css";
|
16
|
+
import './comps/shape/connector';
|
17
|
+
|
18
|
+
var DynamicPorts = function DynamicPorts() {
|
19
|
+
var divRef = React.useRef(null);
|
20
|
+
React.useEffect(function () {
|
21
|
+
if (divRef.current !== null) {
|
22
|
+
var graph = new Graph({
|
23
|
+
container: divRef.current,
|
24
|
+
grid: true,
|
25
|
+
onPortRendered: function onPortRendered(args) {
|
26
|
+
var port = args.port;
|
27
|
+
var contentSelectors = args.contentSelectors;
|
28
|
+
var container = contentSelectors && contentSelectors.content;
|
29
|
+
var placement = port.group === 'in' ? 'top' : 'bottom';
|
30
|
+
|
31
|
+
if (container) {
|
32
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(_Tooltip, {
|
33
|
+
title: port.description,
|
34
|
+
placement: placement
|
35
|
+
}, /*#__PURE__*/React.createElement("div", {
|
36
|
+
className: "dp-port".concat(port.connected ? '.connected' : '')
|
37
|
+
})), container);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
});
|
41
|
+
graph.addNode(new DPNode({
|
42
|
+
id: '1',
|
43
|
+
x: 40,
|
44
|
+
y: 35,
|
45
|
+
ports: {
|
46
|
+
items: [{
|
47
|
+
group: 'in',
|
48
|
+
id: 'in11'
|
49
|
+
}, {
|
50
|
+
group: 'in',
|
51
|
+
id: 'in22'
|
52
|
+
}, {
|
53
|
+
group: 'out',
|
54
|
+
id: 'out11'
|
55
|
+
}, {
|
56
|
+
group: 'out',
|
57
|
+
id: 'out22'
|
58
|
+
}]
|
59
|
+
},
|
60
|
+
data: {
|
61
|
+
id: '1',
|
62
|
+
name: '算法'
|
63
|
+
},
|
64
|
+
shape: 'rz-rect-port',
|
65
|
+
component: /*#__PURE__*/React.createElement(NodeElement, null)
|
66
|
+
}));
|
67
|
+
graph.addNode(new DPNode({
|
68
|
+
id: '2',
|
69
|
+
x: 300,
|
70
|
+
y: 35,
|
71
|
+
ports: {
|
72
|
+
items: [{
|
73
|
+
group: 'in',
|
74
|
+
id: 'in1',
|
75
|
+
connected: true
|
76
|
+
}, {
|
77
|
+
group: 'in',
|
78
|
+
id: 'in2'
|
79
|
+
}, {
|
80
|
+
group: 'out',
|
81
|
+
id: 'out1'
|
82
|
+
}, {
|
83
|
+
group: 'out',
|
84
|
+
id: 'out2'
|
85
|
+
}]
|
86
|
+
},
|
87
|
+
data: {
|
88
|
+
id: '2',
|
89
|
+
name: 'Kafka数据源'
|
90
|
+
},
|
91
|
+
shape: 'rz-rect-port',
|
92
|
+
component: /*#__PURE__*/React.createElement(NodeElement, null)
|
93
|
+
}));
|
94
|
+
graph.addEdge(new DPGroupEdge({
|
95
|
+
sourceAnchor: 'bottom',
|
96
|
+
source: {
|
97
|
+
cell: '1',
|
98
|
+
port: 'out11',
|
99
|
+
anchor: {
|
100
|
+
name: 'bottom'
|
101
|
+
}
|
102
|
+
},
|
103
|
+
target: {
|
104
|
+
cell: '2',
|
105
|
+
port: 'in1',
|
106
|
+
anchor: {
|
107
|
+
name: 'center'
|
108
|
+
}
|
109
|
+
},
|
110
|
+
zIndex: 1
|
111
|
+
}));
|
112
|
+
}
|
113
|
+
}, []);
|
114
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
115
|
+
style: {
|
116
|
+
width: '100%',
|
117
|
+
height: '100%'
|
118
|
+
},
|
119
|
+
ref: divRef
|
120
|
+
}));
|
121
|
+
};
|
122
|
+
|
123
|
+
export default DynamicPorts;
|
124
|
+
var testNode = {
|
125
|
+
x: 40,
|
126
|
+
y: 35,
|
127
|
+
width: 160,
|
128
|
+
height: 30,
|
129
|
+
label: 'Hello',
|
130
|
+
attrs: {
|
131
|
+
body: {
|
132
|
+
strokeWidth: 1,
|
133
|
+
stroke: '#108ee9',
|
134
|
+
fill: '#fff',
|
135
|
+
rx: 5,
|
136
|
+
ry: 5
|
137
|
+
}
|
138
|
+
},
|
139
|
+
portMarkup: [Markup.getForeignObjectMarkup()],
|
140
|
+
ports: {
|
141
|
+
items: [{
|
142
|
+
group: 'in',
|
143
|
+
id: 'in1'
|
144
|
+
}, {
|
145
|
+
group: 'in',
|
146
|
+
id: 'in2'
|
147
|
+
}, {
|
148
|
+
group: 'out',
|
149
|
+
id: 'out1'
|
150
|
+
}, {
|
151
|
+
group: 'out',
|
152
|
+
id: 'out2'
|
153
|
+
}],
|
154
|
+
groups: {
|
155
|
+
in: {
|
156
|
+
position: {
|
157
|
+
name: 'top'
|
158
|
+
},
|
159
|
+
attrs: {
|
160
|
+
fo: {
|
161
|
+
width: 10,
|
162
|
+
height: 10,
|
163
|
+
x: -5,
|
164
|
+
y: -5,
|
165
|
+
magnet: 'true'
|
166
|
+
}
|
167
|
+
},
|
168
|
+
zIndex: 1
|
169
|
+
},
|
170
|
+
out: {
|
171
|
+
position: {
|
172
|
+
name: 'bottom'
|
173
|
+
},
|
174
|
+
attrs: {
|
175
|
+
fo: {
|
176
|
+
width: 10,
|
177
|
+
height: 10,
|
178
|
+
x: -5,
|
179
|
+
y: -5,
|
180
|
+
magnet: 'true'
|
181
|
+
}
|
182
|
+
},
|
183
|
+
zIndex: 1
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
};
|
@@ -36,11 +36,13 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
36
36
|
var metaType = useMetaType(metadataTag, refresh);
|
37
37
|
|
38
38
|
var onTypeChange = function onTypeChange(idx) {
|
39
|
-
var _properties
|
39
|
+
var _properties$idx, _properties$idx2;
|
40
|
+
|
41
|
+
var _properties = form.getFieldValue('properties') || [];
|
40
42
|
|
41
43
|
var __properties = {
|
42
|
-
id: _properties[idx].id,
|
43
|
-
type: _properties[idx].type
|
44
|
+
id: (_properties$idx = _properties[idx]) === null || _properties$idx === void 0 ? void 0 : _properties$idx.id,
|
45
|
+
type: (_properties$idx2 = _properties[idx]) === null || _properties$idx2 === void 0 ? void 0 : _properties$idx2.type
|
44
46
|
};
|
45
47
|
_properties[idx] = __properties;
|
46
48
|
form.setFieldsValue({
|
@@ -117,37 +117,74 @@ function Index(props) {
|
|
117
117
|
initEnumValue: initEnumValue
|
118
118
|
};
|
119
119
|
}, [field]);
|
120
|
+
var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
|
121
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(server, __TYPE__) {
|
122
|
+
var _schema, res, provider, FormCls, formCls, _fields;
|
123
|
+
|
124
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
125
|
+
while (1) {
|
126
|
+
switch (_context2.prev = _context2.next) {
|
127
|
+
case 0:
|
128
|
+
_schema = []; // 如果有内部类,优先在内部类里面找
|
129
|
+
|
130
|
+
if (__TYPE__.length > 0) {
|
131
|
+
_schema = __TYPE__.filter(function (it) {
|
132
|
+
return it.id === refId;
|
133
|
+
});
|
134
|
+
} // 内部类找不到 从接口里面拿
|
135
|
+
|
136
|
+
|
137
|
+
if (!(_schema.length === 0)) {
|
138
|
+
_context2.next = 7;
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
|
142
|
+
_context2.next = 5;
|
143
|
+
return server.GetMetadataDetailById(refId);
|
144
|
+
|
145
|
+
case 5:
|
146
|
+
res = _context2.sent;
|
147
|
+
|
148
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
149
|
+
_schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
|
150
|
+
}
|
151
|
+
|
152
|
+
case 7:
|
153
|
+
provider = new JsonMetadataProvider();
|
154
|
+
|
155
|
+
if (_schema.length > 0) {
|
156
|
+
provider.add_types(_schema);
|
157
|
+
FormCls = provider.get_type(_schema[0].id);
|
158
|
+
formCls = new FormCls();
|
159
|
+
_fields = formCls.__type__.__fields__;
|
160
|
+
refFieldsRef.current = _fields;
|
161
|
+
setRefFields(_objectSpread({}, _fields));
|
162
|
+
setSchema(_toConsumableArray(_schema));
|
163
|
+
}
|
164
|
+
|
165
|
+
case 9:
|
166
|
+
case "end":
|
167
|
+
return _context2.stop();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}, _callee2);
|
171
|
+
}));
|
172
|
+
|
173
|
+
return function (_x, _x2) {
|
174
|
+
return _ref2.apply(this, arguments);
|
175
|
+
};
|
176
|
+
}(), [refId]);
|
120
177
|
React.useEffect(function () {
|
121
178
|
if (refId) {
|
122
179
|
var server = new MetadataService();
|
123
|
-
server.
|
124
|
-
var provider = new JsonMetadataProvider();
|
125
|
-
|
126
|
-
if (res === null || res === void 0 ? void 0 : res.schema) {
|
127
|
-
var mySchema = JSON.parse(res.schema);
|
128
|
-
provider.add_types(mySchema);
|
129
|
-
var FormCls = provider.get_type(mySchema[0].id);
|
130
|
-
var formCls = new FormCls();
|
131
|
-
var _fields = formCls.__type__.__fields__;
|
132
|
-
refFieldsRef.current = _fields;
|
133
|
-
setRefFields(_objectSpread({}, _fields));
|
134
|
-
setSchema(_toConsumableArray(mySchema));
|
135
|
-
return function () {
|
136
|
-
provider = null;
|
137
|
-
};
|
138
|
-
}
|
139
|
-
|
140
|
-
return function () {
|
141
|
-
provider = null;
|
142
|
-
};
|
143
|
-
});
|
180
|
+
getSchemaByRefId(server, formContext.__TYPE__);
|
144
181
|
return function () {
|
145
182
|
server = null;
|
146
183
|
};
|
147
184
|
}
|
148
185
|
|
149
186
|
return function () {};
|
150
|
-
}, [
|
187
|
+
}, [getSchemaByRefId, formContext.__TYPE__]);
|
151
188
|
React.useEffect(function () {
|
152
189
|
if (refId) {
|
153
190
|
var arr = refId.split(':');
|
@@ -14,14 +14,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
14
|
/*
|
15
15
|
* @Author:wangxian
|
16
16
|
* @Date: 2021-09-18 14:15:04
|
17
|
-
* @LastEditTime: 2022-05-23
|
17
|
+
* @LastEditTime: 2022-05-23 16:51:06
|
18
18
|
*/
|
19
19
|
import React from 'react';
|
20
20
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
21
21
|
import { useGetExtraInfo } from '../hooks';
|
22
22
|
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
23
|
-
import { deepClone } from '
|
24
|
-
import { useAsyncMemo } from '
|
23
|
+
import { deepClone } from '../../../utils';
|
24
|
+
import { useAsyncMemo } from '../../../framework/hooks/use-async-memo';
|
25
25
|
|
26
26
|
function Index(props) {
|
27
27
|
var _extraInfo$http3, _extraInfo$http4;
|
@@ -40,15 +40,7 @@ function Index(props) {
|
|
40
40
|
var formRefContext = React.useContext(MetadataRefContext);
|
41
41
|
var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
|
42
42
|
|
43
|
-
var _React$useState = React.useState([
|
44
|
-
value: 'zhejiang',
|
45
|
-
label: 'Zhejiang',
|
46
|
-
isLeaf: false
|
47
|
-
}, {
|
48
|
-
value: 'jiangsu',
|
49
|
-
label: 'Jiangsu',
|
50
|
-
isLeaf: false
|
51
|
-
}]),
|
43
|
+
var _React$useState = React.useState([]),
|
52
44
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
53
45
|
cascaderOption = _React$useState2[0],
|
54
46
|
setCascaderOption = _React$useState2[1];
|
@@ -69,7 +61,7 @@ function Index(props) {
|
|
69
61
|
switch (_context.prev = _context.next) {
|
70
62
|
case 0:
|
71
63
|
server = new MetadataService();
|
72
|
-
_url = pid ? http.url.replace('{pid}', pid) : http.url;
|
64
|
+
_url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
|
73
65
|
_context.next = 4;
|
74
66
|
return server.GetEnumDataByUrl(_url);
|
75
67
|
|
@@ -83,14 +75,6 @@ function Index(props) {
|
|
83
75
|
|
84
76
|
return _context.abrupt("return", res.map(function (it) {
|
85
77
|
if (http === null || http === void 0 ? void 0 : http.isCascader) {
|
86
|
-
if (pid === 'child_1') {
|
87
|
-
return {
|
88
|
-
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
89
|
-
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
90
|
-
isLeaf: it['isLeaf'] ? it['isLeaf'] : true
|
91
|
-
};
|
92
|
-
}
|
93
|
-
|
94
78
|
return {
|
95
79
|
value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
|
96
80
|
label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
|
@@ -164,7 +148,7 @@ function Index(props) {
|
|
164
148
|
}
|
165
149
|
|
166
150
|
_context2.next = 3;
|
167
|
-
return getEnumDataByUrl(deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http));
|
151
|
+
return getEnumDataByUrl(deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http), '');
|
168
152
|
|
169
153
|
case 3:
|
170
154
|
res = _context2.sent;
|
@@ -225,7 +209,8 @@ function Index(props) {
|
|
225
209
|
return /*#__PURE__*/React.createElement(_Cascader, {
|
226
210
|
multiple: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple,
|
227
211
|
options: cascaderOption,
|
228
|
-
loadData: loadData
|
212
|
+
loadData: loadData,
|
213
|
+
maxTagCount: 10
|
229
214
|
});
|
230
215
|
} else {
|
231
216
|
var _extraInfo$disabled;
|
@@ -235,7 +220,7 @@ function Index(props) {
|
|
235
220
|
onSelect: onSelect,
|
236
221
|
disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
|
237
222
|
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
|
238
|
-
options: httpOptions
|
223
|
+
options: httpOptions && httpOptions.length > 0 ? httpOptions : options,
|
239
224
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
240
225
|
return triggerNode.parentNode;
|
241
226
|
},
|
@@ -0,0 +1 @@
|
|
1
|
+
|
File without changes
|
package/es/index.d.ts
CHANGED
@@ -7,6 +7,7 @@ export { default as JsonView } from './comps/JsonView';
|
|
7
7
|
export { default as JsonEdit } from './comps/JsonEdit';
|
8
8
|
export { default as MdEditor } from './comps/MdEdit';
|
9
9
|
export { default as Editable } from './comps/Editable';
|
10
|
+
export { default as DynamicPorts } from './comps/DynamicPorts';
|
10
11
|
export * from './framework/metadata/index';
|
11
12
|
export { default as http, addInterceptor } from './framework/http/index';
|
12
13
|
export { default as useMemoSubject } from './framework/rxjs-hooks/useMemoSubject';
|
package/es/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author:wangxian
|
3
3
|
* @Date: 2021-09-18 14:15:04
|
4
|
-
* @LastEditTime: 2022-05-
|
4
|
+
* @LastEditTime: 2022-05-23 16:32:32
|
5
5
|
*/
|
6
6
|
import "./theme.css";
|
7
7
|
export { default as MetadataEdit } from './comps/MetadataEdit';
|
@@ -12,6 +12,7 @@ export { default as JsonView } from './comps/JsonView';
|
|
12
12
|
export { default as JsonEdit } from './comps/JsonEdit';
|
13
13
|
export { default as MdEditor } from './comps/MdEdit';
|
14
14
|
export { default as Editable } from './comps/Editable';
|
15
|
+
export { default as DynamicPorts } from './comps/DynamicPorts';
|
15
16
|
export * from './framework/metadata/index';
|
16
17
|
export { default as http, addInterceptor } from './framework/http/index';
|
17
18
|
export { default as useMemoSubject } from './framework/rxjs-hooks/useMemoSubject';
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"public": true,
|
3
3
|
"name": "ronds-metadata",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.7",
|
5
5
|
"scripts": {
|
6
6
|
"start": "dumi dev",
|
7
7
|
"docs:build": "dumi build",
|
@@ -31,6 +31,8 @@
|
|
31
31
|
"/es"
|
32
32
|
],
|
33
33
|
"dependencies": {
|
34
|
+
"@antv/x6": "^1.32.2",
|
35
|
+
"@antv/x6-react-shape": "^1.6.0",
|
34
36
|
"@babel/helper-create-regexp-features-plugin": "^7.12.13",
|
35
37
|
"@babel/runtime": "^7.11.2",
|
36
38
|
"@popperjs/core": "^2.4.4",
|