@riil-frontend/component-topology 6.0.4 → 6.0.6

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.
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["topo", "showLabel"];
3
+ var _excluded = ["topo", "showLabel", "editorProps"];
4
4
  import React, { useEffect, useMemo, useState } from 'react';
5
5
  import { getEdgesBySelection, setEdgesAndChildren, setEdgesType } from "../../../../utils/edgeTypeStyleUtil";
6
6
  import DropdownButton from "../components/DropdownButton";
@@ -16,24 +16,29 @@ import EdgeType from "./EdgeType";
16
16
  function EdgeTypeButton(props) {
17
17
  var topo = props.topo,
18
18
  showLabel = props.showLabel,
19
+ editorProps = props.editorProps,
19
20
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
20
21
 
21
22
  var _useState = useState(true),
22
23
  disabled = _useState[0],
23
- setDisabled = _useState[1]; // 拓扑图是否加载
24
+ setDisabled = _useState[1]; // FIXME 临时方案支持业务拓扑禁用连线设置
24
25
 
25
26
 
27
+ var linkDrawShapeEnabled = editorProps.linkDrawShapeEnabled; // 拓扑图是否加载
28
+
26
29
  var _topo$store$useModelS = topo.store.useModelState('topoMod'),
27
30
  graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
28
31
 
29
32
 
30
33
  var selection = topo.selectionModel.useHtSelection();
31
34
  useEffect(function () {
32
- if (graphLoaded) {
35
+ if (graphLoaded && linkDrawShapeEnabled !== false) {
33
36
  var edges = getEdgesBySelection(topo);
34
37
  setDisabled(!edges.length);
38
+ } else {
39
+ setDisabled(true);
35
40
  }
36
- }, [selection, graphLoaded]);
41
+ }, [selection, graphLoaded, linkDrawShapeEnabled]);
37
42
 
38
43
  var handleChange = function handleChange(name, value) {
39
44
  var edges = getEdgesBySelection(topo);
@@ -1,12 +1,10 @@
1
1
  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
- import { useMemo, useState, useEffect } from 'react';
5
- import rlog from '@riil-frontend/component-topology-utils/es/rlog';
6
- import { DEFAULT_GROUP } from "../../utils/template";
7
- import ResourceConfigUtil from "../../utils/ResourceConfigUtil";
8
- import { getEdges, getElements, getNodes } from "../../utils/htElementUtils";
9
4
  import { getAllEdgeResourceIds as _getAllEdgeResourceIds, isResourceNodeElement } from "../../utils/htElementDataUtil";
5
+ import { getElements } from "../../utils/htElementUtils";
6
+ import ResourceConfigUtil from "../../utils/ResourceConfigUtil";
7
+ import { DEFAULT_GROUP } from "../../utils/template";
10
8
  export default function (props) {
11
9
  var topo = props.topo;
12
10
  var store = topo.store;
@@ -18,9 +16,10 @@ export default function (props) {
18
16
  while (1) {
19
17
  switch (_context.prev = _context.next) {
20
18
  case 0:
21
- editDispatchers.getConditions();
19
+ _context.next = 2;
20
+ return editDispatchers.getConditions();
22
21
 
23
- case 1:
22
+ case 2:
24
23
  case "end":
25
24
  return _context.stop();
26
25
  }
@@ -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 "6.0.4" === 'string' ? "6.0.4" : null;
26
+ var version = typeof "6.0.6" === 'string' ? "6.0.6" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -557,15 +557,20 @@ var Topo = /*#__PURE__*/function () {
557
557
  case 8:
558
558
  updateEdgeExpanded(this);
559
559
 
560
- if (this.options.onSwitchToEditMode) {
561
- this.options.onSwitchToEditMode(this);
562
- } // 加载自定义上传的图标
560
+ if (!this.options.onSwitchToEditMode) {
561
+ _context12.next = 12;
562
+ break;
563
+ }
563
564
 
565
+ _context12.next = 12;
566
+ return this.options.onSwitchToEditMode(this);
564
567
 
568
+ case 12:
569
+ // 加载自定义上传的图标
565
570
  iconManageDispatchers = this.store.getModelDispatchers('customIcon');
566
571
  iconManageDispatchers.loadEditorIcons();
567
572
 
568
- case 12:
573
+ case 14:
569
574
  case "end":
570
575
  return _context12.stop();
571
576
  }
@@ -594,11 +599,15 @@ var Topo = /*#__PURE__*/function () {
594
599
  editDispatchers = this.store.getModelDispatchers('topoConfig');
595
600
  editDispatchers.switchToViewMode(this.id);
596
601
 
597
- if (this.options.onSwitchToViewMode) {
598
- this.options.onSwitchToViewMode(this);
602
+ if (!this.options.onSwitchToViewMode) {
603
+ _context13.next = 7;
604
+ break;
599
605
  }
600
606
 
601
- case 5:
607
+ _context13.next = 7;
608
+ return this.options.onSwitchToViewMode(this);
609
+
610
+ case 7:
602
611
  case "end":
603
612
  return _context13.stop();
604
613
  }
@@ -63,9 +63,10 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
63
63
  while (1) {
64
64
  switch (_context2.prev = _context2.next) {
65
65
  case 0:
66
- topo.resourceConfig.loadConfig();
66
+ _context2.next = 2;
67
+ return topo.resourceConfig.loadConfig();
67
68
 
68
- case 1:
69
+ case 2:
69
70
  case "end":
70
71
  return _context2.stop();
71
72
  }
@@ -79,13 +80,37 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
79
80
 
80
81
  return onSwitchToEditMode;
81
82
  }(),
82
- onSwitchToViewMode: function onSwitchToViewMode(topo) {
83
- var topoModDispatchers = topo.store.getModelDispatchers('topoMod');
84
- topoModDispatchers.openTopoPage({
85
- id: topo.id
86
- });
87
- topoModDispatchers.refreshTopoTree();
88
- }
83
+ onSwitchToViewMode: function () {
84
+ var _onSwitchToViewMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(topo) {
85
+ var topoModDispatchers;
86
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
87
+ while (1) {
88
+ switch (_context3.prev = _context3.next) {
89
+ case 0:
90
+ topoModDispatchers = topo.store.getModelDispatchers('topoMod');
91
+ _context3.next = 3;
92
+ return topoModDispatchers.openTopoPage({
93
+ id: topo.id
94
+ });
95
+
96
+ case 3:
97
+ _context3.next = 5;
98
+ return topoModDispatchers.refreshTopoTree();
99
+
100
+ case 5:
101
+ case "end":
102
+ return _context3.stop();
103
+ }
104
+ }
105
+ }, _callee3);
106
+ }));
107
+
108
+ function onSwitchToViewMode(_x3) {
109
+ return _onSwitchToViewMode.apply(this, arguments);
110
+ }
111
+
112
+ return onSwitchToViewMode;
113
+ }()
89
114
  })) || this;
