ronds-metadata 1.1.6 → 1.1.9
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/ContextMenu.css +8 -0
- package/es/comps/DynamicPorts/comps/ContextMenu.d.ts +7 -0
- package/es/comps/DynamicPorts/comps/ContextMenu.js +44 -0
- package/es/comps/DynamicPorts/comps/DragNode.d.ts +7 -0
- package/es/comps/DynamicPorts/comps/DragNode.js +52 -0
- package/es/comps/DynamicPorts/comps/GraphHandler/index.css +27 -0
- package/es/comps/DynamicPorts/comps/GraphHandler/index.d.ts +11 -0
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +51 -0
- package/es/comps/DynamicPorts/comps/NodeElement.d.ts +6 -0
- package/es/comps/DynamicPorts/comps/NodeElement.js +30 -0
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.css +5 -0
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.d.ts +8 -0
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +42 -0
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.css +21 -0
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.d.ts +8 -0
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +40 -0
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.css +23 -0
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.d.ts +7 -0
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +55 -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/graph.d.ts +62 -0
- package/es/comps/DynamicPorts/graph.js +584 -0
- package/es/comps/DynamicPorts/index.css +167 -0
- package/es/comps/DynamicPorts/index.d.ts +18 -1
- package/es/comps/DynamicPorts/index.js +131 -70
- package/es/comps/DynamicPorts/interface.d.ts +44 -0
- package/es/comps/DynamicPorts/interface.js +6 -0
- package/es/comps/DynamicPorts/utils.d.ts +104 -0
- package/es/comps/DynamicPorts/utils.js +127 -0
- package/es/comps/Icons/index.d.ts +18 -0
- package/es/comps/Icons/index.js +23 -0
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +5 -3
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +63 -25
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +10 -1
- package/es/comps/locales/en-US.d.ts +4 -0
- package/es/comps/locales/en-US.js +10 -1
- package/es/comps/locales/zh-CN.d.ts +4 -0
- package/es/comps/locales/zh-CN.js +10 -1
- package/es/framework/graph/index.css +12 -0
- package/es/framework/graph/index.d.ts +60 -0
- package/es/framework/graph/index.js +425 -0
- package/es/framework/libs/iconfont/iconfont.css +187 -0
- package/es/framework/libs/iconfont/iconfont.ttf +0 -0
- package/es/framework/libs/iconfont/iconfont.woff +0 -0
- package/es/framework/libs/iconfont/iconfont.woff2 +0 -0
- package/es/framework/rxjs-hooks/useObservableState.d.ts +3 -0
- package/es/framework/rxjs-hooks/useObservableState.js +45 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/package.json +7 -1
@@ -0,0 +1,23 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import React from "react";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* @Author: wangxian
|
6
|
+
* @Date: 2022-05-28 11:04:20
|
7
|
+
* @LastEditTime: 2022-05-28 11:15:23
|
8
|
+
*/
|
9
|
+
import '../../framework/libs/iconfont/iconfont.css';
|
10
|
+
|
11
|
+
var Icon = function Icon(props) {
|
12
|
+
var type = props.type,
|
13
|
+
_props$className = props.className,
|
14
|
+
className = _props$className === void 0 ? '' : _props$className,
|
15
|
+
_props$style = props.style,
|
16
|
+
style = _props$style === void 0 ? {} : _props$style;
|
17
|
+
return /*#__PURE__*/React.createElement("span", {
|
18
|
+
className: "fa fa-".concat(type, " ").concat(className),
|
19
|
+
style: _objectSpread({}, style)
|
20
|
+
});
|
21
|
+
};
|
22
|
+
|
23
|
+
export default Icon;
|
@@ -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({
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import "antd/es/form/style";
|
2
2
|
import _Form from "antd/es/form";
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
5
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
6
8
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
9
|
import React, { useRef } from 'react';
|
@@ -10,6 +12,7 @@ import { JsonMetadataProvider } from '../../../../framework/metadata';
|
|
10
12
|
import Editable from '../../../../comps/Editable';
|
11
13
|
import useObservable from '../../../../framework/rxjs-hooks/useObservable';
|
12
14
|
import { MetadataFormContext } from '../../interface';
|
15
|
+
import { getLabelByProps } from '../../utils';
|
13
16
|
|
14
17
|
var TableArray = function TableArray(props) {
|
15
18
|
var initValue = props.initValue,
|
@@ -46,31 +49,68 @@ var TableArray = function TableArray(props) {
|
|
46
49
|
setList(_toConsumableArray(p.payload[name]));
|
47
50
|
}
|
48
51
|
}, [formContext.stream$]);
|
52
|
+
var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
|
53
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(server, __TYPE__) {
|
54
|
+
var _schema, res, provider, FormCls, formCls, _fields;
|
55
|
+
|
56
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
57
|
+
while (1) {
|
58
|
+
switch (_context.prev = _context.next) {
|
59
|
+
case 0:
|
60
|
+
_schema = []; // 如果有内部类,优先在内部类里面找
|
61
|
+
|
62
|
+
if (__TYPE__.length > 0) {
|
63
|
+
_schema = __TYPE__.filter(function (it) {
|
64
|
+
return it.id === refId;
|
65
|
+
});
|
66
|
+
} // 内部类找不到 从接口里面拿
|
67
|
+
|
68
|
+
|
69
|
+
if (!(_schema.length === 0)) {
|
70
|
+
_context.next = 7;
|
71
|
+
break;
|
72
|
+
}
|
73
|
+
|
74
|
+
_context.next = 5;
|
75
|
+
return server.GetMetadataDetailById(refId);
|
76
|
+
|
77
|
+
case 5:
|
78
|
+
res = _context.sent;
|
79
|
+
|
80
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
81
|
+
_schema = JSON.parse(res === null || res === void 0 ? void 0 : res.schema);
|
82
|
+
}
|
83
|
+
|
84
|
+
case 7:
|
85
|
+
provider = new JsonMetadataProvider();
|
86
|
+
|
87
|
+
if (_schema.length > 0) {
|
88
|
+
provider.add_types(_schema);
|
89
|
+
FormCls = provider.get_type(_schema[0].id);
|
90
|
+
formCls = new FormCls();
|
91
|
+
_fields = formCls.__type__.__fields__;
|
92
|
+
refFieldsRef.current = _fields;
|
93
|
+
setRefFields(_objectSpread({}, _fields));
|
94
|
+
setSchema(_toConsumableArray(_schema));
|
95
|
+
setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
|
96
|
+
}
|
97
|
+
|
98
|
+
case 9:
|
99
|
+
case "end":
|
100
|
+
return _context.stop();
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}, _callee);
|
104
|
+
}));
|
105
|
+
|
106
|
+
return function (_x, _x2) {
|
107
|
+
return _ref.apply(this, arguments);
|
108
|
+
};
|
109
|
+
}(), [refId]);
|
49
110
|
React.useEffect(function () {
|
50
111
|
if (refId) {
|
51
112
|
var server = new MetadataService();
|
52
|
-
server.
|
53
|
-
var provider = new JsonMetadataProvider();
|
54
|
-
|
55
|
-
if (res === null || res === void 0 ? void 0 : res.schema) {
|
56
|
-
var mySchema = JSON.parse(res.schema);
|
57
|
-
provider.add_types(mySchema);
|
58
|
-
var FormCls = provider.get_type(mySchema[0].id);
|
59
|
-
var formCls = new FormCls();
|
60
|
-
var _fields = formCls.__type__.__fields__;
|
61
|
-
refFieldsRef.current = _fields;
|
62
|
-
setRefFields(_objectSpread({}, _fields));
|
63
|
-
setSchema(_toConsumableArray(mySchema));
|
64
|
-
setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
|
65
|
-
return function () {
|
66
|
-
provider = null;
|
67
|
-
};
|
68
|
-
}
|
69
|
-
|
70
|
-
return function () {
|
71
|
-
provider = null;
|
72
|
-
};
|
73
|
-
});
|
113
|
+
getSchemaByRefId(server, formContext.__TYPE__);
|
74
114
|
return function () {
|
75
115
|
server = null;
|
76
116
|
};
|
@@ -88,11 +128,9 @@ var TableArray = function TableArray(props) {
|
|
88
128
|
var _columns = [];
|
89
129
|
|
90
130
|
for (var i = 0; i < _properties.length; i++) {
|
91
|
-
var _it$fields$0$value, _it$fields$0$value$co, _it$fields$0$value2;
|
92
|
-
|
93
131
|
var it = _properties[i];
|
94
132
|
var obj = {
|
95
|
-
title: (it
|
133
|
+
title: getLabelByProps(it),
|
96
134
|
key: it.id,
|
97
135
|
dataIndex: it.id,
|
98
136
|
width: 100,
|
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
/*
|
6
6
|
* @Author: wangxian
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
8
|
-
* @LastEditTime: 2022-05-
|
8
|
+
* @LastEditTime: 2022-05-28 09:35:48
|
9
9
|
*/
|
10
10
|
import React from 'react';
|
11
11
|
import Input from './DataCell/Input';
|
@@ -64,4 +64,13 @@ export function renderForm(schemaRef, options, stream$) {
|
|
64
64
|
}
|
65
65
|
|
66
66
|
return /*#__PURE__*/React.createElement(React.Fragment, null, _form);
|
67
|
+
}
|
68
|
+
export function getLabelByProps(data) {
|
69
|
+
if (data.fields && data.fields.length > 0) {
|
70
|
+
var _data$fields$0$value, _data$fields$0$value$, _data$fields$, _data$fields$$value;
|
71
|
+
|
72
|
+
return ((_data$fields$0$value = data.fields[0].value) === null || _data$fields$0$value === void 0 ? void 0 : (_data$fields$0$value$ = _data$fields$0$value.common) === null || _data$fields$0$value$ === void 0 ? void 0 : _data$fields$0$value$.label) || ((_data$fields$ = data.fields[0]) === null || _data$fields$ === void 0 ? void 0 : (_data$fields$$value = _data$fields$.value) === null || _data$fields$$value === void 0 ? void 0 : _data$fields$$value.label) || data.id;
|
73
|
+
}
|
74
|
+
|
75
|
+
return data.id;
|
67
76
|
}
|
@@ -1,3 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2022-05-09 11:53:44
|
4
|
+
* @LastEditTime: 2022-05-28 10:21:09
|
5
|
+
*/
|
1
6
|
export default {
|
2
7
|
操作: 'Operation',
|
3
8
|
添加一行: 'Add New Line',
|
@@ -11,5 +16,9 @@ export default {
|
|
11
16
|
请输入key: 'Please enter key',
|
12
17
|
请输入title: 'Please enter title',
|
13
18
|
确认会删除该列: 'Confirm will delete the column?',
|
14
|
-
当前值无修改: 'No change to current value'
|
19
|
+
当前值无修改: 'No change to current value',
|
20
|
+
放大: 'Enlarge',
|
21
|
+
缩小: 'zoom out',
|
22
|
+
实际尺寸: 'Actual size',
|
23
|
+
适应画布: 'Fit to canvas'
|
15
24
|
};
|
@@ -1,3 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2022-05-09 11:53:44
|
4
|
+
* @LastEditTime: 2022-05-28 10:19:25
|
5
|
+
*/
|
1
6
|
export default {
|
2
7
|
操作: '操作',
|
3
8
|
添加一行: '添加一行',
|
@@ -11,5 +16,9 @@ export default {
|
|
11
16
|
请输入key: '请输入key',
|
12
17
|
请输入title: '请输入title',
|
13
18
|
确认会删除该列: '确认会删除该列?',
|
14
|
-
当前值无修改: '当前值无修改'
|
19
|
+
当前值无修改: '当前值无修改',
|
20
|
+
放大: '放大',
|
21
|
+
缩小: '缩小',
|
22
|
+
实际尺寸: '实际尺寸',
|
23
|
+
适应画布: '适应画布'
|
15
24
|
};
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { Graph, Node, Edge, Collection } from '@antv/x6';
|
2
|
+
import './index.less';
|
3
|
+
declare type DPGraphOptions = ConstructorParameters<typeof Graph>[0];
|
4
|
+
export declare type ConnectionRemovedArgs = Collection.EdgeEventArgs['edge:removed'];
|
5
|
+
interface RenderParams {
|
6
|
+
wrapper?: HTMLElement;
|
7
|
+
container?: HTMLElement;
|
8
|
+
nodes?: Node.Metadata[];
|
9
|
+
edges?: Node.Metadata[];
|
10
|
+
}
|
11
|
+
interface Options extends DPGraphOptions {
|
12
|
+
wrapper?: HTMLElement;
|
13
|
+
container?: HTMLElement;
|
14
|
+
nodes?: any[];
|
15
|
+
edges?: any[];
|
16
|
+
}
|
17
|
+
export interface ContextMenuInfo {
|
18
|
+
type: 'edge' | 'graph' | 'node';
|
19
|
+
data: any;
|
20
|
+
}
|
21
|
+
export declare class GraphCore<N extends Node<Node.Properties> = Node<Node.Properties>, E extends Edge<Edge.Properties> = Edge<Edge.Properties>> {
|
22
|
+
wrapper?: HTMLElement;
|
23
|
+
container?: HTMLElement;
|
24
|
+
nodeMetas?: any[];
|
25
|
+
edgeMetas?: any[];
|
26
|
+
options: Exclude<Options, 'wrapper' | 'nodes' | 'edges'>;
|
27
|
+
graph?: Graph;
|
28
|
+
private factorySub?;
|
29
|
+
constructor(options: Options);
|
30
|
+
setMeta(params: Pick<Options, 'wrapper' | 'container' | 'nodes' | 'edges'>): void;
|
31
|
+
get isMetaValid(): boolean;
|
32
|
+
setWrapper(wrapper: HTMLElement): void;
|
33
|
+
setContainer(container: HTMLElement): void;
|
34
|
+
setNodes(nodes: any[]): void;
|
35
|
+
setEdges(edges: any[]): void;
|
36
|
+
initFactorySub(): void;
|
37
|
+
render(params: RenderParams): void;
|
38
|
+
renderNode(nodeMeta: any): N | undefined;
|
39
|
+
renderEdge(edgeMeta: any): E | undefined;
|
40
|
+
afterLayout(): void;
|
41
|
+
onConnectNode(args: any): void;
|
42
|
+
onSelectNodes(nodes: N[]): void;
|
43
|
+
resizeGraph: () => void;
|
44
|
+
onConnectionRemoved(args: ConnectionRemovedArgs): void;
|
45
|
+
onDeleteNodeOrEdge(args: {
|
46
|
+
nodes: N[];
|
47
|
+
edges: E[];
|
48
|
+
}): void;
|
49
|
+
validateContextMenu(data: ContextMenuInfo): boolean;
|
50
|
+
onContextMenu(data: ContextMenuInfo): any;
|
51
|
+
zoom: (factor: number | 'fit' | 'real') => void;
|
52
|
+
addNode: (nodeMeta: any) => N;
|
53
|
+
addEdge: (edgeMeta: any) => E;
|
54
|
+
deleteNodes: (nodes: (Node | string)[] | Node | string) => void;
|
55
|
+
deleteEdges: (edges: (Edge | string)[] | Edge | string) => void;
|
56
|
+
getNodeById: (nodeId: string) => N | undefined;
|
57
|
+
throwRenderError: () => void;
|
58
|
+
dispose(): void;
|
59
|
+
}
|
60
|
+
export {};
|