@riil-frontend/component-topology 2.4.1 → 2.4.5

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 (59) hide show
  1. package/build/1.js +2 -2
  2. package/build/2.js +1 -1
  3. package/build/index.css +1 -1
  4. package/build/index.js +21 -21
  5. package/es/{plugins → common/plugins}/useSelectionPlugin.d.ts +0 -0
  6. package/es/{plugins → common/plugins}/useSelectionPlugin.js +0 -0
  7. package/es/components/ResourceList/ResourceSelect.js +1 -1
  8. package/es/core/components/TopoView/TopoView.module.scss +4 -0
  9. package/es/core/components/TopoView/topoView.js +3 -2
  10. package/es/core/components/titlebar/TitleBar.module.scss +5 -9
  11. package/es/core/editor/components/settings/Settings.module.scss +3 -1
  12. package/es/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.d.ts +5 -0
  13. package/es/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.js +69 -20
  14. package/es/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.module.scss +5 -0
  15. package/es/core/editor/components/settings/common/NodeSizeInput/NodeSizeNumberPicker.d.ts +7 -0
  16. package/es/core/editor/components/settings/common/NodeSizeInput/NodeSizeNumberPicker.js +73 -0
  17. package/es/core/editor/components/settings/common/text/TextStyle.js +1 -1
  18. package/es/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -2
  19. package/es/core/editor/components/settings/group/GroupNodeList/icon.js +14 -2
  20. package/es/core/editor/components/settings/node/NodeIconSelect.js +6 -21
  21. package/es/core/editor/components/settings/node/NodeIconSelectTest.d.ts +1 -0
  22. package/es/core/editor/components/settings/node/NodeIconSelectTest.js +31 -0
  23. package/es/core/editor/components/settings/text/TextPropertyView.js +1 -5
  24. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +2 -1
  25. package/es/core/models/TopoApp.js +21 -7
  26. package/es/models/topoMod.d.ts +1 -0
  27. package/es/models/topoMod.js +9 -3
  28. package/es/style.js +1 -1
  29. package/es/topoCenter/store/topoCenter.js +15 -2
  30. package/es/topoCenter/store/topoTreeMod.d.ts +0 -1
  31. package/es/topoCenter/store/topoTreeMod.js +30 -107
  32. package/lib/{plugins → common/plugins}/useSelectionPlugin.d.ts +0 -0
  33. package/lib/{plugins → common/plugins}/useSelectionPlugin.js +0 -0
  34. package/lib/components/ResourceList/ResourceSelect.js +1 -1
  35. package/lib/core/components/TopoView/TopoView.module.scss +4 -0
  36. package/lib/core/components/TopoView/topoView.js +4 -2
  37. package/lib/core/components/titlebar/TitleBar.module.scss +5 -9
  38. package/lib/core/editor/components/settings/Settings.module.scss +3 -1
  39. package/lib/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.d.ts +5 -0
  40. package/lib/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.js +69 -20
  41. package/lib/core/editor/components/settings/common/NodeSizeInput/NodeSizeInput.module.scss +5 -0
  42. package/lib/core/editor/components/settings/common/NodeSizeInput/NodeSizeNumberPicker.d.ts +7 -0
  43. package/lib/core/editor/components/settings/common/NodeSizeInput/NodeSizeNumberPicker.js +87 -0
  44. package/lib/core/editor/components/settings/common/text/TextStyle.js +1 -1
  45. package/lib/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -2
  46. package/lib/core/editor/components/settings/group/GroupNodeList/icon.js +18 -2
  47. package/lib/core/editor/components/settings/node/NodeIconSelect.js +5 -24
  48. package/lib/core/editor/components/settings/node/NodeIconSelectTest.d.ts +1 -0
  49. package/lib/core/editor/components/settings/node/NodeIconSelectTest.js +43 -0
  50. package/lib/core/editor/components/settings/text/TextPropertyView.js +1 -5
  51. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +3 -1
  52. package/lib/core/models/TopoApp.js +21 -7
  53. package/lib/models/topoMod.d.ts +1 -0
  54. package/lib/models/topoMod.js +9 -3
  55. package/lib/style.js +1 -1
  56. package/lib/topoCenter/store/topoCenter.js +15 -2
  57. package/lib/topoCenter/store/topoTreeMod.d.ts +0 -1
  58. package/lib/topoCenter/store/topoTreeMod.js +30 -108
  59. package/package.json +6 -5