90
115
  _this.resourceConfig = null;
91
116
  var menuCommands = createMenuCommands(_assertThisInitialized(_this));
@@ -106,25 +131,25 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
106
131
  _proto.initData =
107
132
  /*#__PURE__*/
108
133
  function () {
109
- var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(params) {
134
+ var _initData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params) {
110
135
  var topoDispatchers;
111
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
136
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
112
137
  while (1) {
113
- switch (_context3.prev = _context3.next) {
138
+ switch (_context4.prev = _context4.next) {
114
139
  case 0:
115
140
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
116
- _context3.next = 3;
141
+ _context4.next = 3;
117
142
  return topoDispatchers.initData(params);
118
143
 
119
144
  case 3:
120
145
  case "end":
121
- return _context3.stop();
146
+ return _context4.stop();
122
147
  }
123
148
  }
124
- }, _callee3, this);
149
+ }, _callee4, this);
125
150
  }));
126
151
 
127
- function initData(_x3) {
152
+ function initData(_x4) {
128
153
  return _initData.apply(this, arguments);
129
154
  }
130
155
 
@@ -143,22 +168,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
143
168
  _proto.exit =
144
169
  /*#__PURE__*/
145
170
  function () {
146
- var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
171
+ var _exit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
147
172
  var topoDispatchers;
148
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
173
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
149
174
  while (1) {
150
- switch (_context4.prev = _context4.next) {
175
+ switch (_context5.prev = _context5.next) {
151
176
  case 0:
152
177
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
153
- _context4.next = 3;
178
+ _context5.next = 3;
154
179
  return topoDispatchers.exit();
155
180
 
156
181
  case 3:
157
182
  case "end":
158
- return _context4.stop();
183
+ return _context5.stop();
159
184
  }
160
185
  }
161
- }, _callee4, this);
186
+ }, _callee5, this);
162
187
  }));
163
188
 
164
189
  function exit() {
@@ -21,7 +21,7 @@ var _constants = require("./constants");
21
21
 
22
22
  var _EdgeType = _interopRequireDefault(require("./EdgeType"));
23
23
 
24
- var _excluded = ["topo", "showLabel"];
24
+ var _excluded = ["topo", "showLabel", "editorProps"];
25
25
 
26
26
  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); }
