@riil-frontend/component-topology 6.0.0-alpha.65 → 6.0.0-alpha.66

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.
@@ -268,14 +268,14 @@ var Topology = function Topology(props) {
268
268
  direction: "row",
269
269
  flex: 1,
270
270
  className: classnames((_classnames = {}, _classnames[editorStyles.borderLine] = isEditMode, _classnames))
271
- }, isEditMode && /*#__PURE__*/React.createElement(Sidebar, {
271
+ }, isEditMode && /*#__PURE__*/React.createElement(Sidebar, _extends({
272
272
  topo: topo,
273
273
  topoEdit: topoEdit,
274
274
  topoContext: {
275
275
  urlParams: urlParams
276
276
  },
277
277
  editorProps: editorProps
278
- }), renderCanvas(), isEditMode && graphLoaded && /*#__PURE__*/React.createElement(PropertyView, {
278
+ }, editorProps === null || editorProps === void 0 ? void 0 : editorProps.sidebarProps)), renderCanvas(), isEditMode && graphLoaded && /*#__PURE__*/React.createElement(PropertyView, {
279
279
  topo: topo,
280
280
  editorProps: editorProps
281
281
  })), !isEditMode && /*#__PURE__*/React.createElement(ViewerPlugin, {
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useEffect, useState } from 'react';
2
+ import React, { useEffect, useMemo } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import Tab from "../../../../components/VerticalIconTab";
5
5
  import panes from "./panes";
@@ -8,7 +8,8 @@ import styles from "./Sidebar.module.scss";
8
8
  function Sidebar(props) {
9
9
  var _classNames;
10
10
 
11
- var topo = props.topo;
11
+ var topo = props.topo,
12
+ getPanels = props.getPanels;
12
13
 
13
14
  var _topo$store$useModel = topo.store.useModel('topoEdit'),
14
15
  topoEditState = _topo$store$useModel[0],
@@ -19,6 +20,9 @@ function Sidebar(props) {
19
20
  var _topo$store$useModelS = topo.store.useModelState('topoMod'),
20
21
  graphLoaded = _topo$store$useModelS.graphLoaded;
21
22
 
23
+ var visiblePanels = useMemo(function () {
24
+ return getPanels ? getPanels(panes) : panes;
25
+ }, [getPanels]);
22
26
  useEffect(function () {
23
27
  return function () {
24
28
  // 退出编辑模式,关闭资源面板状态
@@ -63,7 +67,7 @@ function Sidebar(props) {
63
67
  resourceTabActiveKey: key
64
68
  });
65
69
  }
66
- }, panes.map(renderTabItem))));
70
+ }, visiblePanels.map(renderTabItem))));
67
71
  }
68
72
 
69
73
  export default Sidebar;
