@riil-frontend/component-topology 2.15.43 → 2.15.46

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 (139) hide show
  1. package/build/index.css +1 -1
  2. package/build/index.js +22 -22
  3. package/es/components/Drawer/index.js +8 -2
  4. package/es/components/TagImageSelect/index.js +3 -1
  5. package/es/components/TagSelect/index.js +3 -3
  6. package/es/components/TemplateButton/index.module.scss +1 -0
  7. package/es/core/common/hooks/ht/useDataModelDataPropertyChange.js +13 -4
  8. package/es/core/common/icons/icon.js +1 -1
  9. package/es/core/common/icons/useIcons.js +1 -1
  10. package/es/core/components/TopoView/topoView.js +8 -18
  11. package/es/core/{models/createTopoApp.js → createTopoApp.js} +1 -1
  12. package/es/core/editor/components/BackgroundView/index.js +80 -44
  13. package/es/core/editor/components/BackgroundView/index.module.scss +1 -0
  14. package/es/core/editor/components/{iconManage/IconManage.js → CustomIconPlugin/CustomIconPlugin.js} +3 -3
  15. package/es/core/editor/components/{iconManage → CustomIconPlugin}/RenameDialog.js +1 -1
  16. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.js +16 -2
  17. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.module.scss +0 -0
  18. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.scss +0 -0
  19. package/es/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialogWrapper.js +1 -1
  20. package/es/core/editor/components/CustomIconPlugin/index.js +2 -0
  21. package/es/core/editor/components/{iconManage → CustomIconPlugin}/utils/svgToShape.js +0 -0
  22. package/es/core/editor/components/EditorPlugin.js +2 -2
  23. package/es/core/editor/components/settings/common/LayoutSettings.js +11 -19
  24. package/es/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +4 -4
  25. package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +13 -8
  26. package/es/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +2 -0
  27. package/es/core/models/TopoApp.js +9 -5
  28. package/es/core/services/background.js +26 -1
  29. package/es/core/store/coreModels.js +32 -26
  30. package/es/core/store/createStore.js +1 -1
  31. package/es/core/test/Test.js +3 -1
  32. package/es/core/viewer/contextmenu/buildNodeContextmenu.js +65 -64
  33. package/es/createTopo.js +1 -1
  34. package/es/hooks/useAlarm.js +3 -6
  35. package/es/hooks/useResourceConfig.js +1 -1
  36. package/es/hooks/useTopoEdit.js +4 -8
  37. package/es/models/{iconManage.js → customIcon.js} +1 -1
  38. package/es/models/topoBizMod.js +22 -52
  39. package/es/models/{topoCreateMod.js → topoConfig.js} +8 -4
  40. package/es/models/topoMod.js +32 -69
  41. package/es/{components → topoCenter/components}/Link/form.js +0 -0
  42. package/es/{components → topoCenter/components}/Link/hook.js +0 -0
  43. package/es/{components → topoCenter/components}/Link/index copy.js +1 -1
  44. package/es/{components → topoCenter/components}/Link/index.js +1 -1
  45. package/es/{components → topoCenter/components}/Link/index.module.scss +0 -0
  46. package/es/{components → topoCenter/components}/Link/setting.js +0 -0
  47. package/es/topoCenter/components/TopoView.js +16 -3
  48. package/es/topoCenter/components/Topology.js +0 -5
  49. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.js +0 -0
  50. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.module.scss +0 -0
  51. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/index.js +0 -0
  52. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.js +0 -0
  53. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.module.scss +0 -0
  54. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.js +0 -0
  55. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.module.scss +0 -0
  56. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.scss +0 -0
  57. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.js +0 -0
  58. package/es/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.module.scss +0 -0
  59. package/es/topoCenter/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +1 -1
  60. package/es/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +3 -3
  61. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +1 -1
  62. package/es/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
  63. package/es/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.js → LinkInfoPreview.js} +1 -1
  64. package/es/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.module.scss → LinkInfoPreview.module.scss} +0 -0
  65. package/es/{hooks → topoCenter/hooks/viewer}/useRelateTopo.js +2 -2
  66. package/es/{models → topoCenter/store}/linkDynamicStyle.js +3 -3
  67. package/es/{models → topoCenter/store}/linkDynamicStyleConfig.js +2 -1
  68. package/es/{models → topoCenter/store}/linkManager.js +0 -0
  69. package/lib/components/Drawer/index.js +7 -2
  70. package/lib/components/TagImageSelect/index.js +3 -1
  71. package/lib/components/TagSelect/index.js +3 -3
  72. package/lib/components/TemplateButton/index.module.scss +1 -0
  73. package/lib/core/common/hooks/ht/useDataModelDataPropertyChange.js +13 -4
  74. package/lib/core/common/icons/icon.js +1 -1
  75. package/lib/core/common/icons/useIcons.js +1 -1
  76. package/lib/core/components/TopoView/topoView.js +9 -20
  77. package/lib/core/{models/createTopoApp.js → createTopoApp.js} +1 -1
  78. package/lib/core/editor/components/BackgroundView/index.js +80 -44
  79. package/lib/core/editor/components/BackgroundView/index.module.scss +1 -0
  80. package/lib/core/editor/components/{iconManage/IconManage.js → CustomIconPlugin/CustomIconPlugin.js} +3 -3
  81. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/RenameDialog.js +1 -1
  82. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.js +17 -2
  83. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.module.scss +0 -0
  84. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialog.scss +0 -0
  85. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/UploadIconDialogWrapper.js +1 -1
  86. package/lib/core/editor/components/CustomIconPlugin/index.js +11 -0
  87. package/lib/core/editor/components/{iconManage → CustomIconPlugin}/utils/svgToShape.js +0 -0
  88. package/lib/core/editor/components/EditorPlugin.js +2 -2
  89. package/lib/core/editor/components/settings/common/LayoutSettings.js +10 -18
  90. package/lib/core/editor/components/settings/propertyViews/group/DataTab/hoooks/useGroupRelateResource.js +2 -4
  91. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +12 -7
  92. package/lib/core/editor/components/settings/propertyViews/group/SettingTab/Setting.js +2 -0
  93. package/lib/core/models/TopoApp.js +9 -5
  94. package/lib/core/services/background.js +26 -1
  95. package/lib/core/store/coreModels.js +35 -26
  96. package/lib/core/store/createStore.js +2 -2
  97. package/lib/core/test/Test.js +3 -1
  98. package/lib/core/viewer/contextmenu/buildNodeContextmenu.js +65 -64
  99. package/lib/createTopo.js +1 -1
  100. package/lib/hooks/useAlarm.js +3 -6
  101. package/lib/hooks/useResourceConfig.js +1 -1
  102. package/lib/hooks/useTopoEdit.js +4 -8
  103. package/lib/models/{iconManage.js → customIcon.js} +1 -1
  104. package/lib/models/topoBizMod.js +22 -52
  105. package/lib/models/{topoCreateMod.js → topoConfig.js} +7 -4
  106. package/lib/models/topoMod.js +32 -69
  107. package/lib/{components → topoCenter/components}/Link/form.js +0 -0
  108. package/lib/{components → topoCenter/components}/Link/hook.js +0 -0
  109. package/lib/{components → topoCenter/components}/Link/index copy.js +1 -1
  110. package/lib/{components → topoCenter/components}/Link/index.js +1 -1
  111. package/lib/{components → topoCenter/components}/Link/index.module.scss +0 -0
  112. package/lib/{components → topoCenter/components}/Link/setting.js +0 -0
  113. package/lib/topoCenter/components/TopoView.js +19 -3
  114. package/lib/topoCenter/components/Topology.js +0 -7
  115. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.js +0 -0
  116. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/RuleSetting.module.scss +0 -0
  117. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/index.js +0 -0
  118. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.js +0 -0
  119. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/Rule.module.scss +0 -0
  120. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.js +0 -0
  121. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.module.scss +0 -0
  122. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleCondition.scss +0 -0
  123. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.js +0 -0
  124. package/lib/{core/editor/components → topoCenter/components/editor}/LinkDynamicStyleSettingDrawer/rule/RuleStyle.module.scss +0 -0
  125. package/lib/topoCenter/components/editor/propertyViews/edge/EdgeGroupPropertyView.js +2 -2
  126. package/lib/topoCenter/components/editor/propertyViews/edge/LinkPropertyView/Data/index.js +8 -8
  127. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/AddLinkDrawer.js +1 -1
  128. package/lib/topoCenter/components/editor/propertyViews/edge/addLinkDrawer/components/editLinkInfo.js +1 -1
  129. package/lib/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.js → LinkInfoPreview.js} +4 -4
  130. package/lib/topoCenter/components/editor/propertyViews/edge/link/{LindInfoPreview.module.scss → LinkInfoPreview.module.scss} +0 -0
  131. package/lib/{hooks → topoCenter/hooks/viewer}/useRelateTopo.js +2 -2
  132. package/lib/{models → topoCenter/store}/linkDynamicStyle.js +3 -3
  133. package/lib/{models → topoCenter/store}/linkDynamicStyleConfig.js +2 -1
  134. package/lib/{models → topoCenter/store}/linkManager.js +0 -0
  135. package/package.json +2 -2
  136. package/es/core/editor/LinkDynamicStyleConfig.js +0 -16
  137. package/es/core/store/getStoreModels.js +0 -40
  138. package/lib/core/editor/LinkDynamicStyleConfig.js +0 -21
  139. package/lib/core/store/getStoreModels.js +0 -67
