@riil-frontend/component-topology 6.0.0-alpha.4 → 6.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) 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.module.scss +5 -1
  6. package/es/core/editor/components/Sidebar/Sidebar.js +23 -50
  7. package/es/core/editor/components/Sidebar/panes.js +32 -0
  8. package/es/core/editor/components/Sidebar/views/CanvasPanel/{ImagePanel.js → CanvasPanel.js} +1 -1
  9. package/es/core/editor/components/Sidebar/views/CanvasPanel/index.js +1 -1
  10. package/es/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +2 -5
  11. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +2 -4
  12. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.module.scss +5 -0
  13. package/es/core/editor/components/Toolbar/EditorToolbar.js +9 -6
  14. package/es/core/editor/components/Toolbar/Toolbar.js +1 -1
  15. package/es/core/editor/components/Toolbar/Toolbar.module.scss +14 -3
  16. package/es/core/editor/components/Toolbar/widgets/AddResourceButton.js +6 -5
  17. package/es/core/editor/components/Toolbar/widgets/CanvasMoveWidget.js +13 -2
  18. package/es/core/editor/components/Toolbar/widgets/CanvasSelectWidget.js +11 -2
  19. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +133 -3
  20. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +46 -0
  21. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +46 -0
  22. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +31 -0
  23. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +27 -6
  24. package/es/core/editor/components/Toolbar/widgets/HistoryRedoButton.js +2 -1
  25. package/es/core/editor/components/Toolbar/widgets/HistoryUndoButton.js +3 -2
  26. package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +2 -1
  27. package/es/core/editor/components/Toolbar/widgets/WidgetBox.js +7 -20
  28. package/es/core/editor/components/Toolbar/widgets/WidgetBox.module.scss +1 -0
  29. package/es/core/editor/components/Toolbar/widgets/components/ButtonBox.js +4 -2
  30. package/es/core/editor/components/Toolbar/widgets/components/DropdownButton.js +8 -5
  31. package/es/core/editor/components/settings/common/LineType/index.js +3 -19
  32. package/es/core/editor/components/settings/common/SizeInput/NodeSizeInput.js +3 -0
  33. package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +2 -37
  34. package/es/core/{store/models → editor/store}/background.js +0 -0
  35. package/es/core/{store/models → editor/store}/historyManager.js +0 -0
  36. package/es/core/{store/models → editor/store}/topoEdit.js +8 -1
  37. package/es/core/editor/utils/edgeTypeStyleUtil.js +73 -0
  38. package/es/core/hooks/useTopoEdit.js +21 -54
  39. package/es/core/models/TopoApp.js +1 -1
  40. package/es/core/models/TopoGraphView.js +8 -2
  41. package/es/core/store/coreModels.js +6 -7
  42. package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +5 -1
  43. package/lib/core/editor/components/Sidebar/Sidebar.js +22 -53
  44. package/lib/core/editor/components/Sidebar/panes.js +45 -0
  45. package/lib/core/editor/components/Sidebar/views/CanvasPanel/{ImagePanel.js → CanvasPanel.js} +2 -2
  46. package/lib/core/editor/components/Sidebar/views/CanvasPanel/index.js +2 -2
  47. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +2 -5
  48. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +3 -4
  49. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.module.scss +5 -0
  50. package/lib/core/editor/components/Toolbar/EditorToolbar.js +10 -6
  51. package/lib/core/editor/components/Toolbar/Toolbar.js +1 -1
  52. package/lib/core/editor/components/Toolbar/Toolbar.module.scss +14 -3
  53. package/lib/core/editor/components/Toolbar/widgets/AddResourceButton.js +6 -5
  54. package/lib/core/editor/components/Toolbar/widgets/CanvasMoveWidget.js +13 -2
  55. package/lib/core/editor/components/Toolbar/widgets/CanvasSelectWidget.js +11 -2
  56. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +143 -3
  57. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +46 -0
  58. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +61 -0
  59. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +31 -0
  60. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +27 -5
  61. package/lib/core/editor/components/Toolbar/widgets/HistoryRedoButton.js +3 -1
  62. package/lib/core/editor/components/Toolbar/widgets/HistoryUndoButton.js +3 -1
  63. package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +2 -1
  64. package/lib/core/editor/components/Toolbar/widgets/WidgetBox.js +9 -24
  65. package/lib/core/editor/components/Toolbar/widgets/WidgetBox.module.scss +1 -0
  66. package/lib/core/editor/components/Toolbar/widgets/components/ButtonBox.js +4 -2
  67. package/lib/core/editor/components/Toolbar/widgets/components/DropdownButton.js +8 -5
  68. package/lib/core/editor/components/settings/common/LineType/index.js +3 -18
  69. package/lib/core/editor/components/settings/common/SizeInput/NodeSizeInput.js +3 -0
  70. package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +2 -37
  71. package/lib/core/{store/models → editor/store}/background.js +0 -0
  72. package/lib/core/{store/models → editor/store}/historyManager.js +0 -0
  73. package/lib/core/{store/models → editor/store}/topoEdit.js +8 -1
  74. package/lib/core/editor/utils/edgeTypeStyleUtil.js +82 -0
  75. package/lib/core/hooks/useTopoEdit.js +21 -56
  76. package/lib/core/models/TopoApp.js +1 -1
  77. package/lib/core/models/TopoGraphView.js +8 -2
  78. package/lib/core/store/coreModels.js +5 -7
  79. package/package.json +2 -2
  80. package/es/core/store/models/topoView.js +0 -36
  81. package/lib/core/store/models/topoView.js +0 -47
