@riil-frontend/component-topology 6.0.0-alpha.44 → 6.0.0-alpha.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +12 -12
- package/es/components/ColorPanel/index.js +8 -4
- package/es/components/VerticalIconTab/VerticalIconTab.module.scss +1 -0
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +33 -25
- package/es/core/editor/components/Toolbar/widgets/Layout/index.js +11 -9
- package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +3 -3
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/colorUtil.js +5 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +2 -1
- package/es/core/editor/components/settings/common/AlignSetting/AlignSetting.module.scss +1 -1
- package/es/core/editor/components/settings/common/NameInput.js +21 -0
- package/es/core/editor/components/settings/propertyViews/box/NameInput.js +5 -4
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupBasicSetting.js +3 -2
- package/es/core/editor/components/settings/propertyViews/layer/BasicSetting.js +3 -2
- package/es/core/editor/components/settings/propertyViews/node/Setting/NameInput.js +5 -4
- package/es/core/hooks/useCanvasTheme.js +1 -1
- package/es/core/models/TopoApp.js +1 -1
- package/lib/components/ColorPanel/index.js +8 -4
- package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +1 -0
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +33 -25
- package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +12 -10
- package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +3 -3
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/colorUtil.js +7 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +2 -1
- package/lib/core/editor/components/settings/common/AlignSetting/AlignSetting.module.scss +1 -1
- package/lib/core/editor/components/settings/common/NameInput.js +33 -0
- package/lib/core/editor/components/settings/propertyViews/box/NameInput.js +6 -5
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupBasicSetting.js +4 -3
- package/lib/core/editor/components/settings/propertyViews/layer/BasicSetting.js +4 -3
- package/lib/core/editor/components/settings/propertyViews/node/Setting/NameInput.js +6 -5
- package/lib/core/hooks/useCanvasTheme.js +1 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
@@ -71,14 +71,18 @@ function ColorPanel(props) {
|
|
71
71
|
var rgba = "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + rgb.a + ")";
|
72
72
|
|
73
73
|
if (data !== prevValue) {
|
74
|
-
setData(
|
75
|
-
onChange({
|
74
|
+
setData({
|
76
75
|
hex: prevValue,
|
77
76
|
rgb: rgb
|
78
|
-
}
|
77
|
+
});
|
79
78
|
}
|
80
79
|
};
|
81
80
|
|
81
|
+
var pickerBlur = function pickerBlur() {
|
82
|
+
onChange(data, 'change');
|
83
|
+
onPickerBlur();
|
84
|
+
};
|
85
|
+
|
82
86
|
var getColor16 = function getColor16(color) {
|
83
87
|
var that = color;
|
84
88
|
|
@@ -157,7 +161,7 @@ function ColorPanel(props) {
|
|
157
161
|
style: {
|
158
162
|
paddingBottom: 0
|
159
163
|
},
|
160
|
-
onBlur:
|
164
|
+
onBlur: pickerBlur,
|
161
165
|
onFocus: onPickerFocus
|
162
166
|
}, /*#__PURE__*/React.createElement(SketchPicker, {
|
163
167
|
color: data // width={230}
|
@@ -16,36 +16,44 @@ function FontColorDropdown(props) {
|
|
16
16
|
disabled = _useState[0],
|
17
17
|
setDisabled = _useState[1];
|
18
18
|
|
19
|
-
var
|
19
|
+
var backOpacityChange = function backOpacityChange(value) {
|
20
20
|
topo.historyManager.beginTransaction();
|
21
|
-
};
|
22
|
-
|
23
|
-
var onPickerBlur = function onPickerBlur() {
|
24
|
-
topo.historyManager.endTransaction();
|
25
|
-
};
|
26
|
-
|
27
|
-
var backOpacityChange = function backOpacityChange(value, type) {
|
28
|
-
if (type === 'select') onPickerFocus();
|
29
21
|
onChange({
|
30
22
|
opacity: value / 100
|
31
23
|
});
|
32
|
-
|
24
|
+
topo.historyManager.endTransaction();
|
25
|
+
};
|
26
|
+
|
27
|
+
var colorBackgroundChanges = function colorBackgroundChanges(type, name, value) {
|
28
|
+
if (type === 'select') topo.historyManager.beginTransaction();
|
29
|
+
|
30
|
+
if (name === 'color') {
|
31
|
+
onChange({
|
32
|
+
color: value
|
33
|
+
});
|
34
|
+
} else {
|
35
|
+
onChange({
|
36
|
+
background: value
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
40
|
+
if (type === 'select') topo.historyManager.endTransaction();
|
33
41
|
};
|
34
42
|
|
35
43
|
var colorChang = function colorChang(value, type) {
|
36
|
-
|
37
|
-
onChange({
|
38
|
-
color: value
|
39
|
-
});
|
40
|
-
if (type === 'select') onPickerBlur();
|
44
|
+
colorBackgroundChanges(type, 'color', value);
|
41
45
|
};
|
42
46
|
|
43
|
-
var backgroundChang = function backgroundChang(value) {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
var backgroundChang = function backgroundChang(value, type) {
|
48
|
+
colorBackgroundChanges(type, 'background', value);
|
49
|
+
};
|
50
|
+
|
51
|
+
var onFocus = function onFocus() {
|
52
|
+
topo.historyManager.beginTransaction();
|
53
|
+
};
|
54
|
+
|
55
|
+
var onBlur = function onBlur() {
|
56
|
+
topo.historyManager.endTransaction();
|
49
57
|
};
|
50
58
|
|
51
59
|
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
@@ -69,8 +77,8 @@ function FontColorDropdown(props) {
|
|
69
77
|
}
|
70
78
|
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
71
79
|
onChange: colorChang,
|
72
|
-
onPickerFocus:
|
73
|
-
onPickerBlur:
|
80
|
+
onPickerFocus: onFocus,
|
81
|
+
onPickerBlur: onBlur
|
74
82
|
}))), /*#__PURE__*/React.createElement("div", {
|
75
83
|
className: styles.backgroundColor
|
76
84
|
}, /*#__PURE__*/React.createElement("span", null, "\u80CC\u666F\u586B\u5145"), /*#__PURE__*/React.createElement("div", {
|
@@ -93,8 +101,8 @@ function FontColorDropdown(props) {
|
|
93
101
|
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
94
102
|
showClear: true,
|
95
103
|
onChange: backgroundChang,
|
96
|
-
onPickerFocus:
|
97
|
-
onPickerBlur:
|
104
|
+
onPickerFocus: onFocus,
|
105
|
+
onPickerBlur: onBlur
|
98
106
|
})))));
|
99
107
|
}
|
100
108
|
|
@@ -7,7 +7,7 @@ import React, { useState, useMemo } from 'react';
|
|
7
7
|
import LayoutSettings from "./components/LayoutSettings";
|
8
8
|
import WidgetBox from "../WidgetBox";
|
9
9
|
import DropdownButton from "../components/DropdownButton";
|
10
|
-
import { isGroup, isLayer } from "../../../../../../utils/
|
10
|
+
import { isGroup, isLayer } from "../../../../../../utils/htElementDataUtil";
|
11
11
|
|
12
12
|
function Layout(props) {
|
13
13
|
var topo = props.topo,
|
@@ -24,7 +24,7 @@ function Layout(props) {
|
|
24
24
|
selection = _topo$store$useModelS.selection;
|
25
25
|
|
26
26
|
var setDisabled = function setDisabled(data) {
|
27
|
-
if (topoShowType == 'layers' && selection.length == 1) {
|
27
|
+
if (topoShowType == 'layers' && selection.length == 1 && !isGroup(selection[0])) {
|
28
28
|
return data != 'rectangle';
|
29
29
|
} else {
|
30
30
|
return data == 'rectangle';
|
@@ -87,15 +87,17 @@ function LayoutWidget(props) {
|
|
87
87
|
// type为partition且selection.length>=0时可以点击布局, selection[0].className != 'ht.Node'
|
88
88
|
// type为auto且selection.length==0时可以点击布局
|
89
89
|
|
90
|
-
var
|
90
|
+
var _topo$store$useModelS2 = topo.store.useModelState('selection'),
|
91
|
+
selection = _topo$store$useModelS2.selection;
|
92
|
+
|
91
93
|
var topoShowType = topoState.type; // 获取ID以及拓扑类型 // 拓扑类型:auto自由布局,layers分层,partition分区
|
92
94
|
|
93
95
|
var disabled = useMemo(function () {
|
94
96
|
return !isLayoutEnabled({
|
95
97
|
topoShowType: topoShowType,
|
96
|
-
|
98
|
+
selection: selection
|
97
99
|
});
|
98
|
-
}, [topoShowType,
|
100
|
+
}, [topoShowType, selection]);
|
99
101
|
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
100
102
|
src: "/img/topo/editor/toolbar/layout/Disable.svg",
|
101
103
|
alt: ""
|
@@ -119,19 +121,19 @@ function LayoutWidget(props) {
|
|
119
121
|
|
120
122
|
function isLayoutEnabled(props) {
|
121
123
|
var topoShowType = props.topoShowType,
|
122
|
-
|
124
|
+
selection = props.selection; // 选中单个区域/集群后,该按钮亮起
|
123
125
|
|
124
|
-
if (isGroup(
|
126
|
+
if (selection.length === 1 && isGroup(selection[0]) && selection[0].expanded) {
|
125
127
|
return true;
|
126
128
|
} // 分层拓扑选中任意分层时,布局按钮亮起
|
127
129
|
|
128
130
|
|
129
|
-
if (topoShowType === 'layers' &&
|
131
|
+
if (topoShowType === 'layers' && selection.length === 1 && isLayer(selection[0])) {
|
130
132
|
return true;
|
131
133
|
} // 空白拓扑未选中任何资源时,布局按钮亮起
|
132
134
|
|
133
135
|
|
134
|
-
if (topoShowType !== 'layers' && !
|
136
|
+
if (topoShowType !== 'layers' && !selection.length) {
|
135
137
|
return true;
|
136
138
|
}
|
137
139
|
|
@@ -72,8 +72,8 @@ function NodeAlignWidget(props) {
|
|
72
72
|
if (nodes.length === 2) {
|
73
73
|
var h = topo.view.topoClient.htTopoClient.getElementsSpace(nodes, 'h')[0];
|
74
74
|
var v = topo.view.topoClient.htTopoClient.getElementsSpace(nodes, 'v')[0];
|
75
|
-
setLeftInputVal(h * 1 > 0 ? h : 0);
|
76
|
-
setRightInputVal(v * 1 > 0 ? v : 0);
|
75
|
+
setLeftInputVal(Math.round(h * 1 > 0 ? h : 0));
|
76
|
+
setRightInputVal(Math.round(v * 1 > 0 ? v : 0));
|
77
77
|
}
|
78
78
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
79
79
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
.leftInput{
|
2
|
-
width:
|
3
|
-
margin: 0px
|
2
|
+
width: 106px !important;
|
3
|
+
margin: 0px 9px 10px 9px;
|
4
4
|
:global{
|
5
5
|
input{
|
6
6
|
background: url('/img/topo/editor/toolbar/对齐/水平间距_normal.svg')no-repeat 5px center !important;
|
@@ -16,7 +16,7 @@
|
|
16
16
|
}
|
17
17
|
}
|
18
18
|
.rightInput{
|
19
|
-
width:
|
19
|
+
width: 106px !important;
|
20
20
|
:global{
|
21
21
|
input{
|
22
22
|
background: url('/img/topo/editor/toolbar/对齐/垂直间距 _normal.svg')no-repeat 5px center !important;
|
@@ -35,6 +35,10 @@ export function parseBackground(colorStr) {
|
|
35
35
|
export function formatHexColor(color) {
|
36
36
|
return color ? color.hex : null;
|
37
37
|
}
|
38
|
+
export function formatRgbaColor(color) {
|
39
|
+
var rgb = color.rgb;
|
40
|
+
return "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + rgb.a + ")";
|
41
|
+
}
|
38
42
|
/**
|
39
43
|
* 格式化背景rgba颜色
|
40
44
|
* @param {{background, opacity}} prevColor
|
@@ -43,7 +47,7 @@ export function formatHexColor(color) {
|
|
43
47
|
|
44
48
|
export function formatBackgroundRgbaColor(prevColor, currentColor) {
|
45
49
|
if (!('background' in currentColor) && !('opacity' in currentColor)) {
|
46
|
-
return
|
50
|
+
return formatRgbaColor(prevColor.background);
|
47
51
|
}
|
48
52
|
|
49
53
|
var colorObj = Object.assign(prevColor, currentColor);
|
@@ -19,7 +19,8 @@ export function setTextStyle(element, style) {
|
|
19
19
|
|
20
20
|
|
21
21
|
var prevStyle = getTextStyle(element);
|
22
|
-
|
22
|
+
var background = formatBackgroundRgbaColor(prevStyle, style);
|
23
|
+
element.s('textBackground', background);
|
23
24
|
|
24
25
|
var fontStyle = _extends({}, getTextStyle(element), style);
|
25
26
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import _Input from "@alifd/next/es/input";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import React from 'react';
|
4
|
+
var NameInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5
|
+
var multipleLine = props.multipleLine;
|
6
|
+
|
7
|
+
if (multipleLine) {
|
8
|
+
return /*#__PURE__*/React.createElement(_Input.TextArea, _extends({
|
9
|
+
ref: ref,
|
10
|
+
autoHeight: {
|
11
|
+
minRows: 4,
|
12
|
+
maxRows: 4
|
13
|
+
}
|
14
|
+
}, props));
|
15
|
+
}
|
16
|
+
|
17
|
+
return /*#__PURE__*/React.createElement(_Input, _extends({
|
18
|
+
ref: ref
|
19
|
+
}, props));
|
20
|
+
});
|
21
|
+
export default NameInput;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import _Input from "@alifd/next/es/input";
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
3
2
|
import React, { useEffect, useState } from 'react';
|
4
|
-
|
3
|
+
import NameInput from "../../common/NameInput";
|
4
|
+
var BoxNameInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5
5
|
var onChange = props.onChange,
|
6
6
|
topo = props.topo;
|
7
7
|
|
@@ -33,12 +33,13 @@ var NameInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
33
33
|
topo.historyManager.endTransaction();
|
34
34
|
};
|
35
35
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
36
|
+
return /*#__PURE__*/React.createElement(NameInput, _extends({}, props, {
|
37
37
|
ref: ref,
|
38
38
|
value: value,
|
39
|
+
multipleLine: true,
|
39
40
|
onChange: handleChange,
|
40
41
|
onFocus: handleFocus,
|
41
42
|
onBlur: handleBlur
|
42
43
|
}));
|
43
44
|
});
|
44
|
-
export default
|
45
|
+
export default BoxNameInput;
|
package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupBasicSetting.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import _Form from "@alifd/next/es/form";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
|
-
import _Input from "@alifd/next/es/input";
|
4
3
|
import _Field from "@alifd/next/es/field";
|
5
4
|
import _Collapse from "@alifd/next/es/collapse";
|
6
5
|
import React, { useEffect } from "react";
|
@@ -9,6 +8,7 @@ import GroupIconSelect from "./GroupIconSelect";
|
|
9
8
|
import GroupExpandStatus from "./GroupExpandStatus";
|
10
9
|
import GroupExpandSetting from "./GroupExpandSetting";
|
11
10
|
import { SPECIAL_CHARACTER_FORM_ITEM_VALIDATE_PROPS, validateSpecialCharacter } from "../../../../../../../utils/SpecialCharacterValidateUtil";
|
11
|
+
import NameInput from "../../../common/NameInput";
|
12
12
|
var CollapsePanel = _Collapse.Panel;
|
13
13
|
export default function GroupBasicSetting(props) {
|
14
14
|
var topo = props.topo,
|
@@ -51,8 +51,9 @@ export default function GroupBasicSetting(props) {
|
|
51
51
|
label: isCluster ? '集群名称' : '区域名称'
|
52
52
|
}, SPECIAL_CHARACTER_FORM_ITEM_VALIDATE_PROPS, {
|
53
53
|
patternTrigger: "onChange"
|
54
|
-
}), /*#__PURE__*/React.createElement(
|
54
|
+
}), /*#__PURE__*/React.createElement(NameInput, {
|
55
55
|
name: "attrObject.name",
|
56
|
+
multipleLine: true,
|
56
57
|
maxLength: 30,
|
57
58
|
placeholder: "\u8BF7\u8F93\u5165",
|
58
59
|
onFocus: function onFocus() {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import _Form from "@alifd/next/es/form";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
|
-
import _Input from "@alifd/next/es/input";
|
4
3
|
import _Field from "@alifd/next/es/field";
|
5
4
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
6
5
|
import React, { useEffect } from 'react';
|
7
6
|
import { SPECIAL_CHARACTER_FORM_ITEM_VALIDATE_PROPS, validateSpecialCharacter } from "../../../../../../utils/SpecialCharacterValidateUtil";
|
7
|
+
import NameInput from "../../common/NameInput";
|
8
8
|
export default function BasicSetting(props) {
|
9
9
|
var topo = props.topo,
|
10
10
|
values = props.values,
|
@@ -43,8 +43,9 @@ export default function BasicSetting(props) {
|
|
43
43
|
paddingLeft: 32,
|
44
44
|
paddingRight: 16
|
45
45
|
}
|
46
|
-
}), /*#__PURE__*/React.createElement(
|
46
|
+
}), /*#__PURE__*/React.createElement(NameInput, {
|
47
47
|
name: "styleMap.label",
|
48
|
+
multipleLine: true,
|
48
49
|
maxLength: 30,
|
49
50
|
placeholder: "\u8BF7\u8F93\u5165",
|
50
51
|
onFocus: function onFocus() {
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import _Input from "@alifd/next/es/input";
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
3
2
|
import React, { useEffect, useState } from 'react';
|
4
|
-
|
3
|
+
import NameInput from "../../../common/NameInput";
|
4
|
+
var NodeNameInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5
5
|
var onChange = props.onChange,
|
6
6
|
topo = props.topo;
|
7
7
|
|
@@ -33,12 +33,13 @@ var NameInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
33
33
|
topo.historyManager.endTransaction();
|
34
34
|
};
|
35
35
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
36
|
+
return /*#__PURE__*/React.createElement(NameInput, _extends({}, props, {
|
37
37
|
ref: ref,
|
38
38
|
value: value,
|
39
|
+
multipleLine: true,
|
39
40
|
onChange: handleChange,
|
40
41
|
onFocus: handleFocus,
|
41
42
|
onBlur: handleBlur
|
42
43
|
}));
|
43
44
|
});
|
44
|
-
export default
|
45
|
+
export default NodeNameInput;
|
@@ -22,7 +22,7 @@ import topoFactory from "./topoFactory";
|
|
22
22
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
23
23
|
import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
|
24
24
|
|
25
|
-
var version = typeof "6.0.0-alpha.
|
25
|
+
var version = typeof "6.0.0-alpha.46" === 'string' ? "6.0.0-alpha.46" : null;
|
26
26
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
27
27
|
/**
|
28
28
|
* 拓扑显示和编辑
|
@@ -87,14 +87,18 @@ function ColorPanel(props) {
|
|
87
87
|
var rgba = "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + rgb.a + ")";
|
88
88
|
|
89
89
|
if (data !== prevValue) {
|
90
|
-
setData(
|
91
|
-
onChange({
|
90
|
+
setData({
|
92
91
|
hex: prevValue,
|
93
92
|
rgb: rgb
|
94
|
-
}
|
93
|
+
});
|
95
94
|
}
|
96
95
|
};
|
97
96
|
|
97
|
+
var pickerBlur = function pickerBlur() {
|
98
|
+
onChange(data, 'change');
|
99
|
+
onPickerBlur();
|
100
|
+
};
|
101
|
+
|
98
102
|
var getColor16 = function getColor16(color) {
|
99
103
|
var that = color;
|
100
104
|
|
@@ -174,7 +178,7 @@ function ColorPanel(props) {
|
|
174
178
|
style: {
|
175
179
|
paddingBottom: 0
|
176
180
|
},
|
177
|
-
onBlur:
|
181
|
+
onBlur: pickerBlur,
|
178
182
|
onFocus: onPickerFocus
|
179
183
|
}, /*#__PURE__*/_react["default"].createElement(_reactColor.SketchPicker, {
|
180
184
|
color: data // width={230}
|
@@ -33,36 +33,44 @@ function FontColorDropdown(props) {
|
|
33
33
|
disabled = _useState[0],
|
34
34
|
setDisabled = _useState[1];
|
35
35
|
|
36
|
-
var
|
36
|
+
var backOpacityChange = function backOpacityChange(value) {
|
37
37
|
topo.historyManager.beginTransaction();
|
38
|
-
};
|
39
|
-
|
40
|
-
var onPickerBlur = function onPickerBlur() {
|
41
|
-
topo.historyManager.endTransaction();
|
42
|
-
};
|
43
|
-
|
44
|
-
var backOpacityChange = function backOpacityChange(value, type) {
|
45
|
-
if (type === 'select') onPickerFocus();
|
46
38
|
onChange({
|
47
39
|
opacity: value / 100
|
48
40
|
});
|
49
|
-
|
41
|
+
topo.historyManager.endTransaction();
|
42
|
+
};
|
43
|
+
|
44
|
+
var colorBackgroundChanges = function colorBackgroundChanges(type, name, value) {
|
45
|
+
if (type === 'select') topo.historyManager.beginTransaction();
|
46
|
+
|
47
|
+
if (name === 'color') {
|
48
|
+
onChange({
|
49
|
+
color: value
|
50
|
+
});
|
51
|
+
} else {
|
52
|
+
onChange({
|
53
|
+
background: value
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
if (type === 'select') topo.historyManager.endTransaction();
|
50
58
|
};
|
51
59
|
|
52
60
|
var colorChang = function colorChang(value, type) {
|
53
|
-
|
54
|
-
onChange({
|
55
|
-
color: value
|
56
|
-
});
|
57
|
-
if (type === 'select') onPickerBlur();
|
61
|
+
colorBackgroundChanges(type, 'color', value);
|
58
62
|
};
|
59
63
|
|
60
|
-
var backgroundChang = function backgroundChang(value) {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
var backgroundChang = function backgroundChang(value, type) {
|
65
|
+
colorBackgroundChanges(type, 'background', value);
|
66
|
+
};
|
67
|
+
|
68
|
+
var onFocus = function onFocus() {
|
69
|
+
topo.historyManager.beginTransaction();
|
70
|
+
};
|
71
|
+
|
72
|
+
var onBlur = function onBlur() {
|
73
|
+
topo.historyManager.endTransaction();
|
66
74
|
};
|
67
75
|
|
68
76
|
var icon = disabled ? /*#__PURE__*/_react["default"].createElement("img", {
|
@@ -86,8 +94,8 @@ function FontColorDropdown(props) {
|
|
86
94
|
}
|
87
95
|
}, /*#__PURE__*/_react["default"].createElement(_ColorPanel["default"], {
|
88
96
|
onChange: colorChang,
|
89
|
-
onPickerFocus:
|
90
|
-
onPickerBlur:
|
97
|
+
onPickerFocus: onFocus,
|
98
|
+
onPickerBlur: onBlur
|
91
99
|
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
92
100
|
className: _FontColorButtonModule["default"].backgroundColor
|
93
101
|
}, /*#__PURE__*/_react["default"].createElement("span", null, "\u80CC\u666F\u586B\u5145"), /*#__PURE__*/_react["default"].createElement("div", {
|
@@ -110,8 +118,8 @@ function FontColorDropdown(props) {
|
|
110
118
|
}, /*#__PURE__*/_react["default"].createElement(_ColorPanel["default"], {
|
111
119
|
showClear: true,
|
112
120
|
onChange: backgroundChang,
|
113
|
-
onPickerFocus:
|
114
|
-
onPickerBlur:
|
121
|
+
onPickerFocus: onFocus,
|
122
|
+
onPickerBlur: onBlur
|
115
123
|
})))));
|
116
124
|
}
|
117
125
|
|
@@ -17,7 +17,7 @@ var _WidgetBox = _interopRequireDefault(require("../WidgetBox"));
|
|
17
17
|
|
18
18
|
var _DropdownButton = _interopRequireDefault(require("../components/DropdownButton"));
|
19
19
|
|
20
|
-
var
|
20
|
+
var _htElementDataUtil = require("../../../../../../utils/htElementDataUtil");
|
21
21
|
|
22
22
|
var _excluded = ["topo", "showLabel"];
|
23
23
|
|
@@ -40,7 +40,7 @@ function Layout(props) {
|
|
40
40
|
selection = _topo$store$useModelS.selection;
|
41
41
|
|
42
42
|
var setDisabled = function setDisabled(data) {
|
43
|
-
if (topoShowType == 'layers' && selection.length == 1) {
|
43
|
+
if (topoShowType == 'layers' && selection.length == 1 && !(0, _htElementDataUtil.isGroup)(selection[0])) {
|
44
44
|
return data != 'rectangle';
|
45
45
|
} else {
|
46
46
|
return data == 'rectangle';
|
@@ -61,7 +61,7 @@ function Layout(props) {
|
|
61
61
|
} // eslint-disable-next-line eqeqeq
|
62
62
|
|
63
63
|
|
64
|
-
if ((0,
|
64
|
+
if ((0, _htElementDataUtil.isLayer)(firstElement)) {
|
65
65
|
topo.getHtTopo().layoutLayer(firstElement);
|
66
66
|
}
|
67
67
|
};
|
@@ -102,15 +102,17 @@ function LayoutWidget(props) {
|
|
102
102
|
// type为partition且selection.length>=0时可以点击布局, selection[0].className != 'ht.Node'
|
103
103
|
// type为auto且selection.length==0时可以点击布局
|
104
104
|
|
105
|
-
var
|
105
|
+
var _topo$store$useModelS2 = topo.store.useModelState('selection'),
|
106
|
+
selection = _topo$store$useModelS2.selection;
|
107
|
+
|
106
108
|
var topoShowType = topoState.type; // 获取ID以及拓扑类型 // 拓扑类型:auto自由布局,layers分层,partition分区
|
107
109
|
|
108
110
|
var disabled = (0, _react.useMemo)(function () {
|
109
111
|
return !isLayoutEnabled({
|
110
112
|
topoShowType: topoShowType,
|
111
|
-
|
113
|
+
selection: selection
|
112
114
|
});
|
113
|
-
}, [topoShowType,
|
115
|
+
}, [topoShowType, selection]);
|
114
116
|
var icon = disabled ? /*#__PURE__*/_react["default"].createElement("img", {
|
115
117
|
src: "/img/topo/editor/toolbar/layout/Disable.svg",
|
116
118
|
alt: ""
|
@@ -134,19 +136,19 @@ function LayoutWidget(props) {
|
|
134
136
|
|
135
137
|
function isLayoutEnabled(props) {
|
136
138
|
var topoShowType = props.topoShowType,
|
137
|
-
|
139
|
+
selection = props.selection; // 选中单个区域/集群后,该按钮亮起
|
138
140
|
|
139
|
-
if ((0,
|
141
|
+
if (selection.length === 1 && (0, _htElementDataUtil.isGroup)(selection[0]) && selection[0].expanded) {
|
140
142
|
return true;
|
141
143
|
} // 分层拓扑选中任意分层时,布局按钮亮起
|
142
144
|
|
143
145
|
|
144
|
-
if (topoShowType === 'layers' &&
|
146
|
+
if (topoShowType === 'layers' && selection.length === 1 && (0, _htElementDataUtil.isLayer)(selection[0])) {
|
145
147
|
return true;
|
146
148
|
} // 空白拓扑未选中任何资源时,布局按钮亮起
|
147
149
|
|
148
150
|
|
149
|
-
if (topoShowType !== 'layers' && !
|
151
|
+
if (topoShowType !== 'layers' && !selection.length) {
|
150
152
|
return true;
|
151
153
|
}
|
152
154
|
|
@@ -91,8 +91,8 @@ function NodeAlignWidget(props) {
|
|
91
91
|
if (nodes.length === 2) {
|
92
92
|
var h = topo.view.topoClient.htTopoClient.getElementsSpace(nodes, 'h')[0];
|
93
93
|
var v = topo.view.topoClient.htTopoClient.getElementsSpace(nodes, 'v')[0];
|
94
|
-
setLeftInputVal(h * 1 > 0 ? h : 0);
|
95
|
-
setRightInputVal(v * 1 > 0 ? v : 0);
|
94
|
+
setLeftInputVal(Math.round(h * 1 > 0 ? h : 0));
|
95
|
+
setRightInputVal(Math.round(v * 1 > 0 ? v : 0));
|
96
96
|
}
|
97
97
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
98
98
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
.leftInput{
|
2
|
-
width:
|
3
|
-
margin: 0px
|
2
|
+
width: 106px !important;
|
3
|
+
margin: 0px 9px 10px 9px;
|
4
4
|
:global{
|
5
5
|
input{
|
6
6
|
background: url('/img/topo/editor/toolbar/对齐/水平间距_normal.svg')no-repeat 5px center !important;
|
@@ -16,7 +16,7 @@
|
|
16
16
|
}
|
17
17
|
}
|
18
18
|
.rightInput{
|
19
|
-
width:
|
19
|
+
width: 106px !important;
|
20
20
|
:global{
|
21
21
|
input{
|
22
22
|
background: url('/img/topo/editor/toolbar/对齐/垂直间距 _normal.svg')no-repeat 5px center !important;
|