@riil-frontend/component-topology 7.0.0-dev.13 → 7.0.0-dev.15

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.
Files changed (30) hide show
  1. package/build/index.js +1 -1
  2. package/es/core/editor/components/Toolbar/buttons.js +2 -2
  3. package/es/core/editor/components/settings/PropertyView.js +11 -10
  4. package/es/core/editor/components/settings/Settings.js +8 -1
  5. package/es/core/editor/components/settings/core/PropertyViewManager.js +4 -3
  6. package/es/core/editor/components/settings/core/edgePropertyViewAdapter.js +1 -7
  7. package/es/core/hooks/usePolling.js +1 -6
  8. package/es/core/hooks/useTopoEdit.js +3 -1
  9. package/es/core/models/Alarm.js +12 -24
  10. package/es/core/models/TopoApp.js +1 -1
  11. package/es/core/models/utils/linkUtils.js +0 -3
  12. package/es/core/store/models/topoMod.js +7 -6
  13. package/es/networkTopo/getTopoData.js +16 -27
  14. package/es/networkTopo/hooks/editor/useDeleteEdges.js +1 -3
  15. package/lib/core/editor/components/Toolbar/buttons.js +2 -2
  16. package/lib/core/editor/components/settings/PropertyView.js +10 -10
  17. package/lib/core/editor/components/settings/Settings.js +9 -1
  18. package/lib/core/editor/components/settings/core/PropertyViewManager.js +4 -3
  19. package/lib/core/editor/components/settings/core/edgePropertyViewAdapter.js +1 -10
  20. package/lib/core/hooks/usePolling.js +1 -6
  21. package/lib/core/hooks/useTopoEdit.js +3 -1
  22. package/lib/core/models/Alarm.js +12 -24
  23. package/lib/core/models/TopoApp.js +1 -1
  24. package/lib/core/models/utils/linkUtils.js +0 -5
  25. package/lib/core/store/models/topoMod.js +9 -6
  26. package/lib/networkTopo/getTopoData.js +16 -28
  27. package/lib/networkTopo/hooks/editor/useDeleteEdges.js +1 -4
  28. package/package.json +2 -2
  29. package/es/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +0 -10
  30. package/lib/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +0 -19
@@ -32,7 +32,7 @@ export default function getButtons(isNetworkTopo) {
32
32
  Divider, NodeImageButton, // 替换图片
33
33
  NodeSizeButton, // 图片尺寸
34
34
  Divider, Layout, // 布局方式
35
- NodeAlignWidget // 对齐方式
36
- // SearchWidget, // 搜索
35
+ NodeAlignWidget, // 对齐方式
36
+ SearchWidget // 搜索
37
37
  ]);
38
38
  }
@@ -5,8 +5,11 @@ import { adapterGetEdgePropertyViewType, addEdgePropertyViews } from "./core/edg
5
5
  import PropertyViewManager from "./core/PropertyViewManager";
6
6
  import Settings from "./Settings";
7
7
  import styles from "./Settings.module.scss";
8
+
9
+ function PropertyViewProvider(props) {}
10
+
8
11
  export default function PropertyPanel(props) {
9
- var _classNames;
12
+ var _editorProps$property, _editorProps$property2, _classNames;
10
13
 
11
14
  var topo = props.topo,
12
15
  editorProps = props.editorProps;
@@ -18,21 +21,19 @@ export default function PropertyPanel(props) {
18
21
  var _store$useModelState = store.useModelState('selection'),
19
22
  selection = _store$useModelState.selection;
20
23
 
21
- var _topo$store$useModel = topo.store.useModel('topoEdit'),
22
- topoEditState = _topo$store$useModel[0],
23
- topoEditDispatchers = _topo$store$useModel[1];
24
-
24
+ var topoEditState = topo.store.useModelState('topoEdit');
25
25
  var propertyPanelVisible = topoEditState.propertyPanelVisible;
26
26
  var propertyViewManager = useMemo(function () {
27
27
  return new PropertyViewManager(topo);
28
- }, []); // 临时适配连线属性面板类型,后期组件支持自定义适配
29
-
30
- addEdgePropertyViews(propertyViewManager, editorProps);
28
+ }, []);
29
+ propertyViewManager.addViews((_editorProps$property = editorProps.propertyView) === null || _editorProps$property === void 0 ? void 0 : _editorProps$property.views);
31
30
 
