@riil-frontend/component-topology 2.15.42 → 2.15.45

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 (133) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +2 -2
  3. package/es/common/components/ColorPicker/ColorPicker.js +5 -2
  4. package/es/components/Drawer/index.js +8 -2
  5. package/es/components/TemplateButton/index.module.scss +1 -0
  6. package/es/core/common/hooks/ht/useDataModelDataPropertyChange.js +13 -4
  7. package/es/core/common/icons/icon.js +1 -1
  8. package/es/core/common/icons/useIcons.js +1 -1
  9. package/es/core/components/TopoView/topoView.js +8 -18
  10. package/es/core/{models/createTopoApp.js → createTopoApp.js} +1 -1
  11. package/es/core/editor/components/BackgroundView/index.js +80 -44
  12. package/es/core/editor/components/BackgroundView/index.module.scss +1 -0
  13. package/es/core/editor/components/{iconManage/IconManage.js → CustomIconPlugin/CustomIconPlugin.js} +3 -3
  14. package/es/core/editor/components/{iconManage → CustomIconPlugin}/RenameDialog.js +1 -1
  15. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.js +16 -2
  16. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.module.scss +0 -0
  17. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.scss +0 -0
  18. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialogWrapper.js +1 -1
  19. package/es/core/editor/components/CustomIconPlugin/index.js +2 -0
  20. package/es/core/editor/components/{iconManage → CustomIconPlugin}/utils/svgToShape.js +0 -0
  21. package/es/core/editor/components/EditorPlugin.js +2 -2
  22. package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +2 -0
  23. package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +2 -2
  24. package/es/core/models/TopoApp.js +9 -5
  25. package/es/core/services/background.js +26 -1
  26. package/es/core/store/coreModels.js +32 -26
  27. package/es/core/store/createStore.js +1 -1
  28. package/es/core/test/Test.js +3 -1
  29. package/es/core/viewer/contextmenu/buildNodeContextmenu.js +65 -64
  30. package/es/createTopo.js +1 -1
  31. package/es/hooks/useAlarm.js +3 -6
  32. package/es/hooks/useResourceConfig.js +1 -1
  33. package/es/hooks/useTopoEdit.js +4 -8
  34. package/es/models/{iconManage.js → customIcon.js} +1 -1
  35. package/es/models/topoBizMod.js +22 -52
  36. package/es/models/{topoCreateMod.js → topoConfig.js} +8 -4
  37. package/es/models/topoMod.js +32 -69
  38. package/es/{components → topoCenter/components}/Link/form.js +0 -0
  39. package/es/{components → topoCenter/components}/Link/hook.js +0 -0
  40. package/es/{components → topoCenter/components}/Link/index copy.js +1 -1
  41. package/es/{components → topoCenter/components}/Link/index.js +1 -1
  42. package/es/{components → topoCenter/components}/Link/index.module.scss +0 -0
  43. package/es/{components → topoCenter/components}/Link/setting.js +0 -0
  44. package/es/topoCenter/components/TopoView.js +16 -3
  45. package/es/topoCenter/components/Topology.js +0 -5
  46. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.js +0 -0
  47. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.module.scss +0 -0
  48. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/index.js +0 -0
  49. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.js +0 -0
  50. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.module.scss +0 -0
  51. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.js +0 -0
  52. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.module.scss +0 -0
  53. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.scss +0 -0
  54. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.js +0 -0
  55. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.module.scss +0 -0
  56. package/es/topoCenter/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +1 -1
  57. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +3 -3
  58. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +1 -1
  59. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
  60. package/es/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.js → LinkInfoPreview.js} +1 -1
  61. package/es/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.module.scss → LinkInfoPreview.module.scss} +0 -0
  62. package/es/{hooks → topoCenter/hooks/viewer}/useRelateTopo.js +2 -2
  63. package/es/{models → topoCenter/store}/linkDynamicStyle.js +3 -3
  64. package/es/{models → topoCenter/store}/linkDynamicStyleConfig.js +2 -1
  65. package/es/{models → topoCenter/store}/linkManager.js +0 -0
  66. package/lib/common/components/ColorPicker/ColorPicker.js +5 -2
  67. package/lib/components/Drawer/index.js +7 -2
  68. package/lib/components/TemplateButton/index.module.scss +1 -0
  69. package/lib/core/common/hooks/ht/useDataModelDataPropertyChange.js +13 -4
  70. package/lib/core/common/icons/icon.js +1 -1
  71. package/lib/core/common/icons/useIcons.js +1 -1
  72. package/lib/core/components/TopoView/topoView.js +9 -20
  73. package/lib/core/{models/createTopoApp.js → createTopoApp.js} +1 -1
  74. package/lib/core/editor/components/BackgroundView/index.js +80 -44
  75. package/lib/core/editor/components/BackgroundView/index.module.scss +1 -0
  76. package/lib/core/editor/components/{iconManage/IconManage.js → CustomIconPlugin/CustomIconPlugin.js} +3 -3
  77. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/RenameDialog.js +1 -1
  78. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.js +17 -2
  79. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.module.scss +0 -0
  80. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.scss +0 -0
  81. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialogWrapper.js +1 -1
  82. package/lib/core/editor/components/CustomIconPlugin/index.js +11 -0
  83. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/utils/svgToShape.js +0 -0
  84. package/lib/core/editor/components/EditorPlugin.js +2 -2
  85. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +2 -0
  86. package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +1 -1
  87. package/lib/core/models/TopoApp.js +9 -5
  88. package/lib/core/services/background.js +26 -1
  89. package/lib/core/store/coreModels.js +35 -26
  90. package/lib/core/store/createStore.js +2 -2
  91. package/lib/core/test/Test.js +3 -1
  92. package/lib/core/viewer/contextmenu/buildNodeContextmenu.js +65 -64
  93. package/lib/createTopo.js +1 -1
  94. package/lib/hooks/useAlarm.js +3 -6
  95. package/lib/hooks/useResourceConfig.js +1 -1
  96. package/lib/hooks/useTopoEdit.js +4 -8
  97. package/lib/models/{iconManage.js → customIcon.js} +1 -1
  98. package/lib/models/topoBizMod.js +22 -52
  99. package/lib/models/{topoCreateMod.js → topoConfig.js} +7 -4
  100. package/lib/models/topoMod.js +32 -69
  101. package/lib/{components → topoCenter/components}/Link/form.js +0 -0
  102. package/lib/{components → topoCenter/components}/Link/hook.js +0 -0
  103. package/lib/{components → topoCenter/components}/Link/index copy.js +1 -1
  104. package/lib/{components → topoCenter/components}/Link/index.js +1 -1
  105. package/lib/{components → topoCenter/components}/Link/index.module.scss +0 -0
  106. package/lib/{components → topoCenter/components}/Link/setting.js +0 -0
  107. package/lib/topoCenter/components/TopoView.js +19 -3
  108. package/lib/topoCenter/components/Topology.js +0 -7
  109. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.js +0 -0
  110. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.module.scss +0 -0
  111. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/index.js +0 -0
  112. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.js +0 -0
  113. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.module.scss +0 -0
  114. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.js +0 -0
  115. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.module.scss +0 -0
  116. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.scss +0 -0
  117. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.js +0 -0
  118. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.module.scss +0 -0
  119. package/lib/topoCenter/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +2 -2
  120. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +8 -8
  121. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +1 -1
  122. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
  123. package/lib/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.js → LinkInfoPreview.js} +4 -4
  124. package/lib/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.module.scss → LinkInfoPreview.module.scss} +0 -0
  125. package/lib/{hooks → topoCenter/hooks/viewer}/useRelateTopo.js +2 -2
  126. package/lib/{models → topoCenter/store}/linkDynamicStyle.js +3 -3
  127. package/lib/{models → topoCenter/store}/linkDynamicStyleConfig.js +2 -1
  128. package/lib/{models → topoCenter/store}/linkManager.js +0 -0
  129. package/package.json +2 -2
  130. package/es/core/editor/LinkDynamicStyleConfig.js +0 -16
  131. package/es/core/store/getStoreModels.js +0 -40
  132. package/lib/core/editor/LinkDynamicStyleConfig.js +0 -21
  133. package/lib/core/store/getStoreModels.js +0 -67
