@riil-frontend/component-topology 6.0.0-alpha.1 → 6.0.0-alpha.3

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 (68) 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/components/VerticalIconTab/VerticalIconTab.js +4 -3
  6. package/es/components/VerticalIconTab/VerticalIconTab.module.scss +26 -4
  7. package/es/components/collapse/Collapse.js +7 -0
  8. package/es/components/collapse/Collapse.module.scss +44 -0
  9. package/es/components/collapse/CollapseFullheight.module.scss +20 -0
  10. package/es/components/collapse/Panel.js +3 -0
  11. package/es/core/common/icons/icon.js +18 -5
  12. package/es/core/editor/components/Sidebar/Sidebar.js +19 -18
  13. package/es/core/editor/components/Sidebar/Sidebar.module.scss +18 -2
  14. package/es/core/editor/components/Sidebar/views/BackgroundPanel/BackgroundPanel.js +9 -0
  15. package/es/core/editor/components/Sidebar/views/BackgroundPanel/index.js +2 -0
  16. package/es/core/editor/components/Sidebar/views/CanvasPanel/ImagePanel.js +4 -0
  17. package/es/core/editor/components/Sidebar/views/CanvasPanel/index.js +2 -0
  18. package/es/core/editor/components/Sidebar/views/ComponentPanel.js +41 -0
  19. package/es/core/editor/components/Sidebar/views/ImagePanel/CiTypeImagePanel.js +20 -0
  20. package/es/core/editor/components/Sidebar/views/ImagePanel/CustomImagePanel.js +20 -0
  21. package/es/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +45 -0
  22. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +44 -0
  23. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePalette.js +44 -0
  24. package/es/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +29 -0
  25. package/es/core/editor/components/Sidebar/views/ImagePanel/index.js +2 -0
  26. package/es/core/editor/components/Sidebar/views/LinkPanel.js +43 -0
  27. package/es/core/editor/components/Toolbar/widgets/AddResourceButton.js +54 -6
  28. package/es/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +48 -0
  29. package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceButton.js +12 -18
  30. package/es/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +13 -46
  31. package/es/core/editor/components/settings/propertyViews/layer/DataTab/RelateData.js +2 -1
  32. package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +9 -15
  33. package/es/core/editor/hooks/useLayerAddResource.js +28 -0
  34. package/es/core/models/TopoApp.js +1 -1
  35. package/lib/components/VerticalIconTab/VerticalIconTab.js +4 -3
  36. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +26 -4
  37. package/lib/components/collapse/Collapse.js +15 -0
  38. package/lib/components/collapse/Collapse.module.scss +44 -0
  39. package/lib/components/collapse/CollapseFullheight.module.scss +20 -0
  40. package/lib/components/collapse/Panel.js +3 -0
  41. package/lib/core/common/icons/icon.js +20 -5
  42. package/lib/core/editor/components/Sidebar/Sidebar.js +25 -19
  43. package/lib/core/editor/components/Sidebar/Sidebar.module.scss +18 -2
  44. package/lib/core/editor/components/Sidebar/views/BackgroundPanel/BackgroundPanel.js +18 -0
  45. package/lib/core/editor/components/Sidebar/views/BackgroundPanel/index.js +11 -0
  46. package/lib/core/editor/components/Sidebar/views/CanvasPanel/ImagePanel.js +12 -0
  47. package/lib/core/editor/components/Sidebar/views/CanvasPanel/index.js +11 -0
  48. package/lib/core/editor/components/Sidebar/views/ComponentPanel.js +53 -0
  49. package/lib/core/editor/components/Sidebar/views/ImagePanel/CiTypeImagePanel.js +34 -0
  50. package/lib/core/editor/components/Sidebar/views/ImagePanel/CustomImagePanel.js +34 -0
  51. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +58 -0
  52. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +56 -0
  53. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePalette.js +56 -0
  54. package/lib/core/editor/components/Sidebar/views/ImagePanel/ImagePanel.js +45 -0
  55. package/lib/core/editor/components/Sidebar/views/ImagePanel/index.js +11 -0
  56. package/lib/core/editor/components/Sidebar/views/{LinkView.js → LinkPanel.js} +28 -17
  57. package/lib/core/editor/components/Toolbar/widgets/AddResourceButton.js +61 -6
  58. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/DefaultLayerAddResourceDrawer.js +63 -0
  59. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceButton.js +13 -22
  60. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/LayerAddResourceDrawer.js +12 -50
  61. package/lib/core/editor/components/settings/propertyViews/layer/DataTab/RelateData.js +2 -1
  62. package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -11
  63. package/lib/core/editor/hooks/useLayerAddResource.js +34 -0
  64. package/lib/core/models/TopoApp.js +1 -1
  65. package/package.json +2 -2
  66. package/es/core/editor/components/Sidebar/views/LinkView.js +0 -35
  67. package/es/core/editor/components/Toolbar/widgets/AddResourceWidget.js +0 -17
  68. package/lib/core/editor/components/Toolbar/widgets/AddResourceWidget.js +0 -27
