@riil-frontend/component-topology 6.0.7 → 6.0.8
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/components/TopoView/GraphViewPanel.js +3 -2
- package/es/core/hooks/useCanvasTheme.js +16 -5
- package/es/core/models/TopoApp.js +1 -1
- package/lib/core/components/TopoView/GraphViewPanel.js +3 -2
- package/lib/core/hooks/useCanvasTheme.js +16 -5
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
@@ -9,14 +9,15 @@ export default function GraphViewPanel(props) {
|
|
9
9
|
|
10
10
|
var _useCanvasTheme = useCanvasTheme({
|
11
11
|
topo: topo,
|
12
|
-
themeName: themeName
|
12
|
+
themeName: themeName,
|
13
|
+
hideBackgroundColor: hideBackgroundColor
|
13
14
|
}),
|
14
15
|
canvasColor = _useCanvasTheme.canvasColor;
|
15
16
|
|
16
17
|
return /*#__PURE__*/React.createElement("div", {
|
17
18
|
className: styles.viewPanel,
|
18
19
|
style: {
|
19
|
-
background:
|
20
|
+
background: canvasColor
|
20
21
|
}
|
21
22
|
}, props.children);
|
22
23
|
}
|
@@ -30,15 +30,16 @@ var themeMap = [{
|
|
30
30
|
}, {});
|
31
31
|
export default function useCanvasTheme(props) {
|
32
32
|
var topo = props.topo,
|
33
|
-
themeName = props.themeName
|
33
|
+
themeName = props.themeName,
|
34
|
+
hideBackgroundColor = props.hideBackgroundColor; // 拓扑图是否加载
|
34
35
|
|
35
36
|
var _topo$store$useModelS = topo.store.useModelState('topoMod'),
|
36
37
|
graphLoaded = _topo$store$useModelS.graphLoaded;
|
37
38
|
|
39
|
+
var themeConfig = themeMap[themeName || 'white'];
|
40
|
+
var canvasColor = hideBackgroundColor ? null : themeConfig.color;
|
38
41
|
useEffect(function () {
|
39
42
|
// 设置
|
40
|
-
var themeConfig = themeMap[themeName || 'white'];
|
41
|
-
|
42
43
|
if (graphLoaded && themeConfig) {
|
43
44
|
try {
|
44
45
|
topo.getHtTopo().setTheme(themeName);
|
@@ -47,8 +48,18 @@ export default function useCanvasTheme(props) {
|
|
47
48
|
console.error('切换主题失败', error);
|
48
49
|
}
|
49
50
|
}
|
50
|
-
}, [
|
51
|
+
}, [graphLoaded, themeName]);
|
52
|
+
useEffect(function () {
|
53
|
+
// 设置
|
54
|
+
if (graphLoaded) {
|
55
|
+
try {
|
56
|
+
topo.getHtTopo().getGraphView().dm().setBackground(canvasColor);
|
57
|
+
} catch (error) {
|
58
|
+
console.error('切换主题失败', error);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}, [graphLoaded, canvasColor]);
|
51
62
|
return {
|
52
|
-
canvasColor:
|
63
|
+
canvasColor: canvasColor
|
53
64
|
};
|
54
65
|
}
|
@@ -23,7 +23,7 @@ import topoFactory from "./topoFactory";
|
|
23
23
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
24
24
|
import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
|
25
25
|
|
26
|
-
var version = typeof "6.0.
|
26
|
+
var version = typeof "6.0.8" === 'string' ? "6.0.8" : null;
|
27
27
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
28
28
|
/**
|
29
29
|
* 拓扑显示和编辑
|
@@ -19,14 +19,15 @@ function GraphViewPanel(props) {
|
|
19
19
|
|
20
20
|
var _useCanvasTheme = (0, _useCanvasTheme2["default"])({
|
21
21
|
topo: topo,
|
22
|
-
themeName: themeName
|
22
|
+
themeName: themeName,
|
23
|
+
hideBackgroundColor: hideBackgroundColor
|
23
24
|
}),
|
24
25
|
canvasColor = _useCanvasTheme.canvasColor;
|
25
26
|
|
26
27
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
27
28
|
className: _TopoViewModule["default"].viewPanel,
|
28
29
|
style: {
|
29
|
-
background:
|
30
|
+
background: canvasColor
|
30
31
|
}
|
31
32
|
}, props.children);
|
32
33
|
}
|
@@ -44,15 +44,16 @@ var themeMap = [{
|
|
44
44
|
|
45
45
|
function useCanvasTheme(props) {
|
46
46
|
var topo = props.topo,
|
47
|
-
themeName = props.themeName
|
47
|
+
themeName = props.themeName,
|
48
|
+
hideBackgroundColor = props.hideBackgroundColor; // 拓扑图是否加载
|
48
49
|
|
49
50
|
var _topo$store$useModelS = topo.store.useModelState('topoMod'),
|
50
51
|
graphLoaded = _topo$store$useModelS.graphLoaded;
|
51
52
|
|
53
|
+
var themeConfig = themeMap[themeName || 'white'];
|
54
|
+
var canvasColor = hideBackgroundColor ? null : themeConfig.color;
|
52
55
|
(0, _react.useEffect)(function () {
|
53
56
|
// 设置
|
54
|
-
var themeConfig = themeMap[themeName || 'white'];
|
55
|
-
|
56
57
|
if (graphLoaded && themeConfig) {
|
57
58
|
try {
|
58
59
|
topo.getHtTopo().setTheme(themeName);
|
@@ -61,8 +62,18 @@ function useCanvasTheme(props) {
|
|
61
62
|
console.error('切换主题失败', error);
|
62
63
|
}
|
63
64
|
}
|
64
|
-
}, [
|
65
|
+
}, [graphLoaded, themeName]);
|
66
|
+
(0, _react.useEffect)(function () {
|
67
|
+
// 设置
|
68
|
+
if (graphLoaded) {
|
69
|
+
try {
|
70
|
+
topo.getHtTopo().getGraphView().dm().setBackground(canvasColor);
|
71
|
+
} catch (error) {
|
72
|
+
console.error('切换主题失败', error);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}, [graphLoaded, canvasColor]);
|
65
76
|
return {
|
66
|
-
canvasColor:
|
77
|
+
canvasColor: canvasColor
|
67
78
|
};
|
68
79
|
}
|
@@ -54,7 +54,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
|
|
54
54
|
var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
|
55
55
|
|
56
56
|
// eslint-disable-next-line no-undef
|
57
|
-
var version = typeof "6.0.
|
57
|
+
var version = typeof "6.0.8" === 'string' ? "6.0.8" : null;
|
58
58
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
59
59
|
/**
|
60
60
|
* 拓扑显示和编辑
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "6.0.
|
3
|
+
"version": "6.0.8",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -116,6 +116,6 @@
|
|
116
116
|
"access": "public"
|
117
117
|
},
|
118
118
|
"license": "MIT",
|
119
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.8/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|