27
27
 
@@ -35,24 +35,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
35
35
  function EdgeTypeButton(props) {
36
36
  var topo = props.topo,
37
37
  showLabel = props.showLabel,
38
+ editorProps = props.editorProps,
38
39
  otherProps = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
39
40
 
40
41
  var _useState = (0, _react.useState)(true),
41
42
  disabled = _useState[0],
42
- setDisabled = _useState[1]; // 拓扑图是否加载
43
+ setDisabled = _useState[1]; // FIXME 临时方案支持业务拓扑禁用连线设置
43
44
 
44
45
 
46
+ var linkDrawShapeEnabled = editorProps.linkDrawShapeEnabled; // 拓扑图是否加载
47
+
45
48
  var _topo$store$useModelS = topo.store.useModelState('topoMod'),
46
49
  graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
47
50
 
48
51
 
49
52
  var selection = topo.selectionModel.useHtSelection();
50
53
  (0, _react.useEffect)(function () {
51
- if (graphLoaded) {
54
+ if (graphLoaded && linkDrawShapeEnabled !== false) {
52
55
  var edges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
53
56
  setDisabled(!edges.length);
57
+ } else {
58
+ setDisabled(true);
54
59
  }
55
- }, [selection, graphLoaded]);
60
+ }, [selection, graphLoaded, linkDrawShapeEnabled]);
56
61
 
57
62
  var handleChange = function handleChange(name, value) {
58
63
  var edges = (0, _edgeTypeStyleUtil.getEdgesBySelection)(topo);
@@ -11,17 +11,13 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
 
14
- var _react = require("react");
15
-
16
- var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-utils/es/rlog"));
14
+ var _htElementDataUtil = require("../../utils/htElementDataUtil");
17
15
 
18
- var _template = require("../../utils/template");
16
+ var _htElementUtils = require("../../utils/htElementUtils");
19
17
 
20
18
  var _ResourceConfigUtil = _interopRequireDefault(require("../../utils/ResourceConfigUtil"));
21
19
 
22
- var _htElementUtils = require("../../utils/htElementUtils");
23
-
24
- var _htElementDataUtil = require("../../utils/htElementDataUtil");
20
+ var _template = require("../../utils/template");
25
21
 
26
22
  function _default(props) {
27
23
  var topo = props.topo;
@@ -34,9 +30,10 @@ function _default(props) {
34
30
  while (1) {
35
31
  switch (_context.prev = _context.next) {
36
32
  case 0:
37
- editDispatchers.getConditions();
33
+ _context.next = 2;
34
+ return editDispatchers.getConditions();
38
35
 
39
- case 1:
36
+ case 2:
40
37
  case "end":
41
38
  return _context.stop();
42
39
  }
@@ -54,7 +54,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
54
54
  var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
55
55
 
56
56
  // eslint-disable-next-line no-undef
57
- var version = typeof "6.0.4" === 'string' ? "6.0.4" : null;
57
+ var version = typeof "6.0.6" === 'string' ? "6.0.6" : null;
58
58
  console.info("\u62D3\u6251\u7248\u672C: " + version);
59
59
  /**
60
60
  * 拓扑显示和编辑
@@ -588,15 +588,20 @@ var Topo = /*#__PURE__*/function () {
588
588
  case 8:
589
589
  (0, _edgeUtil.updateEdgeExpanded)(this);
590
590
 
591
- if (this.options.onSwitchToEditMode) {
592
- this.options.onSwitchToEditMode(this);
593
- } // 加载自定义上传的图标
591
+ if (!this.options.onSwitchToEditMode) {
592
+ _context12.next = 12;
593
+ break;
594
+ }
594
595
 
596
+ _context12.next = 12;
597
+ return this.options.onSwitchToEditMode(this);
595
598
 
599
+ case 12:
600
+ // 加载自定义上传的图标
596
601
  iconManageDispatchers = this.store.getModelDispatchers('customIcon');
597
602
  iconManageDispatchers.loadEditorIcons();
598
603
 
599
- case 12:
604
+ case 14:
600
605
  case "end":
601
606
  return _context12.stop();
602
607
  }
@@ -625,11 +630,15 @@ var Topo = /*#__PURE__*/function () {
625
630
  editDispatchers = this.store.getModelDispatchers('topoConfig');
626
631
  editDispatchers.switchToViewMode(this.id);
627
632
 
628
- if (this.options.onSwitchToViewMode) {
629
- this.options.onSwitchToViewMode(this);
633
+ if (!this.options.onSwitchToViewMode) {
634
+ _context13.next = 7;
635
+ break;
630
636
  }
631
637
 
632
- case 5:
638
+ _context13.next = 7;
639
+ return this.options.onSwitchToViewMode(this);
640
+
641
+ case 7:
633
642
  case "end":
634
643
  return _context13.stop();
635
644
  }
@@ -81,9 +81,10 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
81
81
  while (1) {
82
82
  switch (_context2.prev = _context2.next) {
83
83
  case 0:
84
- topo.resourceConfig.loadConfig();
84
+ _context2.next = 2;
85
+ return topo.resourceConfig.loadConfig();
85
86
 
86
- case 1:
87
+ case 2:
87
88
  case "end":
88
89
  return _context2.stop();
89
90
  }
@@ -97,13 +98,37 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
97
98
 
98
99
  return onSwitchToEditMode;
99
100
  }(),
100
- onSwitchToViewMode: function onSwitchToViewMode(topo) {
101
- var topoModDispatchers = topo.store.getModelDispatchers('topoMod');
102
- topoModDispatchers.openTopoPage({
103
- id: topo.id
104
- });
105
- topoModDispatchers.refreshTopoTree();
106
- }
101
+ onSwitchToViewMode: function () {
102
+ var _onSwitchToViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(topo) {
103
+ var topoModDispatchers;
104
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
105
+ while (1) {
106
+ switch (_context3.prev = _context3.next) {
107
+ case 0:
108
+ topoModDispatchers = topo.store.getModelDispatchers('topoMod');
109
+ _context3.next = 3;
110
+ return topoModDispatchers.openTopoPage({
111
+ id: topo.id
112
+ });
113
+
114
+ case 3:
115
+ _context3.next = 5;
116
+ return topoModDispatchers.refreshTopoTree();
117
+
118
+ case 5:
119
+ case "end":
120
+ return _context3.stop();
121
+ }
122
+ }
123
+ }, _callee3);
124
+ }));
125
+
126
+ function onSwitchToViewMode(_x3) {
127
+ return _onSwitchToViewMode.apply(this, arguments);
128
+ }
129
+
130
+ return onSwitchToViewMode;
131
+ }()
107
132
  })) || this;