@@ -10,11 +10,12 @@ import styles from "./VerticalIconTab.module.scss";
10
10
  */
11
11
 
12
12
  function CustomTabItem(_ref) {
13
- var title = _ref.title;
13
+ var title = _ref.title,
14
+ icon = _ref.icon;
14
15
  return /*#__PURE__*/React.createElement("div", {
15
16
  className: "v-icon-tab-item"
16
17
  }, /*#__PURE__*/React.createElement("img", {
17
- src: "/img/topo/editor/sidebar/icon/\u94FE\u8DEF.svg",
18
+ src: icon,
18
19
  alt: ""
19
20
  }), /*#__PURE__*/React.createElement("div", {
20
21
  className: "tab-title"
@@ -46,7 +47,7 @@ function VerticalIconTab(props) {
46
47
  }, props));
47
48
  }
48
49
  }, props, {
49
- className: styles.tab,
50
+ className: styles.tabs,
50
51
  navClassName: styles.nav,
51
52
  contentClassName: classNames(styles.content, (_classNames = {}, _classNames[styles.hide] = !activeKey, _classNames)),
52
53
  onClick: handleClick
@@ -1,25 +1,42 @@
1
1
  @import '~@alifd/next/variables.scss';
2
2
 
3
3
 
4
- .tab {
4
+ .tabs {
5
5
  height: 100%;
6
+
6
7
  }
7
8
 
8
9
  // 导航
9
10
  .nav {
10
11
  width: 60px;
11
12
  height: 100%;
12
- border-right: 1px solid #E6E7EB;
13
+ padding-top: 4px;
14
+ border-right: 1px solid var(--tab-wrapped-border-line-color);
15
+ background: none !important;
13
16
 
14
17
  :global {
15
18
 
19
+ .#{$css-prefix}tabs-tab {
20
+ background-color: transparent !important;
21
+
22
+ &.active .v-icon-tab-item {
23
+ background-color: rgba(76, 137, 255, 0.1);
24
+ }
25
+ }
26
+
16
27
  // 图标区
17
28
  .v-icon-tab-item {
29
+ height: 76px;
18
30
  display: flex;
19
31
  flex-direction: column;
20
32
  align-items: center;
21
33
  justify-content: center;
22
- height: 76px;
34
+ margin: 0 4px;
35
+ border-radius: 4px;
36
+
37
+ &:hover {
38
+ background-color: rgba(76, 137, 255, 0.1);
39
+ }
23
40
  }
24
41
  }
25
42
  }
@@ -28,15 +45,20 @@
28
45
  .content {
29
46
  width: 260px;
30
47
  height: 100%;
48
+ transition: all .1s linear;
49
+ border-left: none !important;
50
+ border-right: 1px solid var(--tab-wrapped-border-line-color);
31
51
 
32
52
  :global {
33
53
  .#{$css-prefix}tabs-tabpane {
34
54
  width: 100%;
35
55
  height: 100%;
56
+ overflow: auto;
36
57
  }
37
58
  }
38
59
 
39
60
  &.hide {
40
- display: none;
61
+ width: 0;
62
+ border-right: none;
41
63
  }
42
64
  }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+