@@ -37,6 +37,10 @@
37
37
  &:hover {
38
38
  background-color: rgba(76, 137, 255, 0.1);
39
39
  }
40
+
41
+ .tab-title {
42
+ margin-top: 3px;
43
+ }
40
44
  }
41
45
  }
42
46
  }
@@ -45,9 +49,9 @@
45
49
  .content {
46
50
  width: 260px;
47
51
  height: 100%;
48
- transition: all .1s linear;
49
52
  border-left: none !important;
50
53
  border-right: 1px solid var(--tab-wrapped-border-line-color);
54
+ transition: width .1s linear;
51
55
 
52
56
  :global {
53
57
  .#{$css-prefix}tabs-tabpane {
@@ -1,63 +1,32 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
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";
9
- import styles from "./Sidebar.module.scss";
2
+ import React, { useEffect, useState } from 'react';
10
3
  import classNames from 'classnames';
4
+ import Tab from "../../../../components/VerticalIconTab";
5
+ import panes from "./panes";
6
+ import styles from "./Sidebar.module.scss";
11
7
 
12
8
  function Sidebar(props) {
13
9
  var _classNames;
14
10
 
15
11
  var topo = props.topo;
16
12
 
17
- var _useState = useState(null),
18
- activeKey = _useState[0],
19
- setActivekey = _useState[1];
13
+ var _topo$store$useModel = topo.store.useModel('topoEdit'),
14
+ topoEditState = _topo$store$useModel[0],
15
+ topoEditDispatchers = _topo$store$useModel[1];
20
16
 
21
- var panes = [{
22
- title: '链路',
23
- key: '1',
24
- icon: '/img/topo/editor/sidebar/icon/链路.svg',
25
- content: LinkPanel
26
- }, {
27
- title: '组件',
28
- key: '2',
29
- icon: '/img/topo/editor/sidebar/icon/组件.svg',
30
- content: ComponentPanel
31
- }, {
32
- title: '图片',
33
- key: '3',
34
- icon: '/img/topo/editor/sidebar/icon/图片.svg',
35
- content: ImagePanel
36
- }, {
37
- title: '背景',
38
- key: '4',
39
- icon: '/img/topo/editor/sidebar/icon/背景.svg',
40
- content: BackgroundPanel
41
- }, {
42
- title: '画布',
43
- key: '5',
44
- icon: '/img/topo/editor/sidebar/icon/画布.svg',
45
- content: CanvasPanel
46
- }].map(function (item) {
47
- var View = item.content;
48
- return _extends({}, item, {
49
- content: function content() {
50
- return /*#__PURE__*/React.createElement(View, _extends({}, props, {
51
- topo: topo,
52
- active: activeKey === item.key
53
- }));
54
- }
55
- });
56
- });
17
+ var activeKey = topoEditState.resourceTabactiveKey;
18
+ useEffect(function () {
19
+ return function () {
20
+ // 退出编辑模式,关闭资源面板状态
21
+ topoEditDispatchers.update({
22
+ resourceTabactiveKey: null
23
+ });
24
+ };
25
+ }, []);
57
26
 
58
27
  var renderTabItem = function renderTabItem(pane) {
59
28
  var View = pane.content;
60
- return /*#__PURE__*/React.createElement(VerticalIconTab.Item, _extends({
29
+ return /*#__PURE__*/React.createElement(Tab.Item, _extends({
61
30
  key: pane.key
62
31
  }, pane), /*#__PURE__*/React.createElement(View, {
63
32
  topo: topo,
@@ -69,9 +38,13 @@ function Sidebar(props) {
69
38
  className: styles.sidebar
70
39
  }, /*#__PURE__*/React.createElement("div", {
71
40
  className: classNames(styles.tabsContainer, (_classNames = {}, _classNames[styles.expanded] = !!activeKey, _classNames))
72
- }, /*#__PURE__*/React.createElement(VerticalIconTab, {
41
+ }, /*#__PURE__*/React.createElement(Tab, {
73
42
  activeKey: activeKey,
74
- onChange: setActivekey
43
+ onChange: function onChange(key) {
44
+ return topoEditDispatchers.update({
45
+ resourceTabactiveKey: key
46
+ });
47
+ }
75
48
  }, panes.map(renderTabItem))));
76
49
  }
77
50
 
@@ -0,0 +1,32 @@
1
+ import BackgroundPanel from "./views/BackgroundPanel";
2
+ import CanvasPanel from "./views/CanvasPanel";
3
+ import ComponentPanel from "./views/ComponentPanel";
4
+ import ImagePanel from "./views/ImagePanel";
5
+ import LinkPanel from "./views/LinkPanel";
6
+ var panes = [{
7
+ title: '链路',
8
+ key: '1',
9
+ icon: '/img/topo/editor/sidebar/icon/链路.svg',
10
+ content: LinkPanel
11
+ }, {
12
+ title: '组件',
13
+ key: '2',
14
+ icon: '/img/topo/editor/sidebar/icon/组件.svg',
15
+ content: ComponentPanel
16
+ }, {
17
+ title: '图片',
18
+ key: '3',
19
+ icon: '/img/topo/editor/sidebar/icon/图片.svg',
20
+ content: ImagePanel
21
+ }, {
22
+ title: '背景',
23
+ key: '4',
24
+ icon: '/img/topo/editor/sidebar/icon/背景.svg',
25
+ content: BackgroundPanel
26
+ }, {
27
+ title: '画布',
28
+ key: '5',
29
+ icon: '/img/topo/editor/sidebar/icon/画布.svg',
30
+ content: CanvasPanel
31
+ }];
32
+ export default panes;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- export default function ImagePanel(props) {
2
+ export default function CanvasPanel(props) {
3
3
  return /*#__PURE__*/React.createElement("div", null, "ImagePanel");
4
4
  }
@@ -1,2 +1,2 @@
1
- import Panel from "./ImagePanel";
1
+ import Panel from "./CanvasPanel";
2
2
  export default Panel;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
- import { getUserCustomIconsForHt } from "../../../../../common/icons/icon";
3
+ import styles from "./HtImagePalette.module.scss";
4
4
  /**
5
5
  * 组件面板
6
6
  * @param {*} props
@@ -37,9 +37,6 @@ export default function HtCustomImagePanel(props) {
37
37
  }, []);
38
38
  return /*#__PURE__*/React.createElement("div", {
39
39
  ref: divRef,
40
- style: {
41
- width: '100%' // height: '100%',
42
-
43
- }
40
+ className: styles.container
44
41
  });
45
42
  }
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import rlog from '@riil-frontend/component-topology-utils/es/rlog';
3
+ import styles from "./HtImagePalette.module.scss";
3
4
  /**
4
5
  * 组件面板
5
6
  * @param {*} props
@@ -36,9 +37,6 @@ export default function HtImagePalette(props) {
36
37
  }, []);
37
38
  return /*#__PURE__*/React.createElement("div", {
38
39
  ref: divRef,
39
- style: {
40
- width: '100%' // height: '100%',
41
-
42
- }
40
+ className: styles.container
43
41
  });
44
42
  }
@@ -0,0 +1,5 @@
1
+ .container {
2
+ width: '100%';
3
+ max-height: 400px;
4
+ overflow: auto;
5
+ }
@@ -1,24 +1,27 @@
1
1
  import _Button from "@alifd/next/es/button";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import classNames from 'classnames';
3
4
  import React, { useState } from 'react';
4
5
  import buttons from "./buttons";
5
6
  import Toolbar from "./Toolbar";
6
7
  import styles from "./Toolbar.module.scss";
7
8
 
8
9
  function EditorToolbar(props) {
10
+ var _classNames;
11
+
9
12
  var _useState = useState(true),
10
- showLabel = _useState[0],
11
- setShowLabel = _useState[1];
13
+ expanded = _useState[0],
14
+ setExpanded = _useState[1];
12
15
 
13
16
  return /*#__PURE__*/React.createElement("div", {
14
- className: styles.toolbarContainer
17
+ className: classNames(styles.toolbarWrap, (_classNames = {}, _classNames[styles.normal] = expanded, _classNames[styles.expanded] = !expanded, _classNames))
15
18
  }, /*#__PURE__*/React.createElement("div", {
16
19
  className: styles.content
17
20
  }, /*#__PURE__*/React.createElement(Toolbar, null, buttons.map(function (ToolbarButton, index) {
18
21
  return /*#__PURE__*/React.createElement(ToolbarButton, _extends({
19
22
  key: index
20
23
  }, props, {
21
- showLabel: showLabel
24
+ showLabel: expanded
22
25
  }));
23
26
  }))), /*#__PURE__*/React.createElement("div", {
24
27
  className: styles.right
@@ -26,10 +29,10 @@ function EditorToolbar(props) {
26
29
  type: "normal",
27
30
  text: true,
28
31
  onClick: function onClick() {
29
- setShowLabel(!showLabel);
32
+ setExpanded(!expanded);
30
33
  }
31
34
  }, /*#__PURE__*/React.createElement("img", {
32
- src: showLabel ? '/img/topo/editor/toolbar/ToolbarNarrowed/Normal.svg' : '/img/topo/editor/toolbar/ToolbbbarExpand/Normal.svg',
35
+ src: expanded ? '/img/topo/editor/toolbar/ToolbarNarrowed/Normal.svg' : '/img/topo/editor/toolbar/ToolbbbarExpand/Normal.svg',
33
36
  alt: "",
34
37
  style: {
35
38
  verticalAlign: 'middle'
@@ -3,7 +3,7 @@ import styles from "./Toolbar.module.scss";
3
3
 
4
4
  function Toolbar(props) {
5
5
  return /*#__PURE__*/React.createElement("div", {
6
- className: styles.widgets
6
+ className: styles.toolbarContainer
7
7
  }, props.children);
8
8
  }
9
9
 
@@ -1,19 +1,30 @@
1
- .toolbarContainer {
2
- height: 54px;
1
+ .toolbarWrap {
3
2
  display: flex;
4
3
  align-items: center;
5
4
  justify-content: center;
5
+ transition: all .1s linear;
6
+
7
+ &.normal {
8
+ height: 54px;
9
+ }
10
+
11
+ &.expanded {
12
+ height: 40px;
13
+ }
6
14
  }
7
15
 
8
16
  .content {
17
+ height: 100%;
9
18
  flex: 1;
10
19
  display: flex;
11
20
  align-items: center;
12
21
  justify-content: center;
22
+ overflow-x: auto;
13
23
  }
14
24
 
15
- .widgets {
25
+ .toolbarContainer {
16
26
  display: flex;
27
+ min-width: 1060px;
17
28
  }
18
29
 
19
30
  .right {
@@ -27,16 +27,16 @@ function AddResourceButton(props) {
27
27
 
28
28
  var _useState = useState(getAddType(selection)),
29
29
  addType = _useState[0],
30
- setAddType = _useState[1]; // 选中分层添加
30
+ setAddType = _useState[1];
31
31
 
32
+ useEffect(function () {
33
+ setAddType(getAddType(selection));
34
+ }, [selection]); // 选中分层添加
32
35
 
33
36
  var layerAddResource = useLayerAddResource({
34
37
  topo: topo,
35
38
  topoEdit: topoEdit
36
39
  });
37
- useEffect(function () {
38
- setAddType(getAddType(selection));
39
- }, [selection]);
40
40
 
41
41
  var handleClick = function handleClick() {
42
42
  if (!addType) {
@@ -48,7 +48,8 @@ function AddResourceButton(props) {
48
48
  } else if (addType === 'group') {
49
49
  // 选中区域添加资源
50
50
  var group = selection[0];
51
- topoEdit.groupAddResource.open(group);
51
+ var htGroup = topo.getHtTopo().getGraphView().getDataModel().getDataById(group.id);
52
+ topoEdit.groupAddResource.open(htGroup);
52
53
  }
53
54
  };
54
55
 
@@ -3,12 +3,23 @@ import WidgetBox from "./WidgetBox";
3
3
  import ButtonBox from "./components/ButtonBox";
4
4
 
5
5
  function CanvasMoveWidget(props) {
6
- var showLabel = props.showLabel;
6
+ var topo = props.topo,
7
+ showLabel = props.showLabel,
8
+ topoEdit = props.topoEdit;
9
+
10
+ var _topo$store$useModelS = topo.store.useModelState('topoEdit'),
11
+ viewMouseMode = _topo$store$useModelS.viewMouseMode;
12
+
7
13
  return /*#__PURE__*/React.createElement(WidgetBox, {
8
14
  label: "\u79FB\u52A8",
9
15
  tooltip: "\u79FB\u52A8",
10
16
  showLabel: showLabel
11
- }, /*#__PURE__*/React.createElement(ButtonBox, null, /*#__PURE__*/React.createElement("img", {
17
+ }, /*#__PURE__*/React.createElement(ButtonBox, {
18
+ active: viewMouseMode === 'move',
19
+ onClick: function onClick() {
20
+ topoEdit.setViewMouseMode('move');
21
+ }
22
+ }, /*#__PURE__*/React.createElement("img", {
12
23
  src: "/img/topo/editor/toolbar/drag/Normal.svg",
13
24
  alt: ""
14
25
  })));
@@ -3,13 +3,22 @@ import WidgetBox from "./WidgetBox";
3
3
  import ButtonBox from "./components/ButtonBox";
4
4
 
5
5
  function CanvasSelectWidget(props) {
6
- var showLabel = props.showLabel;
6
+ var topo = props.topo,
7
+ showLabel = props.showLabel,
8
+ topoEdit = props.topoEdit;
9
+
10
+ var _topo$store$useModelS = topo.store.useModelState('topoEdit'),
11
+ viewMouseMode = _topo$store$useModelS.viewMouseMode;
12
+
7
13
  return /*#__PURE__*/React.createElement(WidgetBox, {
8
14
  label: "\u9009\u62E9",
9
15
  tooltip: "\u9009\u62E9",
10
16
  showLabel: showLabel
11
17
  }, /*#__PURE__*/React.createElement(ButtonBox, {
12
- active: true
18
+ active: viewMouseMode === 'select',
19
+ onClick: function onClick() {
20
+ topoEdit.setViewMouseMode('select');
21
+ }
13
22
  }, /*#__PURE__*/React.createElement("img", {
14
23
  src: "/img/topo/editor/toolbar/select/Normal.svg",
15
24
  alt: ""
@@ -1,8 +1,138 @@
1
- import React from 'react';
1
+ import _Field from "@alifd/next/es/field";
2
+ import _Select from "@alifd/next/es/select";
3
+ import _Form from "@alifd/next/es/form";
4
+ import React, { useState } from 'react';
5
+ import styles from "./EdgeType.module.scss";
6
+ import LineType from "./LineType";
7
+ var FormItem = _Form.Item;
8
+ var Option = _Select.Option;
9
+ var START_END_TYPE_OPTIONS = [{
10
+ value: 'nil',
11
+ label: '无',
12
+ icon: 'topo_startEndPoint_icon_nothing'
13
+ }, {
14
+ value: 'hollowCrcial',
15
+ label: '空心圆',
16
+ icon: 'topo_startEndPoint_icon_hollow_cricle'
17
+ }, {
18
+ value: 'solidCricle',
19
+ label: '实心圆',
20
+ icon: 'topo_startEndPoint_icon_solid_cricle'
21
+ }, {
22
+ value: 'arrowPoint',
23
+ label: '箭头',
24
+ icon: 'topo_startEndPoint_icon_arrow'
25
+ }];
26
+ var LINE_MOLD_OPTIONS = [{
27
+ value: 'solidLine',
28
+ label: '实线',
29
+ icon: 'topo_lineMold_solid'
30
+ }, {
31
+ value: 'dottedLine',
32
+ label: '虚线',
33
+ icon: 'topo_lineMold_dotted'
34
+ }, {
35
+ value: 'dottedLine1',
36
+ label: '虚线1',
37
+ icon: 'topo_lineMold_dotted_one'
38
+ }, {
39
+ value: 'dottedLine2',
40
+ label: '虚线2',
41
+ icon: 'topo_lineMold_dotted_two'
42
+ }];
2
43
 
3
44
  function EdgeType(props) {
4
- // const { } = props
5
- return /*#__PURE__*/React.createElement("div", null, "\u7EBF\u5F62\u8BBE\u7F6E");
45
+ var _onChange = props.onChange;
46
+
47
+ var field = _Field.useField({
48
+ autoUnmount: false,
49
+ values: {
50
+ startPoint: 'nil',
51
+ endPoint: 'nil',
52
+ type: null
53
+ },
54
+ onChange: function onChange(name, value) {
55
+ if (['startPoint', 'endPoint'].includes(name) && value === 'nil') {
56
+ _onChange(name, null);
57
+ } else {
58
+ _onChange(name, value);
59
+ }
60
+ }
61
+ });
62
+
63
+ return /*#__PURE__*/React.createElement("div", {
64
+ className: styles.lineBox
65
+ }, /*#__PURE__*/React.createElement(_Form, {
66
+ field: field,
67
+ inline: true,
68
+ labelAlign: "top"
69
+ }, /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement(LineType, {
70
+ name: "lineButton"
71
+ })), /*#__PURE__*/React.createElement(FormItem, {
72
+ label: "\u8D77\u70B9"
73
+ }, /*#__PURE__*/React.createElement(_Select, {
74
+ name: "startPoint",
75
+ popupProps: {
76
+ container: function container(trigger) {
77
+ return trigger.parentNode;
78
+ }
79
+ }
80
+ }, START_END_TYPE_OPTIONS.map(function (item, index, array) {
81
+ return /*#__PURE__*/React.createElement(Option, {
82
+ value: item.value,
83
+ key: index,
84
+ title: item.label,
85
+ onchange: _onChange
86
+ }, /*#__PURE__*/React.createElement("img", {
87
+ src: "/img/topo/editor/lineType/" + item.icon + ".svg",
88
+ alt: "",
89
+ className: styles.iconImg
90
+ }));
91
+ }))), /*#__PURE__*/React.createElement(FormItem, {
92
+ label: "\u7EC8\u70B9"
93
+ }, /*#__PURE__*/React.createElement(_Select, {
94
+ name: "endPoint",
95
+ popupProps: {
96
+ container: function container(trigger) {
97
+ return trigger.parentNode;
98
+ }
99
+ }
100
+ }, START_END_TYPE_OPTIONS.map(function (item, index, array) {
101
+ return /*#__PURE__*/React.createElement(Option, {
102
+ value: item.value,
103
+ key: index,
104
+ title: item.label,
105
+ onchange: _onChange
106
+ }, /*#__PURE__*/React.createElement("img", {
107
+ src: "/img/topo/editor/lineType/" + item.icon + ".svg",
108
+ alt: "",
109
+ className: styles.iconImg
110
+ }));
111
+ }))), /*#__PURE__*/React.createElement(FormItem, {
112
+ label: "\u7C7B\u578B"
113
+ }, /*#__PURE__*/React.createElement(_Select, {
114
+ name: "type",
115
+ popupProps: {
116
+ container: function container(trigger) {
117
+ return trigger.parentNode;
118
+ }
119
+ },
120
+ placeholder: ""
121
+ }, LINE_MOLD_OPTIONS.map(function (item, index, array) {
122
+ return /*#__PURE__*/React.createElement(Option, {
123
+ value: item.value,
124
+ key: index,
125
+ title: item.label,
126
+ onchange: _onChange
127
+ }, /*#__PURE__*/React.createElement("img", {
128
+ src: "/img/topo/editor/lineType/" + item.icon + ".svg",
129
+ alt: "",
130
+ className: styles.iconImg
131
+ }));
132
+ })))));
6
133
  }
7
134
 
135
+ EdgeType.defaultProps = {
136
+ onChange: function onChange(v) {}
137
+ };
8
138
  export default EdgeType;
@@ -0,0 +1,46 @@
1
+ @import '~@alifd/next/variables.scss';
2
+
3
+ .lineBox{
4
+ width: 236px;
5
+ background: #FFFFFF;
6
+ border-radius: 4px;
7
+ margin-bottom: -7px;
8
+
9
+ :global {
10
+ .#{$css-prefix}form-item:first-child{
11
+ margin-top: 0;
12
+ margin-bottom: 0;
13
+ }
14
+ .#{$css-prefix}form-item {
15
+ margin-top: 7px;
16
+ margin-bottom: 7px;
17
+ }
18
+ .#{$css-prefix}form.#{$css-prefix}inline .#{$css-prefix}form-item:not(:last-child) {
19
+ margin-right: 8px;
20
+ .#{$css-prefix}select-trigger {
21
+ min-width: 0;
22
+ width: 64px;
23
+ height: 28px;
24
+ .#{$css-prefix}select-inner {
25
+ min-width:0 !important;
26
+ }
27
+ }
28
+ }
29
+ .#{$css-prefix}form.#{$css-prefix}inline .#{$css-prefix}form-item:last-child{
30
+ .#{$css-prefix}select-trigger {
31
+ min-width: 0;
32
+ width: 88px;
33
+ height: 28px;
34
+ .#{$css-prefix}select-inner {
35
+ min-width:0 !important;
36
+ }
37
+ }
38
+ }
39
+ .#{$css-prefix}input.#{$css-prefix}medium .#{$css-prefix}input-text-field {
40
+ line-height: calc(28px - 10px * 2);
41
+ }
42
+ .#{$css-prefix}select-trigger-search {
43
+ height: 12px;
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ import _Button from "@alifd/next/es/button";
2
+ import React, { useState } from 'react';
3
+ import styles from "./LineType.module.scss";
4
+ var LINE_TYPE_OPTIONS = [{
5
+ value: 'boundary',
6
+ label: '直线',
7
+ icon: 'topo_linear_icon_straightline'
8
+ }, {
9
+ value: 'oposite',
10
+ label: '内向双向箭头',
11
+ icon: 'topo_linear_icon_narrow_straightline'
12
+ }, {
13
+ value: 'h.v',
14
+ label: '纵向折线',
15
+ icon: 'topo_linear_icon_vertical_foldline'
16
+ }, {
17
+ value: 'ortho',
18
+ label: '双折线',
19
+ icon: 'topo_linear_icon_bilinear'
20
+ }, {
21
+ value: 'flex',
22
+ label: '双弧线',
23
+ icon: 'topo_linear_icon_arcline'
24
+ }];
25
+
26
+ function LineType(props) {
27
+ var onChange = props.onChange;
28
+ return /*#__PURE__*/React.createElement("div", {
29
+ className: styles.lineType
30
+ }, LINE_TYPE_OPTIONS.map(function (item, index, array) {
31
+ return /*#__PURE__*/React.createElement(_Button, {
32
+ key: index,
33
+ title: item.label,
34
+ className: "" + styles.redioBtn,
35
+ onClick: function onClick() {
36
+ onChange(item.value);
37
+ }
38
+ }, /*#__PURE__*/React.createElement("img", {
39
+ src: "/img/topo/editor/lineType/" + item.icon + ".svg",
40
+ alt: "",
41
+ className: styles.iconImg
42
+ }));
43
+ }));
44
+ }
45
+
46
+ export default LineType;
@@ -0,0 +1,31 @@
1
+ .lineType{
2
+ display:flex;
3
+ .redioBtn {
4
+ width: 24px;
5
+ height: 24px;
6
+ border-radius: 4px;
7
+ border: none !important;
8
+ color: #4D6277;
9
+ padding: 0;
10
+ margin-right: 16px;
11
+ text-align: center;
12
+
13
+ .iconImg {
14
+ vertical-align: middle;
15
+ }
16
+
17
+ &:active {
18
+ background: #F2F7FD !important;
19
+ }
20
+
21
+ &:hover {
22
+ background: #F2F7FD !important;
23
+ }
24
+ }
25
+ .redioBtn:last-child{
26
+ margin-right: 0;
27
+ }
28
+ }
29
+ .iconImg {
30
+ vertical-align: middle;
31
+ }