@@ -1,7 +1,9 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
- var _excluded = ["color", "background", "opacity"];
4
- import { formatBackgroundRgbaColor, parseBackground } from "../ElementTextStyleSetting/colorUtil";
3
+ var _excluded = ["color", "background", "opacity"],
4
+ _excluded2 = ["color", "background", "opacity", "bold", "italic"];
5
+ import fontStyleUtil from "../../../../../settings/common/text/fontStyleUtil";
6
+ import { formatBackgroundRgbaColor, parseBackground, parseColor } from "../ElementTextStyleSetting/colorUtil";
5
7
  var defaultStyle = {
6
8
  color: '#AFB9C2',
7
9
  fontFamily: '微软雅黑'
@@ -29,12 +31,13 @@ export var setGlobalTagStyle = function setGlobalTagStyle(topo, styleData) {
29
31
 
30
32
  var globalEdgeTagStyle = _extends({}, nodeLabelStyle, defaultEdgeLabelStyle, style);
31
33
 
32
- topo.getHtTopo().setGlobalNodeLabelStyle(globalNodeLabelStyle);
33
- topo.getHtTopo().setGlobalEdgeTagStyle(globalEdgeTagStyle);
34
34
  displayConfigDispatchers.update({
35
35
  nodeLabelStyle: globalNodeLabelStyle,
36
36
  defaultEdgeLabelStyle: globalEdgeTagStyle
37
37
  });
38
+ var styles = setTextStyle(styleData, nodeLabelStyle);
39
+ topo.getHtTopo().setGlobalNodeLabelStyle(styles);
40
+ topo.getHtTopo().setGlobalEdgeTagStyle(styles);
38
41
  };
39
42
 
40
43
  function buildStyle(styleData, prevTagStyle) {
@@ -57,4 +60,40 @@ function buildStyle(styleData, prevTagStyle) {
57
60
  return style;
58
61
  }
59
62
 
63
+ function setTextStyle(styleData, nodeLabelStyle) {
64
+ var _fontStyleUtil$remove = fontStyleUtil.removeBoldItalic(styleData),
65
+ color = _fontStyleUtil$remove.color,
66
+ background = _fontStyleUtil$remove.background,
67
+ opacity = _fontStyleUtil$remove.opacity,
68
+ bold = _fontStyleUtil$remove.bold,
69
+ italic = _fontStyleUtil$remove.italic,
70
+ otherStyle = _objectWithoutPropertiesLoose(_fontStyleUtil$remove, _excluded2);
71
+
72
+ var tagStyle = _extends({}, otherStyle);
73
+
74
+ if ('color' in styleData) {
75
+ tagStyle.color = color.hex;
76
+ }
77
+
78
+ if ('bold' in styleData) {
79
+ tagStyle.fontBold = bold;
80
+ }
81
+
82
+ if ('italic' in styleData) {
83
+ tagStyle.fontItalic = italic;
84
+ }
85
+
86
+ if ('background' in styleData) {
87
+ // 背景颜色
88
+ var prevBackgroundStyle = parseBackground(nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.background);
89
+ tagStyle.background = formatBackgroundRgbaColor(prevBackgroundStyle, styleData);
90
+ }
91
+
92
+ if ('opacity' in styleData) {
93
+ tagStyle.opacity = opacity;
94
+ }
95
+
96
+ return tagStyle;
97
+ }
98
+
60
99
  export function setStyle() {}
@@ -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.0-alpha.65" === 'string' ? "6.0.0-alpha.65" : null;
26
+ var version = typeof "6.0.0-alpha.66" === 'string' ? "6.0.0-alpha.66" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -310,14 +310,14 @@ var Topology = function Topology(props) {
310
310
  direction: "row",
311
311
  flex: 1,
312
312
  className: (0, _classnames2["default"])((_classnames = {}, _classnames[_editorModule["default"].borderLine] = isEditMode, _classnames))
313
- }, isEditMode && /*#__PURE__*/_react["default"].createElement(_Sidebar["default"], {
313
+ }, isEditMode && /*#__PURE__*/_react["default"].createElement(_Sidebar["default"], (0, _extends2["default"])({
314
314
  topo: topo,
315
315
  topoEdit: topoEdit,
316
316
  topoContext: {
317
317
  urlParams: urlParams
318
318
  },
319
319
  editorProps: editorProps
320
- }), renderCanvas(), isEditMode && graphLoaded && /*#__PURE__*/_react["default"].createElement(_PropertyView["default"], {
320
+ }, editorProps === null || editorProps === void 0 ? void 0 : editorProps.sidebarProps)), renderCanvas(), isEditMode && graphLoaded && /*#__PURE__*/_react["default"].createElement(_PropertyView["default"], {
321
321
  topo: topo,
322
322
  editorProps: editorProps
323
323
  })), !isEditMode && /*#__PURE__*/_react["default"].createElement(_ViewerPlugin["default"], {
@@ -24,7 +24,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
24
24
  function Sidebar(props) {
25
25
  var _classNames;
26
26
 
27
- var topo = props.topo;
27
+ var topo = props.topo,
28
+ getPanels = props.getPanels;
28
29
 
29
30
  var _topo$store$useModel = topo.store.useModel('topoEdit'),
30
31
  topoEditState = _topo$store$useModel[0],
@@ -35,6 +36,9 @@ function Sidebar(props) {
35
36
  var _topo$store$useModelS = topo.store.useModelState('topoMod'),
36
37
  graphLoaded = _topo$store$useModelS.graphLoaded;
37
38
 
39
+ var visiblePanels = (0, _react.useMemo)(function () {
40
+ return getPanels ? getPanels(_panes["default"]) : _panes["default"];
41
+ }, [getPanels]);
38
42
  (0, _react.useEffect)(function () {
39
43
  return function () {
40
44
  // 退出编辑模式,关闭资源面板状态
@@ -79,7 +83,7 @@ function Sidebar(props) {
79
83
  resourceTabActiveKey: key
80
84
  });
81
85
  }
82
- }, _panes["default"].map(renderTabItem))));
86
+ }, visiblePanels.map(renderTabItem))));
83
87
  }