3
+ function Collapse(props) {
4
+ return /*#__PURE__*/React.createElement("div", null, "Collapse");
5
+ }
6
+
7
+ export default Collapse;
@@ -0,0 +1,44 @@
1
+ @import "@alifd/next/variables";
2
+
3
+ .collapse {
4
+ :global {
5
+
6
+ // 折叠模板标题
7
+ .#{$css-prefix}collapse-panel:not(:first-child) {
8
+ border-top: none;
9
+ }
10
+
11
+ .#{$css-prefix}collapse-panel-title:hover {
12
+ background: none;
13
+ }
14
+
15
+ .#{$css-prefix}collapse-panel-title {
16
+ background: none;
17
+ font-size: 12px;
18
+ padding-left: 32px;
19
+
20
+ &>.#{$css-prefix}collapse-panel-icon {
21
+ left: 12px;
22
+ margin-top: 0;
23
+ margin-left: 0;
24
+ }
25
+ }
26
+
27
+ .#{$css-prefix}collapse-panel-content,
28
+ .#{$css-prefix}collapse-panel-expanded>.#{$css-prefix}collapse-panel-content {
29
+ // padding-left: 32px;
30
+ padding-top: 8px;
31
+ }
32
+ }
33
+
34
+ &.contentNoPadding {
35
+
36
+ :global {
37
+
38
+ .#{$css-prefix}collapse-panel-content,
39
+ .#{$css-prefix}collapse-panel-expanded>.#{$css-prefix}collapse-panel-content {
40
+ padding: 8px 0;
41
+ }
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,20 @@
1
+ @import "@alifd/next/variables";
2
+
3
+ .fullheight {
4
+ height: 100%;
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ .panelFullHeight {
9
+ height: 100%;
10
+ display: flex;
11
+ flex-direction: column;
12
+
13
+ :global {
14
+ .#{$css-prefix}collapse-panel-content {
15
+ flex: 1;
16
+ overflow: auto;
17
+ }
18
+ }
19
+ }
20
+ }
@@ -52,6 +52,9 @@ function CollapsePanel(props) {
52
52
  },
53
53
  onBlur: function onBlur() {
54
54
  setHoverExtra(false);
55
+ },
56
+ style: {
57
+ height: 20
55
58
  }
56
59
  }, extra));
57
60
  return /*#__PURE__*/React.createElement(_Collapse.Panel, _extends({
@@ -12,6 +12,19 @@ export function getNodeDefaultIcons(topo) {
12
12
  export function getGroupDefaultIcons(topo) {
13
13
  return [].concat(topoManager.iconLibManager.getIcons());
14
14
  }
15
+ export function getUserCustomIconsForHt(topo) {
16
+ return getUserCustomIcons(topo).map(function (_ref) {
17
+ var id = _ref.id,
18
+ name = _ref.name,
19
+ url = _ref.url,
20
+ jsonUrl = _ref.jsonUrl;
21
+ return {
22
+ id: id,
23
+ name: name,
24
+ url: jsonUrl || url
25
+ };
26
+ });
27
+ }
15
28
  /**
16
29
  * 获取编辑模式左侧图片列表
17
30
  * @param {*} topo
@@ -22,11 +35,11 @@ export function getEditorIcons(topo) {
22
35
  // 默认图标
23
36
  system: getNodeDefaultIcons(topo),
24
37
  // 自定义上传图标
25
- custom: getUserCustomIcons(topo).map(function (_ref) {
26
- var id = _ref.id,
27
- name = _ref.name,
28
- url = _ref.url,
29
- jsonUrl = _ref.jsonUrl;
38
+ custom: getUserCustomIcons(topo).map(function (_ref2) {
39
+ var id = _ref2.id,
40
+ name = _ref2.name,
41
+ url = _ref2.url,
42
+ jsonUrl = _ref2.jsonUrl;
30
43
  return {
31
44
  id: id,
32
45
  name: name,
@@ -1,10 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useState } from 'react';
3
+ import VerticalIconTab from "../../../../components/VerticalIconTab";
4
+ import LinkPanel from "./views/LinkPanel";
5
+ import ComponentPanel from "./views/ComponentPanel";
6
+ import ImagePanel from "./views/ImagePanel";
7
+ import BackgroundPanel from "./views/BackgroundPanel";
8
+ import CanvasPanel from "./views/CanvasPanel";
3
9
  import styles from "./Sidebar.module.scss";
4
- import LinkView from "./views/LinkView";
5
- import VerticalIconTab from "../../../../components/VerticalIconTab/VerticalIconTab";
10
+ import classNames from 'classnames';
6
11
 
7
12
  function Sidebar(props) {
13
+ var _classNames;
14
+
8
15
  var topo = props.topo;
9
16
 
10
17
  var _useState = useState(null),
@@ -15,43 +22,35 @@ function Sidebar(props) {
15
22
  title: '链路',
16
23
  key: '1',
17
24
  icon: '/img/topo/editor/sidebar/icon/链路.svg',
18
- content: LinkView
25
+ content: LinkPanel
19
26
  }, {
20
27
  title: '组件',
21
28
  key: '2',
22
29
  icon: '/img/topo/editor/sidebar/icon/组件.svg',
23
- content: function content() {
24
- return /*#__PURE__*/React.createElement("div", null, "222");
25
- }
30
+ content: ComponentPanel
26
31
  }, {
27
32
  title: '图片',
28
33
  key: '3',
29
34
  icon: '/img/topo/editor/sidebar/icon/图片.svg',
30
- content: function content() {
31
- return /*#__PURE__*/React.createElement("div", null, "333");
32
- }
35
+ content: ImagePanel
33
36
  }, {
34
37
  title: '背景',
35
38
  key: '4',
36
39
  icon: '/img/topo/editor/sidebar/icon/背景.svg',
37
- content: function content() {
38
- return /*#__PURE__*/React.createElement("div", null, "333");
39
- }
40
+ content: BackgroundPanel
40
41
  }, {
41
42
  title: '画布',
42
43
  key: '5',
43
44
  icon: '/img/topo/editor/sidebar/icon/画布.svg',
44
- content: function content() {
45
- return /*#__PURE__*/React.createElement("div", null, "333");
46
- }
45
+ content: CanvasPanel
47
46
  }].map(function (item) {
48
47
  var View = item.content;
49
48
  return _extends({}, item, {
50
49
  content: function content() {
51
- return /*#__PURE__*/React.createElement(View, {
50
+ return /*#__PURE__*/React.createElement(View, _extends({}, props, {
52
51
  topo: topo,
53
52
  active: activeKey === item.key
54
- });
53
+ }));
55
54
  }
56
55
  });
57
56
  });
@@ -68,10 +67,12 @@ function Sidebar(props) {
68
67
 
69
68
  return /*#__PURE__*/React.createElement("div", {
70
69
  className: styles.sidebar
70
+ }, /*#__PURE__*/React.createElement("div", {
71
+ className: classNames(styles.tabsContainer, (_classNames = {}, _classNames[styles.expanded] = !!activeKey, _classNames))
71
72
  }, /*#__PURE__*/React.createElement(VerticalIconTab, {
72
73
  activeKey: activeKey,
73
74
  onChange: setActivekey
74
- }, panes.map(renderTabItem)));
75
+ }, panes.map(renderTabItem))));
75
76
  }
