ronds-metadata 1.3.1 → 1.3.2

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.
@@ -79,4 +79,4 @@ declare class DPGraph extends GraphCore<BaseNode, BaseEdge> {
79
79
  export declare let gDPGraph: DPGraph;
80
80
  export default DPGraph;
81
81
  export declare const useDPGraph: (graphData?: NDPGraph.GraphData) => DPGraph;
82
- export declare const useUnmountDPGraph: () => void;
82
+ export declare const useUnmountDPGraph: (dispose: boolean) => 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-08-25 16:03:31
16
+ * @LastEditTime: 2023-08-28 17:02:15
17
17
  */
18
18
  import _regeneratorRuntime from "@babel/runtime/regenerator";
19
19
  import produce from 'immer';
@@ -797,10 +797,12 @@ export var useDPGraph = function useDPGraph(graphData) {
797
797
  gDPGraph = new DPGraph(graphData);
798
798
  return gDPGraph;
799
799
  };
800
- export var useUnmountDPGraph = function useUnmountDPGraph() {
800
+ export var useUnmountDPGraph = function useUnmountDPGraph(dispose) {
801
801
  React.useEffect(function () {
802
802
  return function () {
803
- gDPGraph.dispose();
803
+ if (dispose) {
804
+ gDPGraph.dispose();
805
+ }
804
806
  };
805
- }, []);
807
+ }, [dispose]);
806
808
  };
@@ -7,6 +7,10 @@ interface IDynamicPortsProps {
7
7
  * 渲染图结构
8
8
  */
9
9
  defaultValue?: NDPGraph.GraphData;
10
+ /**
11
+ * 离开销毁
12
+ */
13
+ dispose?: boolean;
10
14
  /**
11
15
  * 图更新事件
12
16
  */
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  /*
4
4
  * @Author: wangxian
5
5
  * @Date: 2022-05-16 18:53:31
6
- * @LastEditTime: 2023-08-22 17:06:28
6
+ * @LastEditTime: 2023-08-28 17:02:54
7
7
  */
8
8
  import React from 'react';
9
9
  import { filter } from 'rxjs';
@@ -18,6 +18,8 @@ import ContextMenu from './comps/ContextMenu';
18
18
  import { GraphHandler } from './comps/GraphHandler';
19
19
  var DynamicPorts = function DynamicPorts(props) {
20
20
  var defaultValue = props.defaultValue,
21
+ _props$dispose = props.dispose,
22
+ dispose = _props$dispose === void 0 ? true : _props$dispose,
21
23
  onChange = props.onChange,
22
24
  onNodeSelect = props.onNodeSelect,
23
25
  onStatusClick = props.onStatusClick,
@@ -31,7 +33,7 @@ var DynamicPorts = function DynamicPorts(props) {
31
33
  var dpGraphRef = React.useRef();
32
34
  var firstLoadRef = React.useRef(true);
33
35
  // 处理画布卸载
34
- useUnmountDPGraph();
36
+ useUnmountDPGraph(dispose);
35
37
  var resizeSensorRef = React.useRef(null);
36
38
  var onResizeStrategy = function onResizeStrategy() {
37
39
  var _dpGraphRef$current, _dpGraphRef$current2;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.1",
4
+ "version": "1.3.2",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",