ronds-metadata 1.2.9 → 1.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
- package/es/comps/FormGenerator/settings/index.d.ts +652 -86
- package/es/comps/MetadataForm/index.less +1 -1
- package/package.json +1 -1
- package/es/api/index.js +0 -249
- package/es/comps/DynamicPorts/comps/ContextMenu.js +0 -44
- package/es/comps/DynamicPorts/comps/DragNode.js +0 -55
- package/es/comps/DynamicPorts/comps/GraphHandler/index.js +0 -51
- package/es/comps/DynamicPorts/comps/NodeElement.js +0 -30
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +0 -42
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +0 -40
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +0 -55
- package/es/comps/DynamicPorts/comps/shape/connector.js +0 -19
- package/es/comps/DynamicPorts/comps/shape/edge.js +0 -91
- package/es/comps/DynamicPorts/comps/shape/node.js +0 -190
- package/es/comps/DynamicPorts/constant/index.js +0 -19
- package/es/comps/DynamicPorts/graph.js +0 -697
- package/es/comps/DynamicPorts/index.js +0 -143
- package/es/comps/DynamicPorts/interface.js +0 -6
- package/es/comps/DynamicPorts/utils.js +0 -127
- package/es/comps/Editable/DataCell/ButtonCell.js +0 -45
- package/es/comps/Editable/DataCell/ColorPicker.js +0 -33
- package/es/comps/Editable/DataCell/Input.js +0 -54
- package/es/comps/Editable/DataCell/Number.js +0 -44
- package/es/comps/Editable/DataCell/Select.js +0 -48
- package/es/comps/Editable/DataCell/Switch.js +0 -33
- package/es/comps/Editable/comps/EditableAction.js +0 -110
- package/es/comps/Editable/comps/EditableCell.js +0 -108
- package/es/comps/Editable/comps/EditableHeardCell.js +0 -172
- package/es/comps/Editable/comps/EditableRow.js +0 -118
- package/es/comps/Editable/comps/Texty.js +0 -277
- package/es/comps/Editable/index.js +0 -385
- package/es/comps/Editable/interface.js +0 -8
- package/es/comps/Editable/utils.js +0 -46
- package/es/comps/FileView/index.js +0 -198
- package/es/comps/FormGenerator/Provider.js +0 -8
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +0 -16
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +0 -50
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +0 -50
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +0 -55
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +0 -13
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +0 -14
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +0 -17
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +0 -250
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +0 -60
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +0 -313
- package/es/comps/FormGenerator/comps/Canvas/index.js +0 -118
- package/es/comps/FormGenerator/comps/Settings/index.js +0 -150
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +0 -48
- package/es/comps/FormGenerator/comps/Sidebar/index.js +0 -37
- package/es/comps/FormGenerator/index.js +0 -67
- package/es/comps/FormGenerator/settings/index.js +0 -307
- package/es/comps/FormGenerator/settings/ruleConfig.js +0 -557
- package/es/comps/FormGenerator/transformer.js +0 -223
- package/es/comps/Icons/index.js +0 -23
- package/es/comps/JsonEdit/constant/index.js +0 -87
- package/es/comps/JsonEdit/index.js +0 -221
- package/es/comps/JsonView/index.js +0 -109
- package/es/comps/MdEdit/index.js +0 -41
- package/es/comps/MdNavbar/index.js +0 -180
- package/es/comps/MdNavbar/utils.js +0 -34
- package/es/comps/MdView/index.js +0 -70
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +0 -419
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +0 -368
- package/es/comps/MetadataEdit/constant/index.js +0 -69
- package/es/comps/MetadataEdit/hooks/index.js +0 -43
- package/es/comps/MetadataEdit/index.js +0 -255
- package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +0 -237
- package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +0 -367
- package/es/comps/MetadataEditV2/constant/index.js +0 -69
- package/es/comps/MetadataEditV2/hooks/index.js +0 -43
- package/es/comps/MetadataEditV2/index.js +0 -298
- package/es/comps/MetadataForm/DataCell/Array.js +0 -147
- package/es/comps/MetadataForm/DataCell/Input.js +0 -199
- package/es/comps/MetadataForm/DataCell/Number.js +0 -130
- package/es/comps/MetadataForm/DataCell/Ref.js +0 -325
- package/es/comps/MetadataForm/DataCell/Select.js +0 -518
- package/es/comps/MetadataForm/DataCell/Switch.js +0 -115
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +0 -359
- package/es/comps/MetadataForm/HOC/index.js +0 -125
- package/es/comps/MetadataForm/constants.js +0 -11
- package/es/comps/MetadataForm/hooks/index.js +0 -128
- package/es/comps/MetadataForm/index.js +0 -268
- package/es/comps/MetadataForm/interface.js +0 -8
- package/es/comps/MetadataForm/utils.js +0 -112
- package/es/comps/locales/en-US.js +0 -24
- package/es/comps/locales/index.js +0 -8
- package/es/comps/locales/zh-CN.js +0 -24
- package/es/config.js +0 -50
- package/es/framework/graph/index.js +0 -515
- package/es/framework/hooks/use-async-memo.js +0 -32
- package/es/framework/hooks/use-sync-scroll.js +0 -106
- package/es/framework/http/cache.js +0 -137
- package/es/framework/http/cancel.js +0 -44
- package/es/framework/http/index.js +0 -392
- package/es/framework/http/msgpack.js +0 -34
- package/es/framework/http/msgpack5/index.js +0 -84
- package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +0 -71
- package/es/framework/http/msgpack5/lib/decoder.js +0 -287
- package/es/framework/http/msgpack5/lib/encoder.js +0 -252
- package/es/framework/http/msgpack5/lib/helpers.js +0 -23
- package/es/framework/http/msgpack5/lib/streams.js +0 -93
- package/es/framework/http/types.js +0 -1
- package/es/framework/libs/jquery.min.js +0 -4022
- package/es/framework/locale/dil8/di18n.js +0 -132
- package/es/framework/locale/dil8/index.js +0 -3
- package/es/framework/locale/dil8/translate.js +0 -76
- package/es/framework/locale/dil8/util.js +0 -17
- package/es/framework/locale/index.js +0 -26
- package/es/framework/metadata/MetadataService.js +0 -169
- package/es/framework/metadata/index.js +0 -384
- package/es/framework/rxjs-hooks/useMemoSubject.js +0 -16
- package/es/framework/rxjs-hooks/useObservable.js +0 -22
- package/es/framework/rxjs-hooks/useObservableState.js +0 -45
- package/es/index.js +0 -27
- package/es/utils.js +0 -138
package/package.json
CHANGED
package/es/api/index.js
DELETED
@@ -1,249 +0,0 @@
|
|
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 };
|
@@ -1,44 +0,0 @@
|
|
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;
|
@@ -1,55 +0,0 @@
|
|
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;
|
@@ -1,51 +0,0 @@
|
|
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
|
-
};
|
@@ -1,30 +0,0 @@
|
|
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;
|
@@ -1,42 +0,0 @@
|
|
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
|
-
};
|
@@ -1,40 +0,0 @@
|
|
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
|
-
};
|
@@ -1,55 +0,0 @@
|
|
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;
|
@@ -1,19 +0,0 @@
|
|
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);
|