@riil-frontend/component-topology 12.1.0-dev.3 → 12.1.0-dev.4

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.
@@ -10,7 +10,7 @@ import Alarm from "./Alarm";
10
10
  import TopoGraphView from "./TopoGraphView";
11
11
  import createStore from "../store/createStore";
12
12
  import buildProvider from "../components/buildProvider";
13
- import { getEdgeDatas, getGroupDatas, getNodeData, getNodeDatas, getNodes as _getNodes } from "../../utils/htElementUtils";
13
+ import { getEdgeDatas, getGroupDatas, getNodeData, getNodeDatas, getNodes } from "../../utils/htElementUtils";
14
14
  import Test from "../test/Test";
15
15
  import { formatGroups } from "../../utils/topoData";
16
16
  import DictCache from "./cache/DictCache";
@@ -24,7 +24,7 @@ import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel";
25
25
  import CiCache from "./cache/CiCache"; // eslint-disable-next-line no-undef
26
26
 
27
- var version = typeof "12.1.0-dev.3" === 'string' ? "12.1.0-dev.3" : null;
27
+ var version = typeof "12.1.0-dev.4" === 'string' ? "12.1.0-dev.4" : null;
28
28
  console.info("\u62D3\u6251\u7248\u672C: " + version);
29
29
  /**
30
30
  * 拓扑显示和编辑
@@ -188,38 +188,29 @@ var Topo = /*#__PURE__*/function () {
188
188
 
189
189
  _proto.getData = function getData() {
190
190
  return {
191
- groups: this.getGroups(),
192
- nodes: this.getNodes(),
193
- lines: this.getLines(),
191
+ groups: getGroupDatas(this.getDataModel()),
192
+ nodes: getNodes(this.getDataModel()).filter(function (node) {
193
+ return !!node.getTag();
194
+ }).map(getNodeData),
194
195
  customNodes: getNodeDatas(this.getDataModel()).filter(function (item) {
195
196
  return !item.id;
196
197
  }),
197
- customLines: this.getEdges().filter(function (item) {
198
+ lines: getEdgeDatas(this.getDataModel()).filter(function (item) {
199
+ return !!item.id;
200
+ }),
201
+ customLines: getEdgeDatas(this.getDataModel()).filter(function (item) {
198
202
  return !item.id;
199
203
  })
200
204
  };
201
- };
202
-
203
- _proto.getGroups = function getGroups() {
204
- return getGroupDatas(this.getDataModel());
205
- };
206
-
207
- _proto.getNodes = function getNodes() {
208
- var nodes = _getNodes(this.getDataModel()).filter(function (node) {
209
- return !!node.getTag();
210
- });
211
-
212
- return nodes.map(getNodeData);
213
- };
205
+ }
206
+ /**
207
+ * @deprecated 待移除。uicbb有使用
208
+ * @returns
209
+ */
210
+ ;
214
211
 
215
212
  _proto.getLines = function getLines() {
216
- return this.getEdges().filter(function (item) {
217
- return !!item.id;
218
- });
219
- };
220
-
221
- _proto.getEdges = function getEdges() {
222
- return getEdgeDatas(this.getDataModel());
213
+ return this.getData().lines;
223
214
  }
224
215
  /**
225
216
  * 全量更新数据
@@ -278,18 +269,19 @@ var Topo = /*#__PURE__*/function () {
278
269
  /*#__PURE__*/
279
270
  function () {
280
271
  var _addElements = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(elements) {
281
- var data;
272
+ var prevData, data;
282
273
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
283
274
  while (1) switch (_context5.prev = _context5.next) {
284
275
  case 0:
276
+ prevData = this.getData();
285
277
  data = {
286
- groups: [].concat(this.getGroups(), elements.groups || []),
287
- nodes: [].concat(this.getNodes(), elements.nodes || []),
288
- lines: [].concat(this.getLines(), elements.lines || [])
278
+ groups: [].concat(prevData.groups, elements.groups || []),
279
+ nodes: [].concat(prevData.nodes, elements.nodes || []),
280
+ lines: [].concat(prevData.lines, elements.lines || [])
289
281
  };
290
282
  this.updateElements(data); // TODO 更新store,触发属性、指标模型加载,更新指标
291
283
 
292
- case 2:
284
+ case 3:
293
285
  case "end":
294
286
  return _context5.stop();
295
287
  }
@@ -133,6 +133,12 @@ export function isEdgeGroup(edge) {
133
133
  export function isEdgeGroupAgent(edge) {
134
134
  return isEdgeGroup(edge) && isEdgeVisible(edge);
135
135
  }
136
+ /**
137
+ * TODO
138
+ * @param {*} edge
139
+ * @returns
140
+ */
141
+
136
142
  export function isEdgeGroupExpanded(edge) {
137
143
  return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
138
144
  }
@@ -218,7 +224,9 @@ export function getEdgeGroupAgents(dataModel) {
218
224
  return getEdges(dataModel).filter(isEdgeGroupAgent);
219
225
  }
220
226
  export function getEdgeDatas(dataModel) {
221
- return getEdges(dataModel).map(function (element) {
227
+ return getEdges(dataModel).filter(function (edge) {
228
+ return !isEdgeGroup(edge);
229
+ }).map(function (element) {
222
230
  var _element$getSource, _element$getTarget;
223
231
 
224
232
  return _extends({}, element.getAttrObject(), {
@@ -54,7 +54,7 @@ var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
54
54
  var _CiCache = _interopRequireDefault(require("./cache/CiCache"));
55
55
 
56
56
  // eslint-disable-next-line no-undef
57
- var version = typeof "12.1.0-dev.3" === 'string' ? "12.1.0-dev.3" : null;
57
+ var version = typeof "12.1.0-dev.4" === 'string' ? "12.1.0-dev.4" : null;
58
58
  console.info("\u62D3\u6251\u7248\u672C: " + version);
59
59
  /**
60
60
  * 拓扑显示和编辑
@@ -218,37 +218,29 @@ var Topo = /*#__PURE__*/function () {
218
218
 
219
219
  _proto.getData = function getData() {
220
220
  return {
221
- groups: this.getGroups(),
222
- nodes: this.getNodes(),
223
- lines: this.getLines(),
221
+ groups: (0, _htElementUtils.getGroupDatas)(this.getDataModel()),
222
+ nodes: (0, _htElementUtils.getNodes)(this.getDataModel()).filter(function (node) {
223
+ return !!node.getTag();
224
+ }).map(_htElementUtils.getNodeData),
224
225
  customNodes: (0, _htElementUtils.getNodeDatas)(this.getDataModel()).filter(function (item) {
225
226
  return !item.id;
226
227
  }),
227
- customLines: this.getEdges().filter(function (item) {
228
+ lines: (0, _htElementUtils.getEdgeDatas)(this.getDataModel()).filter(function (item) {
229
+ return !!item.id;
230
+ }),
231
+ customLines: (0, _htElementUtils.getEdgeDatas)(this.getDataModel()).filter(function (item) {
228
232
  return !item.id;
229
233
  })
230
234
  };
231
- };
232
-
233
- _proto.getGroups = function getGroups() {
234
- return (0, _htElementUtils.getGroupDatas)(this.getDataModel());
235
- };
236
-
237
- _proto.getNodes = function getNodes() {
238
- var nodes = (0, _htElementUtils.getNodes)(this.getDataModel()).filter(function (node) {
239
- return !!node.getTag();
240
- });
241
- return nodes.map(_htElementUtils.getNodeData);
242
- };
235
+ }
236
+ /**
237
+ * @deprecated 待移除。uicbb有使用
238
+ * @returns
239
+ */
240
+ ;
243
241
 
244
242
  _proto.getLines = function getLines() {
245
- return this.getEdges().filter(function (item) {
246
- return !!item.id;
247
- });
248
- };
249
-
250
- _proto.getEdges = function getEdges() {
251
- return (0, _htElementUtils.getEdgeDatas)(this.getDataModel());
243
+ return this.getData().lines;
252
244
  }
253
245
  /**
254
246
  * 全量更新数据
@@ -307,18 +299,19 @@ var Topo = /*#__PURE__*/function () {
307
299
  /*#__PURE__*/
308
300
  function () {
309
301
  var _addElements = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(elements) {
310
- var data;
302
+ var prevData, data;
311
303
  return _regenerator["default"].wrap(function _callee5$(_context5) {
312
304
  while (1) switch (_context5.prev = _context5.next) {
313
305
  case 0:
306
+ prevData = this.getData();
314
307
  data = {
315
- groups: [].concat(this.getGroups(), elements.groups || []),
316
- nodes: [].concat(this.getNodes(), elements.nodes || []),
317
- lines: [].concat(this.getLines(), elements.lines || [])
308
+ groups: [].concat(prevData.groups, elements.groups || []),
309
+ nodes: [].concat(prevData.nodes, elements.nodes || []),
310
+ lines: [].concat(prevData.lines, elements.lines || [])
318
311
  };
319
312
  this.updateElements(data); // TODO 更新store,触发属性、指标模型加载,更新指标
320
313
 
321
- case 2:
314
+ case 3:
322
315
  case "end":
323
316
  return _context5.stop();
324
317
  }
@@ -194,6 +194,12 @@ function isEdgeGroup(edge) {
194
194
  function isEdgeGroupAgent(edge) {
195
195
  return isEdgeGroup(edge) && isEdgeVisible(edge);
196
196
  }
197
+ /**
198
+ * TODO
199
+ * @param {*} edge
200
+ * @returns
201
+ */
202
+
197
203
 
198
204
  function isEdgeGroupExpanded(edge) {
199
205
  return isEdge(edge) && edge.getEdgeGroup() && !!edge.s("edge.expanded");
@@ -287,7 +293,9 @@ function getEdgeGroupAgents(dataModel) {
287
293
  }
288
294
 
289
295
  function getEdgeDatas(dataModel) {
290
- return getEdges(dataModel).map(function (element) {
296
+ return getEdges(dataModel).filter(function (edge) {
297
+ return !isEdgeGroup(edge);
298
+ }).map(function (element) {
291
299
  var _element$getSource, _element$getTarget;
292
300
 
293
301
  return (0, _extends3["default"])({}, element.getAttrObject(), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "12.1.0-dev.3",
3
+ "version": "12.1.0-dev.4",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -123,6 +123,6 @@
123
123
  "access": "public"
124
124
  },
125
125
  "license": "MIT",
126
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@12.1.0-dev.3/build/index.html",
126
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@12.1.0-dev.4/build/index.html",
127
127
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
128
128
  }