@@ -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, {
@@ -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 = ["dataSource", "onChange", "size", "boxProps", "tagProps", "itemProps", "ItemComponent"];
3
+ var _excluded = ["dataSource", "onChange", "size", "boxProps", "tagProps", "itemProps", "ItemComponent", "value"];
4
4
  import React from "react";
5
5
  import TemplateButton from "../TemplateButton";
6
6
  import TagSelect from "../TagSelect";
@@ -14,12 +14,14 @@ var TagImageSelect = function TagImageSelect(props) {
14
14
  tagProps = props.tagProps,
15
15
  itemProps = props.itemProps,
16
16
  ItemComponent = props.ItemComponent,
17
+ value = props.value,
17
18
  otherProps = _objectWithoutPropertiesLoose(props, _excluded);
18
19
 
19
20
  var Item = ItemComponent || TemplateButton;
20
21
  return /*#__PURE__*/React.createElement(TagSelect, _extends({}, otherProps, {
21
22
  onChange: onChange,
22
23
  className: styles.tagSelect,
24
+ value: value,
23
25
  dataSource: dataSource.map(function (item) {
24
26
  return {
25
27
  key: item.id,
@@ -20,9 +20,9 @@ var TagSelect = function TagSelect(props) {
20
20
  setCurrent = _useState[1];
21
21
 
22
22
  useEffect(function () {
23
- if (value) {
24
- setCurrent(value);
25
- }
23
+ // if (value) {
24
+ // }
25
+ setCurrent(value);
26
26
  }, [value]);
27
27
  return /*#__PURE__*/React.createElement("div", {
28
28
  className: "tag-select-wrap"
@@ -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,
@@ -1,6 +1,6 @@
1
1
  import _Form from "@alifd/next/es/form";
2
2
  import _Radio from "@alifd/next/es/radio";
3
- import React, { useState } from "react";
3
+ import React, { useState, useEffect } from "react";
4
4
  import TemplateGroup from "../../../../../components/TagImageSelect";
5
5
  import styles from "./LayoutSettings.module.scss";
6
6
  var LAYOUTS = {
@@ -21,33 +21,25 @@ var LayoutSettings = function LayoutSettings(props) {
21
21
  var _props$layout = props.layout,
22
22
  layout = _props$layout === void 0 ? {} : _props$layout,
23
23
  onChange = props.onChange,
24
+ regionId = props.regionId,
24
25
  size = props.size;
25
26
  var layoutId = layout.id,
26
- layoutOptions = layout.options;
27
-
28
- var _useState = useState(layout || {}),
29
- value = _useState[0],
30
- setValue = _useState[1];
27
+ layoutOptions = layout.options; // const [value, setValue] = useState();
31
28
 
32
29
  var handleChange = function handleChange(data) {
33
- console.log("handleChange", data);
34
- onChange && onChange(data); // setValue({
35
- // id: data,
36
- // options: {
37
- // value: "east",
38
- // label: "横向",
39
- // },
40
- // });
30
+ onChange && onChange(data);
41
31
  };
42
32
 
43
33
  var onLayoutSelect = function onLayoutSelect(id) {
34
+ // console.log("onLayoutSelect", id, layout, value);
44
35
  var options;
45
36
 
46
37
  if (id === "toward") {
47
38
  options = {
48
39
  subId: TREE_LAYOUT_OPTIONS[0].value
49
40
  };
50
- }
41
+ } // setValue(id);
42
+
51
43
 
52
44
  handleChange({
53
45
  id: id,
@@ -60,14 +52,14 @@ var LayoutSettings = function LayoutSettings(props) {
60
52
  id: id,
61
53
  name: LAYOUTS[id],
62
54
  icon: "layout_" + id,
63
- selected: layoutId === id,
64
- onSelect: onLayoutSelect
55
+ selected: layoutId === id
65
56
  };
66
57
  });
67
58
  return /*#__PURE__*/React.createElement("div", {
68
59
  className: styles["layout-setting-template-group"]
69
60
  }, /*#__PURE__*/React.createElement(TemplateGroup, {
70
61
  dataSource: layoutGroup,
62
+ value: layoutId,
71
63
  size: size,
72
64
  onChange: onLayoutSelect,
73
65
  boxProps: {
@@ -86,7 +78,7 @@ var LayoutSettings = function LayoutSettings(props) {
86
78
  iconClassName: styles.icon,
87
79
  textClassName: styles.text
88
80
  }
89
- }), layoutId === "toward" && /*#__PURE__*/React.createElement(_Form.Item, {
81
+ }), layoutId === "toward" ? /*#__PURE__*/React.createElement(_Form.Item, {
90
82
  label: "\u5E03\u5C40\u65B9\u5411"
91
83
  }, /*#__PURE__*/React.createElement(_Radio.Group, {
92
84
  dataSource: TREE_LAYOUT_OPTIONS,
@@ -99,7 +91,7 @@ var LayoutSettings = function LayoutSettings(props) {
99
91
  }
100
92
  });
101
93
  }
102
- })));
94
+ })) : null);
103
95
  };
104
96
 
105
97
  export default LayoutSettings;
@@ -2,11 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import { useState } from "react";
3
3
  import rlog from "@riil-frontend/component-topology-utils/es/rlog";
4
4
  import { iconFactory } from "@riil-frontend/component-topology-graph";
5
- import sortBy from 'lodash/sortBy';
5
+ import sortBy from "lodash/sortBy";
6
6
  import { getGroupChildrenNodes, getNodeData } from "../../../../../../../../utils/htElementUtils";
7
7
 
8
8
  function sortResourcesByName(resources) {
9
- return sortBy(resources, 'name');
9
+ return sortBy(resources, "name");
10
10
  }
11
11
 
12
12
  export default function useGroupRelateResource(props) {
@@ -33,7 +33,7 @@ export default function useGroupRelateResource(props) {
33
33
  data: item,
34
34
  node: item.node
35
35
  };
36
- });
37
- rlog.info('useGroupRelateResource', data);
36
+ }); // rlog.info('useGroupRelateResource', data);
37
+
38
38
  return data;
39
39
  }