ronds-metadata 1.2.90 → 1.2.91

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 09:17:18
16
+ * @LastEditTime: 2023-07-28 16:58:26
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -565,6 +565,30 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
565
565
  value: function onContextMenu(data) {
566
566
  this.factory$.contextMenuInfo.next(data);
567
567
  }
568
+ // 通过id更新名称
569
+ }, {
570
+ key: "updateNodeNameById",
571
+ value: function updateNodeNameById(id, name) {
572
+ var _oldGraph$nodes;
573
+ var oldGraph = this.factory$.dpGraph.getValue();
574
+ this.updateNodeById(id, function (node) {
575
+ node.setData({
576
+ name: name
577
+ });
578
+ });
579
+ var idx = (_oldGraph$nodes = oldGraph.nodes) === null || _oldGraph$nodes === void 0 ? void 0 : _oldGraph$nodes.findIndex(function (it) {
580
+ return it.id === id;
581
+ });
582
+ var _node = _objectSpread(_objectSpread({}, oldGraph.nodes[idx]), {}, {
583
+ name: name
584
+ });
585
+ oldGraph.nodes[idx] = _node;
586
+ var newGraph = {
587
+ edges: oldGraph.edges,
588
+ nodes: oldGraph.nodes
589
+ };
590
+ this.factory$.dpGraph.next(newGraph);
591
+ }
568
592
  }, {
569
593
  key: "onMoveNodes",
570
594
  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 08:14:22
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:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.2.90",
4
+ "version": "1.2.91",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",