ronds-metadata 1.1.20 → 1.1.23
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/graph.d.ts +2 -1
- package/es/comps/DynamicPorts/graph.js +89 -49
- package/es/comps/DynamicPorts/index.d.ts +5 -0
- package/es/comps/DynamicPorts/index.js +4 -2
- package/es/comps/MetadataForm/DataCell/Select.js +5 -1
- package/es/config.d.ts +1 -1
- package/es/config.js +2 -4
- package/package.json +1 -1
@@ -33,6 +33,7 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
|
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;
|
62
|
+
export default DPGraph;
|
61
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,14 +269,14 @@ 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
|
-
|
278
|
+
_context2.prev = 1;
|
279
|
+
_context2.next = 4;
|
242
280
|
return this.loadDPGraph(graphData || {
|
243
281
|
nodes: [],
|
244
282
|
edges: []
|
@@ -246,24 +284,24 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
246
284
|
|
247
285
|
case 4:
|
248
286
|
this.factory$.loading.next(false);
|
249
|
-
|
287
|
+
_context2.next = 11;
|
250
288
|
break;
|
251
289
|
|
252
290
|
case 7:
|
253
|
-
|
254
|
-
|
291
|
+
_context2.prev = 7;
|
292
|
+
_context2.t0 = _context2["catch"](1);
|
255
293
|
this.factory$.loading.next(false);
|
256
|
-
console.error('加载实验错误',
|
294
|
+
console.error('加载实验错误', _context2.t0);
|
257
295
|
|
258
296
|
case 11:
|
259
297
|
case "end":
|
260
|
-
return
|
298
|
+
return _context2.stop();
|
261
299
|
}
|
262
300
|
}
|
263
|
-
},
|
301
|
+
}, _callee2, this, [[1, 7]]);
|
264
302
|
}));
|
265
303
|
|
266
|
-
function initialize(
|
304
|
+
function initialize(_x2) {
|
267
305
|
return _initialize.apply(this, arguments);
|
268
306
|
}
|
269
307
|
|
@@ -273,27 +311,28 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
273
311
|
}, {
|
274
312
|
key: "loadDPGraph",
|
275
313
|
value: function () {
|
276
|
-
var _loadDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
277
|
-
return _regeneratorRuntime.wrap(function
|
314
|
+
var _loadDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(graphData) {
|
315
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
278
316
|
while (1) {
|
279
|
-
switch (
|
317
|
+
switch (_context3.prev = _context3.next) {
|
280
318
|
case 0:
|
281
319
|
this.factory$.dpGraph.next(graphData);
|
282
320
|
|
283
321
|
case 1:
|
284
322
|
case "end":
|
285
|
-
return
|
323
|
+
return _context3.stop();
|
286
324
|
}
|
287
325
|
}
|
288
|
-
},
|
326
|
+
}, _callee3, this);
|
289
327
|
}));
|
290
328
|
|
291
|
-
function loadDPGraph(
|
329
|
+
function loadDPGraph(_x3) {
|
292
330
|
return _loadDPGraph.apply(this, arguments);
|
293
331
|
}
|
294
332
|
|
295
333
|
return loadDPGraph;
|
296
|
-
}() //
|
334
|
+
}() //
|
335
|
+
// 判断画布是否准备完成
|
297
336
|
|
298
337
|
}, {
|
299
338
|
key: "isGraphReady",
|
@@ -344,18 +383,18 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
344
383
|
}, {
|
345
384
|
key: "updateDPGraph",
|
346
385
|
value: function () {
|
347
|
-
var _updateDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
386
|
+
var _updateDPGraph = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
348
387
|
var nodes,
|
349
388
|
edges,
|
350
389
|
oldGraph,
|
351
390
|
newGraph,
|
352
|
-
|
353
|
-
return _regeneratorRuntime.wrap(function
|
391
|
+
_args4 = arguments;
|
392
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
354
393
|
while (1) {
|
355
|
-
switch (
|
394
|
+
switch (_context4.prev = _context4.next) {
|
356
395
|
case 0:
|
357
|
-
nodes =
|
358
|
-
edges =
|
396
|
+
nodes = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
|
397
|
+
edges = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : [];
|
359
398
|
oldGraph = this.factory$.dpGraph.getValue();
|
360
399
|
newGraph = produce(oldGraph, function (nextGraph) {
|
361
400
|
if (nodes.length) {
|
@@ -374,10 +413,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
374
413
|
|
375
414
|
case 5:
|
376
415
|
case "end":
|
377
|
-
return
|
416
|
+
return _context4.stop();
|
378
417
|
}
|
379
418
|
}
|
380
|
-
},
|
419
|
+
}, _callee4, this);
|
381
420
|
}));
|
382
421
|
|
383
422
|
function updateDPGraph() {
|
@@ -390,18 +429,18 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
390
429
|
}, {
|
391
430
|
key: "delDPGraphElement",
|
392
431
|
value: function () {
|
393
|
-
var _delDPGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
432
|
+
var _delDPGraphElement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
394
433
|
var nodes,
|
395
434
|
edges,
|
396
435
|
oldGraph,
|
397
436
|
newGraph,
|
398
|
-
|
399
|
-
return _regeneratorRuntime.wrap(function
|
437
|
+
_args5 = arguments;
|
438
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
400
439
|
while (1) {
|
401
|
-
switch (
|
440
|
+
switch (_context5.prev = _context5.next) {
|
402
441
|
case 0:
|
403
|
-
nodes =
|
404
|
-
edges =
|
442
|
+
nodes = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : [];
|
443
|
+
edges = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : [];
|
405
444
|
oldGraph = this.factory$.dpGraph.getValue();
|
406
445
|
newGraph = produce(oldGraph, function (nextGraph) {
|
407
446
|
if (nodes.length) {
|
@@ -425,10 +464,10 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
425
464
|
|
426
465
|
case 5:
|
427
466
|
case "end":
|
428
|
-
return
|
467
|
+
return _context5.stop();
|
429
468
|
}
|
430
469
|
}
|
431
|
-
},
|
470
|
+
}, _callee5, this);
|
432
471
|
}));
|
433
472
|
|
434
473
|
function delDPGraphElement() {
|
@@ -442,12 +481,12 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
442
481
|
key: "onConnectNode",
|
443
482
|
value: // 处理连线事件
|
444
483
|
function () {
|
445
|
-
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
484
|
+
var _onConnectNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(args) {
|
446
485
|
var _args$edge, edge, isNew, source, target, node, portId, data;
|
447
486
|
|
448
|
-
return _regeneratorRuntime.wrap(function
|
487
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
449
488
|
while (1) {
|
450
|
-
switch (
|
489
|
+
switch (_context6.prev = _context6.next) {
|
451
490
|
case 0:
|
452
491
|
_args$edge = args.edge, edge = _args$edge === void 0 ? {} : _args$edge, isNew = args.isNew;
|
453
492
|
source = edge.source, target = edge.target;
|
@@ -479,19 +518,19 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
479
518
|
}
|
480
519
|
}
|
481
520
|
|
482
|
-
return
|
521
|
+
return _context6.abrupt("return", {
|
483
522
|
success: true
|
484
523
|
});
|
485
524
|
|
486
525
|
case 4:
|
487
526
|
case "end":
|
488
|
-
return
|
527
|
+
return _context6.stop();
|
489
528
|
}
|
490
529
|
}
|
491
|
-
},
|
530
|
+
}, _callee6, this);
|
492
531
|
}));
|
493
532
|
|
494
|
-
function onConnectNode(
|
533
|
+
function onConnectNode(_x4) {
|
495
534
|
return _onConnectNode.apply(this, arguments);
|
496
535
|
}
|
497
536
|
|
@@ -566,13 +605,13 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
566
605
|
}, {
|
567
606
|
key: "onMoveNodes",
|
568
607
|
value: function () {
|
569
|
-
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
608
|
+
var _onMoveNodes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(movedNodes) {
|
570
609
|
var _this2 = this;
|
571
610
|
|
572
611
|
var targetNodes, newPos, oldGraph, newGraph;
|
573
|
-
return _regeneratorRuntime.wrap(function
|
612
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
574
613
|
while (1) {
|
575
|
-
switch (
|
614
|
+
switch (_context7.prev = _context7.next) {
|
576
615
|
case 0:
|
577
616
|
targetNodes = movedNodes.filter(function (arg) {
|
578
617
|
var node = arg.node;
|
@@ -621,13 +660,13 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
621
660
|
|
622
661
|
case 2:
|
623
662
|
case "end":
|
624
|
-
return
|
663
|
+
return _context7.stop();
|
625
664
|
}
|
626
665
|
}
|
627
|
-
},
|
666
|
+
}, _callee7, this);
|
628
667
|
}));
|
629
668
|
|
630
|
-
function onMoveNodes(
|
669
|
+
function onMoveNodes(_x5) {
|
631
670
|
return _onMoveNodes.apply(this, arguments);
|
632
671
|
}
|
633
672
|
|
@@ -643,7 +682,8 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
643
682
|
return DPGraph;
|
644
683
|
}(GraphCore);
|
645
684
|
|
646
|
-
export var gDPGraph;
|
685
|
+
export var gDPGraph;
|
686
|
+
export default DPGraph; // 获取图的实例
|
647
687
|
|
648
688
|
export var useDPGraph = function useDPGraph(graphData) {
|
649
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-06-
|
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,6 +56,7 @@ 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]); // 处理组件拖拽落下事件
|
@@ -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-
|
17
|
+
* @LastEditTime: 2022-07-04 15:54:53
|
18
18
|
*/
|
19
19
|
import React from 'react';
|
20
20
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -221,6 +221,10 @@ function Index(props) {
|
|
221
221
|
disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
|
222
222
|
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
|
223
223
|
options: httpOptions && httpOptions.length > 0 ? httpOptions : options,
|
224
|
+
showSearch: true,
|
225
|
+
filterOption: function filterOption(input, option) {
|
226
|
+
return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
|
227
|
+
},
|
224
228
|
getPopupContainer: function getPopupContainer(triggerNode) {
|
225
229
|
return triggerNode.parentNode;
|
226
230
|
},
|
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';
|