@riil-frontend/component-topology 6.0.0-alpha.41 → 6.0.0-alpha.43
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/index.css +1 -1
- package/build/index.js +20 -20
- package/demo/CHANGELOG/CHANGELOG.md +5 -0
- package/es/components/VerticalIconTab/VerticalIconTab.js +11 -1
- package/es/components/VerticalIconTab/VerticalIconTab.module.scss +1 -0
- package/es/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +8 -3
- package/es/core/components/TopoView/topoView.js +3 -3
- package/es/core/editor/components/Sidebar/panes.js +6 -1
- package/es/core/editor/components/Toolbar/widgets/AddResourceButton.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +38 -12
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.module.scss +4 -5
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/Layout/index.js +2 -2
- package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +8 -1
- package/es/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +1 -1
- package/es/core/editor/components/settings/CloseablePanel.module.scss +12 -0
- package/es/core/editor/components/settings/PropertyView.js +21 -18
- package/es/core/editor/components/settings/Settings.js +39 -77
- package/es/core/editor/components/settings/Settings.module.scss +2 -10
- package/es/core/editor/components/settings/core/PropertyViewManager.js +61 -0
- package/es/core/editor/components/settings/core/getPropertyViewType.js +34 -0
- package/es/core/editor/components/settings/core/updateElementProperty.js +21 -0
- package/es/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +3 -8
- package/es/core/editor/components/settings/propertyViews/box/BoxPropertyViewV1.js +58 -0
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +5 -2
- package/es/core/editor/components/settings/propertyViews/edge/EdgeGroupPropertyView.js +7 -8
- package/es/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +9 -23
- package/es/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +10 -0
- package/es/core/editor/components/settings/propertyViews/edge/edgeGroup/EdgeGroupSetting.js +1 -6
- package/es/core/editor/components/settings/propertyViews/group/GroupPropertyView.js +13 -21
- package/es/core/editor/components/settings/propertyViews/group/GroupPropertyView.module.scss +8 -1
- package/es/core/editor/components/settings/propertyViews/group/GroupPropertyViewV1.js +28 -0
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupBasicSetting.js +74 -0
- package/es/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +9 -7
- package/es/core/editor/components/settings/propertyViews/index.js +4 -2
- package/es/core/editor/components/settings/propertyViews/node/NodePropertyView.js +8 -32
- package/es/core/editor/components/settings/propertyViews/node/NodePropertyViewV1.js +53 -0
- package/es/core/editor/components/settings/propertyViews/node/Setting/BasicSetting.js +49 -0
- package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +4 -19
- package/es/core/models/HistoryManager.js +11 -14
- package/es/core/models/{SelectionManager.js → SelectionModel.js} +27 -18
- package/es/core/models/TopoApp.js +3 -3
- package/es/networkTopo/components/editor/propertyViews/edge/EdgePropertyView.js +39 -6
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +10 -16
- package/es/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyViewV1.js +37 -0
- package/es/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.module.scss +1 -1
- package/es/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/es/style.js +1 -1
- package/lib/components/VerticalIconTab/VerticalIconTab.js +14 -1
- package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +1 -0
- package/lib/core/components/DisplaySettingDrawer/hooks/useDisplaySetting.js +8 -3
- package/lib/core/components/TopoView/topoView.js +3 -3
- package/lib/core/editor/components/Sidebar/panes.js +6 -1
- package/lib/core/editor/components/Toolbar/widgets/AddResourceButton.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +38 -12
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.module.scss +4 -5
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +2 -2
- package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +8 -1
- package/lib/core/editor/components/Toolbar/widgets/NodeImageButton/NodeImageButton.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +1 -1
- package/lib/core/editor/components/settings/CloseablePanel.module.scss +12 -0
- package/lib/core/editor/components/settings/PropertyView.js +26 -19
- package/lib/core/editor/components/settings/Settings.js +44 -79
- package/lib/core/editor/components/settings/Settings.module.scss +2 -10
- package/lib/core/editor/components/settings/core/PropertyViewManager.js +70 -0
- package/lib/core/editor/components/settings/core/getPropertyViewType.js +40 -0
- package/lib/core/editor/components/settings/core/updateElementProperty.js +27 -0
- package/lib/core/editor/components/settings/propertyViews/box/BoxPropertyView.js +3 -8
- package/lib/core/editor/components/settings/propertyViews/box/BoxPropertyViewV1.js +76 -0
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +8 -2
- package/lib/core/editor/components/settings/propertyViews/edge/EdgeGroupPropertyView.js +9 -12
- package/lib/core/editor/components/settings/propertyViews/edge/EdgePropertyView.js +7 -23
- package/lib/core/editor/components/settings/propertyViews/edge/addEdgeProps.js +19 -0
- package/lib/core/editor/components/settings/propertyViews/edge/edgeGroup/EdgeGroupSetting.js +1 -6
- package/lib/core/editor/components/settings/propertyViews/group/GroupPropertyView.js +14 -25
- package/lib/core/editor/components/settings/propertyViews/group/GroupPropertyView.module.scss +8 -1
- package/lib/core/editor/components/settings/propertyViews/group/GroupPropertyViewV1.js +43 -0
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupBasicSetting.js +97 -0
- package/lib/core/editor/components/settings/propertyViews/group/SettingTab/GroupExpandSetting.js +8 -6
- package/lib/core/editor/components/settings/propertyViews/index.js +5 -2
- package/lib/core/editor/components/settings/propertyViews/node/NodePropertyView.js +8 -35
- package/lib/core/editor/components/settings/propertyViews/node/NodePropertyViewV1.js +68 -0
- package/lib/core/editor/components/settings/propertyViews/node/Setting/BasicSetting.js +64 -0
- package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +4 -19
- package/lib/core/models/HistoryManager.js +11 -14
- package/lib/core/models/{SelectionManager.js → SelectionModel.js} +27 -18
- package/lib/core/models/TopoApp.js +3 -3
- package/lib/networkTopo/components/editor/propertyViews/edge/EdgePropertyView.js +45 -7
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyView.js +10 -18
- package/lib/networkTopo/components/editor/propertyViews/edge/LinkPropertyView/LinkPropertyViewV1.js +50 -0
- package/lib/networkTopo/components/editor/propertyViews/edge/link/LinkInfoPreview.module.scss +1 -1
- package/lib/networkTopo/models/LinkDynamicStyleExecutor.js +2 -2
- package/lib/style.js +1 -1
- package/package.json +2 -2
- package/es/core/editor/components/settings/OpenPropertyPanelListener.js +0 -33
- package/lib/core/editor/components/settings/OpenPropertyPanelListener.js +0 -43
@@ -1,5 +1,6 @@
|
|
1
1
|
import _Tab from "@alifd/next/es/tab";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _Balloon from "@alifd/next/es/balloon";
|
3
4
|
import React, { useState } from 'react';
|
4
5
|
import classNames from 'classnames';
|
5
6
|
import styles from "./VerticalIconTab.module.scss";
|
@@ -11,8 +12,9 @@ import styles from "./VerticalIconTab.module.scss";
|
|
11
12
|
|
12
13
|
function CustomTabItem(_ref) {
|
13
14
|
var title = _ref.title,
|
15
|
+
titleTootip = _ref.titleTootip,
|
14
16
|
icon = _ref.icon;
|
15
|
-
|
17
|
+
var tabItem = /*#__PURE__*/React.createElement("div", {
|
16
18
|
className: "v-icon-tab-item"
|
17
19
|
}, /*#__PURE__*/React.createElement("img", {
|
18
20
|
src: icon,
|
@@ -20,6 +22,14 @@ function CustomTabItem(_ref) {
|
|
20
22
|
}), /*#__PURE__*/React.createElement("div", {
|
21
23
|
className: "tab-title"
|
22
24
|
}, title));
|
25
|
+
return /*#__PURE__*/React.createElement(_Balloon.Tooltip, {
|
26
|
+
trigger: tabItem,
|
27
|
+
align: "r" // 解决遮挡下拉浮层问题
|
28
|
+
,
|
29
|
+
popupStyle: {
|
30
|
+
zIndex: 1000
|
31
|
+
}
|
32
|
+
}, titleTootip);
|
23
33
|
}
|
24
34
|
/**
|
25
35
|
* 竖向
|
@@ -76,13 +76,18 @@ export default (function (props) {
|
|
76
76
|
case 7:
|
77
77
|
extraOnOk = displaySettingProps === null || displaySettingProps === void 0 ? void 0 : displaySettingProps.onOk;
|
78
78
|
|
79
|
-
if (extraOnOk) {
|
80
|
-
|
79
|
+
if (!extraOnOk) {
|
80
|
+
_context2.next = 11;
|
81
|
+
break;
|
81
82
|
}
|
82
83
|
|
84
|
+
_context2.next = 11;
|
85
|
+
return extraOnOk(displayConfig);
|
86
|
+
|
87
|
+
case 11:
|
83
88
|
topo.historyManager.endTransaction();
|
84
89
|
|
85
|
-
case
|
90
|
+
case 12:
|
86
91
|
case "end":
|
87
92
|
return _context2.stop();
|
88
93
|
}
|
@@ -109,7 +109,7 @@ var Topology = function Topology(props) {
|
|
109
109
|
// 拓扑退出注销
|
110
110
|
return function () {
|
111
111
|
rlog.info('TopoView 退出');
|
112
|
-
topo.
|
112
|
+
topo.selectionModel.destroy();
|
113
113
|
topoDispatchers.reset();
|
114
114
|
};
|
115
115
|
}, []);
|
@@ -137,7 +137,7 @@ var Topology = function Topology(props) {
|
|
137
137
|
topo.historyManager = new HistoryManager(topo, htHistoryManager);
|
138
138
|
}
|
139
139
|
|
140
|
-
topo.
|
140
|
+
topo.selectionModel.init();
|
141
141
|
topoDispatchers.update({
|
142
142
|
graphLoaded2: true
|
143
143
|
});
|
@@ -156,7 +156,7 @@ var Topology = function Topology(props) {
|
|
156
156
|
fixLink(topo);
|
157
157
|
handleClusterNoPermission(topo);
|
158
158
|
updateEdgeExpanded(topo);
|
159
|
-
topo.
|
159
|
+
topo.selectionModel.init();
|
160
160
|
topoDispatchers.update({
|
161
161
|
graphLoaded: true
|
162
162
|
});
|
@@ -4,28 +4,33 @@ import ComponentPanel from "./views/ComponentPanel";
|
|
4
4
|
import ImagePanel from "./views/ImagePanel";
|
5
5
|
import LinkPanel from "./views/LinkPanel";
|
6
6
|
var panes = [{
|
7
|
-
title: '链路',
|
8
7
|
key: '1',
|
8
|
+
title: '链路',
|
9
|
+
titleTootip: '在两个节点之间添加链路&线',
|
9
10
|
icon: '/img/topo/editor/sidebar/icon/链路.svg',
|
10
11
|
content: LinkPanel
|
11
12
|
}, {
|
12
13
|
title: '组件',
|
13
14
|
key: '2',
|
15
|
+
titleTootip: '基础组件',
|
14
16
|
icon: '/img/topo/editor/sidebar/icon/组件.svg',
|
15
17
|
content: ComponentPanel
|
16
18
|
}, {
|
17
19
|
title: '图片',
|
18
20
|
key: '3',
|
21
|
+
titleTootip: '图片素材',
|
19
22
|
icon: '/img/topo/editor/sidebar/icon/图片.svg',
|
20
23
|
content: ImagePanel
|
21
24
|
}, {
|
22
25
|
title: '背景',
|
23
26
|
key: '4',
|
27
|
+
titleTootip: '背景素材',
|
24
28
|
icon: '/img/topo/editor/sidebar/icon/背景.svg',
|
25
29
|
content: BackgroundPanel
|
26
30
|
}, {
|
27
31
|
title: '画布',
|
28
32
|
key: '5',
|
33
|
+
titleTootip: '拓扑图画布底图',
|
29
34
|
icon: '/img/topo/editor/sidebar/icon/画布.svg',
|
30
35
|
content: CanvasPanel
|
31
36
|
}];
|
@@ -23,7 +23,7 @@ function AddResourceButton(props) {
|
|
23
23
|
topoEdit = props.topoEdit,
|
24
24
|
editorProps = props.editorProps; // 选中的元素
|
25
25
|
|
26
|
-
var selection = topo.
|
26
|
+
var selection = topo.selectionModel.useSelection();
|
27
27
|
|
28
28
|
var _useState = useState(getAddType(selection)),
|
29
29
|
addType = _useState[0],
|
package/es/core/editor/components/Toolbar/widgets/BoxBackgroundButton/BoxBackgroundButton.js
CHANGED
@@ -20,7 +20,7 @@ function BoxBackgroundButton(props) {
|
|
20
20
|
setDisabled = _useState[1]; // 选中的元素
|
21
21
|
|
22
22
|
|
23
|
-
var selection = topo.
|
23
|
+
var selection = topo.selectionModel.useSelection();
|
24
24
|
useEffect(function () {// setDisabled(false)
|
25
25
|
}, [selection]);
|
26
26
|
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
@@ -30,7 +30,7 @@ function EdgeColorButton(props) {
|
|
30
30
|
graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
|
31
31
|
|
32
32
|
|
33
|
-
var selection = topo.
|
33
|
+
var selection = topo.selectionModel.useHtSelection();
|
34
34
|
|
35
35
|
var loopEdges = function loopEdges(edges, operateEdgeFn) {
|
36
36
|
edges.forEach(function (edge) {
|
@@ -27,7 +27,7 @@ function EdgeTypeButton(props) {
|
|
27
27
|
graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
|
28
28
|
|
29
29
|
|
30
|
-
var selection = topo.
|
30
|
+
var selection = topo.selectionModel.useHtSelection();
|
31
31
|
useEffect(function () {
|
32
32
|
if (graphLoaded) {
|
33
33
|
var edges = getEdgesBySelection(topo);
|
@@ -10,30 +10,42 @@ import textStyleSettingRouter from "./components/textStyleSetting/textStyleSetti
|
|
10
10
|
function FontColorDropdown(props) {
|
11
11
|
var onChange = props.onChange,
|
12
12
|
topo = props.topo,
|
13
|
-
color = props.color,
|
14
|
-
background = props.background,
|
15
13
|
opacity = props.opacity;
|
16
14
|
|
17
15
|
var _useState = useState(false),
|
18
16
|
disabled = _useState[0],
|
19
17
|
setDisabled = _useState[1];
|
20
18
|
|
21
|
-
var
|
19
|
+
var onPickerFocus = function onPickerFocus() {
|
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();
|
22
29
|
onChange({
|
23
30
|
opacity: value / 100
|
24
31
|
});
|
32
|
+
if (type === 'select') onPickerBlur();
|
25
33
|
};
|
26
34
|
|
27
|
-
var colorChang = function colorChang(value) {
|
35
|
+
var colorChang = function colorChang(value, type) {
|
36
|
+
if (type === 'select') onPickerFocus();
|
28
37
|
onChange({
|
29
38
|
color: value
|
30
39
|
});
|
40
|
+
if (type === 'select') onPickerBlur();
|
31
41
|
};
|
32
42
|
|
33
43
|
var backgroundChang = function backgroundChang(value) {
|
44
|
+
onPickerFocus();
|
34
45
|
onChange({
|
35
46
|
background: value
|
36
47
|
});
|
48
|
+
onPickerBlur();
|
37
49
|
};
|
38
50
|
|
39
51
|
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
@@ -50,9 +62,16 @@ function FontColorDropdown(props) {
|
|
50
62
|
className: styles.content
|
51
63
|
}, /*#__PURE__*/React.createElement("div", {
|
52
64
|
className: styles.fontColor
|
53
|
-
}, /*#__PURE__*/React.createElement("span", null, "\u5B57\u4F53\u989C\u8272"), /*#__PURE__*/React.createElement(
|
54
|
-
|
55
|
-
|
65
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u5B57\u4F53\u989C\u8272"), /*#__PURE__*/React.createElement("div", {
|
66
|
+
style: {
|
67
|
+
marginTop: '10px',
|
68
|
+
marginLeft: '-4px'
|
69
|
+
}
|
70
|
+
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
71
|
+
onChange: colorChang,
|
72
|
+
onPickerFocus: onPickerFocus,
|
73
|
+
onPickerBlur: onPickerBlur
|
74
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
56
75
|
className: styles.backgroundColor
|
57
76
|
}, /*#__PURE__*/React.createElement("span", null, "\u80CC\u666F\u586B\u5145"), /*#__PURE__*/React.createElement("div", {
|
58
77
|
className: styles.backOpacity
|
@@ -64,11 +83,19 @@ function FontColorDropdown(props) {
|
|
64
83
|
unit: "%",
|
65
84
|
list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
|
66
85
|
onChange: backOpacityChange,
|
67
|
-
defaultValue: opacity
|
68
|
-
})), /*#__PURE__*/React.createElement(
|
86
|
+
defaultValue: opacity * 100
|
87
|
+
})), /*#__PURE__*/React.createElement("div", {
|
88
|
+
style: {
|
89
|
+
marginTop: '10px',
|
90
|
+
marginLeft: '-4px',
|
91
|
+
marginBottom: '3px'
|
92
|
+
}
|
93
|
+
}, /*#__PURE__*/React.createElement(ColorPanel, {
|
69
94
|
showClear: true,
|
70
|
-
onChange: backgroundChang
|
71
|
-
|
95
|
+
onChange: backgroundChang,
|
96
|
+
onPickerFocus: onPickerFocus,
|
97
|
+
onPickerBlur: onPickerBlur
|
98
|
+
})))));
|
72
99
|
}
|
73
100
|
|
74
101
|
function FontColorButton(props) {
|
@@ -85,7 +112,6 @@ function FontColorButton(props) {
|
|
85
112
|
background: style.background,
|
86
113
|
opacity: style.opacity,
|
87
114
|
onChange: function onChange(val) {
|
88
|
-
topo.historyManager.beginTransaction();
|
89
115
|
setStyle(val);
|
90
116
|
topo.historyManager.endTransaction();
|
91
117
|
},
|
@@ -1,20 +1,20 @@
|
|
1
1
|
.content {
|
2
|
-
|
2
|
+
margin: 4px 0px 0px 6px;
|
3
3
|
.fontColor{
|
4
4
|
width: 100%;
|
5
|
-
|
5
|
+
margin-bottom: 16px;
|
6
6
|
.colorPanelBox{
|
7
7
|
padding: 9px;
|
8
8
|
padding-top: 8px;
|
9
9
|
}
|
10
10
|
&>span{
|
11
11
|
font-size: 12px;
|
12
|
-
color: black;
|
13
12
|
font-family: PingFangSC-Regular, PingFang SC;
|
14
13
|
font-weight: 400;
|
15
14
|
color: #4D6277;
|
16
15
|
line-height: 17px;
|
17
16
|
}
|
17
|
+
|
18
18
|
}
|
19
19
|
.backgroundColor{
|
20
20
|
width: 100%;
|
@@ -32,9 +32,8 @@
|
|
32
32
|
line-height: 17px;
|
33
33
|
}
|
34
34
|
.backOpacity{
|
35
|
-
margin-top:
|
35
|
+
margin-top: 5px;
|
36
36
|
margin-bottom: 5px;
|
37
|
-
margin-left: 11px;
|
38
37
|
line-height: 8px;
|
39
38
|
display: flex;
|
40
39
|
flex-direction: row;
|
@@ -57,7 +57,7 @@ function FontStyleButton(props) {
|
|
57
57
|
setValue = _useState2[1]; // 选中的元素
|
58
58
|
|
59
59
|
|
60
|
-
var selection = topo.
|
60
|
+
var selection = topo.selectionModel.useHtSelection();
|
61
61
|
useEffect(function () {
|
62
62
|
var isAllText = !selection.filter(function (ele) {
|
63
63
|
return !isText(ele);
|
@@ -18,7 +18,7 @@ function Layout(props) {
|
|
18
18
|
setLayout = _useState[1]; // 选中的元素
|
19
19
|
|
20
20
|
|
21
|
-
var selectionElements = topo.
|
21
|
+
var selectionElements = topo.selectionModel.useHtSelection();
|
22
22
|
|
23
23
|
var _topo$store$useModelS = topo.store.useModelState('selection'),
|
24
24
|
selection = _topo$store$useModelS.selection;
|
@@ -87,7 +87,7 @@ 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 selectionElements = topo.
|
90
|
+
var selectionElements = topo.selectionModel.useHtSelection();
|
91
91
|
var topoShowType = topoState.type; // 获取ID以及拓扑类型 // 拓扑类型:auto自由布局,layers分层,partition分区
|
92
92
|
|
93
93
|
var disabled = useMemo(function () {
|
@@ -34,7 +34,7 @@ function NodeAlignWidget(props) {
|
|
34
34
|
graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
|
35
35
|
|
36
36
|
|
37
|
-
var selection = topo.
|
37
|
+
var selection = topo.selectionModel.useHtSelection();
|
38
38
|
|
39
39
|
var setSpace = function setSpace(type, num) {
|
40
40
|
topo.historyManager.beginTransaction(); // eslint-disable-next-line no-shadow
|
@@ -68,6 +68,13 @@ function NodeAlignWidget(props) {
|
|
68
68
|
setLeftInputVal();
|
69
69
|
setRightInputVal();
|
70
70
|
setDistributionDisabled(nodes.length <= 2);
|
71
|
+
|
72
|
+
if (nodes.length === 2) {
|
73
|
+
var h = topo.view.topoClient.htTopoClient.getElementsSpace(nodes, 'h')[0];
|
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);
|
77
|
+
}
|
71
78
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
72
79
|
|
73
80
|
}, [graphLoaded, selection]);
|
@@ -25,7 +25,7 @@ function NodeImageButton(props) {
|
|
25
25
|
setImgVal = _useState2[1]; // 选中的元素
|
26
26
|
|
27
27
|
|
28
|
-
var selection = topo.
|
28
|
+
var selection = topo.selectionModel.useHtSelection();
|
29
29
|
useEffect(function () {
|
30
30
|
var nodes = selection.filter(function (ele) {
|
31
31
|
return isGroup(ele) || isNode(ele);
|
@@ -28,7 +28,7 @@ function NodeSizeButton(props) {
|
|
28
28
|
setSize = _useState2[1]; // 选中的元素
|
29
29
|
|
30
30
|
|
31
|
-
var selection = topo.
|
31
|
+
var selection = topo.selectionModel.useSelection();
|
32
32
|
var settingRuntimeState = useSettingRuntimeState();
|
33
33
|
useEffect(function () {
|
34
34
|
var elements = selection.map(function (item) {
|
@@ -16,7 +16,7 @@ function ElementTextStyleSetting(props) {
|
|
16
16
|
graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
|
17
17
|
|
18
18
|
|
19
|
-
var selection = topo.
|
19
|
+
var selection = topo.selectionModel.useSelection();
|
20
20
|
var htSelection = useMemo(function () {
|
21
21
|
if (!selection.length) {
|
22
22
|
return [];
|
@@ -7,7 +7,7 @@ function textStyleSettingRouter(Component, options) {
|
|
7
7
|
var names = (options === null || options === void 0 ? void 0 : options.names) || [];
|
8
8
|
return function TextStyleSettingButton(props) {
|
9
9
|
var topo = props.topo;
|
10
|
-
var selection = topo.
|
10
|
+
var selection = topo.selectionModel.useHtSelection();
|
11
11
|
var Widget = !selection.length ? GlobalTagStyleSetting : ElementTextStyleSetting;
|
12
12
|
return /*#__PURE__*/React.createElement(Widget, _extends({
|
13
13
|
Component: Component
|
@@ -1,9 +1,21 @@
|
|
1
|
+
@import '~@alifd/next/variables.scss';
|
2
|
+
|
3
|
+
|
1
4
|
.panel {
|
2
5
|
height: 100%;
|
3
6
|
display: flex;
|
4
7
|
flex-direction: column;
|
5
8
|
background: #FFFFFF;
|
9
|
+
|
10
|
+
|
11
|
+
:global {
|
12
|
+
.#{$css-prefix}drawer-header {
|
13
|
+
padding-left: 16px;
|
14
|
+
padding-right: 16px;
|
15
|
+
}
|
16
|
+
}
|
6
17
|
}
|
7
18
|
.body {
|
8
19
|
flex: 1;
|
20
|
+
overflow: auto;
|
9
21
|
}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import classNames from 'classnames';
|
2
|
-
import React from 'react';
|
2
|
+
import React, { useEffect, useMemo } from 'react';
|
3
3
|
import CloseablePanel from "./CloseablePanel";
|
4
|
-
import
|
4
|
+
import PropertyViewManager from "./core/PropertyViewManager";
|
5
5
|
import Settings from "./Settings";
|
6
6
|
import styles from "./Settings.module.scss";
|
7
|
-
export default function
|
7
|
+
export default function PropertyPanel(props) {
|
8
8
|
var _classNames;
|
9
9
|
|
10
10
|
var topo = props.topo,
|
@@ -22,37 +22,40 @@ export default function PropertyView(props) {
|
|
22
22
|
topoEditDispatchers = _topo$store$useModel[1];
|
23
23
|
|
24
24
|
var propertyPanelVisible = topoEditState.propertyPanelVisible;
|
25
|
+
var propertyViewManager = useMemo(function () {
|
26
|
+
return new PropertyViewManager(topo);
|
27
|
+
}, []);
|
28
|
+
useEffect(function () {
|
29
|
+
if (graphLoaded) {
|
30
|
+
propertyViewManager.init();
|
31
|
+
}
|
25
32
|
|
26
|
-
|
27
|
-
|
28
|
-
|
33
|
+
return function () {
|
34
|
+
propertyViewManager.destroy();
|
35
|
+
};
|
36
|
+
}, [graphLoaded, propertyViewManager]);
|
29
37
|
|
30
38
|
var renderContent = function renderContent() {
|
31
39
|
if (!propertyPanelVisible) {
|
32
40
|
return null;
|
33
41
|
}
|
34
42
|
|
35
|
-
return /*#__PURE__*/React.createElement(
|
36
|
-
topo: topo
|
37
|
-
}, /*#__PURE__*/React.createElement(Settings, {
|
43
|
+
return /*#__PURE__*/React.createElement(Settings, {
|
38
44
|
topo: topo,
|
45
|
+
selection: selection,
|
46
|
+
propertyViewManager: propertyViewManager,
|
39
47
|
topoShowType: topoShowType,
|
40
48
|
topoEditApi: topo.topoEdit,
|
41
|
-
selection: selection,
|
42
49
|
editorProps: editorProps
|
43
|
-
})
|
50
|
+
});
|
44
51
|
};
|
45
52
|
|
46
53
|
return /*#__PURE__*/React.createElement("div", {
|
47
|
-
className: classNames(styles.
|
54
|
+
className: classNames(styles.propertyPanel, (_classNames = {}, _classNames[styles.hide] = !propertyPanelVisible, _classNames))
|
48
55
|
}, /*#__PURE__*/React.createElement(CloseablePanel, {
|
49
56
|
title: "\u6570\u636E\u5C5E\u6027",
|
50
57
|
onClose: function onClose() {
|
51
|
-
|
52
|
-
propertyPanelVisible: false
|
53
|
-
});
|
58
|
+
propertyViewManager.close();
|
54
59
|
}
|
55
|
-
},
|
56
|
-
topo: topo
|
57
|
-
}, renderContent())));
|
60
|
+
}, renderContent()));
|
58
61
|
}
|
@@ -1,101 +1,63 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
-
import React from
|
3
|
-
import { isEdge, isGroup, isLayer, isNode, isText } from "../../../../utils/htElementDataUtil";
|
4
|
-
import propertyPanelMap from "./propertyViews";
|
2
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
5
3
|
import useSettingRuntimeState from "./useSettingRuntimeState";
|
6
|
-
import
|
4
|
+
import updateElementProperty from "./core/updateElementProperty";
|
7
5
|
|
8
|
-
function
|
9
|
-
var
|
10
|
-
var selectionSize = selection.length;
|
11
|
-
var elementType;
|
12
|
-
|
13
|
-
if (!selectionSize) {
|
14
|
-
// 未选
|
15
|
-
elementType = "view";
|
16
|
-
} else if (selectionSize >= 2) {
|
17
|
-
// 多选
|
18
|
-
elementType = "multiple";
|
19
|
-
} else if (isGroup(selectionElement)) {
|
20
|
-
elementType = "group";
|
21
|
-
} else if (selectionElement.attrObject.topLeftText) {
|
22
|
-
// TODO 临时方式
|
23
|
-
elementType = "box";
|
24
|
-
} else if (isNode(selectionElement)) {
|
25
|
-
elementType = "node";
|
26
|
-
} else if (isEdge(selectionElement)) {
|
27
|
-
elementType = "edge";
|
28
|
-
} else if (isLayer(selectionElement)) {
|
29
|
-
// 分层
|
30
|
-
elementType = "layer";
|
31
|
-
} else if (isText(selectionElement)) {
|
32
|
-
elementType = "text";
|
33
|
-
}
|
6
|
+
function buildElementValues(selection) {
|
7
|
+
var values = _extends({}, selection[0]);
|
34
8
|
|
35
|
-
|
9
|
+
var attrTypes = ['attrObject', 'position', 'styleMap'];
|
10
|
+
attrTypes.forEach(function (type) {
|
11
|
+
Object.keys(values[type] || {}).forEach(function (key) {
|
12
|
+
values[type + "." + key] = values[type][key];
|
13
|
+
});
|
14
|
+
});
|
15
|
+
return values;
|
36
16
|
}
|
37
17
|
|
38
|
-
export default function
|
18
|
+
export default function PropertyViewContainer(props) {
|
39
19
|
var topo = props.topo,
|
40
20
|
topoShowType = props.topoShowType,
|
41
21
|
topoEditApi = props.topoEditApi,
|
42
22
|
selection = props.selection,
|
43
|
-
editorProps = props.editorProps
|
44
|
-
|
45
|
-
|
46
|
-
var
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
} else if (name.startsWith("styleMap.")) {
|
55
|
-
element.setStyle(name.replace("styleMap.", ""), value);
|
56
|
-
} else if (name === "name") {
|
57
|
-
element.setName(value);
|
58
|
-
} else if (name === "width") {
|
59
|
-
element.setWidth(value);
|
60
|
-
} else if (name === "height") {
|
61
|
-
element.setHeight(value);
|
62
|
-
} else if (name === "image") {
|
63
|
-
element.setImage(value);
|
64
|
-
} else if (name === "layout") {
|
65
|
-
// console.info("element----layout", element, value);
|
66
|
-
var layouType = value.id === "toward" ? "" + value.id + value.options.subId : value.id;
|
67
|
-
topo.getHtTopo().layoutInContainer(layouType);
|
68
|
-
}
|
69
|
-
};
|
70
|
-
|
71
|
-
var elementType = getElementType(selection);
|
72
|
-
var PropertyView = propertyPanelMap[elementType];
|
23
|
+
editorProps = props.editorProps,
|
24
|
+
propertyViewManager = props.propertyViewManager;
|
25
|
+
var settingRuntimeState = useSettingRuntimeState();
|
26
|
+
var selectionElements = useMemo(function () {
|
27
|
+
return topo.selectionModel.getSelection();
|
28
|
+
}, [selection]);
|
29
|
+
var PropertyView = propertyViewManager.getPropertyView(selection); // 不建议使用,直接使用ht元素对象。待优化
|
30
|
+
|
31
|
+
var singleElementValues = useMemo(function () {
|
32
|
+
return selection.length === 1 ? buildElementValues(selection) : undefined;
|
33
|
+
}, [selection]);
|
73
34
|
|
74
35
|
if (!PropertyView) {
|
36
|
+
propertyViewManager.close();
|
75
37
|
return null;
|
76
38
|
}
|
77
39
|
|
78
|
-
var
|
40
|
+
var elementProps = {};
|
79
41
|
|
80
|
-
|
42
|
+
if (selection.length === 1) {
|
43
|
+
elementProps = {
|
44
|
+
selectionElement: selectionElements[0],
|
45
|
+
values: singleElementValues
|
46
|
+
};
|
47
|
+
}
|
81
48
|
|
82
|
-
|
83
|
-
Object.keys(values[type] || {}).forEach(function (key) {
|
84
|
-
values[type + "." + key] = values[type][key];
|
85
|
-
});
|
86
|
-
});
|
87
|
-
return /*#__PURE__*/React.createElement("div", {
|
88
|
-
className: styles.content
|
89
|
-
}, /*#__PURE__*/React.createElement(PropertyView, {
|
90
|
-
type: elementType,
|
49
|
+
return /*#__PURE__*/React.createElement(PropertyView, _extends({
|
91
50
|
topo: topo,
|
51
|
+
selection: selection,
|
52
|
+
selectionElements: selectionElements,
|
92
53
|
topoShowType: topoShowType,
|
93
54
|
topoEdit: topoEditApi,
|
94
55
|
topoEditApi: topoEditApi,
|
95
|
-
|
96
|
-
|
97
|
-
onChange:
|
98
|
-
|
56
|
+
editorProps: editorProps
|
57
|
+
}, elementProps, {
|
58
|
+
onChange: function onChange(name, value) {
|
59
|
+
updateElementProperty(topo, name, value);
|
60
|
+
},
|
99
61
|
settingRuntimeState: settingRuntimeState
|
100
62
|
}));
|
101
63
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
@import '~@alifd/next/variables.scss';
|
2
2
|
|
3
|
-
.
|
3
|
+
.propertyPanel {
|
4
4
|
width: 280px;
|
5
5
|
height: 100%;
|
6
6
|
position: absolute;
|
@@ -14,7 +14,7 @@
|
|
14
14
|
overflow: hidden;
|
15
15
|
transition: width .1s linear;
|
16
16
|
|
17
|
-
&.
|
17
|
+
&.hide {
|
18
18
|
width: 0;
|
19
19
|
border-left: none;
|
20
20
|
}
|
@@ -74,11 +74,3 @@
|
|
74
74
|
align-items: center;
|
75
75
|
}
|
76
76
|
}
|
77
|
-
|
78
|
-
.content {
|
79
|
-
flex: 1;
|
80
|
-
background: #FFFFFF;
|
81
|
-
overflow: auto;
|
82
|
-
// padding-bottom: 12px;
|
83
|
-
|
84
|
-
}
|