ronds-metadata 1.2.10 → 1.2.12
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.js +249 -0
- package/es/comps/DynamicPorts/comps/ContextMenu.js +44 -0
- package/es/comps/DynamicPorts/comps/DragNode.js +55 -0
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +51 -0
- package/es/comps/DynamicPorts/comps/NodeElement.js +30 -0
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +42 -0
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +40 -0
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +55 -0
- package/es/comps/DynamicPorts/comps/shape/connector.js +19 -0
- package/es/comps/DynamicPorts/comps/shape/edge.js +91 -0
- package/es/comps/DynamicPorts/comps/shape/node.js +190 -0
- package/es/comps/DynamicPorts/constant/index.js +19 -0
- package/es/comps/DynamicPorts/graph.js +697 -0
- package/es/comps/DynamicPorts/index.js +143 -0
- package/es/comps/DynamicPorts/interface.js +6 -0
- package/es/comps/DynamicPorts/utils.js +127 -0
- package/es/comps/Editable/DataCell/ButtonCell.js +45 -0
- package/es/comps/Editable/DataCell/ColorPicker.js +33 -0
- package/es/comps/Editable/DataCell/Input.js +54 -0
- package/es/comps/Editable/DataCell/Number.js +44 -0
- package/es/comps/Editable/DataCell/Select.js +48 -0
- package/es/comps/Editable/DataCell/Switch.js +33 -0
- package/es/comps/Editable/comps/EditableAction.js +110 -0
- package/es/comps/Editable/comps/EditableCell.js +108 -0
- package/es/comps/Editable/comps/EditableHeardCell.js +172 -0
- package/es/comps/Editable/comps/EditableRow.js +118 -0
- package/es/comps/Editable/comps/Texty.js +277 -0
- package/es/comps/Editable/index.js +386 -0
- package/es/comps/Editable/interface.js +8 -0
- package/es/comps/Editable/utils.js +46 -0
- package/es/comps/FileView/index.js +198 -0
- package/es/comps/FormGenerator/Provider.js +8 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +69 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +16 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +50 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +55 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +14 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +50 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +69 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +55 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +13 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +50 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +14 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +27 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +261 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +62 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +315 -0
- package/es/comps/FormGenerator/comps/Canvas/index.js +120 -0
- package/es/comps/FormGenerator/comps/Settings/index.js +150 -0
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +48 -0
- package/es/comps/FormGenerator/comps/Sidebar/index.js +37 -0
- package/es/comps/FormGenerator/index.js +68 -0
- package/es/comps/FormGenerator/settings/index.js +367 -0
- package/es/comps/FormGenerator/settings/ruleConfig.js +557 -0
- package/es/comps/FormGenerator/transformer.js +300 -0
- package/es/comps/Icons/index.js +23 -0
- package/es/comps/JsonEdit/constant/index.js +87 -0
- package/es/comps/JsonEdit/index.js +221 -0
- package/es/comps/JsonView/index.js +109 -0
- package/es/comps/MdEdit/index.js +41 -0
- package/es/comps/MdNavbar/index.js +180 -0
- package/es/comps/MdNavbar/utils.js +34 -0
- package/es/comps/MdView/index.js +70 -0
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +419 -0
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +368 -0
- package/es/comps/MetadataEdit/constant/index.js +69 -0
- package/es/comps/MetadataEdit/hooks/index.js +43 -0
- package/es/comps/MetadataEdit/index.js +255 -0
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +237 -0
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +367 -0
- package/es/comps/MetadataEditV2/constant/index.js +69 -0
- package/es/comps/MetadataEditV2/hooks/index.js +43 -0
- package/es/comps/MetadataEditV2/index.js +298 -0
- package/es/comps/MetadataForm/DataCell/Array.js +148 -0
- package/es/comps/MetadataForm/DataCell/Input.js +199 -0
- package/es/comps/MetadataForm/DataCell/Number.js +131 -0
- package/es/comps/MetadataForm/DataCell/Ref.js +326 -0
- package/es/comps/MetadataForm/DataCell/Select.js +558 -0
- package/es/comps/MetadataForm/DataCell/Switch.js +116 -0
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +359 -0
- package/es/comps/MetadataForm/HOC/index.js +126 -0
- package/es/comps/MetadataForm/constants.js +11 -0
- package/es/comps/MetadataForm/hooks/index.js +139 -0
- package/es/comps/MetadataForm/index.js +268 -0
- package/es/comps/MetadataForm/interface.d.ts +2 -1
- package/es/comps/MetadataForm/interface.js +8 -0
- package/es/comps/MetadataForm/utils.js +112 -0
- package/es/comps/locales/en-US.js +24 -0
- package/es/comps/locales/index.js +8 -0
- package/es/comps/locales/zh-CN.js +24 -0
- package/es/config.js +50 -0
- package/es/framework/graph/index.js +515 -0
- package/es/framework/hooks/use-async-memo.js +32 -0
- package/es/framework/hooks/use-sync-scroll.js +106 -0
- package/es/framework/http/cache.js +137 -0
- package/es/framework/http/cancel.js +44 -0
- package/es/framework/http/index.js +392 -0
- package/es/framework/http/msgpack.js +34 -0
- package/es/framework/http/msgpack5/index.js +84 -0
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +71 -0
- package/es/framework/http/msgpack5/lib/decoder.js +287 -0
- package/es/framework/http/msgpack5/lib/encoder.js +252 -0
- package/es/framework/http/msgpack5/lib/helpers.js +23 -0
- package/es/framework/http/msgpack5/lib/streams.js +93 -0
- package/es/framework/http/types.js +1 -0
- package/es/framework/libs/jquery.min.js +4022 -0
- package/es/framework/locale/dil8/di18n.js +132 -0
- package/es/framework/locale/dil8/index.js +3 -0
- package/es/framework/locale/dil8/translate.js +76 -0
- package/es/framework/locale/dil8/util.js +17 -0
- package/es/framework/locale/index.js +26 -0
- package/es/framework/metadata/MetadataService.js +169 -0
- package/es/framework/metadata/index.js +384 -0
- package/es/framework/rxjs-hooks/useMemoSubject.js +16 -0
- package/es/framework/rxjs-hooks/useObservable.js +22 -0
- package/es/framework/rxjs-hooks/useObservableState.js +45 -0
- package/es/index.js +27 -0
- package/es/utils.js +138 -0
- package/package.json +1 -1
package/es/api/index.js
ADDED
@@ -0,0 +1,249 @@
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
5
|
+
|
6
|
+
/*
|
7
|
+
* @Author:wangxian
|
8
|
+
* @Date: 2021-09-18 14:15:04
|
9
|
+
* @LastEditTime: 2023-02-09 19:16:42
|
10
|
+
*/
|
11
|
+
import { guid, md5 } from '../utils';
|
12
|
+
import { addInterceptor, HttpHelper } from '../framework/http';
|
13
|
+
var http = new HttpHelper();
|
14
|
+
var token = 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkNBMzFBMEJDMkQ5M0I3RkVFOTBDMDkwMDI4MUVBMTlEIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NzAyODgzMTksImV4cCI6MTcwMTgyNDMxOSwiaXNzIjoiaHR0cDovLzE5Mi4xNjguMS4xNzk6MzEwMDIiLCJhdWQiOiJlcG0iLCJjbGllbnRfaWQiOiJlcG0iLCJzdWIiOiIzYTAyZTY3Zi1mYzNjLWU2YjQtYTFjNC1jOTEzOWE1NjM3OTUiLCJhdXRoX3RpbWUiOjE2NzAyODgzMTksImlkcCI6ImxvY2FsIiwicm9sZSI6InBobV9hZG1pbiIsInBob25lX251bWJlciI6IjEyMzQ1NiIsInBob25lX251bWJlcl92ZXJpZmllZCI6IkZhbHNlIiwiZW1haWwiOiJwaG1AYWJwLmlvIiwiZW1haWxfdmVyaWZpZWQiOiJGYWxzZSIsIm5hbWUiOiJwaG0iLCJpYXQiOjE2NzAyODgzMTksInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsImVwbSIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.J1FKumhVm8zRAAqk61-4_LxjIz7gSehrAWhTKj0BPExZytQhLe8vLjGpXtLL-n_j3JE2eDz8____0afXdC5LaD_b6z-Wxyowe0BdCgGCRxAZDVjHUF-J5PnGPTYpjBTnbQ0g2lpTLTNPCb3AmEKj172okXm_3jRKj3FYYB7delG4ZDNPFKu4VtSoH8B4PubAliSAuBifcDtMYYPv83_mb6zipFbb_S1CgI-IZLNV5c5dMIz6jPpooYyKkOu1B0bcCE31R40V4NcARlomO41nfJiJ3PdwwVfmrOe1OHeFkwLwyG_rersTYVLF1nACT2cOMT9VRWzofkWjhRbW1iz_3w';
|
15
|
+
addInterceptor(function (httpClient) {
|
16
|
+
httpClient.interceptors.request.use(function (_config) {
|
17
|
+
if (!_config.headers) {
|
18
|
+
_config.headers = {};
|
19
|
+
}
|
20
|
+
|
21
|
+
_config.headers.Authorization = token;
|
22
|
+
var url = _config.url;
|
23
|
+
var timestamp = new Date().getTime();
|
24
|
+
|
25
|
+
var _guid = guid();
|
26
|
+
|
27
|
+
var signature = md5("".concat(url).concat(timestamp).concat(guid));
|
28
|
+
_config.headers.url = url;
|
29
|
+
_config.headers.timestamp = timestamp;
|
30
|
+
_config.headers.nonce = _guid;
|
31
|
+
_config.headers.signature = signature;
|
32
|
+
return _config;
|
33
|
+
});
|
34
|
+
});
|
35
|
+
|
36
|
+
var Api = /*#__PURE__*/function () {
|
37
|
+
function Api() {
|
38
|
+
_classCallCheck(this, Api);
|
39
|
+
}
|
40
|
+
|
41
|
+
_createClass(Api, [{
|
42
|
+
key: "GetMetadataList",
|
43
|
+
value:
|
44
|
+
/**
|
45
|
+
* 获取元数据列表
|
46
|
+
* @param keyWords
|
47
|
+
* @returns
|
48
|
+
*/
|
49
|
+
function () {
|
50
|
+
var _GetMetadataList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyWords) {
|
51
|
+
var _res$data;
|
52
|
+
|
53
|
+
var param, url, res;
|
54
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
55
|
+
while (1) {
|
56
|
+
switch (_context.prev = _context.next) {
|
57
|
+
case 0:
|
58
|
+
param = {
|
59
|
+
filter: {
|
60
|
+
name: '',
|
61
|
+
tags: keyWords
|
62
|
+
},
|
63
|
+
order: [],
|
64
|
+
pagination: {
|
65
|
+
page: 1,
|
66
|
+
size: 30
|
67
|
+
}
|
68
|
+
};
|
69
|
+
url = "/metamgt-web/metadata/list";
|
70
|
+
_context.next = 4;
|
71
|
+
return http.post(url, param);
|
72
|
+
|
73
|
+
case 4:
|
74
|
+
res = _context.sent;
|
75
|
+
return _context.abrupt("return", (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list);
|
76
|
+
|
77
|
+
case 6:
|
78
|
+
case "end":
|
79
|
+
return _context.stop();
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}, _callee);
|
83
|
+
}));
|
84
|
+
|
85
|
+
function GetMetadataList(_x) {
|
86
|
+
return _GetMetadataList.apply(this, arguments);
|
87
|
+
}
|
88
|
+
|
89
|
+
return GetMetadataList;
|
90
|
+
}()
|
91
|
+
/**
|
92
|
+
* 通过元数据Id获取元数据详情
|
93
|
+
* @param metadataId
|
94
|
+
* @returns
|
95
|
+
*/
|
96
|
+
|
97
|
+
}, {
|
98
|
+
key: "GetMetadataDetailById",
|
99
|
+
value: function () {
|
100
|
+
var _GetMetadataDetailById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(metadataId) {
|
101
|
+
var url, res;
|
102
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
103
|
+
while (1) {
|
104
|
+
switch (_context2.prev = _context2.next) {
|
105
|
+
case 0:
|
106
|
+
url = "/metamgt-web/metadata/".concat(metadataId);
|
107
|
+
_context2.next = 3;
|
108
|
+
return http.get(url);
|
109
|
+
|
110
|
+
case 3:
|
111
|
+
res = _context2.sent;
|
112
|
+
return _context2.abrupt("return", res.data);
|
113
|
+
|
114
|
+
case 5:
|
115
|
+
case "end":
|
116
|
+
return _context2.stop();
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}, _callee2);
|
120
|
+
}));
|
121
|
+
|
122
|
+
function GetMetadataDetailById(_x2) {
|
123
|
+
return _GetMetadataDetailById.apply(this, arguments);
|
124
|
+
}
|
125
|
+
|
126
|
+
return GetMetadataDetailById;
|
127
|
+
}()
|
128
|
+
/** 添加元数据 */
|
129
|
+
|
130
|
+
}, {
|
131
|
+
key: "SaveMetadata",
|
132
|
+
value: function () {
|
133
|
+
var _SaveMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, metadataTag) {
|
134
|
+
var param, url, res;
|
135
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
136
|
+
while (1) {
|
137
|
+
switch (_context3.prev = _context3.next) {
|
138
|
+
case 0:
|
139
|
+
param = {
|
140
|
+
schema: JSON.stringify([data]),
|
141
|
+
name: data.id,
|
142
|
+
tags: [metadataTag],
|
143
|
+
permission: 'public'
|
144
|
+
};
|
145
|
+
url = "/metamgt-web/metadata/add";
|
146
|
+
_context3.next = 4;
|
147
|
+
return http.post(url, param);
|
148
|
+
|
149
|
+
case 4:
|
150
|
+
res = _context3.sent;
|
151
|
+
return _context3.abrupt("return", res.data);
|
152
|
+
|
153
|
+
case 6:
|
154
|
+
case "end":
|
155
|
+
return _context3.stop();
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}, _callee3);
|
159
|
+
}));
|
160
|
+
|
161
|
+
function SaveMetadata(_x3, _x4) {
|
162
|
+
return _SaveMetadata.apply(this, arguments);
|
163
|
+
}
|
164
|
+
|
165
|
+
return SaveMetadata;
|
166
|
+
}() // 获取元数据的值
|
167
|
+
|
168
|
+
}, {
|
169
|
+
key: "GetMetadataObjList",
|
170
|
+
value: function () {
|
171
|
+
var _GetMetadataObjList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
172
|
+
var url, res;
|
173
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
174
|
+
while (1) {
|
175
|
+
switch (_context4.prev = _context4.next) {
|
176
|
+
case 0:
|
177
|
+
url = "/dataset-web/source/{namespace}/entity/page".replace('{namespace}', data.id);
|
178
|
+
_context4.next = 3;
|
179
|
+
return http.post(encodeURI(url), data);
|
180
|
+
|
181
|
+
case 3:
|
182
|
+
res = _context4.sent;
|
183
|
+
return _context4.abrupt("return", res.successed ? res.data : []);
|
184
|
+
|
185
|
+
case 5:
|
186
|
+
case "end":
|
187
|
+
return _context4.stop();
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}, _callee4);
|
191
|
+
}));
|
192
|
+
|
193
|
+
function GetMetadataObjList(_x5) {
|
194
|
+
return _GetMetadataObjList.apply(this, arguments);
|
195
|
+
}
|
196
|
+
|
197
|
+
return GetMetadataObjList;
|
198
|
+
}() // 通过扩展规则获取枚举类型的值
|
199
|
+
|
200
|
+
}, {
|
201
|
+
key: "GetEnumDataByUrl",
|
202
|
+
value: function () {
|
203
|
+
var _GetEnumDataByUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(url, method, body) {
|
204
|
+
var res, _res;
|
205
|
+
|
206
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
207
|
+
while (1) {
|
208
|
+
switch (_context5.prev = _context5.next) {
|
209
|
+
case 0:
|
210
|
+
if (!(method === 'get')) {
|
211
|
+
_context5.next = 7;
|
212
|
+
break;
|
213
|
+
}
|
214
|
+
|
215
|
+
_context5.next = 3;
|
216
|
+
return http.get(encodeURI(url));
|
217
|
+
|
218
|
+
case 3:
|
219
|
+
res = _context5.sent;
|
220
|
+
return _context5.abrupt("return", res.successed ? res.data : []);
|
221
|
+
|
222
|
+
case 7:
|
223
|
+
_context5.next = 9;
|
224
|
+
return http.post(encodeURI(url), body);
|
225
|
+
|
226
|
+
case 9:
|
227
|
+
_res = _context5.sent;
|
228
|
+
return _context5.abrupt("return", _res.successed ? _res.data : []);
|
229
|
+
|
230
|
+
case 11:
|
231
|
+
case "end":
|
232
|
+
return _context5.stop();
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}, _callee5);
|
236
|
+
}));
|
237
|
+
|
238
|
+
function GetEnumDataByUrl(_x6, _x7, _x8) {
|
239
|
+
return _GetEnumDataByUrl.apply(this, arguments);
|
240
|
+
}
|
241
|
+
|
242
|
+
return GetEnumDataByUrl;
|
243
|
+
}()
|
244
|
+
}]);
|
245
|
+
|
246
|
+
return Api;
|
247
|
+
}();
|
248
|
+
|
249
|
+
export { Api as default };
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* @Author: wangxian
|
5
|
+
* @Date: 2022-05-27 09:56:39
|
6
|
+
* @LastEditTime: 2022-05-27 16:16:25
|
7
|
+
*/
|
8
|
+
import React from 'react';
|
9
|
+
import NodeContextMenu from './contextMenu/NodeContextMenu';
|
10
|
+
import './ContextMenu.less';
|
11
|
+
import { EdgeContextMenu } from './contextMenu/EdgeContextMenu';
|
12
|
+
import useObservable from '../../../framework/rxjs-hooks/useObservable';
|
13
|
+
|
14
|
+
var ContextMenu = function ContextMenu(props) {
|
15
|
+
var _graph$factory$;
|
16
|
+
|
17
|
+
var graph = props.graph;
|
18
|
+
|
19
|
+
var _React$useState = React.useState(),
|
20
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
21
|
+
menu = _React$useState2[0],
|
22
|
+
setMenu = _React$useState2[1];
|
23
|
+
|
24
|
+
useObservable(function (v) {
|
25
|
+
setMenu(v);
|
26
|
+
}, [graph === null || graph === void 0 ? void 0 : (_graph$factory$ = graph.factory$) === null || _graph$factory$ === void 0 ? void 0 : _graph$factory$.contextMenuInfo]);
|
27
|
+
|
28
|
+
// 暂时屏蔽graph的右击菜单
|
29
|
+
if (!(menu === null || menu === void 0 ? void 0 : menu.type) || (menu === null || menu === void 0 ? void 0 : menu.type) === 'graph') {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
34
|
+
className: "mask"
|
35
|
+
}, (menu === null || menu === void 0 ? void 0 : menu.type) === 'node' && /*#__PURE__*/React.createElement(NodeContextMenu, {
|
36
|
+
graph: graph,
|
37
|
+
data: menu.data
|
38
|
+
}), (menu === null || menu === void 0 ? void 0 : menu.type) === 'edge' && /*#__PURE__*/React.createElement(EdgeContextMenu, {
|
39
|
+
graph: graph,
|
40
|
+
data: menu.data
|
41
|
+
}));
|
42
|
+
};
|
43
|
+
|
44
|
+
export default ContextMenu;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* @Author: wangxian
|
5
|
+
* @Date: 2022-05-26 08:50:06
|
6
|
+
* @LastEditTime: 2022-06-25 10:46:48
|
7
|
+
*/
|
8
|
+
import { DragSource } from 'react-dnd';
|
9
|
+
import { GlobalOutlined } from '@ant-design/icons';
|
10
|
+
import Icon from '../../../comps/Icons';
|
11
|
+
import { DRAGGABLE_COMPONENT } from '../constant';
|
12
|
+
import '../index.less';
|
13
|
+
|
14
|
+
var InnerNodeTitle = function InnerNodeTitle(props) {
|
15
|
+
var data = props.data,
|
16
|
+
connectDragPreview = props.connectDragPreview,
|
17
|
+
connectDragSource = props.connectDragSource;
|
18
|
+
return /*#__PURE__*/React.createElement("div", null, connectDragPreview(connectDragSource( /*#__PURE__*/React.createElement("div", {
|
19
|
+
className: "node-element",
|
20
|
+
style: {
|
21
|
+
width: '100%'
|
22
|
+
}
|
23
|
+
}, /*#__PURE__*/React.createElement("div", {
|
24
|
+
className: "icon"
|
25
|
+
}, (data === null || data === void 0 ? void 0 : data.icon) ? /*#__PURE__*/React.createElement(Icon, {
|
26
|
+
type: data === null || data === void 0 ? void 0 : data.icon
|
27
|
+
}) : /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
|
28
|
+
className: "notation"
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
30
|
+
className: "name"
|
31
|
+
}, data.name))))));
|
32
|
+
};
|
33
|
+
|
34
|
+
var NodeTitle = DragSource(DRAGGABLE_COMPONENT, {
|
35
|
+
beginDrag: function beginDrag(props) {
|
36
|
+
return {
|
37
|
+
comp: props.data
|
38
|
+
};
|
39
|
+
}
|
40
|
+
}, function (connect, monitor) {
|
41
|
+
return {
|
42
|
+
connectDragSource: connect.dragSource(),
|
43
|
+
connectDragPreview: connect.dragPreview(),
|
44
|
+
isDragging: monitor.isDragging()
|
45
|
+
};
|
46
|
+
})(InnerNodeTitle);
|
47
|
+
|
48
|
+
var DragNode = function DragNode(props) {
|
49
|
+
var data = props.data;
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NodeTitle, {
|
51
|
+
data: data
|
52
|
+
}));
|
53
|
+
};
|
54
|
+
|
55
|
+
export default DragNode;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import "antd/es/popover/style";
|
2
|
+
import _Popover from "antd/es/popover";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* @Author: wangxian
|
6
|
+
* @Date: 2022-05-27 14:21:23
|
7
|
+
* @LastEditTime: 2022-05-30 09:45:54
|
8
|
+
*/
|
9
|
+
import React from 'react';
|
10
|
+
import { CompressOutlined, OneToOneOutlined, ZoomInOutlined, ZoomOutOutlined } from '@ant-design/icons';
|
11
|
+
import classNames from 'classnames';
|
12
|
+
import './index.less';
|
13
|
+
import { tr } from '../../../../framework/locale';
|
14
|
+
export var GraphHandler = function GraphHandler(props) {
|
15
|
+
var className = props.className,
|
16
|
+
onZoomIn = props.onZoomIn,
|
17
|
+
onZoomOut = props.onZoomOut,
|
18
|
+
onFitContent = props.onFitContent,
|
19
|
+
onRealContent = props.onRealContent;
|
20
|
+
return /*#__PURE__*/React.createElement("ul", {
|
21
|
+
className: classNames('handler', className)
|
22
|
+
}, /*#__PURE__*/React.createElement(_Popover, {
|
23
|
+
overlayClassName: "popover",
|
24
|
+
content: tr('放大'),
|
25
|
+
placement: "left"
|
26
|
+
}, /*#__PURE__*/React.createElement("li", {
|
27
|
+
onClick: onZoomIn,
|
28
|
+
className: "item"
|
29
|
+
}, /*#__PURE__*/React.createElement(ZoomInOutlined, null))), /*#__PURE__*/React.createElement(_Popover, {
|
30
|
+
overlayClassName: "popover",
|
31
|
+
content: tr('缩小'),
|
32
|
+
placement: "left"
|
33
|
+
}, /*#__PURE__*/React.createElement("li", {
|
34
|
+
onClick: onZoomOut,
|
35
|
+
className: "item"
|
36
|
+
}, /*#__PURE__*/React.createElement(ZoomOutOutlined, null))), /*#__PURE__*/React.createElement(_Popover, {
|
37
|
+
overlayClassName: "popover",
|
38
|
+
content: tr('实际尺寸'),
|
39
|
+
placement: "left"
|
40
|
+
}, /*#__PURE__*/React.createElement("li", {
|
41
|
+
onClick: onRealContent,
|
42
|
+
className: "item"
|
43
|
+
}, /*#__PURE__*/React.createElement(OneToOneOutlined, null))), /*#__PURE__*/React.createElement(_Popover, {
|
44
|
+
overlayClassName: "popover",
|
45
|
+
content: tr('适应画布'),
|
46
|
+
placement: "left"
|
47
|
+
}, /*#__PURE__*/React.createElement("li", {
|
48
|
+
onClick: onFitContent,
|
49
|
+
className: "item"
|
50
|
+
}, /*#__PURE__*/React.createElement(CompressOutlined, null))));
|
51
|
+
};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
/*
|
4
|
+
* @Author: wangxian
|
5
|
+
* @Date: 2022-05-24 08:50:16
|
6
|
+
* @LastEditTime: 2022-05-28 11:09:22
|
7
|
+
*/
|
8
|
+
import { GlobalOutlined } from '@ant-design/icons';
|
9
|
+
import '../index.less';
|
10
|
+
import Icon from '../../../comps/Icons';
|
11
|
+
|
12
|
+
var NodeElement = function NodeElement(props) {
|
13
|
+
var node = props.node;
|
14
|
+
var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
|
15
|
+
var name = data.name,
|
16
|
+
icon = data.icon;
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
18
|
+
className: "node-element"
|
19
|
+
}, /*#__PURE__*/React.createElement("div", {
|
20
|
+
className: "icon"
|
21
|
+
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
22
|
+
type: icon
|
23
|
+
}) : /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
|
24
|
+
className: "notation"
|
25
|
+
}, /*#__PURE__*/React.createElement("div", {
|
26
|
+
className: "name"
|
27
|
+
}, name))));
|
28
|
+
};
|
29
|
+
|
30
|
+
export default NodeElement;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import "antd/es/menu/style";
|
2
|
+
import _Menu from "antd/es/menu";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* @Author: wangxian
|
6
|
+
* @Date: 2022-05-27 15:55:57
|
7
|
+
* @LastEditTime: 2022-05-28 10:07:16
|
8
|
+
*/
|
9
|
+
import React, { useCallback, useRef } from 'react';
|
10
|
+
import { DeleteOutlined } from '@ant-design/icons';
|
11
|
+
import { useClickAway } from 'ahooks';
|
12
|
+
import { graphPointToOffsetPoint } from '../../../utils';
|
13
|
+
import './index.less';
|
14
|
+
import { tr } from '../../../../../framework/locale';
|
15
|
+
export var EdgeContextMenu = function EdgeContextMenu(props) {
|
16
|
+
var graph = props.graph,
|
17
|
+
data = props.data;
|
18
|
+
var containerRef = useRef(null);
|
19
|
+
useClickAway(function () {
|
20
|
+
graph.clearContextMenuInfo();
|
21
|
+
}, containerRef);
|
22
|
+
var onDeleteEdge = useCallback(function () {
|
23
|
+
graph.onDeleteEdges(data.edge);
|
24
|
+
graph.clearContextMenuInfo();
|
25
|
+
}, [graph, data]);
|
26
|
+
|
27
|
+
var _graphPointToOffsetPo = graphPointToOffsetPoint(graph.graph, data, graph.wrapper),
|
28
|
+
left = _graphPointToOffsetPo.x,
|
29
|
+
top = _graphPointToOffsetPo.y;
|
30
|
+
|
31
|
+
return /*#__PURE__*/React.createElement("div", {
|
32
|
+
ref: containerRef,
|
33
|
+
className: "edgeContextMenu",
|
34
|
+
style: {
|
35
|
+
top: top,
|
36
|
+
left: left
|
37
|
+
}
|
38
|
+
}, /*#__PURE__*/React.createElement(_Menu, null, /*#__PURE__*/React.createElement(_Menu.Item, {
|
39
|
+
onClick: onDeleteEdge,
|
40
|
+
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
41
|
+
}, tr('删除'))));
|
42
|
+
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import "antd/es/menu/style";
|
2
|
+
import _Menu from "antd/es/menu";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* @Author: wangxian
|
6
|
+
* @Date: 2022-05-27 16:04:27
|
7
|
+
* @LastEditTime: 2022-05-28 10:07:54
|
8
|
+
*/
|
9
|
+
import React, { useRef } from 'react';
|
10
|
+
import { ReloadOutlined } from '@ant-design/icons';
|
11
|
+
import { useClickAway } from 'ahooks';
|
12
|
+
import { graphPointToOffsetPoint } from '../../../utils';
|
13
|
+
import { tr } from '../../../../../framework/locale';
|
14
|
+
import './index.less';
|
15
|
+
export var GraphContextMenu = function GraphContextMenu(props) {
|
16
|
+
var graph = props.graph,
|
17
|
+
data = props.data;
|
18
|
+
var containerRef = useRef(null);
|
19
|
+
useClickAway(function () {
|
20
|
+
graph.clearContextMenuInfo();
|
21
|
+
}, containerRef);
|
22
|
+
|
23
|
+
var onRefresh = function onRefresh() {};
|
24
|
+
|
25
|
+
var _graphPointToOffsetPo = graphPointToOffsetPoint(graph.graph, data, graph.wrapper),
|
26
|
+
left = _graphPointToOffsetPo.x,
|
27
|
+
top = _graphPointToOffsetPo.y;
|
28
|
+
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
30
|
+
ref: containerRef,
|
31
|
+
className: "graphContextMenu",
|
32
|
+
style: {
|
33
|
+
top: top,
|
34
|
+
left: left
|
35
|
+
}
|
36
|
+
}, /*#__PURE__*/React.createElement(_Menu, null, /*#__PURE__*/React.createElement(_Menu.Item, {
|
37
|
+
onClick: onRefresh,
|
38
|
+
icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
|
39
|
+
}, tr('刷新'))));
|
40
|
+
};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import "antd/es/menu/style";
|
2
|
+
import _Menu from "antd/es/menu";
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
5
|
+
import { DeleteOutlined } from '@ant-design/icons';
|
6
|
+
import React from 'react';
|
7
|
+
import { useClickAway } from 'ahooks';
|
8
|
+
import { graphPointToOffsetPoint } from '../../../utils';
|
9
|
+
import { tr } from '../../../../../framework/locale';
|
10
|
+
import './index.less';
|
11
|
+
|
12
|
+
var NodeContextMenu = function NodeContextMenu(props) {
|
13
|
+
var graph = props.graph,
|
14
|
+
data = props.data;
|
15
|
+
var containerRef = React.useRef(null);
|
16
|
+
useClickAway(function () {
|
17
|
+
graph.clearContextMenuInfo();
|
18
|
+
}, containerRef);
|
19
|
+
var onNodeDel = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
21
|
+
while (1) {
|
22
|
+
switch (_context.prev = _context.next) {
|
23
|
+
case 0:
|
24
|
+
_context.next = 2;
|
25
|
+
return graph.onDeleteNodes([data.node.id]);
|
26
|
+
|
27
|
+
case 2:
|
28
|
+
graph.clearContextMenuInfo();
|
29
|
+
|
30
|
+
case 3:
|
31
|
+
case "end":
|
32
|
+
return _context.stop();
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}, _callee);
|
36
|
+
})), [graph]);
|
37
|
+
|
38
|
+
var _graphPointToOffsetPo = graphPointToOffsetPoint(graph.graph, data, graph.wrapper),
|
39
|
+
left = _graphPointToOffsetPo.x,
|
40
|
+
top = _graphPointToOffsetPo.y;
|
41
|
+
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
43
|
+
ref: containerRef,
|
44
|
+
className: "graphContextMenu",
|
45
|
+
style: {
|
46
|
+
top: top,
|
47
|
+
left: left
|
48
|
+
}
|
49
|
+
}, /*#__PURE__*/React.createElement(_Menu, null, /*#__PURE__*/React.createElement(_Menu.Item, {
|
50
|
+
onClick: onNodeDel,
|
51
|
+
icon: /*#__PURE__*/React.createElement(DeleteOutlined, null)
|
52
|
+
}, tr('删除')))));
|
53
|
+
};
|
54
|
+
|
55
|
+
export default NodeContextMenu;
|
@@ -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,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.less';
|
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
|
+
});
|