ronds-metadata 1.2.91 → 1.2.93
Sign up to get free protection for your applications and to get access to all the features.
@@ -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 18:15:11
|
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);
|
@@ -571,21 +572,24 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
571
572
|
value: function updateNodeNameById(id, name) {
|
572
573
|
var _oldGraph$nodes;
|
573
574
|
var oldGraph = this.factory$.dpGraph.getValue();
|
575
|
+
var _oldGraph = deepClone(oldGraph);
|
574
576
|
this.updateNodeById(id, function (node) {
|
575
577
|
node.setData({
|
576
578
|
name: name
|
577
579
|
});
|
578
580
|
});
|
579
|
-
var idx = (_oldGraph$nodes =
|
581
|
+
var idx = (_oldGraph$nodes = _oldGraph.nodes) === null || _oldGraph$nodes === void 0 ? void 0 : _oldGraph$nodes.findIndex(function (it) {
|
580
582
|
return it.id === id;
|
581
583
|
});
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
584
|
+
if (idx !== -1) {
|
585
|
+
var _node = _objectSpread(_objectSpread({}, _oldGraph.nodes[idx]), {}, {
|
586
|
+
name: name
|
587
|
+
});
|
588
|
+
_oldGraph.nodes[idx] = _node;
|
589
|
+
}
|
586
590
|
var newGraph = {
|
587
|
-
edges:
|
588
|
-
nodes:
|
591
|
+
edges: _oldGraph.edges,
|
592
|
+
nodes: _oldGraph.nodes
|
589
593
|
};
|
590
594
|
this.factory$.dpGraph.next(newGraph);
|
591
595
|
}
|