@@ -5,7 +5,7 @@ import _ from 'lodash';
5
5
  import useNextFormTable from '@ahooksjs/next-form-table';
6
6
  import useFilterPlugin from '@ahooksjs/use-filter-plugin';
7
7
  import useSortablePlugin from '@ahooksjs/use-sortable-plugin';
8
- import useSelectionPlugin from "../../plugins/useSelectionPlugin";
8
+ import useSelectionPlugin from "../../common/plugins/useSelectionPlugin";
9
9
  import { fetchCommonQuery } from '@riil-frontend/component-topology-utils/es/services/cmdb';
10
10
  import { getTitleCell } from '@riil-frontend/component-topology-utils/es/utils/table';
11
11
  import { DICT } from '@riil-frontend/component-topology-utils/es/utils/storage';
@@ -10,6 +10,10 @@
10
10
  flex: 1;
11
11
  overflow: hidden;
12
12
  position: relative;
13
+
14
+ &.viewPanelEditMode {
15
+ border-top: 1px solid #E6E7EB;
16
+ }
13
17
  }
14
18
 
15
19
  // 解决拓扑图容器绝对定位z-index>0时浮层和右键菜单不显示问题
@@ -1,5 +1,6 @@
1
1
  import React, { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import classnames from 'classnames';
3
4
  import TopoContainer, { TopoEvent } from '@riil-frontend/component-topology-graph';
4
5
  import rlog from '@riil-frontend/component-topology-utils/es/utils/rlog';
5
6
  import useTopoEdit from "../../../hooks/useTopoEdit";
@@ -17,7 +18,7 @@ import styles from "./TopoView.module.scss";
17
18
  import Settings from "../../editor/components/settings/Settings";
18
19
 
19
20
  var TopoView = function TopoView(props) {
20
- var _topoApp$options$edit;
21
+ var _classnames, _topoApp$options$edit;
21
22
 
22
23
  var engine = props.engine,
23
24
  topo = props.topo,
@@ -209,7 +210,7 @@ var TopoView = function TopoView(props) {
209
210
  topoEditApi: topoEditApi,
210
211
  onEnterEdit: onEnterEdit
211
212
  })), /*#__PURE__*/React.createElement("div", {
212
- className: styles.viewPanel
213
+ className: classnames(styles.viewPanel, (_classnames = {}, _classnames[styles.viewPanelEditMode] = isEditMode, _classnames))
213
214
  }, /*#__PURE__*/React.createElement(TopoContainer, {
214
215
  debugId: topoApp.debugId,
215
216
  data: tData,
@@ -1,6 +1,6 @@
1
1
  .titlebar {
2
2
  display: flex;
3
- padding: 12px 0;
3
+ padding: 16px;
4
4
 
5
5
  .left {
6
6
  flex: 1;
@@ -11,6 +11,10 @@
11
11
 
12
12
  }
13
13
 
14
+ &.titlebarEditMode {
15
+ padding: 10px 16px;
16
+ }
17
+
14
18
  }
15
19
 
16
20
  .title {
@@ -28,12 +32,4 @@
28
32
 
29
33
  .moreMenuButton {
30
34
  margin-left: 8px;
31
- width: 28px;
32
- height: 28px;
33
-
34
- :global {
35
- .next-menu-btn-arrow {
36
- display: none;
37
- }
38
- }
39
35
  }
@@ -5,7 +5,8 @@
5
5
  top: 0;
6
6
  right: 0;
7
7
  border-radius: 2px;
8
- border: 1px solid #E6E7EB;
8
+ //border: 1px solid #E6E7EB;
9
+ //border-left: none;
9
10
 
10
11
  display: flex;
11
12
  flex-direction: column;
@@ -36,6 +37,7 @@
36
37
  background: none;
37
38
  font-size: 12px;
38
39
  padding-bottom: 0;
40
+ padding-left: 32px;
39
41
  }
40
42
  .next-collapse-panel-content {
41
43
  padding-left: 32px;
@@ -1 +1,6 @@
1
+ /**
2
+ * 节点大小组件
3
+ *
4
+ * 文本框失去焦点、按enter键、点击加减按钮时节点大小变化
5
+ */
1
6
  export default function NodeSizeInput(props: any): JSX.Element;
@@ -1,53 +1,102 @@
1
- import _NumberPicker from "@alifd/next/lib/number-picker";
2
- import _Field from "@alifd/next/lib/field";
1
+ import _extends from "@babel/runtime/helpers/extends";
3
2
  import _Grid from "@alifd/next/lib/grid";
4
3
  import _Form from "@alifd/next/lib/form";
5
- import React, { useState, useEffect, useRef, useCallback } from 'react';
4
+ import React, { useState } from 'react';
5
+ import NodeSizeNumberPicker from "./NodeSizeNumberPicker";
6
+ import styles from "./NodeSizeInput.module.scss";
6
7
  var FormItem = _Form.Item;
7
8
  var Row = _Grid.Row,
8
9
  Col = _Grid.Col;
10
+ /**
11
+ * 节点大小组件
12
+ *
13
+ * 文本框失去焦点、按enter键、点击加减按钮时节点大小变化
14
+ */
15
+
9
16
  export default function NodeSizeInput(props) {
10
17
  var value = props.value,
11
- _onChange = props.onChange;
18
+ onChange = props.onChange;
19
+
20
+ var _useState = useState(false),
21
+ lock = _useState[0],
22
+ setLock = _useState[1];
23
+
24
+ var handleValue = function handleValue(val) {
25
+ if (!val || val < 1) {
26
+ return 1;
27
+ }
12
28
 
13
- var field = _Field.useField({
14
- autoUnmount: false,
15
- values: value,
16
- onChange: function onChange(name, value) {
17
- _onChange(field.getValues());
29
+ if (val > 2000) {
30
+ return 2000;
18
31
  }
19
- });
20
32
 
21
- useEffect(function () {
22
- field.setValues(value);
23
- }, [value]);
33
+ return parseInt(val);
34
+ };
35
+
36
+ var handleChange = function handleChange(name, attrValue) {
37
+ var _extends2;
38
+
39
+ var newSize = _extends({}, value, (_extends2 = {}, _extends2[name] = attrValue, _extends2));
40
+
41
+ if (lock) {
42
+ if (name === 'width') {
43
+ newSize.height = handleValue(value.height / value.width * attrValue);
44
+ } else {
45
+ newSize.width = handleValue(value.width / value.height * attrValue);
46
+ }
47
+ }
48
+
49
+ console.error(111, newSize);
50
+ onChange(newSize);
51
+ };
52
+
24
53
  return /*#__PURE__*/React.createElement(_Form, {
25
- field: field,
26
54
  labelAlign: "top",
27
55
  component: "div"
28
56
  }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(Row, {
29
- gutter: "16"
57
+ gutter: "0"
30
58
  }, /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(FormItem, {
31
59
  required: true,
32
60
  requiredTrigger: "onBlur"
33
- }, /*#__PURE__*/React.createElement(_NumberPicker, {
34
- name: "width",
61
+ }, /*#__PURE__*/React.createElement(NodeSizeNumberPicker, {
62
+ value: parseInt(value.width),
63
+ label: "\u5BBD:",
35
64
  min: 1,
36
65
  max: 2000,
37
66
  placeholder: "\u8BF7\u8F93\u5165",
38
67
  style: {
39
68
  width: '100%'
69
+ },
70
+ onChange: function onChange(val) {
71
+ return handleChange('width', val);
72
+ }
73
+ }))), /*#__PURE__*/React.createElement("div", {
74
+ className: styles.lockBtn,
75
+ onClick: function onClick() {
76
+ setLock(!lock);
40
77
  }
41
- }))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(FormItem, {
78
+ }, lock ? /*#__PURE__*/React.createElement("img", {
79
+ src: require("./img/icon_\u89E3\u9501.svg"),
80
+ title: "\u89E3\u9501",
81
+ alt: ""
82
+ }) : /*#__PURE__*/React.createElement("img", {
83
+ src: require("./img/icon_\u9501.svg"),
84
+ title: "\u9501\u5B9A",
85
+ alt: ""
86
+ })), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(FormItem, {
42
87
  required: true,
43
88
  requiredTrigger: "onBlur"
44
- }, /*#__PURE__*/React.createElement(_NumberPicker, {
45
- name: "height",
89
+ }, /*#__PURE__*/React.createElement(NodeSizeNumberPicker, {
90
+ value: parseInt(value.height),
91
+ label: "\u9AD8:",
46
92
  min: 1,
47
93
  max: 2000,
48
94
  placeholder: "\u8BF7\u8F93\u5165",
49
95
  style: {
50
96
  width: '100%'
97
+ },
98
+ onChange: function onChange(val) {
99
+ return handleChange('height', val);
51
100
  }
52
101
  }))))));
53
102
  }
@@ -0,0 +1,5 @@
1
+ .lockBtn {
2
+ height: 28px;
3
+ margin: 6px 10px 0 10px;
4
+ cursor: pointer;
5
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 节点大小组件
3
+ *
4
+ * 文本框失去焦点、按enter键、点击加减按钮时节点大小变化
5
+ * 最大最小值限制
6
+ */
7
+ export default function NodeSizeNumberPicker(props: any): JSX.Element;
@@ -0,0 +1,73 @@
1
+ import _NumberPicker from "@alifd/next/lib/number-picker";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
4
+ var _excluded = ["value", "onChange", "min", "onBlur", "onKeyDown"];
5
+ import React, { useState, useEffect } from 'react';
6
+
7
+ /**
8
+ * 节点大小组件
9
+ *
10
+ * 文本框失去焦点、按enter键、点击加减按钮时节点大小变化
11
+ * 最大最小值限制
12
+ */
13
+ export default function NodeSizeNumberPicker(props) {
14
+ var value = props.value,
15
+ onChange = props.onChange,
16
+ min = props.min,
17
+ onBlur = props.onBlur,
18
+ onKeyDown = props.onKeyDown,
19
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
20
+
21
+ var _useState = useState(value),
22
+ inputValue = _useState[0],
23
+ setInputValue = _useState[1];
24
+
25
+ useEffect(function () {
26
+ setInputValue(value);
27
+ }, [value]);
28
+
29
+ var handleBlur = function handleBlur(e) {
30
+ if (inputValue !== value) {
31
+ onChange(inputValue);
32
+ }
33
+
34
+ onBlur && onBlur(e);
35
+ };
36
+
37
+ var handleKeyDown = function handleKeyDown(e) {
38
+ if (e.keyCode === 13 || e.keyCode === 27) {
39
+ if (inputValue !== value) {
40
+ onChange(inputValue);
41
+ }
42
+ }
43
+
44
+ if (onKeyDown) {
45
+ onKeyDown(e);
46
+ }
47
+ };
48
+
49
+ var handleChange = function handleChange(value, e) {
50
+ // 失去焦点最大最小值
51
+ if (e.type === 'blur') {
52
+ onChange(!value ? min : value);
53
+ return;
54
+ } // 加减号立即变更
55
+
56
+
57
+ if (e.triggerType === 'up' || e.triggerType === 'down') {
58
+ onChange(value);
59
+ return;
60
+ }
61
+
62
+ setInputValue(value);
63
+ };
64
+
65
+ return /*#__PURE__*/React.createElement(_NumberPicker, _extends({}, otherProps, {
66
+ value: inputValue,
67
+ min: min,
68
+ onChange: handleChange,
69
+ onBlur: handleBlur,
70
+ onKeyDown: handleKeyDown
71
+ }));
72
+ }
73
+ ;
@@ -100,7 +100,7 @@ export default function TextStyle(props) {
100
100
  }, /*#__PURE__*/React.createElement(_NumberPicker, {
101
101
  name: "fontSize",
102
102
  min: 8,
103
- max: 36,
103
+ max: 100,
104
104
  style: {
105
105
  width: '100%',
106
106
  marginRight: 8
@@ -70,10 +70,18 @@ export function getIconMap(topo: any): {
70
70
  *
71
71
  * @param topo
72
72
  * @param type {'node' | 'container'}
73
- * @return {{label: string, icons: *[]}[]}
73
+ * @return {{name: string, icons: *[]}[]}
74
74
  */
75
75
  export function getIconGroups(topo: any, type: 'node' | 'container'): {
76
- label: string;
76
+ name: string;
77
+ icons: any[];
78
+ }[];
79
+ export function getNodeIconGroups(topo: any, type: any): {
80
+ name: string;
81
+ icons: any[];
82
+ }[];
83
+ export function getGroupIconGroups(topo: any, type: any): {
84
+ name: string;
77
85
  icons: any[];
78
86
  }[];
79
87
  export function getIconById(id: any, topo: any): any;
@@ -18,12 +18,24 @@ export function getIconMap(topo) {
18
18
  *
19
19
  * @param topo
20
20
  * @param type {'node' | 'container'}
21
- * @return {{label: string, icons: *[]}[]}
21
+ * @return {{name: string, icons: *[]}[]}
22
22
  */
23
23
 
24
24
  export function getIconGroups(topo, type) {
25
25
  return [{
26
- label: '默认',
26
+ name: '默认',
27
+ icons: [].concat(DEFAULT_NODE_ICONS, topo.options.icons || [])
28
+ }];
29
+ }
30
+ export function getNodeIconGroups(topo, type) {
31
+ return [{
32
+ name: '默认',
33
+ icons: [].concat(DEFAULT_NODE_ICONS, topo.options.icons || [])
34
+ }];
35
+ }
36
+ export function getGroupIconGroups(topo, type) {
37
+ return [{
38
+ name: '默认',
27
39
  icons: [].concat(DEFAULT_NODE_ICONS, topo.options.icons || [])
28
40
  }];
29
41
  }
@@ -1,8 +1,6 @@
1
- import _Avatar from "@alifd/next/lib/avatar";
2
- import _Select from "@alifd/next/lib/select";
3
- import React, { useState, useEffect, useRef, useCallback } from 'react';
4
- import { getIconGroups, getIconMap } from "../group/GroupNodeList/icon";
5
- var Option = _Select.Option;
1
+ import React from 'react';
2
+ import { getIconGroups } from "../group/GroupNodeList/icon";
3
+ import IconSelect from '@riil-frontend/component-topo-icon-select';
6
4
  export default function NodeIconSelect(props) {
7
5
  var value = props.value,
8
6
  onChange = props.onChange,
@@ -17,26 +15,13 @@ export default function NodeIconSelect(props) {
17
15
  newId = a[0].id;
18
16
  }
19
17
 
20
- return /*#__PURE__*/React.createElement(_Select, {
18
+ return /*#__PURE__*/React.createElement(IconSelect, {
21
19
  value: newId,
20
+ iconList: iconGroups,
22
21
  onChange: onChange,
23
22
  style: {
24
23
  width: '100%'
25
24
  }
26
- }, iconGroups.map(function (group) {
27
- return /*#__PURE__*/React.createElement(_Select.OptionGroup, {
28
- label: group.label,
29
- key: group.label
30
- }, group.icons.map(function (icon) {
31
- return /*#__PURE__*/React.createElement(Option, {
32
- key: icon.id,
33
- value: icon.id
34
- }, /*#__PURE__*/React.createElement(_Avatar, {
35
- src: icon.url,
36
- shape: "square",
37
- size: "small"
38
- }), "\xA0", icon.name);
39
- }));
40
- }));
25
+ });
41
26
  }
42
27
  ;
@@ -0,0 +1 @@
1
+ export default function NodeIconSelect(props: any): JSX.Element;
@@ -0,0 +1,31 @@
1
+ import _Avatar from "@alifd/next/lib/avatar";
2
+ import _Select from "@alifd/next/lib/select";
3
+ import React from 'react';
4
+ var Option = _Select.Option;
5
+ export default function NodeIconSelect(props) {
6
+ var value = props.value,
7
+ onChange = props.onChange,
8
+ iconList = props.iconList;
9
+ return /*#__PURE__*/React.createElement(_Select, {
10
+ value: value,
11
+ onChange: onChange,
12
+ style: {
13
+ width: '100%'
14
+ }
15
+ }, iconList.map(function (group) {
16
+ return /*#__PURE__*/React.createElement(_Select.OptionGroup, {
17
+ label: group.name,
18
+ key: group.name
19
+ }, group.icons.map(function (icon) {
20
+ return /*#__PURE__*/React.createElement(Option, {
21
+ key: icon.id,
22
+ value: icon.id
23
+ }, /*#__PURE__*/React.createElement(_Avatar, {
24
+ src: icon.url,
25
+ shape: "square",
26
+ size: "small"
27
+ }), "\xA0", icon.name);
28
+ }));
29
+ }));
30
+ }
31
+ ;
@@ -52,11 +52,7 @@ export default function TextPropertyView(props) {
52
52
  useEffect(function () {
53
53
  field.setValues(parseValues(values));
54
54
  }, [values]);
55
- return /*#__PURE__*/React.createElement("div", {
56
- style: {
57
- paddingTop: 8
58
- }
59
- }, /*#__PURE__*/React.createElement(_Form, {
55
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Form, {
60
56
  field: field,
61
57
  labelAlign: "top"
62
58
  }, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Collapse, {
@@ -1,12 +1,13 @@
1
1
  import _Button from "@alifd/next/lib/button";
2
2
  import React, { useState, useEffect, useRef, useCallback } from 'react';
3
+ import classnames from 'classnames';
3
4
  import TitleWidget from "../../../components/titlebar/widgets/TitleWidget";
4
5
  import styles from "../../../components/titlebar/TitleBar.module.scss";
5
6
  export default function TopoEditorTitleBar(props) {
6
7
  var topo = props.topo,
7
8
  topoEditApi = props.topoEditApi;
8
9
  return /*#__PURE__*/React.createElement("div", {
9
- className: styles.titlebar
10
+ className: classnames(styles.titlebar, styles.titlebarEditMode)
10
11
  }, /*#__PURE__*/React.createElement("div", {
11
12
  className: styles.left
12
13
  }, /*#__PURE__*/React.createElement(TitleWidget, {
@@ -599,17 +599,31 @@ var TopoApp = /*#__PURE__*/function () {
599
599
  }
600
600
 
601
601
  return save;
602
- }();
602
+ }()
603
+ /**
604
+ * 导出为图片
605
+ *
606
+ * @param name {string?} 文件名称,不传使用默认
607
+ */
608
+ ;
603
609
 
604
- _proto.exportImage = /*#__PURE__*/function () {
605
- var _exportImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
610
+ _proto.exportImage =
611
+ /*#__PURE__*/
612
+ function () {
613
+ var _exportImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(name) {
614
+ var fileName;
606
615
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
607
616
  while (1) {
608
617
  switch (_context15.prev = _context15.next) {
609
618
  case 0:
610
- this.view.topoClient.exportImage();
619
+ fileName = name;
611
620
 
612
- case 1:
621
+ if (!name) {// TODO 获取拓扑名称,避免改名重绘拓扑图
622
+ }
623
+
624
+ this.view.topoClient.exportImage(fileName);
625
+
626
+ case 3:
613
627
  case "end":
614
628
  return _context15.stop();
615
629
  }
@@ -617,7 +631,7 @@ var TopoApp = /*#__PURE__*/function () {
617
631
  }, _callee15, this);
618
632
  }));
619
633
 
620
- function exportImage() {
634
+ function exportImage(_x9) {
621
635
  return _exportImage.apply(this, arguments);
622
636
  }
623
637
 
@@ -652,7 +666,7 @@ var TopoApp = /*#__PURE__*/function () {
652
666
  }, _callee16, this);
653
667
  }));
654
668
 
655
- function loadAttrsAndMetrics(_x9) {
669
+ function loadAttrsAndMetrics(_x10) {
656
670
  return _loadAttrsAndMetrics.apply(this, arguments);
657
671
  }
658
672
 
@@ -49,6 +49,7 @@ export default function _default(topoApp: any): {
49
49
  mode: string | null;
50
50
  viewState: string | null;
51
51
  }, rootState: any): Promise<void>;
52
+ clearData(): void;
52
53
  switchToViewMode(playload: any, rootState: any): void;
53
54
  enterEditMode(playload: any, rootState: any): void;
54
55
  openDefaultTopoPage(conditions: {}, rootState: any): Promise<void>;
@@ -141,10 +141,7 @@ export default function (topoApp) {
141
141
  id = playload.id, data = playload.data, linkTo = playload.linkTo;
142
142
  viewState = playload.mode || playload.viewState || 'view';
143
143
  topoId = id || data.config.id;
144
- _context2.next = 5;
145
- return topoApp.open(topoId);
146
144
 
147
- case 5:
148
145
  _this2.update({
149
146
  viewState: viewState,
150
147
  currentTopo: playload,
@@ -152,6 +149,10 @@ export default function (topoApp) {
152
149
  topoPermission: undefined
153
150
  });
154
151
 
152
+ _context2.next = 6;
153
+ return topoApp.open(topoId);
154
+
155
+ case 6:
155
156
  _context2.next = 8;
156
157
  return _this2.initTopoData({
157
158
  topoId: topoId,
@@ -173,6 +174,11 @@ export default function (topoApp) {
173
174
  }, _callee2);
174
175
  }))();
175
176
  },
177
+ clearData: function clearData() {
178
+ this.update({
179
+ topoData: null
180
+ });
181
+ },
176
182
  switchToViewMode: function switchToViewMode(playload, rootState) {
177
183
  this.update({
178
184
  viewState: 'view'
package/es/style.js CHANGED
@@ -26,6 +26,6 @@ import '@alifd/next/lib/radio/style';
26
26
  import '@alifd/next/lib/collapse/style';
27
27
  import '@alifd/next/lib/list/style';
28
28
  import '@alifd/next/lib/tree-select/style';
29
- import '@alifd/next/lib/avatar/style';
29
+
30
30
 
31
31
  import './index.scss';
@@ -189,10 +189,23 @@ export default {
189
189
  viewState: viewState || 'view'
190
190
  });
191
191
 
192
- _context4.next = 5;
192
+ if (!id) {
193
+ _context4.next = 8;
194
+ break;
195
+ }
196
+
197
+ _context4.next = 6;
193
198
  return dispatch.topoMod.openTopoPage(playload);
194
199
 
195
- case 5:
200
+ case 6:
201
+ _context4.next = 10;
202
+ break;
203
+
204
+ case 8:
205
+ _context4.next = 10;
206
+ return dispatch.topoMod.clearData();
207
+
208
+ case 10:
196
209
  case "end":
197
210
  return _context4.stop();
198
211
  }
@@ -55,7 +55,6 @@ export default function _default(topoApp: any): {
55
55
  fetchTopoTree(payload: any, rootState: any): Promise<void>;
56
56
  getSelectedTopoId(payload: any, rootState: any): any;
57
57
  refreshTree(payload: any, rootState: any): Promise<void>;
58
- addNewTopo(params: {}, state: any): Promise<void>;
59
58
  editTopoOnTree(conditions: {}, state: any): Promise<void>;
60
59
  /**
61
60
  * 节指定的点和子节点是否包含指定的拓扑