76
77
 
77
78
  export default Sidebar;
@@ -1,3 +1,19 @@
1
1
  .sidebar {
2
- border-right: 1px solid #E6E7EB;
3
- }
2
+ // border-right: 1px solid #E6E7EB;
3
+ position: relative;
4
+ width: 60px;
5
+
6
+ .tabsContainer {
7
+ position: absolute;
8
+ width: 60px;
9
+ height: 100%;
10
+ left: 0;
11
+ top: 0;
12
+ z-index: 1;
13
+ background: #FFF;
14
+
15
+ &.expanded {
16
+ width: 320px;
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import BackgroundView from "../../../BackgroundView";
3
+ export default function BackgroundPanel(props) {
4
+ var topo = props.topo,
5
+ editorProps = props.editorProps;
6
+ return /*#__PURE__*/React.createElement(BackgroundView, {
7
+ topo: topo
8
+ });
9
+ }
@@ -0,0 +1,2 @@
1
+ import Panel from "./BackgroundPanel";
2
+ export default Panel;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export default function ImagePanel(props) {
3
+ return /*#__PURE__*/React.createElement("div", null, "ImagePanel");
4
+ }
@@ -0,0 +1,2 @@
1
+ import Panel from "./ImagePanel";
2
+ export default Panel;
@@ -0,0 +1,41 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ /**
4
+ * 组件面板
5
+ * @param {*} props
6
+ * @returns
7
+ */
8
+
9
+ export default function ComponentPanel(props) {
10
+ var topo = props.topo; // 组件
11
+
12
+ var viewRef = useRef(null); // div容器
13
+
14
+ var divRef = useRef();
15
+ useEffect(function () {
16
+ // 初始化
17
+ var htTopo = topo.getHtTopo();
18
+ var container = divRef.current;
19
+
20
+ try {
21
+ viewRef.current = htTopo.createBasicPalette(container);
22
+ } catch (error) {
23
+ rlog.error('初始化资源面板失败', error);
24
+ } // 注销组件
25
+
26
+
27
+ return function () {
28
+ if (viewRef.current) {
29
+ viewRef.current.destroy();
30
+ viewRef.current = null;
31
+ }
32
+ };
33
+ }, []);
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ ref: divRef,
36
+ style: {
37
+ width: '100%',
38
+ height: '100%'
39
+ }
40
+ });
41
+ }
@@ -0,0 +1,20 @@
1
+ import React, { useEffect, useMemo, useRef } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ import ImagePalette from "./HtImagePalette";
4
+ import { getNodeDefaultIcons } from "../../../../../common/icons/icon";
5
+ /**
6
+ * 组件面板
7
+ * @param {*} props
8
+ * @returns
9
+ */
10
+
11
+ export default function CiTypeImagePanel(props) {
12
+ var topo = props.topo;
13
+ var icons = useMemo(function () {
14
+ return getNodeDefaultIcons(topo);
15
+ }, []);
16
+ return /*#__PURE__*/React.createElement(ImagePalette, {
17
+ icons: icons,
18
+ topo: topo
19
+ });
20
+ }
@@ -0,0 +1,20 @@
1
+ import React, { useEffect, useRef, useMemo } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ import { getUserCustomIconsForHt } from "../../../../../common/icons/icon";
4
+ import HtCustomImagePanel from "./HtCustomImagePanel";
5
+ /**
6
+ * 组件面板
7
+ * @param {*} props
8
+ * @returns
9
+ */
10
+
11
+ export default function CustomImagePanel(props) {
12
+ var topo = props.topo;
13
+ var icons = useMemo(function () {
14
+ return getUserCustomIconsForHt(topo);
15
+ }, []);
16
+ return /*#__PURE__*/React.createElement(HtCustomImagePanel, {
17
+ icons: icons,
18
+ topo: topo
19
+ });
20
+ }
@@ -0,0 +1,45 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ import { getUserCustomIconsForHt } from "../../../../../common/icons/icon";
4
+ /**
5
+ * 组件面板
6
+ * @param {*} props
7
+ * @returns
8
+ */
9
+
10
+ export default function HtCustomImagePanel(props) {
11
+ var topo = props.topo,
12
+ icons = props.icons; // 组件
13
+
14
+ var viewRef = useRef(null); // div容器
15
+
16
+ var divRef = useRef();
17
+ useEffect(function () {
18
+ // 初始化
19
+ var htTopo = topo.getHtTopo();
20
+ var container = divRef.current;
21
+
22
+ try {
23
+ viewRef.current = htTopo.createUploadImagePalette(container, {
24
+ icons: icons
25
+ });
26
+ } catch (error) {
27
+ rlog.error('初始化资源面板失败', error);
28
+ } // 注销组件
29
+
30
+
31
+ return function () {
32
+ if (viewRef.current) {
33
+ viewRef.current.destroy();
34
+ viewRef.current = null;
35
+ }
36
+ };
37
+ }, []);
38
+ return /*#__PURE__*/React.createElement("div", {
39
+ ref: divRef,
40
+ style: {
41
+ width: '100%' // height: '100%',
42
+
43
+ }
44
+ });
45
+ }
@@ -0,0 +1,44 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ /**
4
+ * 组件面板
5
+ * @param {*} props
6
+ * @returns
7
+ */
8
+
9
+ export default function HtImagePalette(props) {
10
+ var topo = props.topo,
11
+ icons = props.icons; // 组件
12
+
13
+ var viewRef = useRef(null); // div容器
14
+
15
+ var divRef = useRef();
16
+ useEffect(function () {
17
+ // 初始化
18
+ var htTopo = topo.getHtTopo();
19
+ var container = divRef.current;
20
+
21
+ try {
22
+ viewRef.current = htTopo.createImagePalette(container, {
23
+ icons: icons
24
+ });
25
+ } catch (error) {
26
+ rlog.error('初始化资源面板失败', error);
27
+ } // 注销组件
28
+
29
+
30
+ return function () {
31
+ if (viewRef.current) {
32
+ viewRef.current.destroy();
33
+ viewRef.current = null;
34
+ }
35
+ };
36
+ }, []);
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ ref: divRef,
39
+ style: {
40
+ width: '100%' // height: '100%',
41
+
42
+ }
43
+ });
44
+ }
@@ -0,0 +1,44 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ /**
4
+ * 组件面板
5
+ * @param {*} props
6
+ * @returns
7
+ */
8
+
9
+ export default function ImagePalette(props) {
10
+ var topo = props.topo,
11
+ icons = props.icons; // 组件
12
+
13
+ var viewRef = useRef(null); // div容器
14
+
15
+ var divRef = useRef();
16
+ useEffect(function () {
17
+ // 初始化
18
+ var htTopo = topo.getHtTopo();
19
+ var container = divRef.current;
20
+
21
+ try {
22
+ viewRef.current = htTopo.createImagePalette(container, {
23
+ icons: icons
24
+ });
25
+ } catch (error) {
26
+ rlog.error('初始化资源面板失败', error);
27
+ } // 注销组件
28
+
29
+
30
+ return function () {
31
+ if (viewRef.current) {
32
+ viewRef.current.destroy();
33
+ viewRef.current = null;
34
+ }
35
+ };
36
+ }, []);
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ ref: divRef,
39
+ style: {
40
+ width: '100%',
41
+ height: '100%'
42
+ }
43
+ });
44
+ }
@@ -0,0 +1,29 @@
1
+ import _Collapse from "@alifd/next/es/collapse";
2
+ import _Button from "@alifd/next/es/button";
3
+ import _Icon from "@alifd/next/es/icon";
4
+ import React from 'react';
5
+ import classNames from 'classnames';
6
+ import CollapsePanel from "../../../../../../components/collapse/Panel";
7
+ import CollapseStyles from "../../../../../../components/collapse/Collapse.module.scss";
8
+ import CiTypeImagePanel from "./CiTypeImagePanel";
9
+ import CustomImagePanel from "./CustomImagePanel";
10
+ export default function ImagePanel(props) {
11
+ return /*#__PURE__*/React.createElement(_Collapse, {
12
+ defaultExpandedKeys: ['资源图片', '自定义图片'],
13
+ style: {
14
+ border: 'none'
15
+ },
16
+ className: classNames(CollapseStyles.collapse, CollapseStyles.contentNoPadding)
17
+ }, /*#__PURE__*/React.createElement(CollapsePanel, {
18
+ key: "\u8D44\u6E90\u56FE\u7247",
19
+ title: "\u8D44\u6E90\u56FE\u7247"
20
+ }, /*#__PURE__*/React.createElement(CiTypeImagePanel, props)), /*#__PURE__*/React.createElement(CollapsePanel, {
21
+ key: "\u81EA\u5B9A\u4E49\u56FE\u7247",
22
+ title: "\u81EA\u5B9A\u4E49\u56FE\u7247",
23
+ extra: /*#__PURE__*/React.createElement(_Button, {
24
+ title: "\u5BFC\u51FA"
25
+ }, /*#__PURE__*/React.createElement(_Icon, {
26
+ type: "topo_button_icon_export"
27
+ }))
28
+ }, /*#__PURE__*/React.createElement(CustomImagePanel, props)));
29
+ }
@@ -0,0 +1,2 @@
1
+ import Panel from "./ImagePanel";
2
+ export default Panel;
@@ -0,0 +1,43 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ /**
4
+ * 链路面板
5
+ * @param {*} props
6
+ * @returns
7
+ */
8
+
9
+ function LinkPanel(props) {
10
+ var topo = props.topo; // 组件
11
+
12
+ var viewRef = useRef(null); // div容器
13
+
14
+ var divRef = useRef();
15
+ useEffect(function () {
16
+ // 初始化
17
+ var htTopo = topo.getHtTopo();
18
+ var container = divRef.current;
19
+
20
+ try {
21
+ viewRef.current = htTopo.createLinkPalette(container);
22
+ } catch (error) {
23
+ rlog.error('初始化资源面板失败', error);
24
+ } // 注销组件
25
+
26
+
27
+ return function () {
28
+ if (viewRef.current) {
29
+ viewRef.current.destroy();
30
+ viewRef.current = null;
31
+ }
32
+ };
33
+ }, []);
34
+ return /*#__PURE__*/React.createElement("div", {
35
+ ref: divRef,
36
+ style: {
37
+ width: '100%',
38
+ height: '100%'
39
+ }
40
+ });
41
+ }
42
+
43
+ export default LinkPanel;