@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.
- package/build/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +21 -21
- package/es/components/VerticalIconTab/VerticalIconTab.module.scss +5 -1
- package/es/core/editor/components/Sidebar/Sidebar.js +23 -50
- package/es/core/editor/components/Sidebar/panes.js +32 -0
- package/es/core/editor/components/Sidebar/views/CanvasPanel/{ImagePanel.js → CanvasPanel.js} +1 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/index.js +1 -1
- package/es/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +2 -5
- package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +2 -4
- package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.module.scss +5 -0
- package/es/core/editor/components/Toolbar/EditorToolbar.js +9 -6
- package/es/core/editor/components/Toolbar/Toolbar.js +1 -1
- package/es/core/editor/components/Toolbar/Toolbar.module.scss +14 -3
- package/es/core/editor/components/Toolbar/widgets/AddResourceButton.js +6 -5
- package/es/core/editor/components/Toolbar/widgets/CanvasMoveWidget.js +13 -2
- package/es/core/editor/components/Toolbar/widgets/CanvasSelectWidget.js +11 -2
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +133 -3
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +46 -0
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +46 -0
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +31 -0
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +27 -6
- package/es/core/editor/components/Toolbar/widgets/HistoryRedoButton.js +2 -1
- package/es/core/editor/components/Toolbar/widgets/HistoryUndoButton.js +3 -2
- package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +2 -1
- package/es/core/editor/components/Toolbar/widgets/WidgetBox.js +7 -20
- package/es/core/editor/components/Toolbar/widgets/WidgetBox.module.scss +1 -0
- package/es/core/editor/components/Toolbar/widgets/components/ButtonBox.js +4 -2
- package/es/core/editor/components/Toolbar/widgets/components/DropdownButton.js +8 -5
- package/es/core/editor/components/settings/common/LineType/index.js +3 -19
- package/es/core/editor/components/settings/common/SizeInput/NodeSizeInput.js +3 -0
- package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +2 -37
- package/es/core/{store/models → editor/store}/background.js +0 -0
- package/es/core/{store/models → editor/store}/historyManager.js +0 -0
- package/es/core/{store/models → editor/store}/topoEdit.js +8 -1
- package/es/core/editor/utils/edgeTypeStyleUtil.js +73 -0
- package/es/core/hooks/useTopoEdit.js +21 -54
- package/es/core/models/TopoApp.js +1 -1
- package/es/core/models/TopoGraphView.js +8 -2
- package/es/core/store/coreModels.js +6 -7
- package/lib/components/VerticalIconTab/VerticalIconTab.module.scss +5 -1
- package/lib/core/editor/components/Sidebar/Sidebar.js +22 -53
- package/lib/core/editor/components/Sidebar/panes.js +45 -0
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/{ImagePanel.js → CanvasPanel.js} +2 -2
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/index.js +2 -2
- package/lib/core/editor/components/Sidebar/views/ImagePanel/HtCustomImagePanel.js +2 -5
- package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +3 -4
- package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.module.scss +5 -0
- package/lib/core/editor/components/Toolbar/EditorToolbar.js +10 -6
- package/lib/core/editor/components/Toolbar/Toolbar.js +1 -1
- package/lib/core/editor/components/Toolbar/Toolbar.module.scss +14 -3
- package/lib/core/editor/components/Toolbar/widgets/AddResourceButton.js +6 -5
- package/lib/core/editor/components/Toolbar/widgets/CanvasMoveWidget.js +13 -2
- package/lib/core/editor/components/Toolbar/widgets/CanvasSelectWidget.js +11 -2
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.js +143 -3
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/EdgeType.module.scss +46 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.js +61 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/LineType.module.scss +31 -0
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +27 -5
- package/lib/core/editor/components/Toolbar/widgets/HistoryRedoButton.js +3 -1
- package/lib/core/editor/components/Toolbar/widgets/HistoryUndoButton.js +3 -1
- package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +2 -1
- package/lib/core/editor/components/Toolbar/widgets/WidgetBox.js +9 -24
- package/lib/core/editor/components/Toolbar/widgets/WidgetBox.module.scss +1 -0
- package/lib/core/editor/components/Toolbar/widgets/components/ButtonBox.js +4 -2
- package/lib/core/editor/components/Toolbar/widgets/components/DropdownButton.js +8 -5
- package/lib/core/editor/components/settings/common/LineType/index.js +3 -18
- package/lib/core/editor/components/settings/common/SizeInput/NodeSizeInput.js +3 -0
- package/lib/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js +2 -37
- package/lib/core/{store/models → editor/store}/background.js +0 -0
- package/lib/core/{store/models → editor/store}/historyManager.js +0 -0
- package/lib/core/{store/models → editor/store}/topoEdit.js +8 -1
- package/lib/core/editor/utils/edgeTypeStyleUtil.js +82 -0
- package/lib/core/hooks/useTopoEdit.js +21 -56
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/core/models/TopoGraphView.js +8 -2
- package/lib/core/store/coreModels.js +5 -7
- package/package.json +2 -2
- package/es/core/store/models/topoView.js +0 -36
- package/lib/core/store/models/topoView.js +0 -47
@@ -1,6 +1,7 @@
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
2
2
|
var _excluded = ["topo", "showLabel"];
|
3
|
-
import React, { useEffect, useState } from 'react';
|
3
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
4
|
+
import { getEdgesBySelection, setEdgesType } from "../../../../utils/edgeTypeStyleUtil";
|
4
5
|
import DropdownButton from "../components/DropdownButton";
|
5
6
|
import WidgetBox from "../WidgetBox";
|
6
7
|
import EdgeType from "./EdgeType";
|
@@ -15,15 +16,32 @@ function EdgeTypeButton(props) {
|
|
15
16
|
showLabel = props.showLabel,
|
16
17
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
17
18
|
|
18
|
-
var _useState = useState(
|
19
|
+
var _useState = useState(false),
|
19
20
|
disabled = _useState[0],
|
20
|
-
setDisabled = _useState[1]; //
|
21
|
+
setDisabled = _useState[1]; // 拓扑图是否加载
|
22
|
+
|
23
|
+
|
24
|
+
var _topo$store$useModelS = topo.store.useModelState('topoMod'),
|
25
|
+
graphLoaded = _topo$store$useModelS.graphLoaded; // 选中的元素
|
21
26
|
|
22
27
|
|
23
28
|
var selection = topo.selectionManager.useSelection();
|
24
29
|
useEffect(function () {
|
25
|
-
|
26
|
-
|
30
|
+
if (graphLoaded) {
|
31
|
+
var edges = getEdgesBySelection(topo);
|
32
|
+
console.info('xxxx', edges, selection);
|
33
|
+
setDisabled(!edges.length);
|
34
|
+
}
|
35
|
+
}, [selection, graphLoaded]);
|
36
|
+
|
37
|
+
var handleChange = function handleChange(name, value) {
|
38
|
+
var edges = getEdgesBySelection(topo);
|
39
|
+
|
40
|
+
if (name === 'lineButton') {
|
41
|
+
setEdgesType(edges, value, topo);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
27
45
|
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
28
46
|
src: "/img/topo/editor/toolbar/\u7EBF\u5F62/Disable.svg",
|
29
47
|
alt: ""
|
@@ -34,11 +52,14 @@ function EdgeTypeButton(props) {
|
|
34
52
|
return /*#__PURE__*/React.createElement(WidgetBox, {
|
35
53
|
label: "\u7EBF\u5F62",
|
36
54
|
tooltip: "\u7EBF\u5F62",
|
55
|
+
disabled: disabled,
|
37
56
|
showLabel: showLabel
|
38
57
|
}, /*#__PURE__*/React.createElement(DropdownButton, {
|
39
58
|
disabled: disabled,
|
40
59
|
trigger: icon
|
41
|
-
}, /*#__PURE__*/React.createElement(EdgeType,
|
60
|
+
}, /*#__PURE__*/React.createElement(EdgeType, {
|
61
|
+
onChange: handleChange
|
62
|
+
})));
|
42
63
|
}
|
43
64
|
|
44
65
|
export default EdgeTypeButton;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import WidgetBox from "./WidgetBox";
|
3
|
+
import ButtonBox from "./components/ButtonBox";
|
3
4
|
|
4
5
|
function HistoryRedoButton(props) {
|
5
6
|
var topo = props.topo,
|
@@ -13,7 +14,7 @@ function HistoryRedoButton(props) {
|
|
13
14
|
label: "\u6062\u590D",
|
14
15
|
tooltip: "\u6062\u590D",
|
15
16
|
showLabel: showLabel
|
16
|
-
}, /*#__PURE__*/React.createElement(
|
17
|
+
}, /*#__PURE__*/React.createElement(ButtonBox, null, /*#__PURE__*/React.createElement("img", {
|
17
18
|
src: "/img/topo/editor/toolbar/redo/" + (disabled ? 'Disable' : 'Normal') + ".svg",
|
18
19
|
alt: ""
|
19
20
|
})));
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React from 'react';
|
2
|
+
import ButtonBox from "./components/ButtonBox"; // import { Icon, Button } from '@alifd/next';
|
2
3
|
|
3
4
|
import WidgetBox from "./WidgetBox";
|
4
5
|
|
@@ -15,7 +16,7 @@ function HistoryUndoButton(props) {
|
|
15
16
|
label: "\u64A4\u9500",
|
16
17
|
tooltip: "\u64A4\u9500",
|
17
18
|
showLabel: showLabel
|
18
|
-
}, /*#__PURE__*/React.createElement(
|
19
|
+
}, /*#__PURE__*/React.createElement(ButtonBox, {
|
19
20
|
disabled: disabled,
|
20
21
|
onClick: function onClick() {
|
21
22
|
topo.historyManager.undo();
|
@@ -1,9 +1,6 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
1
|
import _Balloon from "@alifd/next/es/balloon";
|
4
|
-
var _excluded = ["active", "disabled", "children"];
|
5
|
-
import classNames from 'classnames';
|
6
2
|
import React from 'react';
|
3
|
+
import ButtonBox from "./components/ButtonBox";
|
7
4
|
import styles from "./WidgetBox.module.scss";
|
8
5
|
|
9
6
|
function WidgetBox(props) {
|
@@ -12,9 +9,8 @@ function WidgetBox(props) {
|
|
12
9
|
tooltip = props.tooltip,
|
13
10
|
disabled = props.disabled,
|
14
11
|
children = props.children;
|
15
|
-
var button = /*#__PURE__*/React.createElement("
|
12
|
+
var button = /*#__PURE__*/React.createElement("div", {
|
16
13
|
disabled: disabled,
|
17
|
-
type: "button",
|
18
14
|
className: styles.container
|
19
15
|
}, /*#__PURE__*/React.createElement("div", {
|
20
16
|
className: styles.content
|
@@ -28,22 +24,13 @@ function WidgetBox(props) {
|
|
28
24
|
|
29
25
|
return /*#__PURE__*/React.createElement(_Balloon.Tooltip, {
|
30
26
|
trigger: button,
|
31
|
-
align: "b"
|
27
|
+
align: "b" // 解决遮挡下拉浮层问题
|
28
|
+
,
|
29
|
+
popupStyle: {
|
30
|
+
zIndex: 1000
|
31
|
+
}
|
32
32
|
}, tooltip);
|
33
33
|
}
|
34
34
|
|
35
|
-
function ButtonBox(props) {
|
36
|
-
var _classNames;
|
37
|
-
|
38
|
-
var active = props.active,
|
39
|
-
disabled = props.disabled,
|
40
|
-
children = props.children,
|
41
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
42
|
-
|
43
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
44
|
-
className: classNames(styles.ButtonBox, (_classNames = {}, _classNames[styles.ButtonBoxActive] = active, _classNames[styles.ButtonBoxDisabled] = disabled, _classNames))
|
45
|
-
}, otherProps), children);
|
46
|
-
}
|
47
|
-
|
48
35
|
WidgetBox.ButtonBox = ButtonBox;
|
49
36
|
export default WidgetBox;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _Icon from "@alifd/next/es/icon";
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
4
|
-
var _excluded = ["active", "disabled", "showArrow", "children"];
|
4
|
+
var _excluded = ["active", "disabled", "showArrow", "children", "onClick"];
|
5
5
|
import React from 'react';
|
6
6
|
import PropTypes from 'prop-types';
|
7
7
|
import classNames from 'classnames';
|
@@ -14,10 +14,12 @@ function ButtonBox(props) {
|
|
14
14
|
disabled = props.disabled,
|
15
15
|
showArrow = props.showArrow,
|
16
16
|
children = props.children,
|
17
|
+
onClick = props.onClick,
|
17
18
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
18
19
|
|
19
20
|
return /*#__PURE__*/React.createElement("div", _extends({
|
20
|
-
className: classNames(styles.ButtonBox, (_classNames = {}, _classNames[styles.ButtonBoxActive] = active, _classNames[styles.ButtonBoxDisabled] = disabled, _classNames))
|
21
|
+
className: classNames(styles.ButtonBox, (_classNames = {}, _classNames[styles.ButtonBoxActive] = active, _classNames[styles.ButtonBoxDisabled] = disabled, _classNames)),
|
22
|
+
onClick: disabled ? undefined : onClick
|
21
23
|
}, otherProps), children, showArrow && /*#__PURE__*/React.createElement(React.Fragment, null, "\xA0", /*#__PURE__*/React.createElement(_Icon, {
|
22
24
|
type: "tree_fold_arrow",
|
23
25
|
size: "xxs",
|
@@ -6,6 +6,7 @@ import styles from "./DropdownButton.module.scss";
|
|
6
6
|
|
7
7
|
function DropdownButton(props) {
|
8
8
|
var trigger = props.trigger,
|
9
|
+
disabled = props.disabled,
|
9
10
|
_props$showArrow = props.showArrow,
|
10
11
|
showArrow = _props$showArrow === void 0 ? true : _props$showArrow,
|
11
12
|
_props$showContainer = props.showContainer,
|
@@ -13,18 +14,20 @@ function DropdownButton(props) {
|
|
13
14
|
children = props.children;
|
14
15
|
|
15
16
|
var _useState = useState(false),
|
16
|
-
|
17
|
-
|
17
|
+
active = _useState[0],
|
18
|
+
setActive = _useState[1];
|
18
19
|
|
19
20
|
var button = /*#__PURE__*/React.createElement(ButtonBox, {
|
20
|
-
active:
|
21
|
+
active: active,
|
22
|
+
disabled: disabled,
|
21
23
|
showArrow: showArrow
|
22
24
|
}, trigger);
|
23
25
|
return /*#__PURE__*/React.createElement(_Dropdown, {
|
24
|
-
visible:
|
26
|
+
visible: active,
|
27
|
+
disabled: disabled,
|
25
28
|
trigger: button,
|
26
29
|
triggerType: "click",
|
27
|
-
onVisibleChange:
|
30
|
+
onVisibleChange: setActive
|
28
31
|
}, !showContainer ? children : /*#__PURE__*/React.createElement(PopupCard, null, children));
|
29
32
|
}
|
30
33
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import _Box from "@alifd/next/es/box";
|
2
2
|
import _Button from "@alifd/next/es/button";
|
3
3
|
import React, { useState } from "react";
|
4
|
-
import styles from "./LineType.module.scss";
|
4
|
+
import styles from "./LineType.module.scss";
|
5
|
+
import { setEdgesType } from "../../../../utils/edgeTypeStyleUtil"; // 直线 2. 直线单向箭头 3. 直线双向箭头 4. 双折线 5. 双折线单向箭头 6. 弧线
|
5
6
|
// 7. 弧线单向箭头 8. 内向双向箭头 9. 纵向折线 10. 纵向折线带箭头 11. 水平折线 12. 水平折线带箭头
|
6
7
|
|
7
8
|
var LINE_TYPE_OPTIONS = [{
|
@@ -66,24 +67,7 @@ var LineType = function LineType(props) {
|
|
66
67
|
|
67
68
|
var setLineType = function setLineType(type) {
|
68
69
|
var edges = getEdges();
|
69
|
-
|
70
|
-
edges.forEach(function (edge) {
|
71
|
-
htTopo.setGraphLinear(edge, {
|
72
|
-
type: type
|
73
|
-
});
|
74
|
-
|
75
|
-
if (edge.isEdgeGroupAgent()) {
|
76
|
-
// 连线组折叠时同时设置子连线
|
77
|
-
var edgeChildren = edge.getEdgeGroup().getEdges().toArray();
|
78
|
-
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), true);
|
79
|
-
edgeChildren.forEach(function (edgeChild) {
|
80
|
-
htTopo.setGraphLinear(edgeChild, {
|
81
|
-
type: type
|
82
|
-
});
|
83
|
-
});
|
84
|
-
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), false);
|
85
|
-
}
|
86
|
-
});
|
70
|
+
setEdgesType(edges, type, topo);
|
87
71
|
};
|
88
72
|
|
89
73
|
var handleChange = function handleChange(data) {
|
@@ -26,6 +26,7 @@ function SizeInput(props) {
|
|
26
26
|
onLockChange = props.onLockChange,
|
27
27
|
_props$showLabel = props.showLabel,
|
28
28
|
showLabel = _props$showLabel === void 0 ? true : _props$showLabel,
|
29
|
+
hasTrigger = props.hasTrigger,
|
29
30
|
size = props.size;
|
30
31
|
|
31
32
|
var handleChange = function handleChange(name, attrValue) {
|
@@ -73,6 +74,7 @@ function SizeInput(props) {
|
|
73
74
|
step: step,
|
74
75
|
placeholder: "\u8BF7\u8F93\u5165",
|
75
76
|
size: size,
|
77
|
+
hasTrigger: hasTrigger,
|
76
78
|
style: {
|
77
79
|
width: '100%'
|
78
80
|
},
|
@@ -104,6 +106,7 @@ function SizeInput(props) {
|
|
104
106
|
step: step,
|
105
107
|
placeholder: "\u8BF7\u8F93\u5165",
|
106
108
|
size: size,
|
109
|
+
hasTrigger: hasTrigger,
|
107
110
|
style: {
|
108
111
|
width: '100%'
|
109
112
|
},
|
package/es/core/editor/components/settings/propertyViews/multipleElements/MultipleElementLineType.js
CHANGED
@@ -1,48 +1,13 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { getEdgesBySelection } from "../../../../utils/edgeTypeStyleUtil";
|
3
3
|
import LineType from "../../common/LineType";
|
4
4
|
export default function MultipleElementLineType(props) {
|
5
5
|
var topo = props.topo;
|
6
6
|
|
7
7
|
var setLineType = function setLineType(type) {};
|
8
8
|
|
9
|
-
var getChildrenNodeIds = function getChildrenNodeIds(nodes) {
|
10
|
-
var nodeIds = nodes.map(function (node) {
|
11
|
-
return node.getId();
|
12
|
-
});
|
13
|
-
nodes.forEach(function (node) {
|
14
|
-
if (node instanceof ht.Group) {
|
15
|
-
var children = node.getChildren().toArray();
|
16
|
-
nodeIds.push.apply(nodeIds, getChildrenNodeIds(children));
|
17
|
-
}
|
18
|
-
});
|
19
|
-
return nodeIds;
|
20
|
-
};
|
21
|
-
|
22
9
|
var getSelectedEdges = function getSelectedEdges() {
|
23
|
-
|
24
|
-
var selection = gv.getSelectionModel().getSelection().toArray();
|
25
|
-
var edges = selection.filter(function (element) {
|
26
|
-
return element instanceof ht.Edge;
|
27
|
-
}); // 查询选中节点间的连线
|
28
|
-
|
29
|
-
var nodes = selection.filter(function (element) {
|
30
|
-
return element instanceof ht.Node;
|
31
|
-
});
|
32
|
-
var nodeIds = getChildrenNodeIds(nodes);
|
33
|
-
var dm = gv.getDataModel();
|
34
|
-
getEdges(dm).forEach(function (edge) {
|
35
|
-
if (nodeIds.find(function (nodeId) {
|
36
|
-
return nodeId === edge.getSource().getId();
|
37
|
-
}) && nodeIds.find(function (nodeId) {
|
38
|
-
return nodeId === edge.getTarget().getId();
|
39
|
-
}) && !edges.find(function (item) {
|
40
|
-
return item === edge;
|
41
|
-
})) {
|
42
|
-
edges.push(edge);
|
43
|
-
}
|
44
|
-
});
|
45
|
-
return edges;
|
10
|
+
return getEdgesBySelection(topo);
|
46
11
|
};
|
47
12
|
|
48
13
|
return /*#__PURE__*/React.createElement(LineType, {
|
File without changes
|
File without changes
|
@@ -10,7 +10,14 @@ import topoService from '@riil-frontend/component-topology-common/es/services/to
|
|
10
10
|
export default {
|
11
11
|
// 定义 model 的初始 state
|
12
12
|
state: {
|
13
|
-
|
13
|
+
// 是否就绪
|
14
|
+
ready: false,
|
15
|
+
// 保存状态
|
16
|
+
saving: false,
|
17
|
+
// 选择/拖动模式模式。默认选择模式 select|move
|
18
|
+
viewMouseMode: 'select',
|
19
|
+
// 资源面板展开项
|
20
|
+
resourceTabactiveKey: null
|
14
21
|
},
|
15
22
|
// 定义改变该模型状态的纯函数
|
16
23
|
reducers: {
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { getEdges } from "../../../utils/htElementUtils";
|
2
|
+
var ht = window.ht;
|
3
|
+
export function getEdgesBySelection(topo) {
|
4
|
+
var getChildrenNodeIds = function getChildrenNodeIds(nodes) {
|
5
|
+
var nodeIds = nodes.map(function (node) {
|
6
|
+
return node.getId();
|
7
|
+
});
|
8
|
+
nodes.forEach(function (node) {
|
9
|
+
if (node instanceof ht.Group) {
|
10
|
+
var children = node.getChildren().toArray();
|
11
|
+
nodeIds.push.apply(nodeIds, getChildrenNodeIds(children));
|
12
|
+
}
|
13
|
+
});
|
14
|
+
return nodeIds;
|
15
|
+
};
|
16
|
+
|
17
|
+
var getSelectedEdges = function getSelectedEdges(topo) {
|
18
|
+
var gv = topo.getGraphView();
|
19
|
+
var selection = gv.getSelectionModel().getSelection().toArray(); // 选中的连线
|
20
|
+
|
21
|
+
var edges = selection.filter(function (element) {
|
22
|
+
return element instanceof ht.Edge;
|
23
|
+
}); // 查询选中节点间的连线
|
24
|
+
|
25
|
+
var nodes = selection.filter(function (element) {
|
26
|
+
return element instanceof ht.Node;
|
27
|
+
});
|
28
|
+
var nodeIds = getChildrenNodeIds(nodes);
|
29
|
+
var dm = gv.getDataModel();
|
30
|
+
getEdges(dm).forEach(function (edge) {
|
31
|
+
if (nodeIds.find(function (nodeId) {
|
32
|
+
return nodeId === edge.getSource().getId();
|
33
|
+
}) && nodeIds.find(function (nodeId) {
|
34
|
+
return nodeId === edge.getTarget().getId();
|
35
|
+
}) && !edges.find(function (item) {
|
36
|
+
return item === edge;
|
37
|
+
})) {
|
38
|
+
edges.push(edge);
|
39
|
+
}
|
40
|
+
});
|
41
|
+
return edges;
|
42
|
+
};
|
43
|
+
|
44
|
+
return getSelectedEdges(topo);
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* 批量设置连线线形
|
48
|
+
*
|
49
|
+
* @param {*} edges
|
50
|
+
* @param {*} type
|
51
|
+
* @param {*} topo
|
52
|
+
*/
|
53
|
+
|
54
|
+
export function setEdgesType(edges, type, topo) {
|
55
|
+
var htTopo = topo.getHtTopo();
|
56
|
+
edges.forEach(function (edge) {
|
57
|
+
htTopo.setGraphLinear(edge, {
|
58
|
+
type: type
|
59
|
+
});
|
60
|
+
|
61
|
+
if (edge.isEdgeGroupAgent()) {
|
62
|
+
// 连线组折叠时同时设置子连线
|
63
|
+
var edgeChildren = edge.getEdgeGroup().getEdges().toArray();
|
64
|
+
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), true);
|
65
|
+
edgeChildren.forEach(function (edgeChild) {
|
66
|
+
htTopo.setGraphLinear(edgeChild, {
|
67
|
+
type: type
|
68
|
+
});
|
69
|
+
});
|
70
|
+
htTopo.toggleEdgeGroup(edge.getSource(), edge.getTarget(), false);
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
@@ -43,8 +43,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
43
43
|
editDispatchers = _store$useModel[1];
|
44
44
|
|
45
45
|
var topoDispatchers = store.useModelDispatchers("topoMod");
|
46
|
-
var _editState$groups = editState.groups,
|
47
|
-
groups = _editState$groups === void 0 ? [] : _editState$groups;
|
48
46
|
|
49
47
|
var _useState = useState(false),
|
50
48
|
showComboResDrawer = _useState[0],
|
@@ -288,55 +286,6 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
288
286
|
var deleteNode = function deleteNode(node) {
|
289
287
|
emitEvent(TopoEvent.EVENT_TRIGGER_DELETE, node);
|
290
288
|
};
|
291
|
-
/**
|
292
|
-
* 删除视图内的资源
|
293
|
-
*/
|
294
|
-
|
295
|
-
|
296
|
-
var deleteViewNode = function deleteViewNode(node) {
|
297
|
-
var nodeId = node.id;
|
298
|
-
var viewResources = resourceConfig.getViewResources();
|
299
|
-
var index = viewResources["static"].indexOf(nodeId);
|
300
|
-
|
301
|
-
if (index > -1) {
|
302
|
-
editDispatchers.updateResources({
|
303
|
-
"static": viewResources["static"].filter(function (item) {
|
304
|
-
return item !== nodeId;
|
305
|
-
})
|
306
|
-
});
|
307
|
-
}
|
308
|
-
};
|
309
|
-
/**
|
310
|
-
* 删除容器内的单个资源
|
311
|
-
*
|
312
|
-
* @param allGroups
|
313
|
-
* @param node 资源
|
314
|
-
*/
|
315
|
-
|
316
|
-
|
317
|
-
var deleteGroupNode = function deleteGroupNode(allGroups, node) {
|
318
|
-
var nodeId = node.id; // 更新容器内的资源
|
319
|
-
|
320
|
-
var newGroups = allGroups.map(function (g) {
|
321
|
-
var newGroup = g;
|
322
|
-
|
323
|
-
if (resourceConfig.isGroupContainsNode(g, node)) {
|
324
|
-
newGroup = _extends({}, g, {
|
325
|
-
resources: resourceConfig.removeStaticResource(g.resources, nodeId)
|
326
|
-
});
|
327
|
-
}
|
328
|
-
|
329
|
-
return newGroup;
|
330
|
-
});
|
331
|
-
rlog.info("删除容器内的单个资源", {
|
332
|
-
groups: groups,
|
333
|
-
node: node,
|
334
|
-
newGroups: newGroups
|
335
|
-
});
|
336
|
-
editDispatchers.update({
|
337
|
-
groups: newGroups
|
338
|
-
});
|
339
|
-
};
|
340
289
|
|
341
290
|
var handleDeleteNode = function handleDeleteNode(element) {
|
342
291
|
var _topo$options$editor;
|
@@ -643,9 +592,13 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
643
592
|
topo.linkDynamicStyleExecutor.execute();
|
644
593
|
}
|
645
594
|
|
646
|
-
topo.historyManager.endTransaction();
|
595
|
+
topo.historyManager.endTransaction(); // 添加资源后隐藏资源面板
|
647
596
|
|
648
|
-
|
597
|
+
topoEditDispatchers.update({
|
598
|
+
resourceTabactiveKey: null
|
599
|
+
});
|
600
|
+
|
601
|
+
case 13:
|
649
602
|
case "end":
|
650
603
|
return _context15.stop();
|
651
604
|
}
|
@@ -727,8 +680,11 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
727
680
|
|
728
681
|
case 9:
|
729
682
|
topo.historyManager.endTransaction();
|
683
|
+
topoEditDispatchers.update({
|
684
|
+
resourceTabactiveKey: null
|
685
|
+
});
|
730
686
|
|
731
|
-
case
|
687
|
+
case 11:
|
732
688
|
case "end":
|
733
689
|
return _context7.stop();
|
734
690
|
}
|
@@ -1113,6 +1069,16 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1113
1069
|
|
1114
1070
|
var effectsState = store.useModelEffectsState("topoConfig");
|
1115
1071
|
var topoLoading = effectsState.getTopoByConditions.isLoading;
|
1072
|
+
/**
|
1073
|
+
* 设置视图鼠标模式
|
1074
|
+
*/
|
1075
|
+
|
1076
|
+
var setViewMouseMode = useCallback(function (mode) {
|
1077
|
+
topo.getHtTopo().setViewMouseMode(mode);
|
1078
|
+
topoEditDispatchers.update({
|
1079
|
+
viewMouseMode: mode
|
1080
|
+
});
|
1081
|
+
}, []);
|
1116
1082
|
return {
|
1117
1083
|
resourceConfig: resourceConfig,
|
1118
1084
|
|
@@ -1120,6 +1086,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1120
1086
|
* 拓扑结构加载中状态
|
1121
1087
|
*/
|
1122
1088
|
topoLoading: topoLoading,
|
1089
|
+
setViewMouseMode: setViewMouseMode,
|
1123
1090
|
|
1124
1091
|
/**
|
1125
1092
|
* 资源绑定(多选)抽屉显示状态
|
@@ -22,7 +22,7 @@ import topoFactory from "./topoFactory";
|
|
22
22
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
23
23
|
import SelectionManager from "./SelectionManager"; // eslint-disable-next-line no-undef
|
24
24
|
|
25
|
-
var version = typeof "6.0.0-alpha.
|
25
|
+
var version = typeof "6.0.0-alpha.6" === 'string' ? "6.0.0-alpha.6" : null;
|
26
26
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
27
27
|
/**
|
28
28
|
* 拓扑显示和编辑
|
@@ -26,10 +26,16 @@ var TopoGraphView = /*#__PURE__*/function () {
|
|
26
26
|
this.contextMenu = new ContextMenu();
|
27
27
|
};
|
28
28
|
|
29
|
-
_proto.
|
29
|
+
_proto.getHtGraphView = function getHtGraphView() {
|
30
30
|
var _this$topoClient;
|
31
31
|
|
32
|
-
return (_this$topoClient = this.topoClient) === null || _this$topoClient === void 0 ? void 0 : _this$topoClient.
|
32
|
+
return (_this$topoClient = this.topoClient) === null || _this$topoClient === void 0 ? void 0 : _this$topoClient.getGraphView();
|
33
|
+
};
|
34
|
+
|
35
|
+
_proto.getHtDataModel = function getHtDataModel() {
|
36
|
+
var _this$topoClient2;
|
37
|
+
|
38
|
+
return (_this$topoClient2 = this.topoClient) === null || _this$topoClient2 === void 0 ? void 0 : _this$topoClient2.getDataModel();
|
33
39
|
}
|
34
40
|
/**
|
35
41
|
* 缩放平移整个拓扑以展示所有的图元
|
@@ -2,12 +2,12 @@ import topoMod from "./models/topoMod";
|
|
2
2
|
import customIcon from "./models/customIcon";
|
3
3
|
import ciModel from "./models/ciModel";
|
4
4
|
import topoBizMod from "./models/topoBizMod";
|
5
|
-
import topoConfig from "./models/topoConfig";
|
6
|
-
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import historyManager from "
|
10
|
-
import
|
5
|
+
import topoConfig from "./models/topoConfig"; // 编辑模式
|
6
|
+
|
7
|
+
import topoEdit from "../editor/store/topoEdit";
|
8
|
+
import background from "../editor/store/background";
|
9
|
+
import historyManager from "../editor/store/historyManager";
|
10
|
+
import selection from "./models/selection"; // 显示模式
|
11
11
|
|
12
12
|
import topoAlarm from "./models/topoAlarm";
|
13
13
|
import displayConfig from "./models/displayConfig";
|
@@ -21,7 +21,6 @@ export default {
|
|
21
21
|
topoConfig: topoConfig,
|
22
22
|
historyManager: historyManager,
|
23
23
|
background: background,
|
24
|
-
topoGraphView: topoGraphView,
|
25
24
|
ciModel: ciModel,
|
26
25
|
topoEdit: topoEdit,
|
27
26
|
// 显示模式
|
@@ -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 {
|