@riil-frontend/component-topology 6.0.0-alpha.30 → 6.0.0-alpha.31

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 (55) 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 +20 -20
  5. package/es/core/editor/components/EditorPlugin.js +2 -1
  6. package/es/core/editor/components/Sidebar/Sidebar.js +2 -1
  7. package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +2 -3
  8. package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +1 -0
  9. package/es/core/editor/components/Toolbar/buttons.js +5 -4
  10. package/es/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +23 -6
  11. package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +29 -9
  12. package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +15 -0
  13. package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +4 -0
  14. package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +82 -33
  15. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +20 -25
  16. package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +22 -6
  17. package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +12 -9
  18. package/es/core/editor/components/Toolbar/widgets/components/DropdownButton.js +19 -6
  19. package/es/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +8 -5
  20. package/es/core/editor/components/settings/CloseablePanel.js +7 -2
  21. package/es/core/editor/components/settings/CloseablePanel.module.scss +9 -0
  22. package/es/core/editor/components/settings/PropertyView.js +2 -6
  23. package/es/core/editor/components/settings/common/AlignSetting/index.js +1 -2
  24. package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
  25. package/es/core/editor/utils/textStyleUtil.js +0 -0
  26. package/es/core/hooks/usePolling.js +2 -5
  27. package/es/core/models/AttributeMetricDisplay.js +4 -0
  28. package/es/core/models/TopoApp.js +1 -1
  29. package/es/utils/htElementUtils.js +3 -0
  30. package/lib/core/editor/components/EditorPlugin.js +3 -1
  31. package/lib/core/editor/components/Sidebar/Sidebar.js +2 -1
  32. package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +2 -3
  33. package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +1 -0
  34. package/lib/core/editor/components/Toolbar/buttons.js +5 -4
  35. package/lib/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +20 -6
  36. package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +29 -8
  37. package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +15 -0
  38. package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +5 -0
  39. package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +88 -33
  40. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +20 -25
  41. package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +22 -6
  42. package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +11 -9
  43. package/lib/core/editor/components/Toolbar/widgets/components/DropdownButton.js +18 -6
  44. package/lib/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +10 -5
  45. package/lib/core/editor/components/settings/CloseablePanel.js +8 -2
  46. package/lib/core/editor/components/settings/CloseablePanel.module.scss +9 -0
  47. package/lib/core/editor/components/settings/PropertyView.js +3 -7
  48. package/lib/core/editor/components/settings/common/AlignSetting/index.js +1 -2
  49. package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
  50. package/lib/core/editor/utils/textStyleUtil.js +1 -0
  51. package/lib/core/hooks/usePolling.js +2 -5
  52. package/lib/core/models/AttributeMetricDisplay.js +4 -0
  53. package/lib/core/models/TopoApp.js +1 -1
  54. package/lib/utils/htElementUtils.js +5 -0
  55. package/package.json +2 -2
@@ -4,13 +4,14 @@ import CustomIconPlugin from "./CustomIconPlugin";
4
4
  import SaveLoading from "./plugins/SaveLoading";
5
5
  import MultipleResourceSelectPlugin from "./plugins/MultipleResourceSelectPlugin";
6
6
  import GroupAddResourceDrawerPlugin from "./GroupAddResourceDrawerPlugin";
7
+ import MetricPollingPlugin from "../../viewer/components/plugins/MetricPollingPlugin";
7
8
  export default function TopoEditorPlugin(props) {
8
9
  var topo = props.topo,
9
10
  topoContext = props.topoContext,
10
11
  topoEdit = props.topoEdit,
11
12
  editorProps = props.editorProps;
12
13
  var store = topo.store;
13
- var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, CustomIconPlugin].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
14
+ var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, CustomIconPlugin, MetricPollingPlugin].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
14
15
  return /*#__PURE__*/React.createElement(React.Fragment, null, plugins.map(function (Plugin, index) {
15
16
  return /*#__PURE__*/React.createElement(Plugin, _extends({
16
17
  key: index,
@@ -26,7 +26,8 @@ function Sidebar(props) {
26
26
  resourceTabActiveKey: null
27
27
  });
28
28
  };
29
- }, []);
29
+ }, []); // 通过url参数打开对应面板
30
+
30
31
  useEffect(function () {
31
32
  var _topo$viewProps$urlPa;
32
33
 
@@ -45,7 +45,7 @@ export default function CanvasPanel(props) {
45
45
  topo.historyManager.beginTransaction();
46
46
  displayConfigDispatchers.update({
47
47
  canvasTheme: theme
48
- }); // 设置资源标注
48
+ }); // 设置资源/链路标注样式
49
49
 
50
50
  var _topo$store$getModelS = topo.store.getModelState('displayConfig'),
51
51
  nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle,
@@ -65,8 +65,7 @@ export default function CanvasPanel(props) {
65
65
  displayConfigDispatchers.update({
66
66
  nodeLabelStyle: globalNodeLabelStyle,
67
67
  defaultEdgeLabelStyle: globalEdgeTagStyle
68
- }); // 设置链路标注
69
-
68
+ });
70
69
  topo.historyManager.endTransaction();
71
70
  };
72
71
 
@@ -23,6 +23,7 @@ export default function HtImagePalette(props) {
23
23
  viewRef.current = htTopo.createImagePalette(container, {
24
24
  icons: icons
25
25
  });
26
+ console.error(viewRef.current);
26
27
  } catch (error) {
27
28
  rlog.error('初始化资源面板失败', error);
28
29
  } // 注销组件
@@ -26,13 +26,14 @@ export default function getButtons(isNetworkTopo) {
26
26
  FontSizeWidget, // 字号
27
27
  FontStyleButton, // 文字样式
28
28
  FontColorButton, // 文字颜色
29
- Divider, BoxBackgroundButton, // 框背景
30
- Divider, EdgeColorButton, // 线条颜色
29
+ Divider, // BoxBackgroundButton, // 框背景
30
+ // Divider,
31
+ EdgeColorButton, // 线条颜色
31
32
  EdgeTypeButton, // 线形
32
33
  Divider, NodeImageButton, // 替换图片
33
34
  NodeSizeButton, // 图片尺寸
34
35
  Divider, Layout, // 布局方式
35
- NodeAlignWidget, // 对齐方式
36
- SearchWidget // 搜索
36
+ NodeAlignWidget // 对齐方式
37
+ // SearchWidget, // 搜索
37
38
  ]);
38
39
  }
