@riil-frontend/component-topology 6.0.20 → 7.0.0-dev.1

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.
@@ -52,16 +52,8 @@ function FontStyleButton(props) {
52
52
  underline: underline
53
53
  })),
54
54
  value = _useState2[0],
55
- setValue = _useState2[1]; // 选中的元素
55
+ setValue = _useState2[1];
56
56
 
57
-
58
- var selection = topo.selectionModel.useHtSelection();
59
- useEffect(function () {
60
- var containText = selection.filter(function (ele) {
61
- return isText(ele);
62
- }).length;
63
- setDisabled(!containText);
64
- }, [selection]);
65
57
  useEffect(function () {
66
58
  setValue(buildValue({
67
59
  bold: bold,
@@ -4,21 +4,20 @@ var _excluded = ["color", "background", "opacity", "bold", "italic"];
4
4
  import fontStyleUtil from "../../../../../../settings/common/text/fontStyleUtil";
5
5
  import { formatBackgroundRgbaColor, parseBackground, parseColor } from "../colorUtil";
6
6
  export function getTextStyle(element) {
7
- var underline = null;
8
7
  return _extends({
9
8
  color: parseColor(element.a('edge.tag.color')),
10
9
  fontFamily: element.a('edge.tag.fontFamily') || '微软雅黑',
11
- underline: underline
10
+ bold: !!element.a('edge.tag.fontBold'),
11
+ itatic: !!element.a('edge.tag.fontItalic')
12
12
  }, parseBackground(element.a('edge.tag.background')));
13
13
  }
14
14
  export function setTextStyle(element, style, topo) {
15
- var _fontStyleUtil$remove = fontStyleUtil.removeBoldItalic(style),
16
- color = _fontStyleUtil$remove.color,
17
- background = _fontStyleUtil$remove.background,
18
- opacity = _fontStyleUtil$remove.opacity,
19
- bold = _fontStyleUtil$remove.bold,
20
- italic = _fontStyleUtil$remove.italic,
21
- otherStyle = _objectWithoutPropertiesLoose(_fontStyleUtil$remove, _excluded);
15
+ var color = style.color,
16
+ background = style.background,
17
+ opacity = style.opacity,
18
+ bold = style.bold,
19
+ italic = style.italic,
20
+ otherStyle = _objectWithoutPropertiesLoose(style, _excluded);
22
21
 
23
22
  var tagStyle = _extends({}, otherStyle);
24
23
 
@@ -55,11 +54,11 @@ export function setTextStyle(element, style, topo) {
55
54
  */
56
55
 
57
56
  export function getEnabledFields(element) {
58
- return ['fontFamily', 'color', 'background', 'opacity'];
57
+ return ['fontFamily', 'color', 'background', 'opacity', 'fontSize', 'bold', 'italic'];
59
58
  }
60
59
  export function getFieldDisabled(element) {
61
60
  return {
62
- fontSize: true
61
+ fontSize: false
63
62
  };
64
63
  }
65
64
  export default {
@@ -4,20 +4,19 @@ var _excluded = ["color", "background", "opacity", "bold", "italic"];
4
4
  import fontStyleUtil from "../../../../../../settings/common/text/fontStyleUtil";
5
5
  import { formatBackgroundRgbaColor, parseBackground, parseColor } from "../colorUtil";
6
6
  export function getTextStyle(element) {
7
- var underline = null;
7
+ var underline = !!element.a('node.tag.fontUnderline');
8
8
  return _extends({
9
9
  color: parseColor(element.a('ht.color')),
10
10
  underline: underline
11
11
  }, fontStyleUtil.toMap(element.a('ht.font')), parseBackground(element.a('ht.background')));
12
12
  }
13
13
  export function setTextStyle(element, style, topo) {
14
- var _fontStyleUtil$remove = fontStyleUtil.removeBoldItalic(style),
15
- color = _fontStyleUtil$remove.color,
16
- background = _fontStyleUtil$remove.background,
17
- opacity = _fontStyleUtil$remove.opacity,
18
- bold = _fontStyleUtil$remove.bold,
19
- italic = _fontStyleUtil$remove.italic,
20
- otherStyle = _objectWithoutPropertiesLoose(_fontStyleUtil$remove, _excluded);
14
+ var color = style.color,
15
+ background = style.background,
16
+ opacity = style.opacity,
17
+ bold = style.bold,
18
+ italic = style.italic,
19
+ otherStyle = _objectWithoutPropertiesLoose(style, _excluded);
21
20
 
22
21
  var tagStyle = _extends({}, otherStyle);
23
22
 
@@ -48,7 +47,7 @@ export function setTextStyle(element, style, topo) {
48
47
  }
49
48
  }
50
49
  export function getEnabledFields(element) {
51
- return ['fontFamily', 'color', 'background', 'opacity'];
50
+ return ['fontFamily', 'color', 'background', 'opacity', 'fontSize', 'bold', 'italic', 'underline'];
52
51
  }
53
52
  /**
54
53
  * 获得字段是否禁用
@@ -59,10 +58,10 @@ export function getEnabledFields(element) {
59
58
 
60
59
  export function getFieldDisabled(element) {
61
60
  return {
62
- fontSize: true,
63
- bold: true,
64
- italic: true,
65
- underline: true
61
+ fontSize: false,
62
+ bold: false,
63
+ italic: false,
64
+ underline: false
66
65
  };
67
66
  }
68
67
  export default {
@@ -4,10 +4,10 @@ var _excluded = ["Component"];
4
4
  import React, { useMemo } from 'react';
5
5
  import { setGlobalTagStyle, useValues } from "./globalTag";
6
6
  var fieldDisabled = {
7
- fontSize: true,
8
- bold: true,
9
- italic: true,
10
- underline: true
7
+ fontSize: false,
8
+ bold: false,
9
+ italic: false,
10
+ underline: false
11
11
  };
12
12
 
13
13
  function GlobalTagStyleSetting(props) {
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  var _excluded = ["color", "background", "opacity"],
4
- _excluded2 = ["color", "background", "opacity", "bold", "italic"];
4
+ _excluded2 = ["color", "background", "opacity", "bold", "italic", "underline"];
5
5
  import fontStyleUtil from "../../../../../settings/common/text/fontStyleUtil";
6
6
  import { formatBackgroundRgbaColor, parseBackground, formatRgbaColor } from "../ElementTextStyleSetting/colorUtil";
7
7
  var defaultStyle = {
@@ -15,7 +15,10 @@ export function useValues(topo) {
15
15
  return _extends({
16
16
  color: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.color) || defaultStyle.color,
17
17
  fontFamily: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontFamily) || defaultStyle.fontFamily,
18
- fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize
18
+ fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize,
19
+ bold: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.bold,
20
+ italic: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.italic,
21
+ underline: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.underline
19
22
  }, parseBackground(nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.background));
20
23
  }
21
24
  export var setGlobalTagStyle = function setGlobalTagStyle(topo, styleData) {
@@ -61,13 +64,13 @@ function buildStyle(styleData, prevTagStyle) {
61
64
  }
62
65
 
63
66
  function buildGlobalStyle(styleData) {
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);
67
+ var color = styleData.color,
68
+ background = styleData.background,
69
+ opacity = styleData.opacity,
70
+ bold = styleData.bold,
71
+ italic = styleData.italic,
72
+ underline = styleData.underline,
73
+ otherStyle = _objectWithoutPropertiesLoose(styleData, _excluded2);
71
74
 
72
75
  var tagStyle = _extends({}, otherStyle);
73
76
 
@@ -83,6 +86,10 @@ function buildGlobalStyle(styleData) {
83
86
  tagStyle.fontItalic = italic;
84
87
  }
85
88
 
89
+ if ('underline' in styleData) {
90
+ tagStyle.fontUnderline = underline;
91
+ }
92
+
86
93
  if ('background' in styleData) {
87
94
  // 背景颜色
88
95
  tagStyle.background = formatRgbaColor(background);
@@ -13,12 +13,12 @@ function useUpdateHtTopoDefaultTagStyle(props) {
13
13
  var nodeLabelStyle = displayConfig.nodeLabelStyle,
14
14
  defaultEdgeLabelStyle = displayConfig.defaultEdgeLabelStyle;
15
15
  useEffect(function () {
16
- if (nodeLabelStyle) {
16
+ if (nodeLabelStyle && topo.getHtTopo().setDefaultNodeLabelStyle) {
17
17
  topo.getHtTopo().setDefaultNodeLabelStyle(nodeLabelStyle);
18
18
  }
19
19
  }, [nodeLabelStyle]);
20
20
  useEffect(function () {
21
- if (defaultEdgeLabelStyle) {
21
+ if (defaultEdgeLabelStyle && topo.getHtTopo().setDefaultEdgeTagStyle) {
22
22
  topo.getHtTopo().setDefaultEdgeTagStyle(defaultEdgeLabelStyle);
23
23
  }
24
24
  }, [defaultEdgeLabelStyle]);
@@ -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.20" === 'string' ? "6.0.20" : null;
26
+ var version = typeof "7.0.0-dev.1" === 'string' ? "7.0.0-dev.1" : null;
27
27
  console.info("\u62D3\u6251\u7248\u672C: " + version);
28
28
  /**
29
29
  * 拓扑显示和编辑
@@ -68,16 +68,8 @@ function FontStyleButton(props) {
68
68
  underline: underline
69
69
  })),
70
70
  value = _useState2[0],
71
- setValue = _useState2[1]; // 选中的元素
71
+ setValue = _useState2[1];
72
72
 
73
-
74
- var selection = topo.selectionModel.useHtSelection();
75
- (0, _react.useEffect)(function () {
76
- var containText = selection.filter(function (ele) {
77
- return (0, _htElementUtils.isText)(ele);
78
- }).length;
79
- setDisabled(!containText);
80
- }, [selection]);
81
73
  (0, _react.useEffect)(function () {
82
74
  setValue(buildValue({
83
75
  bold: bold,
@@ -20,23 +20,21 @@ var _colorUtil = require("../colorUtil");
20
20
  var _excluded = ["color", "background", "opacity", "bold", "italic"];
21
21
 
22
22
  function getTextStyle(element) {
23
- var underline = null;
24
23
  return (0, _extends2["default"])({
25
24
  color: (0, _colorUtil.parseColor)(element.a('edge.tag.color')),
26
25
  fontFamily: element.a('edge.tag.fontFamily') || '微软雅黑',
27
- underline: underline
26
+ bold: !!element.a('edge.tag.fontBold'),
27
+ itatic: !!element.a('edge.tag.fontItalic')
28
28
  }, (0, _colorUtil.parseBackground)(element.a('edge.tag.background')));
29
29
  }
30
30
 
31
31
  function setTextStyle(element, style, topo) {
32
- var _fontStyleUtil$remove = _fontStyleUtil["default"].removeBoldItalic(style),
33
- color = _fontStyleUtil$remove.color,
34
- background = _fontStyleUtil$remove.background,
35
- opacity = _fontStyleUtil$remove.opacity,
36
- bold = _fontStyleUtil$remove.bold,
37
- italic = _fontStyleUtil$remove.italic,
38
- otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(_fontStyleUtil$remove, _excluded);
39
-
32
+ var color = style.color,
33
+ background = style.background,
34
+ opacity = style.opacity,
35
+ bold = style.bold,
36
+ italic = style.italic,
37
+ otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(style, _excluded);
40
38
  var tagStyle = (0, _extends2["default"])({}, otherStyle);
41
39
 
42
40
  if ('color' in style) {
@@ -73,12 +71,12 @@ function setTextStyle(element, style, topo) {
73
71
 
74
72
 
75
73
  function getEnabledFields(element) {
76
- return ['fontFamily', 'color', 'background', 'opacity'];
74
+ return ['fontFamily', 'color', 'background', 'opacity', 'fontSize', 'bold', 'italic'];
77
75
  }
78
76
 
79
77
  function getFieldDisabled(element) {
80
78
  return {
81
- fontSize: true
79
+ fontSize: false
82
80
  };
83
81
  }
84
82
 
@@ -20,7 +20,7 @@ var _colorUtil = require("../colorUtil");
20
20
  var _excluded = ["color", "background", "opacity", "bold", "italic"];
21
21
 
22
22
  function getTextStyle(element) {
23
- var underline = null;
23
+ var underline = !!element.a('node.tag.fontUnderline');
24
24
  return (0, _extends2["default"])({
25
25
  color: (0, _colorUtil.parseColor)(element.a('ht.color')),
26
26
  underline: underline
@@ -28,14 +28,12 @@ function getTextStyle(element) {
28
28
  }
29
29
 
30
30
  function setTextStyle(element, style, topo) {
31
- var _fontStyleUtil$remove = _fontStyleUtil["default"].removeBoldItalic(style),
32
- color = _fontStyleUtil$remove.color,
33
- background = _fontStyleUtil$remove.background,
34
- opacity = _fontStyleUtil$remove.opacity,
35
- bold = _fontStyleUtil$remove.bold,
36
- italic = _fontStyleUtil$remove.italic,
37
- otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(_fontStyleUtil$remove, _excluded);
38
-
31
+ var color = style.color,
32
+ background = style.background,
33
+ opacity = style.opacity,
34
+ bold = style.bold,
35
+ italic = style.italic,
36
+ otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(style, _excluded);
39
37
  var tagStyle = (0, _extends2["default"])({}, otherStyle);
40
38
 
41
39
  if ('color' in style) {
@@ -66,7 +64,7 @@ function setTextStyle(element, style, topo) {
66
64
  }
67
65
 
68
66
  function getEnabledFields(element) {
69
- return ['fontFamily', 'color', 'background', 'opacity'];
67
+ return ['fontFamily', 'color', 'background', 'opacity', 'fontSize', 'bold', 'italic', 'underline'];
70
68
  }
71
69
  /**
72
70
  * 获得字段是否禁用
@@ -78,10 +76,10 @@ function getEnabledFields(element) {
78
76
 
79
77
  function getFieldDisabled(element) {
80
78
  return {
81
- fontSize: true,
82
- bold: true,
83
- italic: true,
84
- underline: true
79
+ fontSize: false,
80
+ bold: false,
81
+ italic: false,
82
+ underline: false
85
83
  };
86
84
  }
87
85
 
@@ -20,10 +20,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
20
20
  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; }
21
21
 
22
22
  var fieldDisabled = {
23
- fontSize: true,
24
- bold: true,
25
- italic: true,
26
- underline: true
23
+ fontSize: false,
24
+ bold: false,
25
+ italic: false,
26
+ underline: false
27
27
  };
28
28
 
29
29
  function GlobalTagStyleSetting(props) {
@@ -16,7 +16,7 @@ var _fontStyleUtil = _interopRequireDefault(require("../../../../../settings/com
16
16
  var _colorUtil = require("../ElementTextStyleSetting/colorUtil");
17
17
 
18
18
  var _excluded = ["color", "background", "opacity"],
19
- _excluded2 = ["color", "background", "opacity", "bold", "italic"];
19
+ _excluded2 = ["color", "background", "opacity", "bold", "italic", "underline"];
20
20
  var defaultStyle = {
21
21
  color: '#AFB9C2',
22
22
  fontFamily: '微软雅黑'
@@ -29,7 +29,10 @@ function useValues(topo) {
29
29
  return (0, _extends2["default"])({
30
30
  color: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.color) || defaultStyle.color,
31
31
  fontFamily: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontFamily) || defaultStyle.fontFamily,
32
- fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize
32
+ fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize,
33
+ bold: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.bold,
34
+ italic: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.italic,
35
+ underline: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.underline
33
36
  }, (0, _colorUtil.parseBackground)(nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.background));
34
37
  }
35
38
 
@@ -74,14 +77,13 @@ function buildStyle(styleData, prevTagStyle) {
74
77
  }
75
78
 
76
79
  function buildGlobalStyle(styleData) {
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
-
80
+ var color = styleData.color,
81
+ background = styleData.background,
82
+ opacity = styleData.opacity,
83
+ bold = styleData.bold,
84
+ italic = styleData.italic,
85
+ underline = styleData.underline,
86
+ otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(styleData, _excluded2);
85
87
  var tagStyle = (0, _extends2["default"])({}, otherStyle);
86
88
 
87
89
  if ('color' in styleData) {
@@ -96,6 +98,10 @@ function buildGlobalStyle(styleData) {
96
98
  tagStyle.fontItalic = italic;
97
99
  }
98
100
 
101
+ if ('underline' in styleData) {
102
+ tagStyle.fontUnderline = underline;
103
+ }
104
+
99
105
  if ('background' in styleData) {
100
106
  // 背景颜色
101
107
  tagStyle.background = (0, _colorUtil.formatRgbaColor)(background);
@@ -22,12 +22,12 @@ function useUpdateHtTopoDefaultTagStyle(props) {
22
22
  var nodeLabelStyle = displayConfig.nodeLabelStyle,
23
23
  defaultEdgeLabelStyle = displayConfig.defaultEdgeLabelStyle;
24
24
  (0, _react.useEffect)(function () {
25
- if (nodeLabelStyle) {
25
+ if (nodeLabelStyle && topo.getHtTopo().setDefaultNodeLabelStyle) {
26
26
  topo.getHtTopo().setDefaultNodeLabelStyle(nodeLabelStyle);
27
27
  }
28
28
  }, [nodeLabelStyle]);
29
29
  (0, _react.useEffect)(function () {
30
- if (defaultEdgeLabelStyle) {
30
+ if (defaultEdgeLabelStyle && topo.getHtTopo().setDefaultEdgeTagStyle) {
31
31
  topo.getHtTopo().setDefaultEdgeTagStyle(defaultEdgeLabelStyle);
32
32
  }
33
33
  }, [defaultEdgeLabelStyle]);
@@ -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.20" === 'string' ? "6.0.20" : null;
57
+ var version = typeof "7.0.0-dev.1" === 'string' ? "7.0.0-dev.1" : 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.20",
3
+ "version": "7.0.0-dev.1",
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.20/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@7.0.0-dev.1/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }