ronds-metadata 1.2.85 → 1.2.87

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-03 16:49:09
16
+ * @LastEditTime: 2023-07-27 14:59:14
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -59,6 +59,7 @@ 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;
62
63
  updateEdgeById: (edgeId: string, handler: (node?: E) => void) => void;
63
64
  updateEdges: (handler: (edges: E[]) => void) => void;
64
65
  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: 2022-05-31 10:43:04
9
+ * @LastEditTime: 2023-07-27 15:17:14
10
10
  */
11
11
  import { Graph } from '@antv/x6';
12
12
  import { debounceTime, fromEventPattern, map, merge, scan, tap } from 'rxjs';
@@ -329,7 +329,6 @@ export var GraphCore = /*#__PURE__*/function () {
329
329
  }, {
330
330
  key: "render",
331
331
  value: function render(params) {
332
- var _this3 = this;
333
332
  this.setMeta(params);
334
333
  if (this.isMetaValid) {
335
334
  var wrapper = this.wrapper,
@@ -343,12 +342,10 @@ export var GraphCore = /*#__PURE__*/function () {
343
342
  height: height
344
343
  }));
345
344
  this.graph = graph;
346
- nodeMetas.forEach(function (nodeMeta) {
347
- return _this3.renderNode(nodeMeta);
348
- });
349
- edgeMetas.forEach(function (edgeMeta) {
350
- return _this3.renderEdge(edgeMeta);
351
- });
345
+ // nodeMetas!.forEach((nodeMeta) => this.renderNode(nodeMeta));
346
+ // edgeMetas!.forEach((edgeMeta) => this.renderEdge(edgeMeta));
347
+ this.graph.addNodes(nodeMetas);
348
+ this.graph.addEdges(edgeMetas);
352
349
  this.afterLayout();
353
350
  if (graph.isFrozen()) {
354
351
  graph.unfreeze();
@@ -421,6 +418,17 @@ export var GraphCore = /*#__PURE__*/function () {
421
418
  value: function onMoveNodes(args) {
422
419
  if (process.env.NODE_ENV === 'development') {}
423
420
  }
421
+ }, {
422
+ key: "updateNodeNameById",
423
+ value:
424
+ // 通过id更新名称
425
+ function updateNodeNameById(id, name) {
426
+ this.updateNodeById(id, function (node) {
427
+ node.setData({
428
+ name: name
429
+ });
430
+ });
431
+ }
424
432
  }, {
425
433
  key: "dispose",
426
434
  value:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.2.85",
4
+ "version": "1.2.87",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",