@@ -9,21 +9,38 @@ function useFontStyleSetting(props) {
9
9
  var buttonEnabled = true; // 全局配置
10
10
 
11
11
  var _topo$store$useModel = topo.store.useModel('displayConfig'),
12
- nodeLabelStyle = _topo$store$useModel[0].nodeLabelStyle,
12
+ displayConfigState = _topo$store$useModel[0],
13
13
  displayConfigDispatchers = _topo$store$useModel[1];
14
14
 
15
+ var nodeLabelStyle = displayConfigState.nodeLabelStyle,
16
+ defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
17
+
18
+ var setGlobalTagStyle = function setGlobalTagStyle(styleData) {
19
+ var globalNodeLabelStyle = _extends({}, nodeLabelStyle, styleData);
20
+
21
+ topo.getHtTopo().setGlobalNodeLabelStyle(globalNodeLabelStyle);
22
+
23
+ var globalEdgeTagStyle = _extends({}, defaultEdgeLabelStyle, styleData);
24
+
25
+ topo.getHtTopo().setGlobalEdgeTagStyle(globalEdgeTagStyle);
26
+ displayConfigDispatchers.update({
27
+ nodeLabelStyle: globalNodeLabelStyle,
28
+ defaultEdgeLabelStyle: globalEdgeTagStyle
29
+ });
30
+ };
31
+
15
32
  var setStyle = function setStyle(styleData) {
16
- // 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
33
+ topo.historyManager.beginTransaction(); // 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
34
+
17
35
  if (!selectionElements.length) {
18
- topo.getHtTopo().setGlobalNodeLabelStyle(styleData);
19
- displayConfigDispatchers.update({
20
- nodeLabelStyle: _extends({}, nodeLabelStyle, styleData)
21
- });
36
+ setGlobalTagStyle(styleData);
22
37
  } else {
23
38
  selectionElements.forEach(function (element) {
24
39
  if (isNode(element)) {} else if (isGroup(element)) {} else if (isText(element)) {} else if (isLayer(element)) {}
25
40
  });
26
41
  }
42
+
43
+ topo.historyManager.endTransaction();
27
44
  };
28
45
 
29
46
  return {
@@ -1,7 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
3
  var _excluded = ["topo", "showLabel"];
3
4
  import React, { useEffect, useState } from 'react';
4
- import { getEdgesBySelection, setEdgesAndChildren, loopEdgesAndChildren } from "../../../../utils/edgeTypeStyleUtil";
5
+ import { getEdgesBySelection } from "../../../../utils/edgeTypeStyleUtil";
5
6
  import DropdownButton from "../components/DropdownButton";
6
7
  import WidgetBox from "../WidgetBox";
7
8
  import Content from "./Content";
@@ -31,10 +32,16 @@ function EdgeColorButton(props) {
31
32
 
32
33
  var selection = topo.selectionManager.useHtSelection();
33
34
 
35
+ var loopEdges = function loopEdges(edges, operateEdgeFn) {
36
+ edges.forEach(function (edge) {
37
+ operateEdgeFn(edge);
38
+ });
39
+ };
40
+
34
41
  var getLines = function getLines(list) {
35
42
  // eslint-disable-next-line prefer-const
36
43
  var arr = [];
37
- loopEdgesAndChildren(topo, list, function (edge) {
44
+ loopEdges(list, function (edge) {
38
45
  // eslint-disable-next-line eqeqeq
39
46
  if (edge.getAttrObject().type == 'line') {
40
47
  arr.push(edge);
@@ -49,7 +56,7 @@ function EdgeColorButton(props) {
49
56
  var list = getLines(edges);
50
57
  setLineWidth(0); // eslint-disable-next-line eqeqeq
51
58
 
52
- if (selection.length == 1 && selection[0].getAttrObject().type == 'line') {
59
+ if (selection.length == 1 && selection[0].a('type') == 'line') {
53
60
  setLineWidth(list[0] && (list[0].a('styles') && list[0].a('styles').width || list[0].getStyleMap()['edge.width']) || 2);
54
61
  }
55
62
 
@@ -57,14 +64,20 @@ function EdgeColorButton(props) {
57
64
  }
58
65
  }, [selection, graphLoaded]);
59
66
 
60
- var colorOnChange = function colorOnChange(color, type) {
67
+ var colorOnChange = function colorOnChange(colors, type) {
61
68
  // eslint-disable-next-line eqeqeq
62
69
  if (type == 'select') topo.historyManager.beginTransaction();
63
70
  var edges = getEdgesBySelection(topo);
64
- loopEdgesAndChildren(topo, edges, function (edge) {
71
+ loopEdges(edges, function (edge) {
65
72
  // eslint-disable-next-line eqeqeq
66
73
  if (edge.getAttrObject().type == 'line') {
67
- edge.s('edge.color', color.hex);
74
+ var color = colors.hex;
75
+ edge.s('edge.color', color);
76
+ edge.s('edge.dash.color', color);
77
+ var style = edge.a('styles') || {};
78
+ edge.a('styles', _extends({}, style, {
79
+ color: color
80
+ }));
68
81
  }
69
82
  }); // eslint-disable-next-line eqeqeq
70
83
 
@@ -80,14 +93,21 @@ function EdgeColorButton(props) {
80
93
  topo.historyManager.endTransaction();
81
94
  };
82
95
 
83
- var lineSizeChange = function lineSizeChange(value) {
96
+ var lineSizeChange = function lineSizeChange(width) {
84
97
  var edges = getEdgesBySelection(topo);
85
- setEdgesAndChildren(topo, edges, function (edge) {
98
+ topo.historyManager.beginTransaction();
99
+ loopEdges(edges, function (edge) {
86
100
  // eslint-disable-next-line eqeqeq
87
101
  if (edge.getAttrObject().type == 'line') {
88
- edge.s('edge.width', value); // 设置
102
+ edge.s('edge.dash.width', width);
103
+ edge.s('edge.width', width);
104
+ var style = edge.a('styles') || {};
105
+ edge.a('styles', _extends({}, style, {
106
+ width: width
107
+ }));
89
108
  }
90
109
  });
110
+ topo.historyManager.endTransaction();
91
111
  };
92
112
 
93
113
  var icon = disabled ? /*#__PURE__*/React.createElement("img", {
@@ -67,8 +67,23 @@ function EdgeTypeButton(props) {
67
67
  edge.s('icons', _extends({}, edge.s('icons')));
68
68
  edge.addStyleIcon(value, EDGE_END_POINT_TYPE_MAP[value]);
69
69
  } else if (name === 'lineMold') {
70
+ // 修改实线虚线
70
71
  edge.a('lineMode', value);
71
72
  htTopo.setElementStyle(edge, LINE_MOLD_MAP[value]);
73
+
74
+ if (value !== 'solid') {
75
+ var edgeWidth = edge.s('edge.width');
76
+
77
+ if (edgeWidth) {
78
+ edge.s('edge.dash.width', edgeWidth);
79
+ }
80
+
81
+ var color = edge.s('edge.color');
82
+
83
+ if (edgeWidth) {
84
+ edge.s('edge.dash.color', color);
85
+ }
86
+ }
72
87
  }
73
88
  });
74
89
  };
@@ -5,6 +5,7 @@ import WidgetBox from "./WidgetBox";
5
5
  import ColorPanel from "../../../../../components/ColorPanel";
6
6
  import FontColorRange from "../../../../../components/ColorPanel/components/FontColorRange";
7
7
  import styles from "./FontColorButton.module.scss";
8
+ import useFontStyleSetting from "../hooks/useFontStyleSetting";
8
9
 
9
10
  function FontFamilySelect(props) {
10
11
  var value = props.value,
@@ -15,6 +16,9 @@ function FontFamilySelect(props) {
15
16
  disabled = _useState[0],
16
17
  setDisabled = _useState[1];
17
18
 
19
+ var fontStyleSetting = useFontStyleSetting({
20
+ topo: topo
21
+ });
18
22
  console.log(topo, 'topo这里需要处理颜色改变的事情');
19
23
 
20
24
  var backOpacityChange = function backOpacityChange(value) {
@@ -1,41 +1,38 @@
1
1
  import React, { useState, useEffect } from 'react';
2
+ import { isText } from "../../../../../utils/htElementUtils";
3
+ import fontStyleUtil from "../../settings/common/text/fontStyleUtil";
4
+ import useFontStyleSetting from "../hooks/useFontStyleSetting";
2
5
  import DropdownMenu from "./components/DropdownMenu";
3
6
  import WidgetBox from "./WidgetBox";
7
+ var items = [{
8
+ key: 'bold',
9
+ label: '加粗',
10
+ icon: 'bold'
11
+ }, {
12
+ key: 'italic',
13
+ label: '斜体',
14
+ icon: 'Italics'
15
+ }, {
16
+ key: 'underline',
17
+ label: '下划线',
18
+ icon: 'Underline'
19
+ }];
4
20
 
5
- function FontFamilySelect(props) {
6
- var value = props.value,
7
- disabled = props.disabled,
8
- onChange = props.onChange;
9
- var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
10
- var icon = disabled ? /*#__PURE__*/React.createElement("img", {
11
- src: "/img/topo/editor/toolbar/bold/Disable.svg",
12
- alt: ""
13
- }) : /*#__PURE__*/React.createElement("img", {
14
- src: "/img/topo/editor/toolbar/bold/Normal.svg",
15
- alt: ""
16
- });
17
- return /*#__PURE__*/React.createElement(DropdownMenu, {
18
- value: value,
19
- valueRender: function valueRender() {
20
- return icon;
21
- },
22
- onChange: onChange
23
- }, items.map(function (item) {
24
- return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
25
- key: item
26
- }, /*#__PURE__*/React.createElement("div", {
27
- style: {
28
- fontFamily: item
29
- }
30
- }, item));
31
- }));
21
+ function getTextFontStyle(textElement) {
22
+ var underline = textElement.s('text.decoration') === 'underline';
23
+ var fontStyle = fontStyleUtil.toMap(textElement.s('text.font'));
24
+ return {
25
+ underline: underline,
26
+ bold: fontStyle.bold,
27
+ italic: fontStyle.italic
28
+ };
32
29
  }
33
30
 
34
31
  function FontStyleButton(props) {
35
32
  var topo = props.topo,
36
33
  showLabel = props.showLabel;
37
34
 
38
- var _useState = useState('微软雅黑'),
35
+ var _useState = useState(['bold']),
39
36
  value = _useState[0],
40
37
  setValue = _useState[1];
41
38
 
@@ -44,19 +41,71 @@ function FontStyleButton(props) {
44
41
  setDisabled = _useState2[1]; // 选中的元素
45
42
 
46
43
 
47
- var selection = topo.selectionManager.useSelection();
44
+ var selection = topo.selectionManager.useHtSelection();
45
+ var fontStyleSetting = useFontStyleSetting({
46
+ topo: topo
47
+ });
48
48
  useEffect(function () {
49
49
  setDisabled(false);
50
+ var fontObj = {};
51
+
52
+ if (selection.length === 1) {
53
+ var element = selection[0];
54
+
55
+ if (isText(element)) {
56
+ fontObj = getTextFontStyle(element);
57
+ }
58
+ }
59
+
60
+ var newValue = Object.keys(fontObj).reduce(function (result, key) {
61
+ if (fontObj[key]) {
62
+ return [].concat(result, [key]);
63
+ }
64
+
65
+ return result;
66
+ }, []);
67
+ setValue(newValue);
50
68
  }, [selection]);
69
+ /**
70
+ *
71
+ * @param {Array} selectedKeys
72
+ */
73
+
74
+ var handleChange = function handleChange(selectedKeys) {
75
+ setValue(selectedKeys);
76
+ var style = {
77
+ fontBold: selectedKeys.includes('bold')
78
+ };
79
+ fontStyleSetting.setStyle(style);
80
+ };
81
+
51
82
  return /*#__PURE__*/React.createElement(WidgetBox, {
52
83
  label: "\u6587\u5B57\u6837\u5F0F",
53
84
  tooltip: "\u6587\u5B57\u6837\u5F0F",
54
85
  showLabel: showLabel
55
- }, /*#__PURE__*/React.createElement(FontFamilySelect, {
86
+ }, /*#__PURE__*/React.createElement(DropdownMenu, {
56
87
  value: value,
57
- disabled: disabled,
58
- onChange: setValue
59
- }));
88
+ valueRender: function valueRender() {
89
+ return /*#__PURE__*/React.createElement("img", {
90
+ src: "/img/topo/editor/toolbar/bold/" + (disabled ? 'Disable' : 'Normal') + ".svg",
91
+ alt: ""
92
+ });
93
+ },
94
+ multiple: true,
95
+ onChange: handleChange
96
+ }, items.map(function (item) {
97
+ return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
98
+ key: item.key
99
+ }, /*#__PURE__*/React.createElement("div", {
100
+ style: {
101
+ display: 'flex',
102
+ alignItems: 'center'
103
+ }
104
+ }, /*#__PURE__*/React.createElement("img", {
105
+ src: "/img/topo/editor/toolbar/" + item.icon + "/Normal.svg",
106
+ alt: ""
107
+ }), /*#__PURE__*/React.createElement("span", null, item.label)));
108
+ })));
60
109
  }
61
110
 
62
111
  export default FontStyleButton;
@@ -1,4 +1,4 @@
1
- import _Input from "@alifd/next/es/input";
1
+ import _NumberPicker from "@alifd/next/es/number-picker";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["topo", "showLabel"];
4
4
  import React, { useState, useEffect } from 'react';
@@ -51,27 +51,13 @@ function NodeAlignWidget(props) {
51
51
  };
52
52
 
53
53
  var leftInputChange = function leftInputChange(v) {
54
- if (v * 1 < 0) {
55
- setLeftInputVal(0);
56
- } else if (v * 1 > 10000) {
57
- setLeftInputVal(10000);
58
- } else {
59
- setLeftInputVal(v);
60
- }
61
-
62
- setSpace('v', leftInputVal);
54
+ setLeftInputVal(v);
55
+ setSpace('h', v);
63
56
  };
64
57
 
65
58
  var rightInputChange = function rightInputChange(v) {
66
- if (v * 1 < 0) {
67
- setRightInputVal(0);
68
- } else if (v * 1 > 10000) {
69
- setRightInputVal(10000);
70
- } else {
71
- setRightInputVal(v);
72
- }
73
-
74
- setSpace('h', rightInputVal);
59
+ setRightInputVal(v);
60
+ setSpace('v', v);
75
61
  };
76
62
 
77
63
  useEffect(function () {
@@ -82,10 +68,17 @@ function NodeAlignWidget(props) {
82
68
  });
83
69
  setDisabled(nodes.length <= 1);
84
70
  getClickType('none');
71
+ setLeftInputVal();
72
+ setRightInputVal();
85
73
  }
86
74
  }, [graphLoaded, selection]);
87
75
 
88
76
  var getClickType = function getClickType(type) {
77
+ if (leftInputVal || rightInputVal) {
78
+ setLeftInputVal();
79
+ setRightInputVal();
80
+ }
81
+
89
82
  setLeftDisable(true);
90
83
  setRightDisable(true);
91
84
 
@@ -116,23 +109,25 @@ function NodeAlignWidget(props) {
116
109
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AlignSetting, {
117
110
  topo: topo,
118
111
  getClickType: getClickType
119
- }), /*#__PURE__*/React.createElement(_Input, {
112
+ }), /*#__PURE__*/React.createElement(_NumberPicker, {
120
113
  disabled: leftDisable,
121
114
  size: "small",
115
+ hasTrigger: false,
122
116
  placeholder: "\u591A\u4E2A\u503C",
123
117
  className: styles.leftInput,
124
118
  value: leftInputVal,
125
- htmlType: "number",
126
- maxLength: 5,
119
+ min: 0,
120
+ max: 10000,
127
121
  onChange: leftInputChange
128
- }), /*#__PURE__*/React.createElement(_Input, {
122
+ }), /*#__PURE__*/React.createElement(_NumberPicker, {
129
123
  disabled: rightDisable,
130
124
  size: "small",
125
+ hasTrigger: false,
131
126
  placeholder: "\u591A\u4E2A\u503C",
132
127
  className: styles.rightInput,
133
128
  value: rightInputVal,
134
- htmlType: "number",
135
- maxLength: 5,
129
+ min: 0,
130
+ max: 10000,
136
131
  onChange: rightInputChange
137
132
  }))));
138
133
  }
@@ -1,12 +1,28 @@
1
1
  .leftInput{
2
- background: url('/img/topo/editor/toolbar/对齐/Disable.svg')no-repeat 5px center;
3
- background-position: right center;
4
- width: 100px;
2
+ width: 100px !important;
5
3
  margin-right: 10px;
6
4
  margin-left: 5px;
5
+ :global{
6
+ input{
7
+ background: url('/img/topo/editor/toolbar/对齐/水平间距_normal.svg')no-repeat 5px center !important;
8
+ background-position: right center !important;
9
+ }
10
+ .next-disabled input{
11
+ background: url('/img/topo/editor/toolbar/对齐/水平间距_disable.svg')no-repeat 5px center !important;
12
+ background-position: right center !important;
13
+ }
14
+ }
7
15
  }
8
16
  .rightInput{
9
- width: 100px;
10
- background: url('/img/topo/editor/toolbar/对齐/Disable.svg')no-repeat 5px center;
11
- background-position: right center;
17
+ width: 100px !important;
18
+ :global{
19
+ input{
20
+ background: url('/img/topo/editor/toolbar/对齐/垂直间距 _normal.svg')no-repeat 5px center !important;
21
+ background-position: right center !important;
22
+ }
23
+ .next-disabled input{
24
+ background: url('/img/topo/editor/toolbar/对齐/垂直间距_disable.svg')no-repeat 5px center !important;
25
+ background-position: right center !important;
26
+ }
27
+ }
12
28
  }
@@ -1,12 +1,11 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
2
  var _excluded = ["topo", "showLabel"];
3
- import React, { useEffect, useState } from "react"; // import BatchSetNodeSize from "../../../settings/propertyViews/view/BatchSetNodeSize";
3
+ import React, { useEffect, useState } from 'react'; // import BatchSetNodeSize from "../../../settings/propertyViews/view/BatchSetNodeSize";
4
4
 
5
5
  import BatchSetNodeSize from "../../../settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize";
6
6
  import NodeSizeInput from "../../../settings/common/NodeSizeInput/NodeSizeInput";
7
7
  import useSettingRuntimeState from "../../../settings/useSettingRuntimeState";
8
8
  import WidgetBox from "../WidgetBox";
9
- import BoxBackgroundSetting from "./BoxBackgroundSetting";
10
9
  import styles from "./NodeSizeButton.module.scss";
11
10
  import { isGroup, isNode } from "../../../../../../utils/htElementUtils";
12
11
  /**
@@ -29,10 +28,15 @@ function NodeSizeButton(props) {
29
28
  setSize = _useState2[1]; // 选中的元素
30
29
 
31
30
 
32
- var selection = topo.selectionManager.useHtSelection();
31
+ var selection = topo.selectionManager.useSelection();
33
32
  var settingRuntimeState = useSettingRuntimeState();
34
33
  useEffect(function () {
35
- var nodes = selection.filter(function (ele) {
34
+ var elements = selection.map(function (item) {
35
+ return item.id;
36
+ }).map(function (id) {
37
+ return topo.getDataModel().getDataById(id);
38
+ });
39
+ var nodes = elements.filter(function (ele) {
36
40
  return isGroup(ele) || isNode(ele);
37
41
  });
38
42
 
@@ -57,12 +61,11 @@ function NodeSizeButton(props) {
57
61
  var _onChange = function onChange(prop) {
58
62
  var name = prop.name,
59
63
  value = prop.value;
60
- var gv = topo.view.topoClient.getGraphView();
61
64
  var element = topo.getSelectionModel().getFirstData();
62
65
 
63
- if (name === "width") {
66
+ if (name === 'width') {
64
67
  element.setWidth(value);
65
- } else if (name === "height") {
68
+ } else if (name === 'height') {
66
69
  element.setHeight(value);
67
70
  }
68
71
  };
@@ -106,12 +109,12 @@ function NodeSizeButton(props) {
106
109
  topo.historyManager.beginTransaction();
107
110
 
108
111
  _onChange({
109
- name: "width",
112
+ name: 'width',
110
113
  value: size.width
111
114
  });
112
115
 
113
116
  _onChange({
114
- name: "height",
117
+ name: 'height',
115
118
  value: size.height
116
119
  });
117
120
 
@@ -14,21 +14,34 @@ function DropdownButton(props) {
14
14
  children = props.children;
15
15
 
16
16
  var _useState = useState(false),
17
- active = _useState[0],
18
- setActive = _useState[1];
17
+ visible = _useState[0],
18
+ setVisible = _useState[1];
19
19
 
20
20
  var button = /*#__PURE__*/React.createElement(ButtonBox, {
21
- active: active,
21
+ active: visible,
22
22
  disabled: disabled,
23
23
  showArrow: showArrow
24
24
  }, trigger);
25
+
26
+ var renderContent = function renderContent() {
27
+ if (!visible) {
28
+ return /*#__PURE__*/React.createElement("div", null);
29
+ }
30
+
31
+ if (showContainer) {
32
+ return /*#__PURE__*/React.createElement(PopupCard, null, children);
33
+ }
34
+
35
+ return children;
36
+ };
37
+
25
38
  return /*#__PURE__*/React.createElement(_Dropdown, {
26
- visible: active,
39
+ visible: visible,
27
40
  disabled: disabled,
28
41
  trigger: button,
29
42
  triggerType: "click",
30
- onVisibleChange: setActive
31
- }, !showContainer ? children : /*#__PURE__*/React.createElement(PopupCard, null, children));
43
+ onVisibleChange: setVisible
44
+ }, renderContent());
32
45
  }
33
46
 
34
47
  DropdownButton.propTypes = {
@@ -6,18 +6,21 @@ import DropdownButton from "./DropdownButton";
6
6
  function DropdownMenu(props) {
7
7
  var value = props.value,
8
8
  children = props.children,
9
+ multiple = props.multiple,
9
10
  onChange = props.onChange,
10
11
  valueRender = props.valueRender;
11
12
  var selectedKeys = Array.isArray(value) ? value : [value];
12
13
  var valueDisplay = valueRender ? valueRender(value) : value;
14
+ var selectMode = multiple ? 'multiple' : 'single';
15
+ var menu = /*#__PURE__*/React.createElement(_Menu, {
16
+ selectMode: selectMode,
17
+ selectedKeys: selectedKeys,
18
+ onSelect: onChange
19
+ }, children);
13
20
  return /*#__PURE__*/React.createElement(DropdownButton, {
14
21
  trigger: valueDisplay,
15
22
  showContainer: false
16
- }, /*#__PURE__*/React.createElement(_Menu, {
17
- selectMode: "single",
18
- selectedKeys: selectedKeys,
19
- onSelect: onChange
20
- }, children));
23
+ }, multiple ? /*#__PURE__*/React.createElement("div", null, menu) : menu);
21
24
  }
22
25
 
23
26
  DropdownButton.propTypes = {