@riil-frontend/component-topology 2.15.18 → 2.15.19

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.
@@ -240,9 +240,7 @@ var TopoView = function TopoView(props) {
240
240
  className: classnames(styles.viewPanel, (_classnames = {}, _classnames[styles.viewPanelEditMode] = isEditMode, _classnames))
241
241
  }, /*#__PURE__*/React.createElement(TopoGraph, _extends({}, graphViewProps, {
242
242
  createHtTopoProps: _extends({}, graphViewProps.createHtTopoProps, {
243
- editor: _extends({}, ((_graphViewProps$creat = graphViewProps.createHtTopoProps) === null || _graphViewProps$creat === void 0 ? void 0 : _graphViewProps$creat.editor) || {}, {
244
- useNewElementsDeleteEvent: true
245
- })
243
+ editor: _extends({}, ((_graphViewProps$creat = graphViewProps.createHtTopoProps) === null || _graphViewProps$creat === void 0 ? void 0 : _graphViewProps$creat.editor) || {})
246
244
  }),
247
245
  data: tData,
248
246
  defaultEnterEditMode: defaultEnterEditMode,
@@ -17,15 +17,11 @@ import AttributeMetricDisplay from "./AttributeMetricDisplay";
17
17
  import DataModel from "./DataModel";
18
18
  import GraphDataModel from "./GraphDataModel";
19
19
  import { updateEdgeExpanded } from "../utils/edgeUtil";
20
- import PluginManager from "./PluginManager"; // eslint-disable-next-line no-undef
20
+ import PluginManager from "./PluginManager";
21
+ import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
21
22
 
22
- var version = typeof "2.15.18" === 'string' ? "2.15.18" : null;
23
+ var version = typeof "2.15.19" === 'string' ? "2.15.19" : null;
23
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
24
- var topoDebug = {};
25
- window.topoDebug = topoDebug;
26
- var htTopo = {};
27
- window.htTopo = htTopo;
28
- var n = 0;
29
25
  /**
30
26
  * 拓扑显示和编辑
31
27
  */
@@ -35,7 +31,6 @@ var Topo = /*#__PURE__*/function () {
35
31
  * @type TopoGraphView
36
32
  */
37
33
  function Topo(options) {
38
- this.version = version;
39
34
  this.options = void 0;
40
35
  this.id = void 0;
41
36
  this.view = void 0;
@@ -46,6 +41,8 @@ var Topo = /*#__PURE__*/function () {
46
41
  this.ciTyeCache = CiTyeCache;
47
42
  this.dictCache = DictCache;
48
43
  this.test = void 0;
44
+ this.uid = void 0;
45
+ this.version = version;
49
46
  this.options = _extends({
50
47
  enableDefaultAlarmLoader: true,
51
48
  enableDefaultMetricLoader: true,
@@ -58,9 +55,6 @@ var Topo = /*#__PURE__*/function () {
58
55
  }
59
56
 
60
57
  this.initialize(options);
61
- this.debugId = options.name || "t" + n++;
62
- topoDebug[this.debugId] = this;
63
- htTopo[this.debugId] = this.getHtTopo.bind(this);
64
58
  }
65
59
 
66
60
  var _proto = Topo.prototype;
@@ -80,6 +74,7 @@ var Topo = /*#__PURE__*/function () {
80
74
  this.alarm.init(this); // 指标
81
75
 
82
76
  this.test = new Test(this);
77
+ this.uid = topoFactory.add(options.name, this);
83
78
  }
84
79
  /**
85
80
  * TODO 移除
@@ -100,10 +95,9 @@ var Topo = /*#__PURE__*/function () {
100
95
  return topoDispatchers.exit();
101
96
 
102
97
  case 3:
103
- delete topoDebug[this.debugId];
104
- delete htTopo[this.debugId];
98
+ topoFactory.remove(this.uid);
105
99
 
106
- case 5:
100
+ case 4:
107
101
  case "end":
108
102
  return _context.stop();
109
103
  }
@@ -0,0 +1,25 @@
1
+ var n = 0;
2
+
3
+ var TopoFactory = /*#__PURE__*/function () {
4
+ function TopoFactory() {
5
+ this.map = {};
6
+ }
7
+
8
+ var _proto = TopoFactory.prototype;
9
+
10
+ _proto.add = function add(name, topo) {
11
+ var uid = name || "" + n++;
12
+ this.map[uid] = topo;
13
+ return uid;
14
+ };
15
+
16
+ _proto.remove = function remove(name) {
17
+ delete this.map[name];
18
+ };
19
+
20
+ return TopoFactory;
21
+ }();
22
+
23
+ var topoFactory = new TopoFactory();
24
+ window.topoFactory = topoFactory;
25
+ export default topoFactory;
@@ -43,7 +43,10 @@ export default function NetworkTopologyFull(props) {
43
43
  graphViewProps: _extends({}, props.graphViewProps, {
44
44
  onElementsDelete: topoEdit.onElementsDelete,
45
45
  createHtTopoProps: {
46
- elementChangeLayerByDrag: true
46
+ elementChangeLayerByDrag: true,
47
+ editor: {
48
+ useNewElementsDeleteEvent: true
49
+ }
47
50
  }
48
51
  })
49
52
  }));
@@ -276,9 +276,7 @@ var TopoView = function TopoView(props) {
276
276
  className: (0, _classnames2["default"])(_TopoViewModule["default"].viewPanel, (_classnames = {}, _classnames[_TopoViewModule["default"].viewPanelEditMode] = isEditMode, _classnames))
277
277
  }, /*#__PURE__*/_react["default"].createElement(_componentTopologyGraph["default"], (0, _extends2["default"])({}, graphViewProps, {
278
278
  createHtTopoProps: (0, _extends2["default"])({}, graphViewProps.createHtTopoProps, {
279
- editor: (0, _extends2["default"])({}, ((_graphViewProps$creat = graphViewProps.createHtTopoProps) === null || _graphViewProps$creat === void 0 ? void 0 : _graphViewProps$creat.editor) || {}, {
280
- useNewElementsDeleteEvent: true
281
- })
279
+ editor: (0, _extends2["default"])({}, ((_graphViewProps$creat = graphViewProps.createHtTopoProps) === null || _graphViewProps$creat === void 0 ? void 0 : _graphViewProps$creat.editor) || {})
282
280
  }),
283
281
  data: tData,
284
282
  defaultEnterEditMode: defaultEnterEditMode,
@@ -45,14 +45,11 @@ var _edgeUtil = require("../utils/edgeUtil");
45
45
 
46
46
  var _PluginManager = _interopRequireDefault(require("./PluginManager"));
47
47
 
48
+ var _topoFactory = _interopRequireDefault(require("./topoFactory"));
49
+
48
50
  // eslint-disable-next-line no-undef
49
- var version = typeof "2.15.18" === 'string' ? "2.15.18" : null;
51
+ var version = typeof "2.15.19" === 'string' ? "2.15.19" : null;
50
52
  console.info("\u62D3\u6251\u7248\u672C: " + version);
51
- var topoDebug = {};
52
- window.topoDebug = topoDebug;
53
- var htTopo = {};
54
- window.htTopo = htTopo;
55
- var n = 0;
56
53
  /**
57
54
  * 拓扑显示和编辑
58
55
  */
@@ -62,7 +59,6 @@ var Topo = /*#__PURE__*/function () {
62
59
  * @type TopoGraphView
63
60
  */
64
61
  function Topo(options) {
65
- this.version = version;
66
62
  this.options = void 0;
67
63
  this.id = void 0;
68
64
  this.view = void 0;
@@ -73,6 +69,8 @@ var Topo = /*#__PURE__*/function () {
73
69
  this.ciTyeCache = _CiTyeCache["default"];
74
70
  this.dictCache = _DictCache["default"];
75
71
  this.test = void 0;
72
+ this.uid = void 0;
73
+ this.version = version;
76
74
  this.options = (0, _extends2["default"])({
77
75
  enableDefaultAlarmLoader: true,
78
76
  enableDefaultMetricLoader: true,
@@ -85,9 +83,6 @@ var Topo = /*#__PURE__*/function () {
85
83
  }
86
84
 
87
85
  this.initialize(options);
88
- this.debugId = options.name || "t" + n++;
89
- topoDebug[this.debugId] = this;
90
- htTopo[this.debugId] = this.getHtTopo.bind(this);
91
86
  }
92
87
 
93
88
  var _proto = Topo.prototype;
@@ -107,6 +102,7 @@ var Topo = /*#__PURE__*/function () {
107
102
  this.alarm.init(this); // 指标
108
103
 
109
104
  this.test = new _Test["default"](this);
105
+ this.uid = _topoFactory["default"].add(options.name, this);
110
106
  }
111
107
  /**
112
108
  * TODO 移除
@@ -127,10 +123,9 @@ var Topo = /*#__PURE__*/function () {
127
123
  return topoDispatchers.exit();
128
124
 
129
125
  case 3:
130
- delete topoDebug[this.debugId];
131
- delete htTopo[this.debugId];
126
+ _topoFactory["default"].remove(this.uid);
132
127
 
133
- case 5:
128
+ case 4:
134
129
  case "end":
135
130
  return _context.stop();
136
131
  }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = void 0;
5
+ var n = 0;
6
+
7
+ var TopoFactory = /*#__PURE__*/function () {
8
+ function TopoFactory() {
9
+ this.map = {};
10
+ }
11
+
12
+ var _proto = TopoFactory.prototype;
13
+
14
+ _proto.add = function add(name, topo) {
15
+ var uid = name || "" + n++;
16
+ this.map[uid] = topo;
17
+ return uid;
18
+ };
19
+
20
+ _proto.remove = function remove(name) {
21
+ delete this.map[name];
22
+ };
23
+
24
+ return TopoFactory;
25
+ }();
26
+
27
+ var topoFactory = new TopoFactory();
28
+ window.topoFactory = topoFactory;
29
+ var _default = topoFactory;
30
+ exports["default"] = _default;
@@ -63,7 +63,10 @@ function NetworkTopologyFull(props) {
63
63
  graphViewProps: (0, _extends2["default"])({}, props.graphViewProps, {
64
64
  onElementsDelete: topoEdit.onElementsDelete,
65
65
  createHtTopoProps: {
66
- elementChangeLayerByDrag: true
66
+ elementChangeLayerByDrag: true,
67
+ editor: {
68
+ useNewElementsDeleteEvent: true
69
+ }
67
70
  }
68
71
  })
69
72
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "2.15.18",
3
+ "version": "2.15.19",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -110,6 +110,6 @@
110
110
  "access": "public"
111
111
  },
112
112
  "license": "MIT",
113
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.18/build/index.html",
113
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@2.15.19/build/index.html",
114
114
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
115
115
  }