84
88
 
85
89
  var _default = Sidebar;
@@ -11,9 +11,12 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
14
+ var _fontStyleUtil = _interopRequireDefault(require("../../../../../settings/common/text/fontStyleUtil"));
15
+
14
16
  var _colorUtil = require("../ElementTextStyleSetting/colorUtil");
15
17
 
16
- var _excluded = ["color", "background", "opacity"];
18
+ var _excluded = ["color", "background", "opacity"],
19
+ _excluded2 = ["color", "background", "opacity", "bold", "italic"];
17
20
  var defaultStyle = {
18
21
  color: '#AFB9C2',
19
22
  fontFamily: '微软雅黑'
@@ -40,12 +43,13 @@ var setGlobalTagStyle = function setGlobalTagStyle(topo, styleData) {
40
43
  var style = buildStyle(styleData, nodeLabelStyle);
41
44
  var globalNodeLabelStyle = (0, _extends2["default"])({}, nodeLabelStyle, style);
42
45
  var globalEdgeTagStyle = (0, _extends2["default"])({}, nodeLabelStyle, defaultEdgeLabelStyle, style);
43
- topo.getHtTopo().setGlobalNodeLabelStyle(globalNodeLabelStyle);
44
- topo.getHtTopo().setGlobalEdgeTagStyle(globalEdgeTagStyle);
45
46
  displayConfigDispatchers.update({
46
47
  nodeLabelStyle: globalNodeLabelStyle,
47
48
  defaultEdgeLabelStyle: globalEdgeTagStyle
48
49
  });
50
+ var styles = setTextStyle(styleData, nodeLabelStyle);
51
+ topo.getHtTopo().setGlobalNodeLabelStyle(styles);
52
+ topo.getHtTopo().setGlobalEdgeTagStyle(styles);
49
53
  };
50
54
 
51
55
  exports.setGlobalTagStyle = setGlobalTagStyle;
@@ -69,4 +73,40 @@ function buildStyle(styleData, prevTagStyle) {
69
73
  return style;
70
74
  }
71
75
 
76
+ function setTextStyle(styleData, nodeLabelStyle) {
77
+ var _fontStyleUtil$remove = _fontStyleUtil["default"].removeBoldItalic(styleData),
78
+ color = _fontStyleUtil$remove.color,
79
+ background = _fontStyleUtil$remove.background,
80
+ opacity = _fontStyleUtil$remove.opacity,
81
+ bold = _fontStyleUtil$remove.bold,
82
+ italic = _fontStyleUtil$remove.italic,
83
+ otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(_fontStyleUtil$remove, _excluded2);
84
+
85
+ var tagStyle = (0, _extends2["default"])({}, otherStyle);
86
+
87
+ if ('color' in styleData) {
88
+ tagStyle.color = color.hex;
89
+ }
90
+
91
+ if ('bold' in styleData) {
92
+ tagStyle.fontBold = bold;
93
+ }
94
+
95
+ if ('italic' in styleData) {
96
+ tagStyle.fontItalic = italic;
97
+ }
98
+
99
+ if ('background' in styleData) {
100
+ // 背景颜色
101
+ var prevBackgroundStyle = (0, _colorUtil.parseBackground)(nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.background);
102
+ tagStyle.background = (0, _colorUtil.formatBackgroundRgbaColor)(prevBackgroundStyle, styleData);
103
+ }
104
+
105
+ if ('opacity' in styleData) {
106
+ tagStyle.opacity = opacity;
107
+ }
108
+
109
+ return tagStyle;
110
+ }
111
+
72
112
  function setStyle() {}
@@ -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.0-alpha.65" === 'string' ? "6.0.0-alpha.65" : null;
57
+ var version = typeof "6.0.0-alpha.66" === 'string' ? "6.0.0-alpha.66" : 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.0-alpha.65",
3
+ "version": "6.0.0-alpha.66",
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.0-alpha.65/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.66/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }