ronds-metadata 1.2.91 → 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.
|
@@ -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);
|
|
@@ -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
|
}
|