ronds-metadata 1.1.5 → 1.1.6
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/index.d.ts +2 -0
- package/es/comps/DynamicPorts/index.js +80 -0
- package/es/comps/MetadataForm/DataCell/Ref.js +45 -25
- package/es/comps/MetadataForm/DataCell/Select.js +7 -22
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/package.json +2 -1
- package/es/comps/RzGraph/index.d.ts +0 -2
- package/es/comps/RzGraph/index.js +0 -7
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2022-05-16 18:53:31
|
4
|
+
* @LastEditTime: 2022-05-23 17:05:14
|
5
|
+
*/
|
6
|
+
import { Markup } from "@antv/x6/es/view/markup";
|
7
|
+
import React from 'react';
|
8
|
+
|
9
|
+
var DynamicPorts = function DynamicPorts() {
|
10
|
+
var containerRef = React.useRef();
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
12
|
+
ref: containerRef
|
13
|
+
}));
|
14
|
+
};
|
15
|
+
|
16
|
+
export default DynamicPorts;
|
17
|
+
var testNode = {
|
18
|
+
x: 40,
|
19
|
+
y: 35,
|
20
|
+
width: 160,
|
21
|
+
height: 30,
|
22
|
+
label: 'Hello',
|
23
|
+
attrs: {
|
24
|
+
body: {
|
25
|
+
strokeWidth: 1,
|
26
|
+
stroke: '#108ee9',
|
27
|
+
fill: '#fff',
|
28
|
+
rx: 5,
|
29
|
+
ry: 5
|
30
|
+
}
|
31
|
+
},
|
32
|
+
portMarkup: [Markup.getForeignObjectMarkup()],
|
33
|
+
ports: {
|
34
|
+
items: [{
|
35
|
+
group: 'in',
|
36
|
+
id: 'in1'
|
37
|
+
}, {
|
38
|
+
group: 'in',
|
39
|
+
id: 'in2'
|
40
|
+
}, {
|
41
|
+
group: 'out',
|
42
|
+
id: 'out1'
|
43
|
+
}, {
|
44
|
+
group: 'out',
|
45
|
+
id: 'out2'
|
46
|
+
}],
|
47
|
+
groups: {
|
48
|
+
in: {
|
49
|
+
position: {
|
50
|
+
name: 'top'
|
51
|
+
},
|
52
|
+
attrs: {
|
53
|
+
fo: {
|
54
|
+
width: 10,
|
55
|
+
height: 10,
|
56
|
+
x: -5,
|
57
|
+
y: -5,
|
58
|
+
magnet: 'true'
|
59
|
+
}
|
60
|
+
},
|
61
|
+
zIndex: 1
|
62
|
+
},
|
63
|
+
out: {
|
64
|
+
position: {
|
65
|
+
name: 'bottom'
|
66
|
+
},
|
67
|
+
attrs: {
|
68
|
+
fo: {
|
69
|
+
width: 10,
|
70
|
+
height: 10,
|
71
|
+
x: -5,
|
72
|
+
y: -5,
|
73
|
+
magnet: 'true'
|
74
|
+
}
|
75
|
+
},
|
76
|
+
zIndex: 1
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
};
|
@@ -118,11 +118,51 @@ function Index(props) {
|
|
118
118
|
};
|
119
119
|
}, [field]);
|
120
120
|
var getSchemaByRefId = React.useCallback( /*#__PURE__*/function () {
|
121
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(server) {
|
121
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(server, __TYPE__) {
|
122
|
+
var _schema, res, provider, FormCls, formCls, _fields;
|
123
|
+
|
122
124
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
123
125
|
while (1) {
|
124
126
|
switch (_context2.prev = _context2.next) {
|
125
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:
|
126
166
|
case "end":
|
127
167
|
return _context2.stop();
|
128
168
|
}
|
@@ -130,41 +170,21 @@ function Index(props) {
|
|
130
170
|
}, _callee2);
|
131
171
|
}));
|
132
172
|
|
133
|
-
return function (_x) {
|
173
|
+
return function (_x, _x2) {
|
134
174
|
return _ref2.apply(this, arguments);
|
135
175
|
};
|
136
|
-
}(), []);
|
176
|
+
}(), [refId]);
|
137
177
|
React.useEffect(function () {
|
138
178
|
if (refId) {
|
139
179
|
var server = new MetadataService();
|
140
|
-
server.
|
141
|
-
var provider = new JsonMetadataProvider();
|
142
|
-
|
143
|
-
if (res === null || res === void 0 ? void 0 : res.schema) {
|
144
|
-
var mySchema = JSON.parse(res.schema);
|
145
|
-
provider.add_types(mySchema);
|
146
|
-
var FormCls = provider.get_type(mySchema[0].id);
|
147
|
-
var formCls = new FormCls();
|
148
|
-
var _fields = formCls.__type__.__fields__;
|
149
|
-
refFieldsRef.current = _fields;
|
150
|
-
setRefFields(_objectSpread({}, _fields));
|
151
|
-
setSchema(_toConsumableArray(mySchema));
|
152
|
-
return function () {
|
153
|
-
provider = null;
|
154
|
-
};
|
155
|
-
}
|
156
|
-
|
157
|
-
return function () {
|
158
|
-
provider = null;
|
159
|
-
};
|
160
|
-
});
|
180
|
+
getSchemaByRefId(server, formContext.__TYPE__);
|
161
181
|
return function () {
|
162
182
|
server = null;
|
163
183
|
};
|
164
184
|
}
|
165
185
|
|
166
186
|
return function () {};
|
167
|
-
}, [
|
187
|
+
}, [getSchemaByRefId, formContext.__TYPE__]);
|
168
188
|
React.useEffect(function () {
|
169
189
|
if (refId) {
|
170
190
|
var arr = refId.split(':');
|
@@ -14,7 +14,7 @@ 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';
|
@@ -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
|
},
|
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.6",
|
5
5
|
"scripts": {
|
6
6
|
"start": "dumi dev",
|
7
7
|
"docs:build": "dumi build",
|
@@ -31,6 +31,7 @@
|
|
31
31
|
"/es"
|
32
32
|
],
|
33
33
|
"dependencies": {
|
34
|
+
"@antv/x6": "^1.32.2",
|
34
35
|
"@babel/helper-create-regexp-features-plugin": "^7.12.13",
|
35
36
|
"@babel/runtime": "^7.11.2",
|
36
37
|
"@popperjs/core": "^2.4.4",
|