ronds-metadata 1.2.90 → 1.2.92
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.
|
@@ -54,6 +54,7 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
|
|
|
54
54
|
edges: DPEdge[];
|
|
55
55
|
}): void;
|
|
56
56
|
onContextMenu(data: ContextMenuInfo): any;
|
|
57
|
+
updateNodeNameById(id: string, name: string): void;
|
|
57
58
|
clearContextMenuInfo: () => void;
|
|
58
59
|
clearGraphCells: () => void;
|
|
59
60
|
onMoveNodes(movedNodes: any[]): Promise<void>;
|
|
@@ -13,7 +13,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
|
13
13
|
/*
|
|
14
14
|
* @Author: wangxian
|
|
15
15
|
* @Date: 2022-05-24 14:31:01
|
|
16
|
-
* @LastEditTime: 2023-07-28
|
|
16
|
+
* @LastEditTime: 2023-07-28 17:58:50
|
|
17
17
|
*/
|
|
18
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
19
19
|
import produce from 'immer';
|
|
@@ -27,6 +27,7 @@ import NodeElement from './comps/NodeElement';
|
|
|
27
27
|
import { DPEdge } from './comps/shape/edge';
|
|
28
28
|
import { DPNode } from './comps/shape/node';
|
|
29
29
|
import { formatGraphData, formatNodeInfoToNodeMeta } from './utils';
|
|
30
|
+
import { deepClone } from '@/utils';
|
|
30
31
|
var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
31
32
|
_inherits(DPGraph, _GraphCore);
|
|
32
33
|
var _super = _createSuper(DPGraph);
|
|
@@ -565,6 +566,33 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
565
566
|
value: function onContextMenu(data) {
|
|
566
567
|
this.factory$.contextMenuInfo.next(data);
|
|
567
568
|
}
|
|
569
|
+
// 通过id更新名称
|
|
570
|
+
}, {
|
|
571
|
+
key: "updateNodeNameById",
|
|
572
|
+
value: function updateNodeNameById(id, name) {
|
|
573
|
+
var _oldGraph$nodes;
|
|
574
|
+
var oldGraph = this.factory$.dpGraph.getValue();
|
|
575
|
+
var _oldGraph = deepClone(oldGraph);
|
|
576
|
+
this.updateNodeById(id, function (node) {
|
|
577
|
+
node.setData({
|
|
578
|
+
name: name
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
var idx = (_oldGraph$nodes = _oldGraph.nodes) === null || _oldGraph$nodes === void 0 ? void 0 : _oldGraph$nodes.findIndex(function (it) {
|
|
582
|
+
return it.id === id;
|
|
583
|
+
});
|
|
584
|
+
if (idx !== -1) {
|
|
585
|
+
var _node = _objectSpread(_objectSpread({}, _oldGraph.nodes[idx]), {}, {
|
|
586
|
+
name: name
|
|
587
|
+
});
|
|
588
|
+
_oldGraph.nodes[idx] = _node;
|
|
589
|
+
}
|
|
590
|
+
var newGraph = {
|
|
591
|
+
edges: _oldGraph.edges,
|
|
592
|
+
nodes: _oldGraph.nodes
|
|
593
|
+
};
|
|
594
|
+
this.factory$.dpGraph.next(newGraph);
|
|
595
|
+
}
|
|
568
596
|
}, {
|
|
569
597
|
key: "onMoveNodes",
|
|
570
598
|
value: function () {
|
|
@@ -59,7 +59,6 @@ export declare class GraphCore<N extends Node<Node.Properties> = Node<Node.Prope
|
|
|
59
59
|
getNodeById: (nodeId: string) => N | undefined;
|
|
60
60
|
updateNodeById: (nodeId: string, handler: (node?: N) => void) => void;
|
|
61
61
|
updateNodes: (handler: (nodes: N[]) => void) => void;
|
|
62
|
-
updateNodeNameById(id: string, name: string): void;
|
|
63
62
|
updateEdgeById: (edgeId: string, handler: (node?: E) => void) => void;
|
|
64
63
|
updateEdges: (handler: (edges: E[]) => void) => void;
|
|
65
64
|
throwRenderError: () => void;
|
|
@@ -6,7 +6,7 @@ var _excluded = ["wrapper", "container", "nodes", "edges"];
|
|
|
6
6
|
/*
|
|
7
7
|
* @Author: wangxian
|
|
8
8
|
* @Date: 2022-05-24 13:55:44
|
|
9
|
-
* @LastEditTime: 2023-07-28
|
|
9
|
+
* @LastEditTime: 2023-07-28 16:52:22
|
|
10
10
|
*/
|
|
11
11
|
import { Graph } from '@antv/x6';
|
|
12
12
|
import { debounceTime, fromEventPattern, map, merge, scan, tap } from 'rxjs';
|
|
@@ -423,17 +423,6 @@ export var GraphCore = /*#__PURE__*/function () {
|
|
|
423
423
|
value: function onMoveNodes(args) {
|
|
424
424
|
if (process.env.NODE_ENV === 'development') {}
|
|
425
425
|
}
|
|
426
|
-
}, {
|
|
427
|
-
key: "updateNodeNameById",
|
|
428
|
-
value:
|
|
429
|
-
// 通过id更新名称
|
|
430
|
-
function updateNodeNameById(id, name) {
|
|
431
|
-
this.updateNodeById(id, function (node) {
|
|
432
|
-
node.setData({
|
|
433
|
-
name: name
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
426
|
}, {
|
|
438
427
|
key: "dispose",
|
|
439
428
|
value:
|