32
- propertyViewManager.customGetViewType = editorProps.getPropertyViewType || function (elements) {
31
+ propertyViewManager.customGetViewType = ((_editorProps$property2 = editorProps.propertyView) === null || _editorProps$property2 === void 0 ? void 0 : _editorProps$property2.getPropertyViewType) || function (elements) {
33
32
  return adapterGetEdgePropertyViewType(elements, editorProps);
34
- };
33
+ }; // 临时适配连线属性面板类型,后期组件支持自定义适配
35
34
 
35
+
36
+ addEdgePropertyViews(propertyViewManager, editorProps);
36
37
  var PropertyView = propertyViewManager.getPropertyView();
37
38
  useEffect(function () {
38
39
  if (graphLoaded) {
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useMemo, useState } from 'react';
3
3
  import useSettingRuntimeState from "./useSettingRuntimeState";
4
4
  import updateElementProperty from "./core/updateElementProperty";
5
+ import { isEdge } from "../../../../utils/htElementUtils";
5
6
 
6
7
  function buildElementValues(selection) {
7
8
  var values = _extends({}, selection[0]);
@@ -33,10 +34,16 @@ export default function PropertyViewContainer(props) {
33
34
  var elementProps = {};
34
35
 
35
36
  if (selection.length === 1) {
37
+ var element = selectionElements[0];
36
38
  elementProps = {
37
- selectionElement: selectionElements[0],
39
+ element: element,
40
+ selectionElement: element,
38
41
  values: singleElementValues
39
42
  };
43
+
44
+ if (isEdge(element)) {
45
+ elementProps.edge = element;
46
+ }
40
47
  }
41
48
 
42
49
  return /*#__PURE__*/React.createElement(PropertyView, _extends({
@@ -4,17 +4,18 @@ import _getPropertyViewType from "./getPropertyViewType";
4
4
 
5
5
  var PropertyViewManager = /*#__PURE__*/function () {
6
6
  function PropertyViewManager(topo) {
7
- this.viewMap = propertyViews;
7
+ this.viewMap = _extends({}, propertyViews);
8
8
  this.topo = void 0;
9
9
  this.customGetViewType = void 0;
10
10
  this.topo = topo;
11
+ this.topo.propertyViewManager = this;
11
12
  this.open = this.open.bind(this);
12
13
  }
13
14
 
14
15
  var _proto = PropertyViewManager.prototype;
15
16
 
16
- _proto.updateViews = function updateViews(viewMap) {
17
- this.viewMap = _extends({}, propertyViews, viewMap);
17
+ _proto.addViews = function addViews(viewMap) {
18
+ Object.assign(this.viewMap, viewMap);
18
19
  };
19
20
 
20
21
  _proto.init = function init() {
@@ -1,5 +1,4 @@
1
1
  import { isEdge } from "../../../../../utils/htElementUtils";
2
- import addEdgeProps from "../propertyViews/edge/addEdgeProps";
3
2
  export function adapterGetEdgePropertyViewType(selection, editorProps) {
4
3
  var fn = editorProps.getEdgePropertyViewType;
5
4
 
@@ -13,10 +12,5 @@ export function adapterGetEdgePropertyViewType(selection, editorProps) {
13
12
  return null;
14
13
  }
15
14
  export function addEdgePropertyViews(propertyViewManager, editorProps) {
16
- var oldMap = editorProps.edgePropertyViews || {};
17
- var map = {};
18
- Object.keys(oldMap).forEach(function (name) {
19
- map[name] = addEdgeProps(oldMap[name]);
20
- });
21
- propertyViewManager.updateViews(map);
15
+ propertyViewManager.addViews(editorProps.edgePropertyViews || {});
22
16
  }
@@ -13,12 +13,7 @@ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
13
13
  var usePolling = function usePolling(props) {
14
14
  var topo = props.topo;
15
15
  var store = topo.store;
16
- var topoState = store.useModelState('topoMod');
17
-
18
- var _store$useModel = store.useModel('topoBizMod'),
19
- bizState = _store$useModel[0],
20
- bizDispatchers = _store$useModel[1];
21
-
16
+ var bizState = store.useModelState('topoBizMod');
22
17
  var resAndMetrics = bizState.resAndMetrics,
23
18
  pollingSwitch = bizState.pollingSwitch;
24
19
  var displayConfig = topo.store.useModelState('displayConfig');
@@ -53,8 +53,10 @@ var useTopoEdit = function useTopoEdit(params) {
53
53
  setComboResData = _useState2[1];
54
54
 
55
55
  var reset = function reset() {
56
+ var _topo$historyManager;
57
+
56
58
  topoEditDispatchers.reset();
57
- topo.historyManager.destroy();
59
+ (_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.destroy();
58
60
  };
59
61
  /**
60
62
  * 增加资源到视图
@@ -220,23 +220,11 @@ var Alarm = /*#__PURE__*/function () {
220
220
 
221
221
  _proto.hmGetTopoAlarm = /*#__PURE__*/function () {
222
222
  var _hmGetTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
223
- var _this$topo$store$getS, data, resAndMetrics, topoData, _this$getState2, alarmIsOpened, alarmOpening, nodeIdsList, linkIdsList, resIdsList, mainCiIdList, endTime, startTime, parms, result;
224
-
223
+ var mainCiIdList, endTime, startTime, parms, result;
225
224
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
226
225
  while (1) {
227
226
  switch (_context3.prev = _context3.next) {
228
227
  case 0:
229
- _this$topo$store$getS = this.topo.store.getState().topoMod, data = _this$topo$store$getS.data, resAndMetrics = _this$topo$store$getS.resAndMetrics, topoData = _this$topo$store$getS.topoData;
230
- _this$getState2 = this.getState(), alarmIsOpened = _this$getState2.alarmIsOpened, alarmOpening = _this$getState2.alarmOpening; // const { nodes, links } = data;
231
-
232
- nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList, resIdsList = resAndMetrics.resIdsList; // rlog.debug(
233
- // "获取告警列表--resAndMetrics,topoData,data",
234
- // this.topo,
235
- // resAndMetrics,
236
- // topoData,
237
- // data
238
- // );
239
-
240
228
  mainCiIdList = this.topo.dataModel.getDatas().filter(function (ci) {
241
229
  return !!ci.operation;
242
230
  }) // 过滤掉权限
@@ -245,7 +233,7 @@ var Alarm = /*#__PURE__*/function () {
245
233
  });
246
234
 
247
235
  if (!(mainCiIdList.length === 0)) {
248
- _context3.next = 7;
236
+ _context3.next = 4;
249
237
  break;
250
238
  }
251
239
 
@@ -255,7 +243,7 @@ var Alarm = /*#__PURE__*/function () {
255
243
  });
256
244
  return _context3.abrupt("return");
257
245
 
258
- case 7:
246
+ case 4:
259
247
  //rlog.debug("获取告警列表", mainCiIdList);
260
248
  endTime = null; // new Date().valueOf();
261
249
 
@@ -280,10 +268,10 @@ var Alarm = /*#__PURE__*/function () {
280
268
  endTime: endTime
281
269
  }
282
270
  };
283
- _context3.next = 12;
271
+ _context3.next = 9;
284
272
  return topoService.getAlarmByIds(parms);
285
273
 
286
- case 12:
274
+ case 9:
287
275
  result = _context3.sent;
288
276
  rlog.debug("getAlarmById-result", result); // if (alarmIsOpened) {
289
277
  // //this.topo.loadAlarm(result.datas);
@@ -294,7 +282,7 @@ var Alarm = /*#__PURE__*/function () {
294
282
  // alarmPanelIsOpen: result.datas.length > 0,
295
283
  // });
296
284
 
297
- case 14:
285
+ case 11:
298
286
  case "end":
299
287
  return _context3.stop();
300
288
  }
@@ -389,14 +377,14 @@ var Alarm = /*#__PURE__*/function () {
389
377
  var _openTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
390
378
  var _this2 = this;
391
379
 
392
- var _this$getState3, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
380
+ var _this$getState2, alarmOpening, topoAlarmIsOpen, alarmDispatchers;
393
381
 
394
382
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
395
383
  while (1) {
396
384
  switch (_context6.prev = _context6.next) {
397
385
  case 0:
398
386
  // 如果当前拓扑图开启中或已开启则退出
399
- _this$getState3 = this.getState(), alarmOpening = _this$getState3.alarmOpening, topoAlarmIsOpen = _this$getState3.topoAlarmIsOpen;
387
+ _this$getState2 = this.getState(), alarmOpening = _this$getState2.alarmOpening, topoAlarmIsOpen = _this$getState2.topoAlarmIsOpen;
400
388
 
401
389
  if (!(this.currentTopoId === id && (topoAlarmIsOpen || alarmOpening))) {
402
390
  _context6.next = 3;
@@ -456,14 +444,14 @@ var Alarm = /*#__PURE__*/function () {
456
444
  /*#__PURE__*/
457
445
  function () {
458
446
  var _closeTopoAlarm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id) {
459
- var _this$getState4, alarmIsOpened, alarmOpening;
447
+ var _this$getState3, alarmIsOpened, alarmOpening;
460
448
 
461
449
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
462
450
  while (1) {
463
451
  switch (_context7.prev = _context7.next) {
464
452
  case 0:
465
453
  // 如果未开启则退出
466
- _this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened, alarmOpening = _this$getState4.alarmOpening;
454
+ _this$getState3 = this.getState(), alarmIsOpened = _this$getState3.alarmIsOpened, alarmOpening = _this$getState3.alarmOpening;
467
455
 
468
456
  if (!(!alarmIsOpened && !alarmOpening)) {
469
457
  _context7.next = 3;
@@ -550,13 +538,13 @@ var Alarm = /*#__PURE__*/function () {
550
538
  /*#__PURE__*/
551
539
  function () {
552
540
  var _handleAlarmEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(alertData) {
553
- var _this$getState5, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
541
+ var _this$getState4, alarmIsOpened, resAndMetrics, resIdsList, nodeIdsList, linkIdsList, alarmDispatchers, sendAl, idsList, operations, _yield$alarmDispatche, eqFlag, alarmlist, _this$topo$viewProps, _this$topo$viewProps2;
554
542
 
555
543
  return _regeneratorRuntime.wrap(function _callee9$(_context9) {
556
544
  while (1) {
557
545
  switch (_context9.prev = _context9.next) {
558
546
  case 0:
559
- _this$getState5 = this.getState(), alarmIsOpened = _this$getState5.alarmIsOpened;
547
+ _this$getState4 = this.getState(), alarmIsOpened = _this$getState4.alarmIsOpened;
560
548
  resAndMetrics = this.topo.store.getState().topoMod.resAndMetrics;
561
549
  resIdsList = resAndMetrics.resIdsList, nodeIdsList = resAndMetrics.nodeIdsList, linkIdsList = resAndMetrics.linkIdsList;
562
550
  alarmDispatchers = this.topo.store.getModelDispatchers("topoAlarm"); // 添加事件
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
23
23
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
24
24
  import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
25
25
 
26
- var version = typeof "7.0.0-dev.13" === 'string' ? "7.0.0-dev.13" : null;
26
+ var version = typeof "7.0.0-dev.15" === 'string' ? "7.0.0-dev.15" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -33,9 +33,6 @@ export function isCrucialLink(link) {
33
33
  export function isExitLink(link) {
34
34
  return (link === null || link === void 0 ? void 0 : link.attributes) && !(link !== null && link !== void 0 && link.attributes['destination_id']);
35
35
  }
36
- export function isAggLink(link) {
37
- return link.attributes["network_link.connect_type"] === "agg";
38
- }
39
36
  export var getInterfaceObject = /*#__PURE__*/function () {
40
37
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(codes) {
41
38
  var query, promises, result, ifDoc;
@@ -606,15 +606,16 @@ export default function (topoApp) {
606
606
 
607
607
  case 4:
608
608
  topoPermission = _context11.sent;
609
- _context11.next = 10;
609
+ rlog.debug('查询拓扑权限', topoPermission);
610
+ _context11.next = 11;
610
611
  break;
611
612
 
612
- case 7:
613
- _context11.prev = 7;
613
+ case 8:
614
+ _context11.prev = 8;
614
615
  _context11.t0 = _context11["catch"](1);
615
616
  rlog.error("\u67E5\u8BE2\u62D3\u6251" + id + "\u7684\u6743\u9650\u5931\u8D25", _context11.t0); // 尚未区分拓扑图不存在还是接口请求报错
616
617
 
617
- case 10:
618
+ case 11:
618
619
  if (update !== false) {
619
620
  _this8.update({
620
621
  topoPermission: topoPermission
@@ -623,12 +624,12 @@ export default function (topoApp) {
623
624
 
624
625
  return _context11.abrupt("return", topoPermission);
625
626
 
626
- case 12:
627
+ case 13:
627
628
  case "end":
628
629
  return _context11.stop();
629
630
  }
630
631
  }
631
- }, _callee11, null, [[1, 7]]);
632
+ }, _callee11, null, [[1, 8]]);
632
633
  }))();
633
634
  }
634
635
  };
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { getLinksDetail } from "../core/models/utils/linkUtils";
5
- import { queryCisByIds } from "../core/services";
6
5
  import { addTopoDataResourcePermission } from "./utils/resourcePermissionUtil"; // import "./utils/__tests__/resourcePermissionUtil.test";
7
6
 
8
7
  export function addLinkData(_x, _x2) {
@@ -16,7 +15,7 @@ export function addLinkData(_x, _x2) {
16
15
 
17
16
  function _addLinkData() {
18
17
  _addLinkData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(oldLinks, nodes) {
19
- var links;
18
+ var links, networkLinks, otherLinks;
20
19
  return _regeneratorRuntime.wrap(function _callee$(_context) {
21
20
  while (1) {
22
21
  switch (_context.prev = _context.next) {
@@ -32,18 +31,24 @@ function _addLinkData() {
32
31
  }
33
32
 
34
33
  return true;
35
- });
34
+ }); // 如果是网络链路,补充详情信息
35
+
36
36
  _context.next = 3;
37
- return getLinksDetail(links, nodes);
37
+ return getLinksDetail(links.filter(function (link) {
38
+ return !link.ciType;
39
+ }), nodes);
38
40
 
39
41
  case 3:
40
- links = _context.sent;
42
+ networkLinks = _context.sent;
43
+ otherLinks = links.filter(function (link) {
44
+ return !!link.ciType;
45
+ });
41
46
  return _context.abrupt("return", {
42
- links: links,
47
+ links: [].concat(networkLinks, otherLinks),
43
48
  linkGroups: []
44
49
  });
45
50
 
46
- case 5:
51
+ case 6:
47
52
  case "end":
48
53
  return _context.stop();
49
54
  }
@@ -72,7 +77,7 @@ export function buildData(_x3) {
72
77
 
73
78
  function _buildData() {
74
79
  _buildData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
75
- var newData, nodes, _yield$Promise$all, nodeCis, linkData;
80
+ var newData, nodes, _yield$Promise$all, linkData;
76
81
 
77
82
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
78
83
  while (1) {
@@ -89,34 +94,18 @@ function _buildData() {
89
94
  });
90
95
  });
91
96
  _context2.next = 4;
92
- return Promise.all([// 查询节点属性
93
- queryCisByIds(nodes.map(function (node) {
94
- return node.id;
95
- })), addLinkData(data.links || [], nodes)]);
97
+ return Promise.all([addLinkData(data.links || [], nodes)]);
96
98
 
97
99
  case 4:
98
100
  _yield$Promise$all = _context2.sent;
99
- nodeCis = _yield$Promise$all[0];
100
- linkData = _yield$Promise$all[1];
101
- nodes = nodes.map(function (node) {
102
- var _node$attributes$find;
103
-
104
- return _extends({}, node, {
105
- ipAddress: Array.isArray(node.attributes) ? (_node$attributes$find = node.attributes.find(function (item) {
106
- return item.code === 'ipAddress';
107
- })) === null || _node$attributes$find === void 0 ? void 0 : _node$attributes$find.value : null,
108
- attributes: nodeCis.find(function (ci) {
109
- return ci.id === node.id;
110
- }).attributes
111
- });
112
- });
101
+ linkData = _yield$Promise$all[0];
113
102
  newData = _extends({}, newData, {
114
103
  nodes: nodes
115
104
  }, linkData);
116
105
  newData = addTopoDataResourcePermission(newData);
117
106
  return _context2.abrupt("return", newData);
118
107
 
119
- case 11:
108
+ case 9:
120
109
  case "end":
121
110
  return _context2.stop();
122
111
  }
@@ -4,7 +4,6 @@ import _Message from "@alifd/next/es/message";
4
4
  import _Dialog from "@alifd/next/es/dialog";
5
5
  import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
7
- import { isAggLink } from "../../../core/models/utils/linkUtils";
8
7
  import linkService from "../../services/link";
9
8
  import { getLinkPermission } from "../../utils/resourcePermissionUtil";
10
9
  /**
@@ -49,8 +48,7 @@ export default (function (_ref) {
49
48
  switch (_context.prev = _context.next) {
50
49
  case 0:
51
50
  id = link.id;
52
- isGroup = false; // isAggLink(link);
53
-
51
+ isGroup = false;
54
52
  _context.next = 4;
55
53
  return linkService.deleteLink(id);
56
54
 
@@ -57,7 +57,7 @@ function getButtons(isNetworkTopo) {
57
57
  _Divider["default"], _NodeImageButton["default"], // 替换图片
58
58
  _NodeSizeButton["default"], // 图片尺寸
59
59
  _Divider["default"], _Layout["default"], // 布局方式
60
- _NodeAlignWidget["default"] // 对齐方式
61
- // SearchWidget, // 搜索
60
+ _NodeAlignWidget["default"], // 对齐方式
61
+ _SearchWidget["default"] // 搜索
62
62
  ]);
63
63
  }
@@ -23,8 +23,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
23
23
 
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
+ function PropertyViewProvider(props) {}
27
+
26
28
  function PropertyPanel(props) {
27
- var _classNames;
29
+ var _editorProps$property, _editorProps$property2, _classNames;
28
30
 
29
31
  var topo = props.topo,
30
32
  editorProps = props.editorProps;
@@ -36,21 +38,19 @@ function PropertyPanel(props) {
36
38
  var _store$useModelState = store.useModelState('selection'),
37
39
  selection = _store$useModelState.selection;
38
40
 
39
- var _topo$store$useModel = topo.store.useModel('topoEdit'),
40
- topoEditState = _topo$store$useModel[0],
41
- topoEditDispatchers = _topo$store$useModel[1];
42
-
41
+ var topoEditState = topo.store.useModelState('topoEdit');
43
42
  var propertyPanelVisible = topoEditState.propertyPanelVisible;
44
43
  var propertyViewManager = (0, _react.useMemo)(function () {
45
44
  return new _PropertyViewManager["default"](topo);
46
- }, []); // 临时适配连线属性面板类型,后期组件支持自定义适配
47
-
48
- (0, _edgePropertyViewAdapter.addEdgePropertyViews)(propertyViewManager, editorProps);
45
+ }, []);
46
+ propertyViewManager.addViews((_editorProps$property = editorProps.propertyView) === null || _editorProps$property === void 0 ? void 0 : _editorProps$property.views);
49
47
 
50
- propertyViewManager.customGetViewType = editorProps.getPropertyViewType || function (elements) {
48
+ propertyViewManager.customGetViewType = ((_editorProps$property2 = editorProps.propertyView) === null || _editorProps$property2 === void 0 ? void 0 : _editorProps$property2.getPropertyViewType) || function (elements) {
51
49
  return (0, _edgePropertyViewAdapter.adapterGetEdgePropertyViewType)(elements, editorProps);
52
- };
50
+ }; // 临时适配连线属性面板类型,后期组件支持自定义适配
51
+
53
52
 
53
+ (0, _edgePropertyViewAdapter.addEdgePropertyViews)(propertyViewManager, editorProps);
54
54
  var PropertyView = propertyViewManager.getPropertyView();
55
55
  (0, _react.useEffect)(function () {
56
56
  if (graphLoaded) {
@@ -13,6 +13,8 @@ var _useSettingRuntimeState = _interopRequireDefault(require("./useSettingRuntim
13
13
 
14
14
  var _updateElementProperty = _interopRequireDefault(require("./core/updateElementProperty"));
15
15
 
16
+ var _htElementUtils = require("../../../../utils/htElementUtils");
17
+
16
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
19
 
18
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -46,10 +48,16 @@ function PropertyViewContainer(props) {
46
48
  var elementProps = {};
47
49
 
48
50
  if (selection.length === 1) {
51
+ var element = selectionElements[0];
49
52
  elementProps = {
50
- selectionElement: selectionElements[0],
53
+ element: element,
54
+ selectionElement: element,
51
55
  values: singleElementValues
52
56
  };
57
+
58
+ if ((0, _htElementUtils.isEdge)(element)) {
59
+ elementProps.edge = element;
60
+ }
53
61
  }
54
62
 
55
63
  return /*#__PURE__*/_react["default"].createElement(PropertyView, (0, _extends2["default"])({
@@ -13,17 +13,18 @@ var _getPropertyViewType2 = _interopRequireDefault(require("./getPropertyViewTyp
13
13
 
14
14
  var PropertyViewManager = /*#__PURE__*/function () {
15
15
  function PropertyViewManager(topo) {
16
- this.viewMap = _propertyViews["default"];
16
+ this.viewMap = (0, _extends2["default"])({}, _propertyViews["default"]);
17
17
  this.topo = void 0;
18
18
  this.customGetViewType = void 0;
19
19
  this.topo = topo;
20
+ this.topo.propertyViewManager = this;
20
21
  this.open = this.open.bind(this);
21
22
  }
22
23
 
23
24
  var _proto = PropertyViewManager.prototype;
24
25
 
25
- _proto.updateViews = function updateViews(viewMap) {
26
- this.viewMap = (0, _extends2["default"])({}, _propertyViews["default"], viewMap);
26
+ _proto.addViews = function addViews(viewMap) {
27
+ Object.assign(this.viewMap, viewMap);
27
28
  };
28
29
 
29
30
  _proto.init = function init() {
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  exports.__esModule = true;
6
4
  exports.adapterGetEdgePropertyViewType = adapterGetEdgePropertyViewType;
7
5
  exports.addEdgePropertyViews = addEdgePropertyViews;
8
6
 
9
7
  var _htElementUtils = require("../../../../../utils/htElementUtils");
10
8
 
11
- var _addEdgeProps = _interopRequireDefault(require("../propertyViews/edge/addEdgeProps"));
12
-
13
9
  function adapterGetEdgePropertyViewType(selection, editorProps) {
14
10
  var fn = editorProps.getEdgePropertyViewType;
15
11
 
@@ -24,10 +20,5 @@ function adapterGetEdgePropertyViewType(selection, editorProps) {
24
20
  }
25
21
 
26
22
  function addEdgePropertyViews(propertyViewManager, editorProps) {
27
- var oldMap = editorProps.edgePropertyViews || {};
28
- var map = {};
29
- Object.keys(oldMap).forEach(function (name) {
30
- map[name] = (0, _addEdgeProps["default"])(oldMap[name]);
31
- });
32
- propertyViewManager.updateViews(map);
23
+ propertyViewManager.addViews(editorProps.edgePropertyViews || {});
33
24
  }
@@ -26,12 +26,7 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
26
26
  var usePolling = function usePolling(props) {
27
27
  var topo = props.topo;
28
28
  var store = topo.store;
29
- var topoState = store.useModelState('topoMod');
30
-
31
- var _store$useModel = store.useModel('topoBizMod'),
32
- bizState = _store$useModel[0],
33
- bizDispatchers = _store$useModel[1];
34
-
29
+ var bizState = store.useModelState('topoBizMod');
35
30
  var resAndMetrics = bizState.resAndMetrics,
36
31
  pollingSwitch = bizState.pollingSwitch;
37
32
  var displayConfig = topo.store.useModelState('displayConfig');
@@ -75,8 +75,10 @@ var useTopoEdit = function useTopoEdit(params) {
75
75
  setComboResData = _useState2[1];
76
76
 
77
77
  var reset = function reset() {
78
+ var _topo$historyManager;
79
+
78
80
  topoEditDispatchers.reset();
79
- topo.historyManager.destroy();
81
+ (_topo$historyManager = topo.historyManager) === null || _topo$historyManager === void 0 ? void 0 : _topo$historyManager.destroy();
80
82
  };
81
83
  /**
82
84
  * 增加资源到视图