ronds-metadata 1.1.19 → 1.1.22
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/DragNode.js +2 -2
- package/es/comps/DynamicPorts/graph.d.ts +4 -3
- package/es/comps/DynamicPorts/graph.js +93 -50
- package/es/comps/DynamicPorts/index.d.ts +5 -0
- package/es/comps/DynamicPorts/index.js +5 -3
- package/es/config.d.ts +1 -1
- package/es/config.js +2 -4
- package/package.json +1 -1
@@ -3,7 +3,7 @@ import React from "react";
|
|
3
3
|
/*
|
4
4
|
* @Author: wangxian
|
5
5
|
* @Date: 2022-05-26 08:50:06
|
6
|
-
* @LastEditTime: 2022-06-25 10:
|
6
|
+
* @LastEditTime: 2022-06-25 10:46:48
|
7
7
|
*/
|
8
8
|
import { DragSource } from 'react-dnd';
|
9
9
|
import { GlobalOutlined } from '@ant-design/icons';
|
@@ -18,7 +18,7 @@ var InnerNodeTitle = function InnerNodeTitle(props) {
|
|
18
18
|
return /*#__PURE__*/React.createElement("div", null, connectDragPreview(connectDragSource( /*#__PURE__*/React.createElement("div", {
|
19
19
|
className: "node-element",
|
20
20
|
style: {
|
21
|
-
width: '100%
|
21
|
+
width: '100%'
|
22
22
|
}
|
23
23
|
}, /*#__PURE__*/React.createElement("div", {
|
24
24
|
className: "icon"
|
@@ -29,10 +29,11 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
|
29
29
|
factory$: IFactory$;
|
30
30
|
dpGraphSub?: Subscription;
|
31
31
|
constructor(graphData?: NDPGraph.GraphData);
|
32
|
-
initialize(graphData
|
32
|
+
initialize(graphData?: NDPGraph.GraphData): Promise<void>;
|
33
33
|
loadDPGraph(graphData: any): Promise<void>;
|
34
34
|
isGraphReady(): boolean;
|
35
35
|
renderGraph: (wrapper: HTMLElement, container: HTMLElement) => void;
|
36
|
+
renderGraphData: (graphData: NDPGraph.GraphData) => Promise<void>;
|
36
37
|
renderNode(nodeMeta: NodeMeta): BaseNode | undefined;
|
37
38
|
renderEdge(edgeMeta: EdgeMeta): BaseEdge | undefined;
|
38
39
|
addDragNode(data: NDPGraph.Node): void;
|
@@ -58,6 +59,6 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
|
58
59
|
dispose(): void;
|
59
60
|
}
|
60
61
|
export declare let gDPGraph: DPGraph;
|
61
|
-
export
|
62
|
+
export default DPGraph;
|
63
|
+
export declare const useDPGraph: (graphData?: NDPGraph.GraphData) => DPGraph;
|
62
64
|
export declare const useUnmountDPGraph: () => void;
|
63
|
-
export {};
|
@@ -186,6 +186,44 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
186
186
|
});
|
187
187
|
};
|
188
188
|
|
189
|
+
_this.renderGraphData = /*#__PURE__*/function () {
|
190
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(graphData) {
|
191
|
+
var oldGraph, _formatGraphData2, nodes, edges;
|
192
|
+
|
193
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
194
|
+
while (1) {
|
195
|
+
switch (_context.prev = _context.next) {
|
196
|
+
case 0:
|
197
|
+
// 清除已有的图谱
|
198
|
+
oldGraph = _this.factory$.dpGraph.getValue();
|
199
|
+
|
200
|
+
_this.deleteNodes(oldGraph.nodes.map(function (it) {
|
201
|
+
return it.id;
|
202
|
+
}));
|
203
|
+
|
204
|
+
_formatGraphData2 = formatGraphData(graphData), nodes = _formatGraphData2.nodes, edges = _formatGraphData2.edges;
|
205
|
+
nodes.forEach(function (nodeMeta) {
|
206
|
+
return _this.renderNode(nodeMeta);
|
207
|
+
});
|
208
|
+
edges.forEach(function (edgeMeta) {
|
209
|
+
return _this.renderEdge(edgeMeta);
|
210
|
+
});
|
211
|
+
|
212
|
+
_this.loadDPGraph(graphData);
|
213
|
+
|
214
|
+
case 6:
|
215
|
+
case "end":
|
216
|
+
return _context.stop();
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}, _callee);
|
220
|
+
}));
|
221
|
+
|
222
|
+
return function (_x) {
|
223
|
+
return _ref3.apply(this, arguments);
|
224
|
+
};
|
225
|
+
}();
|
226
|
+
|
189
227
|
_this.zoomGraph = function (factor) {
|
190
228
|
_this.zoom(factor);
|
191
229
|
};
|
@@ -231,36 +269,39 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
231
269
|
_createClass(DPGraph, [{
|
232
270
|
key: "initialize",
|
233
271
|
value: function () {
|
234
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
235
|
-
return _regeneratorRuntime.wrap(function
|
272
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(graphData) {
|
273
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
236
274
|
while (1) {
|
237
|
-
switch (
|
275
|
+
switch (_context2.prev = _context2.next) {
|
238
276
|
case 0:
|
239
277
|
this.factory$.loading.next(true);
|
240
|
-
|
241
|
-
|
242
|
-
return this.loadDPGraph(graphData
|
278
|
+
_context2.prev = 1;
|
279
|
+
_context2.next = 4;
|
280
|
+
return this.loadDPGraph(graphData || {
|
281
|
+
nodes: [],
|
282
|
+
edges: []
|
283
|
+
});
|
243
284
|
|
244
285
|
case 4:
|
245
286
|
this.factory$.loading.next(false);
|
246
|
-
|
287
|
+
_context2.next = 11;
|
247
288
|
break;
|
248
289
|
|
249
290
|
case 7:
|
250
|
-
|
251
|
-
|
291
|
+
_context2.prev = 7;
|
292
|
+
_context2.t0 = _context2["catch"](1);
|
252
293
|
this.factory$.loading.next(false);
|
253
|
-
console.error('加载实验错误',
|
294
|
+
console.error('加载实验错误', _context2.t0);
|
254
295
|
|
255
296
|
case 11:
|
256
297
|
case "end":
|
257
|
-
return
|
298
|
+
return _context2.stop();
|
258
299
|
}
|
259
300
|
}
|
260
|
-
},
|
301
|
+
}, _callee2, this, [[1, 7]]);
|
261
302
|
}));
|
262
303
|
|
263
|
-
function initialize(
|
304
|
+
function initialize(_x2) {
|
264
305
|
return _initialize.apply(this, arguments);
|
265
306
|
}
|
266
307
|
|
@@ -270,27 +311,28 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
270
311
|
}, {
|
271
312
|
key: "loadDPGraph",
|
272
313
|
value: function () {
|
273
|
-
var _loadDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
274
|
-
return _regeneratorRuntime.wrap(function
|
314
|
+
var _loadDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(graphData) {
|
315
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
275
316
|
while (1) {
|
276
|
-
switch (
|
317
|
+
switch (_context3.prev = _context3.next) {
|
277
318
|
case 0:
|
278
319
|
this.factory$.dpGraph.next(graphData);
|
279
320
|
|
280
321
|
case 1:
|
281
322
|
case "end":
|
282
|
-
return
|
323
|
+
return _context3.stop();
|
283
324
|
}
|
284
325
|
}
|
285
|
-
},
|
326
|
+
}, _callee3, this);
|
286
327
|
}));
|
287
328
|
|
288
|
-
function loadDPGraph(
|
329
|
+
function loadDPGraph(_x3) {
|
289
330
|
return _loadDPGraph.apply(this, arguments);
|
290
331
|
}
|
291
332
|
|
292
333
|
return loadDPGraph;
|
293
|
-
}() //
|
334
|
+
}() //
|
335
|
+
// 判断画布是否准备完成
|
294
336
|
|
295
337
|
}, {
|
296
338
|
key: "isGraphReady",
|
@@ -341,18 +383,18 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
341
383
|
}, {
|
342
384
|
key: "updateDPGraph",
|
343
385
|
value: function () {
|
344
|
-
var _updateDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
386
|
+
var _updateDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
345
387
|
var nodes,
|
346
388
|
edges,
|
347
389
|
oldGraph,
|
348
390
|
newGraph,
|
349
|
-
|
350
|
-
return _regeneratorRuntime.wrap(function
|
391
|
+
_args4 = arguments;
|
392
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
351
393
|
while (1) {
|
352
|
-
switch (
|
394
|
+
switch (_context4.prev = _context4.next) {
|
353
395
|
case 0:
|
354
|
-
nodes =
|
355
|
-
edges =
|
396
|
+
nodes = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
|
397
|
+
edges = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : [];
|
356
398
|
oldGraph = this.factory$.dpGraph.getValue();
|
357
399
|
newGraph = produce(oldGraph, function (nextGraph) {
|
358
400
|
if (nodes.length) {
|
@@ -371,10 +413,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
371
413
|
|
372
414
|
case 5:
|
373
415
|
case "end":
|
374
|
-
return
|
416
|
+
return _context4.stop();
|
375
417
|
}
|
376
418
|
}
|
377
|
-
},
|
419
|
+
}, _callee4, this);
|
378
420
|
}));
|
379
421
|
|
380
422
|
function updateDPGraph() {
|
@@ -387,18 +429,18 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
387
429
|
}, {
|
388
430
|
key: "delDPGraphElement",
|
389
431
|
value: function () {
|
390
|
-
var _delDPGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
432
|
+
var _delDPGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
391
433
|
var nodes,
|
392
434
|
edges,
|
393
435
|
oldGraph,
|
394
436
|
newGraph,
|
395
|
-
|
396
|
-
return _regeneratorRuntime.wrap(function
|
437
|
+
_args5 = arguments;
|
438
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
397
439
|
while (1) {
|
398
|
-
switch (
|
440
|
+
switch (_context5.prev = _context5.next) {
|
399
441
|
case 0:
|
400
|
-
nodes =
|
401
|
-
edges =
|
442
|
+
nodes = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : [];
|
443
|
+
edges = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : [];
|
402
444
|
oldGraph = this.factory$.dpGraph.getValue();
|
403
445
|
newGraph = produce(oldGraph, function (nextGraph) {
|
404
446
|
if (nodes.length) {
|
@@ -422,10 +464,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
422
464
|
|
423
465
|
case 5:
|
424
466
|
case "end":
|
425
|
-
return
|
467
|
+
return _context5.stop();
|
426
468
|
}
|
427
469
|
}
|
428
|
-
},
|
470
|
+
}, _callee5, this);
|
429
471
|
}));
|
430
472
|
|
431
473
|
function delDPGraphElement() {
|
@@ -439,12 +481,12 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
439
481
|
key: "onConnectNode",
|
440
482
|
value: // 处理连线事件
|
441
483
|
function () {
|
442
|
-
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
484
|
+
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(args) {
|
443
485
|
var _args$edge, edge, isNew, source, target, node, portId, data;
|
444
486
|
|
445
|
-
return _regeneratorRuntime.wrap(function
|
487
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
446
488
|
while (1) {
|
447
|
-
switch (
|
489
|
+
switch (_context6.prev = _context6.next) {
|
448
490
|
case 0:
|
449
491
|
_args$edge = args.edge, edge = _args$edge === void 0 ? {} : _args$edge, isNew = args.isNew;
|
450
492
|
source = edge.source, target = edge.target;
|
@@ -476,19 +518,19 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
476
518
|
}
|
477
519
|
}
|
478
520
|
|
479
|
-
return
|
521
|
+
return _context6.abrupt("return", {
|
480
522
|
success: true
|
481
523
|
});
|
482
524
|
|
483
525
|
case 4:
|
484
526
|
case "end":
|
485
|
-
return
|
527
|
+
return _context6.stop();
|
486
528
|
}
|
487
529
|
}
|
488
|
-
},
|
530
|
+
}, _callee6, this);
|
489
531
|
}));
|
490
532
|
|
491
|
-
function onConnectNode(
|
533
|
+
function onConnectNode(_x4) {
|
492
534
|
return _onConnectNode.apply(this, arguments);
|
493
535
|
}
|
494
536
|
|
@@ -563,13 +605,13 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
563
605
|
}, {
|
564
606
|
key: "onMoveNodes",
|
565
607
|
value: function () {
|
566
|
-
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
608
|
+
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(movedNodes) {
|
567
609
|
var _this2 = this;
|
568
610
|
|
569
611
|
var targetNodes, newPos, oldGraph, newGraph;
|
570
|
-
return _regeneratorRuntime.wrap(function
|
612
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
571
613
|
while (1) {
|
572
|
-
switch (
|
614
|
+
switch (_context7.prev = _context7.next) {
|
573
615
|
case 0:
|
574
616
|
targetNodes = movedNodes.filter(function (arg) {
|
575
617
|
var node = arg.node;
|
@@ -618,13 +660,13 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
618
660
|
|
619
661
|
case 2:
|
620
662
|
case "end":
|
621
|
-
return
|
663
|
+
return _context7.stop();
|
622
664
|
}
|
623
665
|
}
|
624
|
-
},
|
666
|
+
}, _callee7, this);
|
625
667
|
}));
|
626
668
|
|
627
|
-
function onMoveNodes(
|
669
|
+
function onMoveNodes(_x5) {
|
628
670
|
return _onMoveNodes.apply(this, arguments);
|
629
671
|
}
|
630
672
|
|
@@ -640,7 +682,8 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
640
682
|
return DPGraph;
|
641
683
|
}(GraphCore);
|
642
684
|
|
643
|
-
export var gDPGraph;
|
685
|
+
export var gDPGraph;
|
686
|
+
export default DPGraph; // 获取图的实例
|
644
687
|
|
645
688
|
export var useDPGraph = function useDPGraph(graphData) {
|
646
689
|
gDPGraph = new DPGraph(graphData);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import './index.less';
|
2
2
|
import './comps/shape/connector';
|
3
|
+
import DPGraph from './graph';
|
3
4
|
import { NDPGraph } from './interface';
|
4
5
|
interface IDynamicPortsProps {
|
5
6
|
/**
|
@@ -14,6 +15,10 @@ interface IDynamicPortsProps {
|
|
14
15
|
* 节点选中事件
|
15
16
|
*/
|
16
17
|
onNodeSelect?: (data: NDPGraph.Node) => void;
|
18
|
+
/**
|
19
|
+
* 获取实例
|
20
|
+
*/
|
21
|
+
getDPGraphInstance?: (data: DPGraph) => void;
|
17
22
|
}
|
18
23
|
declare const DynamicPorts: (props: IDynamicPortsProps) => JSX.Element;
|
19
24
|
export default DynamicPorts;
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
/*
|
5
5
|
* @Author: wangxian
|
6
6
|
* @Date: 2022-05-16 18:53:31
|
7
|
-
* @LastEditTime: 2022-
|
7
|
+
* @LastEditTime: 2022-06-28 14:58:00
|
8
8
|
*/
|
9
9
|
import React from 'react';
|
10
10
|
import { filter } from 'rxjs';
|
@@ -20,7 +20,8 @@ import { GraphHandler } from './comps/GraphHandler';
|
|
20
20
|
var DynamicPorts = function DynamicPorts(props) {
|
21
21
|
var defaultValue = props.defaultValue,
|
22
22
|
onChange = props.onChange,
|
23
|
-
onNodeSelect = props.onNodeSelect
|
23
|
+
onNodeSelect = props.onNodeSelect,
|
24
|
+
getDPGraphInstance = props.getDPGraphInstance;
|
24
25
|
var divRef = React.useRef(null);
|
25
26
|
var containerRef = React.useRef(null);
|
26
27
|
|
@@ -55,9 +56,10 @@ var DynamicPorts = function DynamicPorts(props) {
|
|
55
56
|
onNodeSelect && onNodeSelect(v[0]);
|
56
57
|
});
|
57
58
|
|
59
|
+
getDPGraphInstance && getDPGraphInstance(_dpGraph);
|
58
60
|
firstLoadRef.current = false;
|
59
61
|
}
|
60
|
-
}, []); // 处理组件拖拽落下事件
|
62
|
+
}, [defaultValue]); // 处理组件拖拽落下事件
|
61
63
|
|
62
64
|
var _useDrop = useDrop({
|
63
65
|
accept: [DRAGGABLE_COMPONENT, DRAGGABLE_MODEL],
|
package/es/config.d.ts
CHANGED
package/es/config.js
CHANGED
@@ -3,11 +3,9 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
/*
|
4
4
|
* @Author: wangxian
|
5
5
|
* @Date: 2021-09-18 14:15:04
|
6
|
-
* @LastEditTime: 2022-
|
6
|
+
* @LastEditTime: 2022-06-28 15:09:29
|
7
7
|
*/
|
8
|
-
import { BehaviorSubject } from 'rxjs
|
9
|
-
import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
|
10
|
-
import { map } from 'rxjs/internal/operators/map';
|
8
|
+
import { BehaviorSubject, map, distinctUntilChanged } from 'rxjs';
|
11
9
|
import { setLocale } from './comps/locales/index';
|
12
10
|
import * as jq from './framework/libs/jquery.min.js';
|
13
11
|
import { localeKey } from './framework/locale';
|