@@ -21,9 +21,11 @@ var ColorPicker = /*#__PURE__*/function (_Component) {
21
21
  var _this$props = _this.props,
22
22
  prevValue = _this$props.value,
23
23
  onChange = _this$props.onChange;
24
+ var value = color.hex; // const rgb = color.rgb;
25
+ // const rgba = `rgba(${rgb.r},${rgb.g},${rgb.b},${rgb.a})`
24
26
 
25
- if (prevValue !== color.hex) {
26
- onChange(color.hex);
27
+ if (value !== prevValue) {
28
+ onChange(value);
27
29
  }
28
30
  };
29
31
 
@@ -58,6 +60,7 @@ var ColorPicker = /*#__PURE__*/function (_Component) {
58
60
  }, /*#__PURE__*/React.createElement(SketchPicker, {
59
61
  color: value // width={230}
60
62
  ,
63
+ disableAlpha: true,
61
64
  styles: {
62
65
  'default': {
63
66
  picker: {
@@ -1,6 +1,8 @@
1
1
  import _Drawer from "@alifd/next/es/drawer";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _Button from "@alifd/next/es/button";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
5
+ var _excluded = ["bodyClassName"];
4
6
  import React from 'react';
5
7
  import classnames from 'classnames';
6
8
  import styles from "./index.module.scss";
@@ -24,6 +26,10 @@ var Drawer = function Drawer(props) {
24
26
  onSave = props.onSave,
25
27
  drawerProps = props.drawerProps,
26
28
  children = props.children;
29
+
30
+ var bodyClassName = drawerProps.bodyClassName,
31
+ otherDrawerProps = _objectWithoutPropertiesLoose(drawerProps, _excluded);
32
+
27
33
  return /*#__PURE__*/React.createElement(_Drawer, _extends({
28
34
  title: title,
29
35
  placement: "right",
@@ -31,12 +37,12 @@ var Drawer = function Drawer(props) {
31
37
  headerStyle: headerStyle,
32
38
  bodyStyle: bodyStyle,
33
39
  closeMode: ['close', 'esc']
34
- }, drawerProps, {
40
+ }, otherDrawerProps, {
35
41
  className: classnames(styles.drawer, drawerProps.className),
36
42
  visible: visible,
37
43
  onClose: onClose
38
44
  }), /*#__PURE__*/React.createElement("div", {
39
- className: classnames(styles.content, drawerProps.bodyClassName)
45
+ className: classnames(styles.content, bodyClassName)
40
46
  }, children), footer && /*#__PURE__*/React.createElement("div", {
41
47
  className: styles.footer
42
48
  }, /*#__PURE__*/React.createElement(_Button, {
@@ -14,6 +14,7 @@
14
14
  display: flex;
15
15
  justify-content: center;
16
16
  align-items: center;
17
+ user-select: none;
17
18
  }
18
19
 
19
20
  .icon {
@@ -1,10 +1,19 @@
1
1
  import { useEffect } from 'react';
2
2
  export default (function (topo, fn) {
3
+ var topoModState = topo.store.useModelState('topoMod');
4
+ var graphLoaded = topoModState.graphLoaded;
3
5
  useEffect(function () {
4
- var dataModel = topo.getDataModel();
5
- dataModel.addDataPropertyChangeListener(fn);
6
+ var dataModel;
7
+
8
+ if (graphLoaded) {
9
+ dataModel = topo.getDataModel();
10
+ dataModel.addDataPropertyChangeListener(fn);
11
+ }
12
+
6
13
  return function () {
7
- dataModel.removeDataPropertyChangeListener(fn);
14
+ if (dataModel) {
15
+ dataModel.removeDataPropertyChangeListener(fn);
16
+ }
8
17
  };
9
- }, [fn]);
18
+ }, [topo, graphLoaded, fn]);
10
19
  });
@@ -67,7 +67,7 @@ export function transformCustomIcons2HtIcons(icons) {
67
67
  */
68
68
 
69
69
  export function getUserCustomIcons(topo) {
70
- var uploadIcons = topo.store.getModelState('iconManage').icons;
70
+ var uploadIcons = topo.store.getModelState('customIcon').icons;
71
71
  return [].concat(transformCustomIcons2HtIcons(uploadIcons.node));
72
72
  } // 获得节点图标列表
73
73
 
@@ -1,7 +1,7 @@
1
1
  import { getGroupDefaultIcons, getNodeDefaultIcons, transformCustomIcon2HtIcon } from "./icon";
2
2
 
3
3
  function useCustomIcons(topo) {
4
- var _topo$store$useModelS = topo.store.useModelState('iconManage'),
4
+ var _topo$store$useModelS = topo.store.useModelState('customIcon'),
5
5
  icons = _topo$store$useModelS.icons;
6
6
 
7
7
  var customIcons = icons.node.map(transformCustomIcon2HtIcon);
@@ -7,7 +7,6 @@ import rlog from "@riil-frontend/component-topology-utils/es/rlog";
7
7
  import { useEventListener, useCbbEventListener } from "@riil-frontend/component-riil-event-emitter";
8
8
  import useTopoEdit from "../../../hooks/useTopoEdit";
9
9
  import useSelection from "../../../hooks/useSelection";
10
- import useRelateTopo from "../../../hooks/useRelateTopo";
11
10
  import showMessage from "../../utils/showMessage";
12
11
  import EditorPlugin from "../../editor/components/EditorPlugin";
13
12
  import ViewerPlugin from "../../viewer/components/plugins/ViewerPlugin";
@@ -15,10 +14,10 @@ import TitleBar from "../titlebar/TitleBar";
15
14
  import { TPL_TREE } from "../../../utils/template";
16
15
  import PropertyView from "../../editor/components/settings/PropertyView";
17
16
  import BackgroundView from "../../editor/components/BackgroundView";
18
- import styles from "./TopoView.module.scss";
19
17
  import { updateEdgeExpanded } from "../../utils/edgeUtil";
18
+ import styles from "./TopoView.module.scss";
20
19
 
21
- var TopoView = function TopoView(props) {
20
+ var Topology = function Topology(props) {
22
21
  var _classnames, _graphViewProps$creat;
23
22
 
24
23
  var topo = props.topo,
@@ -34,6 +33,7 @@ var TopoView = function TopoView(props) {
34
33
  nodeDeleteable = props.nodeDeleteable,
35
34
  onNodeDelete = props.onNodeDelete,
36
35
  onLineDelete = props.onLineDelete,
36
+ onEvent = props.onEvent,
37
37
  _props$graphViewProps = props.graphViewProps,
38
38
  graphViewProps = _props$graphViewProps === void 0 ? {} : _props$graphViewProps,
39
39
  viewerProps = props.viewerProps,
@@ -80,10 +80,7 @@ var TopoView = function TopoView(props) {
80
80
  var onExitEdit = topoEdit.onExitEdit,
81
81
  onBindData = topoEdit.onBindData,
82
82
  onDeleteElement = topoEdit.onDeleteElement,
83
- onSaveTopo = topoEdit.onSaveTopo;
84
- var relateTopo = useRelateTopo({
85
- topo: topo
86
- }); // useAlarm({
83
+ onSaveTopo = topoEdit.onSaveTopo; // useAlarm({
87
84
  // topo,
88
85
  // });
89
86
 
@@ -112,13 +109,6 @@ var TopoView = function TopoView(props) {
112
109
  useEffect(function () {
113
110
  // rlog.debug("TopoView.useEffect topoData", topoData);
114
111
  setTData(buildLoadOptions ? buildLoadOptions(topoData) : topoData);
115
-
116
- if (topoData) {
117
- // TODO 移到模型中
118
- topoDispatchers.update({
119
- currentTopo: topoData.config
120
- });
121
- }
122
112
  }, [topoData]);
123
113
  useEffect(function () {
124
114
  return function () {
@@ -172,7 +162,7 @@ var TopoView = function TopoView(props) {
172
162
 
173
163
  var handleEvent = function handleEvent(event) {
174
164
  rlog.debug("TopoView:onEvent", event);
175
- relateTopo.onEvent(event);
165
+ onEvent(event);
176
166
  topoEdit.onEvent(event);
177
167
 
178
168
  switch (event.name) {
@@ -274,7 +264,7 @@ var TopoView = function TopoView(props) {
274
264
  }));
275
265
  };
276
266
 
277
- TopoView.propTypes = {
267
+ Topology.propTypes = {
278
268
  // 拓扑模型
279
269
  topo: PropTypes.any.isRequired,
280
270
  defaultEnterEditMode: PropTypes.bool,
@@ -294,10 +284,10 @@ TopoView.propTypes = {
294
284
  */
295
285
  titleBar: PropTypes.oneOf([React.ReactNode, false])
296
286
  };
297
- TopoView.defaultProps = {
287
+ Topology.defaultProps = {
298
288
  defaultEnterEditMode: false,
299
289
  viewerProps: {},
300
290
  editorProps: {} // titleBar: false,
301
291
 
302
292
  };
303
- export default TopoView;
293
+ export default Topology;
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import TopoApp from "./TopoApp";
2
+ import TopoApp from "./models/TopoApp";
3
3
  /**
4
4
  *
5
5
  * @param options
@@ -1,11 +1,11 @@
1
1
  import _Message from "@alifd/next/es/message";
2
2
  import _Loading from "@alifd/next/es/loading";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _Dialog from "@alifd/next/es/dialog";
5
5
  import _Tag from "@alifd/next/es/tag";
6
6
  import _Button from "@alifd/next/es/button";
7
7
  import _Icon from "@alifd/next/es/icon";
8
- import _Dialog from "@alifd/next/es/dialog";
8
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import React, { useEffect, useState } from 'react';
11
11
  import styles from "./index.module.scss";
@@ -21,20 +21,56 @@ function List(props) {
21
21
  dataSource = props.dataSource,
22
22
  onRemove = props.onRemove;
23
23
 
24
- function remove(e, id) {
25
- e.stopPropagation();
26
-
27
- _Dialog.confirm({
28
- title: '删除',
29
- messageProps: {
30
- type: 'warning'
31
- },
32
- content: '若执行相关操作,此背景将会从背景库删除,确定删除吗?',
33
- onOk: function onOk() {
34
- return onRemove(id);
35
- },
36
- onCancel: function onCancel() {}
37
- });
24
+ function remove(_x, _x2) {
25
+ return _remove.apply(this, arguments);
26
+ }
27
+
28
+ function _remove() {
29
+ _remove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e, id) {
30
+ var canDelete;
31
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
32
+ while (1) {
33
+ switch (_context.prev = _context.next) {
34
+ case 0:
35
+ e.stopPropagation();
36
+ _context.next = 3;
37
+ return api.canDeleteBackground(id);
38
+
39
+ case 3:
40
+ canDelete = _context.sent;
41
+ console.log('canDelete', canDelete);
42
+
43
+ if (canDelete) {
44
+ _Dialog.confirm({
45
+ title: '删除',
46
+ messageProps: {
47
+ type: 'warning'
48
+ },
49
+ content: '若执行相关操作,此背景将会从背景库删除,确定删除吗?',
50
+ onOk: function onOk() {
51
+ return onRemove(id);
52
+ }
53
+ });
54
+ } else {
55
+ _Dialog.confirm({
56
+ title: '提示',
57
+ messageProps: {
58
+ type: 'warning'
59
+ },
60
+ content: '此背景被占用,不能删除。',
61
+ footerActions: ['ok'],
62
+ onOk: function onOk() {}
63
+ });
64
+ }
65
+
66
+ case 6:
67
+ case "end":
68
+ return _context.stop();
69
+ }
70
+ }
71
+ }, _callee);
72
+ }));
73
+ return _remove.apply(this, arguments);
38
74
  }
39
75
 
40
76
  return /*#__PURE__*/React.createElement("div", {
@@ -95,46 +131,46 @@ export default function BackgroundView(props) {
95
131
  }
96
132
 
97
133
  function _getBackground() {
98
- _getBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
134
+ _getBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
99
135
  var res;
100
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
136
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
101
137
  while (1) {
102
- switch (_context2.prev = _context2.next) {
138
+ switch (_context3.prev = _context3.next) {
103
139
  case 0:
104
- _context2.next = 2;
140
+ _context3.next = 2;
105
141
  return api.getBackgroundList();
106
142
 
107
143
  case 2:
108
- res = _context2.sent;
144
+ res = _context3.sent;
109
145
  setBgList(res);
110
146
 
111
147
  case 4:
112
148
  case "end":
113
- return _context2.stop();
149
+ return _context3.stop();
114
150
  }
115
151
  }
116
- }, _callee2);
152
+ }, _callee3);
117
153
  }));
118
154
  return _getBackground.apply(this, arguments);
119
155
  }
120
156
 
121
- function removeBg(_x) {
157
+ function removeBg(_x3) {
122
158
  return _removeBg.apply(this, arguments);
123
159
  } // 同步拓扑图展示
124
160
 
125
161
 
126
162
  function _removeBg() {
127
- _removeBg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id) {
163
+ _removeBg = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id) {
128
164
  var res;
129
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
165
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
130
166
  while (1) {
131
- switch (_context3.prev = _context3.next) {
167
+ switch (_context4.prev = _context4.next) {
132
168
  case 0:
133
- _context3.next = 2;
169
+ _context4.next = 2;
134
170
  return api.deleteBackground(id);
135
171
 
136
172
  case 2:
137
- res = _context3.sent;
173
+ res = _context4.sent;
138
174
 
139
175
  // 删除当前选中
140
176
  if (id === (current === null || current === void 0 ? void 0 : current.id)) {
@@ -148,10 +184,10 @@ export default function BackgroundView(props) {
148
184
 
149
185
  case 6:
150
186
  case "end":
151
- return _context3.stop();
187
+ return _context4.stop();
152
188
  }
153
189
  }
154
- }, _callee3);
190
+ }, _callee4);
155
191
  }));
156
192
  return _removeBg.apply(this, arguments);
157
193
  }
@@ -161,46 +197,46 @@ export default function BackgroundView(props) {
161
197
  }
162
198
 
163
199
  var handleSelect = /*#__PURE__*/function () {
164
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(currentBg) {
200
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(currentBg) {
165
201
  var imgUrl, size;
166
- return _regeneratorRuntime.wrap(function _callee$(_context) {
202
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
167
203
  while (1) {
168
- switch (_context.prev = _context.next) {
204
+ switch (_context2.prev = _context2.next) {
169
205
  case 0:
170
206
  if (!(currentBg !== null && currentBg !== void 0 && currentBg.id && currentBg.id !== (current === null || current === void 0 ? void 0 : current.id))) {
171
- _context.next = 16;
207
+ _context2.next = 16;
172
208
  break;
173
209
  }
174
210
 
175
211
  setLoadingBackground(true);
176
212
  imgUrl = getBackgroundImageUrl(currentBg);
177
- _context.prev = 3;
178
- _context.next = 6;
213
+ _context2.prev = 3;
214
+ _context2.next = 6;
179
215
  return getImageSize(imgUrl);
180
216
 
181
217
  case 6:
182
- size = _context.sent;
218
+ size = _context2.sent;
183
219
  rlog.debug('获取图片大小', size);
184
220
  setBackground(_extends({}, currentBg, size));
185
221
  topo.getHtTopo().setBackgroundImgUrl(imgUrl, size.width, size.height);
186
222
  setLoadingBackground(false);
187
- _context.next = 16;
223
+ _context2.next = 16;
188
224
  break;
189
225
 
190
226
  case 13:
191
- _context.prev = 13;
192
- _context.t0 = _context["catch"](3);
227
+ _context2.prev = 13;
228
+ _context2.t0 = _context2["catch"](3);
193
229
  setLoadingBackground(false);
194
230
 
195
231
  case 16:
196
232
  case "end":
197
- return _context.stop();
233
+ return _context2.stop();
198
234
  }
199
235
  }
200
- }, _callee, null, [[3, 13]]);
236
+ }, _callee2, null, [[3, 13]]);
201
237
  }));
202
238
 
203
- return function handleSelect(_x2) {
239
+ return function handleSelect(_x4) {
204
240
  return _ref.apply(this, arguments);
205
241
  };
206
242
  }();
@@ -25,6 +25,7 @@
25
25
  .box {
26
26
  position: relative;
27
27
  height: 100%;
28
+ user-select: none;
28
29
  .img {
29
30
  max-width: 100%;
30
31
  max-height: 100%;
@@ -1,10 +1,10 @@
1
- import React, { useState, useEffect, useRef, useCallback } from 'react';
1
+ import React, { useEffect } from 'react';
2
2
  import UploadIconDialogWrapper from "./UploadIconDialogWrapper";
3
3
  import RenameDialog from "./RenameDialog";
4
- export default function IconManage(props) {
4
+ export default function CustomIconPlugin(props) {
5
5
  var topo = props.topo;
6
6
  var store = topo.store;
7
- var dispatchers = store.getModelDispatchers('iconManage'); // 初始化时注册事件
7
+ var dispatchers = store.getModelDispatchers('customIcon'); // 初始化时注册事件
8
8
 
9
9
  useEffect(function () {
10
10
  var notifier = topo.view.topoClient.notifier; // 测试代码
@@ -11,7 +11,7 @@ export default function RenameDialog(props) {
11
11
  var topo = props.topo;
12
12
  var store = topo.store;
13
13
 
14
- var _store$useModel = store.useModel('iconManage'),
14
+ var _store$useModel = store.useModel('customIcon'),
15
15
  state = _store$useModel[0],
16
16
  dispatchers = _store$useModel[1];
17
17
 
@@ -13,6 +13,7 @@ import _ from 'lodash';
13
13
  import _svgToShape from "./utils/svgToShape";
14
14
  import styles from "./UploadIconDialog.module.scss";
15
15
  import "./UploadIconDialog.scss";
16
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
16
17
  var config = _ConfigProvider.config;
17
18
 
18
19
  function getFileName(file) {
@@ -98,7 +99,18 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
98
99
 
99
100
  _this.setState({
100
101
  files: validFiles
101
- });
102
+ }); // 上传接口报错后只会通知该回调,移除上传loading
103
+
104
+
105
+ if (_this.state.uploading && files.filter(function (file) {
106
+ return file.state === 'error';
107
+ }).length && !files.filter(function (file) {
108
+ return file.state === 'uploading';
109
+ }).length) {
110
+ _this.setState({
111
+ uploading: false
112
+ });
113
+ }
102
114
  };
103
115
 
104
116
  _this.submit = function () {
@@ -198,7 +210,9 @@ var UploadIconDialog = /*#__PURE__*/function (_React$Component) {
198
210
  });
199
211
  };
200
212
 
201
- _this.handleUploadError = function () {};
213
+ _this.handleUploadError = function () {
214
+ rlog.error('上传失败');
215
+ };
202
216
 
203
217
  _this.onClose = function () {
204
218
  var dispatchers = _this.props.dispatchers;
@@ -4,7 +4,7 @@ export default function UploadIconDialogWrapper(props) {
4
4
  var topo = props.topo;
5
5
  var store = topo.store;
6
6
 
7
- var _store$useModel = store.useModel('iconManage'),
7
+ var _store$useModel = store.useModel('customIcon'),
8
8
  state = _store$useModel[0],
9
9
  dispatchers = _store$useModel[1];
10
10
 
@@ -0,0 +1,2 @@
1
+ import IconManage from "./CustomIconPlugin";
2
+ export default IconManage;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from "react";
3
- import IconManage from "./iconManage/IconManage";
3
+ import CustomIconPlugin from "./CustomIconPlugin";
4
4
  import SaveLoading from "./plugins/SaveLoading";
5
5
  import MultipleResourceSelectPlugin from "./plugins/MultipleResourceSelectPlugin";
6
6
  import GroupAddResourceDrawerPlugin from "./GroupAddResourceDrawerPlugin";
@@ -10,7 +10,7 @@ export default function TopoEditorPlugin(props) {
10
10
  topoEdit = props.topoEdit,
11
11
  editorProps = props.editorProps;
12
12
  var store = topo.store;
13
- var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, IconManage].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
13
+ var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, CustomIconPlugin].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
14
14
  return /*#__PURE__*/React.createElement(React.Fragment, null, plugins.map(function (Plugin, index) {
15
15
  return /*#__PURE__*/React.createElement(Plugin, _extends({
16
16
  key: index,
@@ -19,6 +19,7 @@ export default function GroupSetting(props) {
19
19
  editorProps = props.editorProps,
20
20
  group = props.group;
21
21
  var expanded = values.expanded;
22
+ var id = values.id;
22
23
 
23
24
  var field = _Field.useField({
24
25
  autoUnmount: false,
@@ -93,6 +94,7 @@ export default function GroupSetting(props) {
93
94
  maxLength: 30,
94
95
  placeholder: "\u8BF7\u8F93\u5165"
95
96
  })), expanded ? /*#__PURE__*/React.createElement(GroupExpandSetting, {
97
+ id: id,
96
98
  group: group,
97
99
  expanded: expanded,
98
100
  topo: topo,
@@ -5,7 +5,7 @@ import _Field from "@alifd/next/es/field";
5
5
  import _extends from "@babel/runtime/helpers/extends";
6
6
  import _Collapse from "@alifd/next/es/collapse";
7
7
  import _Select from "@alifd/next/es/select";
8
- import React, { useState, useEffect } from 'react';
8
+ import React, { useEffect } from 'react';
9
9
  import NodeSizeInput from "../../common/NodeSizeInput/NodeSizeInput";
10
10
  import textStyles from "../../../../../common/text.module.scss";
11
11
  import NodeIconSelect from "./NodeIconSelect";
@@ -73,7 +73,7 @@ export default function NodePropertyView(props) {
73
73
  };
74
74
 
75
75
  var handleBindTopoChange = function handleBindTopoChange(value, data) {
76
- // 设置名称为拓扑名称
76
+ // 设置名称为拓扑名称,清空自定义名称
77
77
  node.a('name', data.label);
78
78
  node.a('customName', null);
79
79
  };
@@ -20,7 +20,7 @@ import { updateEdgeExpanded } from "../utils/edgeUtil";
20
20
  import PluginManager from "./PluginManager";
21
21
  import topoFactory from "./topoFactory"; // eslint-disable-next-line no-undef
22
22
 
23
- var version = typeof "2.15.42" === 'string' ? "2.15.42" : null;
23
+ var version = typeof "2.15.45" === 'string' ? "2.15.45" : null;
24
24
  console.info("\u62D3\u6251\u7248\u672C: " + version);
25
25
  /**
26
26
  * 拓扑显示和编辑
@@ -75,6 +75,10 @@ var Topo = /*#__PURE__*/function () {
75
75
 
76
76
  this.test = new Test(this);
77
77
  this.uid = topoFactory.add(options.name, this);
78
+ };
79
+
80
+ _proto.destroy = function destroy() {
81
+ topoFactory.remove(this.uid);
78
82
  }
79
83
  /**
80
84
  * TODO 移除
@@ -95,7 +99,7 @@ var Topo = /*#__PURE__*/function () {
95
99
  return topoDispatchers.exit();
96
100
 
97
101
  case 3:
98
- topoFactory.remove(this.uid);
102
+ this.destroy();
99
103
 
100
104
  case 4:
101
105
  case "end":
@@ -543,7 +547,7 @@ var Topo = /*#__PURE__*/function () {
543
547
 
544
548
  case 7:
545
549
  updateEdgeExpanded(this);
546
- editDispatchers = this.store.getModelDispatchers('topoCreateMod');
550
+ editDispatchers = this.store.getModelDispatchers('topoConfig');
547
551
  editDispatchers.switchToEditMode();
548
552
 
549
553
  if (this.options.onSwitchToEditMode) {
@@ -551,7 +555,7 @@ var Topo = /*#__PURE__*/function () {
551
555
  } // 加载自定义上传的图标
552
556
 
553
557
 
554
- iconManageDispatchers = this.store.getModelDispatchers('iconManage');
558
+ iconManageDispatchers = this.store.getModelDispatchers('customIcon');
555
559
  iconManageDispatchers.loadEditorIcons();
556
560
 
557
561
  case 13:
@@ -580,7 +584,7 @@ var Topo = /*#__PURE__*/function () {
580
584
  return this.view.switchToViewMode();
581
585
 
582
586
  case 2:
583
- editDispatchers = this.store.getModelDispatchers('topoCreateMod');
587
+ editDispatchers = this.store.getModelDispatchers('topoConfig');
584
588
  editDispatchers.switchToViewMode(this.id);
585
589
 
586
590
  if (this.options.onSwitchToViewMode) {
@@ -107,5 +107,30 @@ export default {
107
107
  /**
108
108
  * 背景图导出
109
109
  */
110
- EXPORT_BG_ZIP: EXPORT_BG_ZIP
110
+ EXPORT_BG_ZIP: EXPORT_BG_ZIP,
111
+
112
+ /**
113
+ * 校验背景图是否被占用
114
+ * @param {*} params id
115
+ */
116
+ canDeleteBackground: function canDeleteBackground(id) {
117
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
118
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
119
+ while (1) {
120
+ switch (_context4.prev = _context4.next) {
121
+ case 0:
122
+ _context4.next = 2;
123
+ return getRequest()("/topo/v1/api/background/" + id);
124
+
125
+ case 2:
126
+ return _context4.abrupt("return", _context4.sent);
127
+
128
+ case 3:
129
+ case "end":
130
+ return _context4.stop();
131
+ }
132
+ }
133
+ }, _callee4);
134
+ }))();
135
+ }
111
136
  };