108
133
  _this.resourceConfig = null;
109
134
  var menuCommands = (0, _createMenuCommands["default"])((0, _assertThisInitialized2["default"])(_this));
@@ -124,25 +149,25 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
124
149
  _proto.initData =
125
150
  /*#__PURE__*/
126
151
  function () {
127
- var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(params) {
152
+ var _initData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(params) {
128
153
  var topoDispatchers;
129
- return _regenerator["default"].wrap(function _callee3$(_context3) {
154
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
130
155
  while (1) {
131
- switch (_context3.prev = _context3.next) {
156
+ switch (_context4.prev = _context4.next) {
132
157
  case 0:
133
158
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
134
- _context3.next = 3;
159
+ _context4.next = 3;
135
160
  return topoDispatchers.initData(params);
136
161
 
137
162
  case 3:
138
163
  case "end":
139
- return _context3.stop();
164
+ return _context4.stop();
140
165
  }
141
166
  }
142
- }, _callee3, this);
167
+ }, _callee4, this);
143
168
  }));
144
169
 
145
- function initData(_x3) {
170
+ function initData(_x4) {
146
171
  return _initData.apply(this, arguments);
147
172
  }
148
173
 
@@ -161,22 +186,22 @@ var TopoCenter = /*#__PURE__*/function (_TopoApp) {
161
186
  _proto.exit =
162
187
  /*#__PURE__*/
163
188
  function () {
164
- var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
189
+ var _exit = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
165
190
  var topoDispatchers;
166
- return _regenerator["default"].wrap(function _callee4$(_context4) {
191
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
167
192
  while (1) {
168
- switch (_context4.prev = _context4.next) {
193
+ switch (_context5.prev = _context5.next) {
169
194
  case 0:
170
195
  topoDispatchers = this.store.getModelDispatchers('topoCenter');
171
- _context4.next = 3;
196
+ _context5.next = 3;
172
197
  return topoDispatchers.exit();
173
198
 
174
199
  case 3:
175
200
  case "end":
176
- return _context4.stop();
201
+ return _context5.stop();
177
202
  }
178
203
  }
179
- }, _callee4, this);
204
+ }, _callee5, this);
180
205
  }));
181
206
 
182
207
  function exit() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "6.0.4",
3
+ "version": "6.0.6",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.4/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.6/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }