@riil-frontend/component-topology 6.0.0-alpha.49 → 6.0.0-alpha.50
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.js +1 -1
- package/es/core/editor/components/EditorPlugin.js +6 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/{useCanvasThemeConfig.js → hooks/useCanvasThemeConfig.js} +25 -12
- package/es/core/editor/components/Sidebar/views/CanvasPanel/hooks/useNewElementTheme.js +32 -0
- package/es/core/editor/components/Sidebar/views/CanvasPanel/themes.js +24 -0
- package/es/core/editor/components/Sidebar/views/CanvasPanel/utils/elementThemeUtil.js +0 -0
- package/es/core/editor/components/Toolbar/widgets/Layout/index.js +2 -2
- package/es/core/editor/components/settings/Settings.js +5 -1
- package/es/core/editor/components/settings/core/PropertyViewManager.js +8 -1
- package/es/core/editor/components/settings/propertyViews/node/data/NodeRelateResourceButton.js +1 -1
- package/es/core/editor/store/topoEdit.js +16 -12
- package/es/core/hooks/useTopoEdit.js +5 -0
- package/es/core/models/SelectionModel.js +5 -0
- package/es/core/models/TopoApp.js +1 -1
- package/lib/core/editor/components/EditorPlugin.js +10 -1
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +1 -1
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/{useCanvasThemeConfig.js → hooks/useCanvasThemeConfig.js} +26 -12
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/hooks/useNewElementTheme.js +48 -0
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/themes.js +24 -0
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/utils/elementThemeUtil.js +1 -0
- package/lib/core/editor/components/Toolbar/widgets/Layout/index.js +2 -2
- package/lib/core/editor/components/settings/Settings.js +5 -1
- package/lib/core/editor/components/settings/core/PropertyViewManager.js +8 -1
- package/lib/core/editor/components/settings/propertyViews/node/data/NodeRelateResourceButton.js +1 -1
- package/lib/core/editor/store/topoEdit.js +17 -12
- package/lib/core/hooks/useTopoEdit.js +5 -0
- package/lib/core/models/SelectionModel.js +5 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
-
import React from "react";
|
2
|
+
import React, { useEffect } from "react";
|
3
3
|
import CustomIconPlugin from "./CustomIconPlugin";
|
4
4
|
import SaveLoading from "./plugins/SaveLoading";
|
5
5
|
import MultipleResourceSelectPlugin from "./plugins/MultipleResourceSelectPlugin";
|
@@ -11,6 +11,11 @@ export default function TopoEditorPlugin(props) {
|
|
11
11
|
topoEdit = props.topoEdit,
|
12
12
|
editorProps = props.editorProps;
|
13
13
|
var store = topo.store;
|
14
|
+
useEffect(function () {
|
15
|
+
return function () {
|
16
|
+
topoEdit.reset();
|
17
|
+
};
|
18
|
+
}, []);
|
14
19
|
var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, CustomIconPlugin, MetricPollingPlugin].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
|
15
20
|
return /*#__PURE__*/React.createElement(React.Fragment, null, plugins.map(function (Plugin, index) {
|
16
21
|
return /*#__PURE__*/React.createElement(Plugin, _extends({
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _Tag from "@alifd/next/es/tag";
|
2
2
|
import React, { useState } from 'react';
|
3
3
|
import styles from "./CanvasPanel.module.scss";
|
4
|
-
import useCanvasThemeConfig from "./useCanvasThemeConfig";
|
4
|
+
import useCanvasThemeConfig from "./hooks/useCanvasThemeConfig";
|
5
5
|
export default function CanvasPanel(props) {
|
6
6
|
var topo = props.topo;
|
7
7
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
|
-
import { isClusterHtElement } from "
|
5
|
-
import { getElements, isEdge, isGroup, isLayer, isNode, isText } from "
|
6
|
-
import THEMES from "
|
4
|
+
import { isClusterHtElement } from "../../../../../../../utils/clusterUtil";
|
5
|
+
import { getElements, isEdge, isGroup, isLayer, isNode, isText } from "../../../../../../../utils/htElementUtils";
|
6
|
+
import THEMES from "../themes";
|
7
|
+
import useNewElementTheme from "./useNewElementTheme";
|
7
8
|
|
8
9
|
function useCanvasThemeConfig(props) {
|
9
10
|
var topo = props.topo;
|
@@ -13,6 +14,12 @@ function useCanvasThemeConfig(props) {
|
|
13
14
|
displayConfigDispatchers = _topo$store$useModel[1];
|
14
15
|
|
15
16
|
var canvasThemeName = displayConfig.canvasTheme || 'white';
|
17
|
+
useNewElementTheme({
|
18
|
+
topo: topo,
|
19
|
+
theme: canvasThemeName,
|
20
|
+
themes: THEMES,
|
21
|
+
setElementTheme: setElementTheme
|
22
|
+
});
|
16
23
|
|
17
24
|
var setCanvasTheme = /*#__PURE__*/function () {
|
18
25
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(themeName) {
|
@@ -93,18 +100,24 @@ function useCanvasThemeConfig(props) {
|
|
93
100
|
var dm = topo.getHtTopo().getGraphView().dm();
|
94
101
|
var elements = getElements(dm);
|
95
102
|
elements.forEach(function (element) {
|
96
|
-
|
97
|
-
element.s('text.color', themeConfig.text.color);
|
98
|
-
} else if (isGroup(element)) {
|
99
|
-
if (isClusterHtElement(element)) {// 集群
|
100
|
-
} else {
|
101
|
-
// 区域(非集群)
|
102
|
-
element.s(themeConfig.group.style);
|
103
|
-
}
|
104
|
-
} else if (isEdge(element)) {}
|
103
|
+
setElementTheme(element, themeConfig);
|
105
104
|
});
|
106
105
|
}
|
107
106
|
|
107
|
+
function setElementTheme(element, themeConfig) {
|
108
|
+
if (isText(element)) {
|
109
|
+
element.s('text.color', themeConfig.text.color);
|
110
|
+
} else if (isGroup(element)) {
|
111
|
+
if (isClusterHtElement(element)) {
|
112
|
+
// 集群
|
113
|
+
element.s(themeConfig.cluster.style);
|
114
|
+
} else {
|
115
|
+
// 区域(非集群)
|
116
|
+
element.s(themeConfig.group.style);
|
117
|
+
}
|
118
|
+
} else if (isEdge(element)) {}
|
119
|
+
}
|
120
|
+
|
108
121
|
return {
|
109
122
|
themes: THEMES,
|
110
123
|
canvasThemeName: canvasThemeName,
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import { isClusterHtElement } from "../../../../../../../utils/clusterUtil";
|
3
|
+
import { getElements, isEdge, isGroup, isLayer, isNode, isText } from "../../../../../../../utils/htElementUtils";
|
4
|
+
import THEMES from "../themes";
|
5
|
+
|
6
|
+
function useNewElementTheme(props) {
|
7
|
+
var topo = props.topo,
|
8
|
+
theme = props.theme,
|
9
|
+
setElementTheme = props.setElementTheme;
|
10
|
+
useEffect(function () {
|
11
|
+
var dm = topo.getHtTopo().getGraphView().dm();
|
12
|
+
dm.addDataModelChangeListener(handleDataModelChangeListener);
|
13
|
+
|
14
|
+
function handleDataModelChangeListener(e) {
|
15
|
+
var kind = e.kind,
|
16
|
+
data = e.data;
|
17
|
+
|
18
|
+
if (kind === 'add') {
|
19
|
+
var themeConfig = THEMES.find(function (item) {
|
20
|
+
return item.name === theme;
|
21
|
+
});
|
22
|
+
setElementTheme(data, themeConfig);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
return function () {
|
27
|
+
dm.removeDataModelChangeListener(handleDataModelChangeListener);
|
28
|
+
};
|
29
|
+
}, [theme]);
|
30
|
+
}
|
31
|
+
|
32
|
+
export default useNewElementTheme;
|
@@ -16,6 +16,18 @@ var baseLightTheme = {
|
|
16
16
|
'group.border.color': '#E4E9EE' // 边框颜色
|
17
17
|
|
18
18
|
}
|
19
|
+
},
|
20
|
+
cluster: {
|
21
|
+
style: {
|
22
|
+
'group.title.color': '#4D6277',
|
23
|
+
// 标题文字颜色
|
24
|
+
'group.title.background': 'rgba(229,245,253,0.6)',
|
25
|
+
// 标题背景颜色
|
26
|
+
'group.background': 'rgba(229,245,253,0.6)',
|
27
|
+
'group.border.color': '#C7E4F3',
|
28
|
+
// 边框颜色
|
29
|
+
'group.border.radius': 3
|
30
|
+
}
|
19
31
|
}
|
20
32
|
};
|
21
33
|
var THEMES = [_extends({}, baseLightTheme, {
|
@@ -58,6 +70,18 @@ var THEMES = [_extends({}, baseLightTheme, {
|
|
58
70
|
'group.border.color': 'rgba(8,165,244,0.8)' // 边框颜色
|
59
71
|
|
60
72
|
}
|
73
|
+
},
|
74
|
+
cluster: {
|
75
|
+
style: {
|
76
|
+
'group.title.color': '#FFFFFF',
|
77
|
+
// 标题文字颜色
|
78
|
+
'group.title.background': '#0E2C45',
|
79
|
+
// 标题背景颜色
|
80
|
+
'group.background': '#0E2C45',
|
81
|
+
'group.border.color': '#08A5F4',
|
82
|
+
// 边框颜色
|
83
|
+
'group.border.radius': 3
|
84
|
+
}
|
61
85
|
}
|
62
86
|
}];
|
63
87
|
export default THEMES;
|
File without changes
|
@@ -32,7 +32,7 @@ function Layout(props) {
|
|
32
32
|
};
|
33
33
|
|
34
34
|
var globalLayout = function globalLayout(data) {
|
35
|
-
var firstElement =
|
35
|
+
var firstElement = selection[0];
|
36
36
|
var layouType = data.id === 'toward' ? "" + data.id + data.options.subId : data.id; // eslint-disable-next-line eqeqeq
|
37
37
|
|
38
38
|
if (topoShowType != 'layers' && selection.length == 0) {
|
@@ -46,7 +46,7 @@ function Layout(props) {
|
|
46
46
|
|
47
47
|
|
48
48
|
if (isLayer(firstElement)) {
|
49
|
-
topo.getHtTopo().layoutLayer(
|
49
|
+
topo.getHtTopo().layoutLayer(selectionElements[0]);
|
50
50
|
}
|
51
51
|
};
|
52
52
|
|
@@ -31,9 +31,13 @@ export default function PropertyViewContainer(props) {
|
|
31
31
|
var singleElementValues = useMemo(function () {
|
32
32
|
return selection.length === 1 ? buildElementValues(selection) : undefined;
|
33
33
|
}, [selection]);
|
34
|
+
useEffect(function () {
|
35
|
+
if (!PropertyView) {
|
36
|
+
propertyViewManager.close();
|
37
|
+
}
|
38
|
+
}, [PropertyView, propertyViewManager]);
|
34
39
|
|
35
40
|
if (!PropertyView) {
|
36
|
-
propertyViewManager.close();
|
37
41
|
return null;
|
38
42
|
}
|
39
43
|
|
@@ -22,7 +22,14 @@ var PropertyViewManager = /*#__PURE__*/function () {
|
|
22
22
|
};
|
23
23
|
|
24
24
|
_proto.destroy = function destroy() {
|
25
|
-
var
|
25
|
+
var _this$topo$getHtTopo;
|
26
|
+
|
27
|
+
var notifier = (_this$topo$getHtTopo = this.topo.getHtTopo()) === null || _this$topo$getHtTopo === void 0 ? void 0 : _this$topo$getHtTopo.getNotifier();
|
28
|
+
|
29
|
+
if (!notifier) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
26
33
|
notifier.off('topo_element_double_click', this.open);
|
27
34
|
};
|
28
35
|
|
@@ -6,25 +6,29 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
* 拓扑编辑 Model
|
7
7
|
*/
|
8
8
|
import rlog from '@riil-frontend/component-topology-utils/es/rlog';
|
9
|
+
var initState = {
|
10
|
+
// 是否就绪
|
11
|
+
ready: false,
|
12
|
+
// 保存状态
|
13
|
+
saving: false,
|
14
|
+
// 选择/拖动模式模式。默认选择模式 select|move
|
15
|
+
viewMouseMode: 'select',
|
16
|
+
// 资源面板展开项
|
17
|
+
resourceTabActiveKey: null,
|
18
|
+
// 属性面板是否显示
|
19
|
+
propertyPanelVisible: false
|
20
|
+
};
|
9
21
|
export default function (topo) {
|
10
22
|
return {
|
11
23
|
// 定义 model 的初始 state
|
12
|
-
state:
|
13
|
-
// 是否就绪
|
14
|
-
ready: false,
|
15
|
-
// 保存状态
|
16
|
-
saving: false,
|
17
|
-
// 选择/拖动模式模式。默认选择模式 select|move
|
18
|
-
viewMouseMode: 'select',
|
19
|
-
// 资源面板展开项
|
20
|
-
resourceTabActiveKey: null,
|
21
|
-
// 属性面板是否显示
|
22
|
-
propertyPanelVisible: false
|
23
|
-
},
|
24
|
+
state: initState,
|
24
25
|
// 定义改变该模型状态的纯函数
|
25
26
|
reducers: {
|
26
27
|
update: function update(prevState, payload) {
|
27
28
|
return _extends({}, prevState, payload);
|
29
|
+
},
|
30
|
+
reset: function reset(prevState, payload) {
|
31
|
+
return _extends({}, initState);
|
28
32
|
}
|
29
33
|
},
|
30
34
|
// 定义处理该模型副作用的函数
|
@@ -73,6 +73,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
73
73
|
var onExitEdit = function onExitEdit() {// editDispatchers.switchToViewMode(topoId);
|
74
74
|
};
|
75
75
|
|
76
|
+
var reset = function reset() {
|
77
|
+
topoEditDispatchers.reset();
|
78
|
+
};
|
79
|
+
|
76
80
|
var onBindData = function onBindData(eventData) {};
|
77
81
|
/**
|
78
82
|
* 增加资源到视图
|
@@ -1131,6 +1135,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1131
1135
|
* 退出编辑模式回调
|
1132
1136
|
*/
|
1133
1137
|
onExitEdit: onExitEdit,
|
1138
|
+
reset: reset,
|
1134
1139
|
addLayerResources: addLayerResources,
|
1135
1140
|
|
1136
1141
|
/**
|
@@ -54,6 +54,11 @@ var SelectionModel = /*#__PURE__*/function () {
|
|
54
54
|
};
|
55
55
|
|
56
56
|
_proto.destroy = function destroy() {
|
57
|
+
var selectionDispatchers = this.topo.store.getModelDispatchers('selection');
|
58
|
+
selectionDispatchers.update({
|
59
|
+
selection: [],
|
60
|
+
selectionIds: []
|
61
|
+
});
|
57
62
|
this.removeListener();
|
58
63
|
};
|
59
64
|
|
@@ -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.50" === 'string' ? "6.0.0-alpha.50" : null;
|
26
26
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
27
27
|
/**
|
28
28
|
* 拓扑显示和编辑
|
@@ -7,7 +7,7 @@ exports["default"] = TopoEditorPlugin;
|
|
7
7
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
9
|
|
10
|
-
var _react =
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
11
|
|
12
12
|
var _CustomIconPlugin = _interopRequireDefault(require("./CustomIconPlugin"));
|
13
13
|
|
@@ -19,12 +19,21 @@ var _GroupAddResourceDrawerPlugin = _interopRequireDefault(require("./GroupAddRe
|
|
19
19
|
|
20
20
|
var _MetricPollingPlugin = _interopRequireDefault(require("../../viewer/components/plugins/MetricPollingPlugin"));
|
21
21
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
|
22
26
|
function TopoEditorPlugin(props) {
|
23
27
|
var topo = props.topo,
|
24
28
|
topoContext = props.topoContext,
|
25
29
|
topoEdit = props.topoEdit,
|
26
30
|
editorProps = props.editorProps;
|
27
31
|
var store = topo.store;
|
32
|
+
(0, _react.useEffect)(function () {
|
33
|
+
return function () {
|
34
|
+
topoEdit.reset();
|
35
|
+
};
|
36
|
+
}, []);
|
28
37
|
var plugins = [_SaveLoading["default"], _GroupAddResourceDrawerPlugin["default"], _MultipleResourceSelectPlugin["default"], _CustomIconPlugin["default"], _MetricPollingPlugin["default"]].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
|
29
38
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, plugins.map(function (Plugin, index) {
|
30
39
|
return /*#__PURE__*/_react["default"].createElement(Plugin, (0, _extends2["default"])({
|
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
12
12
|
var _CanvasPanelModule = _interopRequireDefault(require("./CanvasPanel.module.scss"));
|
13
13
|
|
14
|
-
var _useCanvasThemeConfig2 = _interopRequireDefault(require("./useCanvasThemeConfig"));
|
14
|
+
var _useCanvasThemeConfig2 = _interopRequireDefault(require("./hooks/useCanvasThemeConfig"));
|
15
15
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
17
|
|
@@ -11,11 +11,13 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
11
11
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
13
13
|
|
14
|
-
var _clusterUtil = require("
|
14
|
+
var _clusterUtil = require("../../../../../../../utils/clusterUtil");
|
15
15
|
|
16
|
-
var _htElementUtils = require("
|
16
|
+
var _htElementUtils = require("../../../../../../../utils/htElementUtils");
|
17
17
|
|
18
|
-
var _themes = _interopRequireDefault(require("
|
18
|
+
var _themes = _interopRequireDefault(require("../themes"));
|
19
|
+
|
20
|
+
var _useNewElementTheme = _interopRequireDefault(require("./useNewElementTheme"));
|
19
21
|
|
20
22
|
function useCanvasThemeConfig(props) {
|
21
23
|
var topo = props.topo;
|
@@ -25,6 +27,12 @@ function useCanvasThemeConfig(props) {
|
|
25
27
|
displayConfigDispatchers = _topo$store$useModel[1];
|
26
28
|
|
27
29
|
var canvasThemeName = displayConfig.canvasTheme || 'white';
|
30
|
+
(0, _useNewElementTheme["default"])({
|
31
|
+
topo: topo,
|
32
|
+
theme: canvasThemeName,
|
33
|
+
themes: _themes["default"],
|
34
|
+
setElementTheme: setElementTheme
|
35
|
+
});
|
28
36
|
|
29
37
|
var setCanvasTheme = /*#__PURE__*/function () {
|
30
38
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(themeName) {
|
@@ -105,18 +113,24 @@ function useCanvasThemeConfig(props) {
|
|
105
113
|
var dm = topo.getHtTopo().getGraphView().dm();
|
106
114
|
var elements = (0, _htElementUtils.getElements)(dm);
|
107
115
|
elements.forEach(function (element) {
|
108
|
-
|
109
|
-
element.s('text.color', themeConfig.text.color);
|
110
|
-
} else if ((0, _htElementUtils.isGroup)(element)) {
|
111
|
-
if ((0, _clusterUtil.isClusterHtElement)(element)) {// 集群
|
112
|
-
} else {
|
113
|
-
// 区域(非集群)
|
114
|
-
element.s(themeConfig.group.style);
|
115
|
-
}
|
116
|
-
} else if ((0, _htElementUtils.isEdge)(element)) {}
|
116
|
+
setElementTheme(element, themeConfig);
|
117
117
|
});
|
118
118
|
}
|
119
119
|
|
120
|
+
function setElementTheme(element, themeConfig) {
|
121
|
+
if ((0, _htElementUtils.isText)(element)) {
|
122
|
+
element.s('text.color', themeConfig.text.color);
|
123
|
+
} else if ((0, _htElementUtils.isGroup)(element)) {
|
124
|
+
if ((0, _clusterUtil.isClusterHtElement)(element)) {
|
125
|
+
// 集群
|
126
|
+
element.s(themeConfig.cluster.style);
|
127
|
+
} else {
|
128
|
+
// 区域(非集群)
|
129
|
+
element.s(themeConfig.group.style);
|
130
|
+
}
|
131
|
+
} else if ((0, _htElementUtils.isEdge)(element)) {}
|
132
|
+
}
|
133
|
+
|
120
134
|
return {
|
121
135
|
themes: _themes["default"],
|
122
136
|
canvasThemeName: canvasThemeName,
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
|
+
|
10
|
+
var _clusterUtil = require("../../../../../../../utils/clusterUtil");
|
11
|
+
|
12
|
+
var _htElementUtils = require("../../../../../../../utils/htElementUtils");
|
13
|
+
|
14
|
+
var _themes = _interopRequireDefault(require("../themes"));
|
15
|
+
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
|
+
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
19
|
+
|
20
|
+
function useNewElementTheme(props) {
|
21
|
+
var topo = props.topo,
|
22
|
+
theme = props.theme,
|
23
|
+
setElementTheme = props.setElementTheme;
|
24
|
+
(0, _react.useEffect)(function () {
|
25
|
+
var dm = topo.getHtTopo().getGraphView().dm();
|
26
|
+
dm.addDataModelChangeListener(handleDataModelChangeListener);
|
27
|
+
|
28
|
+
function handleDataModelChangeListener(e) {
|
29
|
+
var kind = e.kind,
|
30
|
+
data = e.data;
|
31
|
+
|
32
|
+
if (kind === 'add') {
|
33
|
+
var themeConfig = _themes["default"].find(function (item) {
|
34
|
+
return item.name === theme;
|
35
|
+
});
|
36
|
+
|
37
|
+
setElementTheme(data, themeConfig);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
return function () {
|
42
|
+
dm.removeDataModelChangeListener(handleDataModelChangeListener);
|
43
|
+
};
|
44
|
+
}, [theme]);
|
45
|
+
}
|
46
|
+
|
47
|
+
var _default = useNewElementTheme;
|
48
|
+
exports["default"] = _default;
|
@@ -24,6 +24,18 @@ var baseLightTheme = {
|
|
24
24
|
'group.border.color': '#E4E9EE' // 边框颜色
|
25
25
|
|
26
26
|
}
|
27
|
+
},
|
28
|
+
cluster: {
|
29
|
+
style: {
|
30
|
+
'group.title.color': '#4D6277',
|
31
|
+
// 标题文字颜色
|
32
|
+
'group.title.background': 'rgba(229,245,253,0.6)',
|
33
|
+
// 标题背景颜色
|
34
|
+
'group.background': 'rgba(229,245,253,0.6)',
|
35
|
+
'group.border.color': '#C7E4F3',
|
36
|
+
// 边框颜色
|
37
|
+
'group.border.radius': 3
|
38
|
+
}
|
27
39
|
}
|
28
40
|
};
|
29
41
|
var THEMES = [(0, _extends2["default"])({}, baseLightTheme, {
|
@@ -66,6 +78,18 @@ var THEMES = [(0, _extends2["default"])({}, baseLightTheme, {
|
|
66
78
|
'group.border.color': 'rgba(8,165,244,0.8)' // 边框颜色
|
67
79
|
|
68
80
|
}
|
81
|
+
},
|
82
|
+
cluster: {
|
83
|
+
style: {
|
84
|
+
'group.title.color': '#FFFFFF',
|
85
|
+
// 标题文字颜色
|
86
|
+
'group.title.background': '#0E2C45',
|
87
|
+
// 标题背景颜色
|
88
|
+
'group.background': '#0E2C45',
|
89
|
+
'group.border.color': '#08A5F4',
|
90
|
+
// 边框颜色
|
91
|
+
'group.border.radius': 3
|
92
|
+
}
|
69
93
|
}
|
70
94
|
}];
|
71
95
|
var _default = THEMES;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -48,7 +48,7 @@ function Layout(props) {
|
|
48
48
|
};
|
49
49
|
|
50
50
|
var globalLayout = function globalLayout(data) {
|
51
|
-
var firstElement =
|
51
|
+
var firstElement = selection[0];
|
52
52
|
var layouType = data.id === 'toward' ? "" + data.id + data.options.subId : data.id; // eslint-disable-next-line eqeqeq
|
53
53
|
|
54
54
|
if (topoShowType != 'layers' && selection.length == 0) {
|
@@ -62,7 +62,7 @@ function Layout(props) {
|
|
62
62
|
|
63
63
|
|
64
64
|
if ((0, _htElementDataUtil.isLayer)(firstElement)) {
|
65
|
-
topo.getHtTopo().layoutLayer(
|
65
|
+
topo.getHtTopo().layoutLayer(selectionElements[0]);
|
66
66
|
}
|
67
67
|
};
|
68
68
|
|
@@ -44,9 +44,13 @@ function PropertyViewContainer(props) {
|
|
44
44
|
var singleElementValues = (0, _react.useMemo)(function () {
|
45
45
|
return selection.length === 1 ? buildElementValues(selection) : undefined;
|
46
46
|
}, [selection]);
|
47
|
+
(0, _react.useEffect)(function () {
|
48
|
+
if (!PropertyView) {
|
49
|
+
propertyViewManager.close();
|
50
|
+
}
|
51
|
+
}, [PropertyView, propertyViewManager]);
|
47
52
|
|
48
53
|
if (!PropertyView) {
|
49
|
-
propertyViewManager.close();
|
50
54
|
return null;
|
51
55
|
}
|
52
56
|
|
@@ -30,7 +30,14 @@ var PropertyViewManager = /*#__PURE__*/function () {
|
|
30
30
|
};
|
31
31
|
|
32
32
|
_proto.destroy = function destroy() {
|
33
|
-
var
|
33
|
+
var _this$topo$getHtTopo;
|
34
|
+
|
35
|
+
var notifier = (_this$topo$getHtTopo = this.topo.getHtTopo()) === null || _this$topo$getHtTopo === void 0 ? void 0 : _this$topo$getHtTopo.getNotifier();
|
36
|
+
|
37
|
+
if (!notifier) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
|
34
41
|
notifier.off('topo_element_double_click', this.open);
|
35
42
|
};
|
36
43
|
|
@@ -16,25 +16,30 @@ var _rlog = _interopRequireDefault(require("@riil-frontend/component-topology-ut
|
|
16
16
|
/**
|
17
17
|
* 拓扑编辑 Model
|
18
18
|
*/
|
19
|
+
var initState = {
|
20
|
+
// 是否就绪
|
21
|
+
ready: false,
|
22
|
+
// 保存状态
|
23
|
+
saving: false,
|
24
|
+
// 选择/拖动模式模式。默认选择模式 select|move
|
25
|
+
viewMouseMode: 'select',
|
26
|
+
// 资源面板展开项
|
27
|
+
resourceTabActiveKey: null,
|
28
|
+
// 属性面板是否显示
|
29
|
+
propertyPanelVisible: false
|
30
|
+
};
|
31
|
+
|
19
32
|
function _default(topo) {
|
20
33
|
return {
|
21
34
|
// 定义 model 的初始 state
|
22
|
-
state:
|
23
|
-
// 是否就绪
|
24
|
-
ready: false,
|
25
|
-
// 保存状态
|
26
|
-
saving: false,
|
27
|
-
// 选择/拖动模式模式。默认选择模式 select|move
|
28
|
-
viewMouseMode: 'select',
|
29
|
-
// 资源面板展开项
|
30
|
-
resourceTabActiveKey: null,
|
31
|
-
// 属性面板是否显示
|
32
|
-
propertyPanelVisible: false
|
33
|
-
},
|
35
|
+
state: initState,
|
34
36
|
// 定义改变该模型状态的纯函数
|
35
37
|
reducers: {
|
36
38
|
update: function update(prevState, payload) {
|
37
39
|
return (0, _extends2["default"])({}, prevState, payload);
|
40
|
+
},
|
41
|
+
reset: function reset(prevState, payload) {
|
42
|
+
return (0, _extends2["default"])({}, initState);
|
38
43
|
}
|
39
44
|
},
|
40
45
|
// 定义处理该模型副作用的函数
|
@@ -95,6 +95,10 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
95
95
|
var onExitEdit = function onExitEdit() {// editDispatchers.switchToViewMode(topoId);
|
96
96
|
};
|
97
97
|
|
98
|
+
var reset = function reset() {
|
99
|
+
topoEditDispatchers.reset();
|
100
|
+
};
|
101
|
+
|
98
102
|
var onBindData = function onBindData(eventData) {};
|
99
103
|
/**
|
100
104
|
* 增加资源到视图
|
@@ -1173,6 +1177,7 @@ var useTopoEdit = function useTopoEdit(params) {
|
|
1173
1177
|
* 退出编辑模式回调
|
1174
1178
|
*/
|
1175
1179
|
onExitEdit: onExitEdit,
|
1180
|
+
reset: reset,
|
1176
1181
|
addLayerResources: addLayerResources,
|
1177
1182
|
|
1178
1183
|
/**
|
@@ -64,6 +64,11 @@ var SelectionModel = /*#__PURE__*/function () {
|
|
64
64
|
};
|
65
65
|
|
66
66
|
_proto.destroy = function destroy() {
|
67
|
+
var selectionDispatchers = this.topo.store.getModelDispatchers('selection');
|
68
|
+
selectionDispatchers.update({
|
69
|
+
selection: [],
|
70
|
+
selectionIds: []
|
71
|
+
});
|
67
72
|
this.removeListener();
|
68
73
|
};
|
69
74
|
|
@@ -52,7 +52,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
|
|
52
52
|
var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
53
53
|
|
54
54
|
// eslint-disable-next-line no-undef
|
55
|
-
var version = typeof "6.0.0-alpha.
|
55
|
+
var version = typeof "6.0.0-alpha.50" === 'string' ? "6.0.0-alpha.50" : null;
|
56
56
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
57
57
|
/**
|
58
58
|
* 拓扑显示和编辑
|