@riil-frontend/component-topology 6.0.0-alpha.55 → 6.0.0-alpha.57
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.css +1 -1
- package/build/index.js +10 -10
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +10 -1
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +3 -8
- package/es/core/editor/components/Toolbar/widgets/components/ButtonBox.js +1 -1
- package/es/core/editor/components/Toolbar/widgets/components/ButtonBox.module.scss +4 -3
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +8 -5
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +26 -7
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +17 -3
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +23 -9
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +26 -7
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +45 -17
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +5 -1
- package/es/core/editor/components/settings/common/text/fontStyleUtil.js +10 -0
- package/es/core/editor/components/settings/propertyViews/layer/BasicSetting.js +0 -1
- package/es/core/models/TopoApp.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +10 -1
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +3 -8
- package/lib/core/editor/components/Toolbar/widgets/components/ButtonBox.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/components/ButtonBox.module.scss +4 -3
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +8 -5
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +29 -7
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +21 -3
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +23 -9
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +29 -7
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +49 -18
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +6 -1
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +13 -0
- package/lib/core/editor/components/settings/propertyViews/layer/BasicSetting.js +0 -2
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports["default"] = void 0;
|
7
|
+
exports.getFieldDisabled = getFieldDisabled;
|
7
8
|
exports.getTextStyle = getTextStyle;
|
8
9
|
exports.setTextStyle = setTextStyle;
|
9
10
|
|
@@ -22,10 +23,16 @@ function getTextStyle(element) {
|
|
22
23
|
}
|
23
24
|
|
24
25
|
var underline = element.s('text.decoration') === 'underline';
|
26
|
+
|
27
|
+
var font = _fontStyleUtil["default"].toMap(element.s('group.title.font'));
|
28
|
+
|
25
29
|
return (0, _extends2["default"])({
|
26
30
|
color: (0, _colorUtil.parseColor)(element.s('group.title.color')),
|
27
31
|
underline: underline
|
28
|
-
}, _fontStyleUtil["default"].toMap(element.s('group.title.font')),
|
32
|
+
}, _fontStyleUtil["default"].toMap(element.s('group.title.font')), {
|
33
|
+
fontSize: font.fontSize || 12,
|
34
|
+
fontFamily: font.fontFamily || '微软雅黑'
|
35
|
+
}, (0, _colorUtil.parseBackground)(element.s('group.title.background')));
|
29
36
|
}
|
30
37
|
|
31
38
|
function setTextStyle(element, style, topo) {
|
@@ -45,13 +52,24 @@ function setTextStyle(element, style, topo) {
|
|
45
52
|
element.s('group.title.background', (0, _colorUtil.formatBackgroundRgbaColor)(prevStyle, style));
|
46
53
|
var fontStyle = (0, _extends2["default"])({}, getTextStyle(element), style);
|
47
54
|
|
48
|
-
var fontStr = _fontStyleUtil["default"].build(fontStyle);
|
55
|
+
var fontStr = _fontStyleUtil["default"].build(_fontStyleUtil["default"].removeBoldItalic(fontStyle));
|
49
56
|
|
50
57
|
element.s('group.title.font', fontStr);
|
51
58
|
}
|
52
59
|
|
60
|
+
function getFieldDisabled(element) {
|
61
|
+
if (!element.isExpanded()) {
|
62
|
+
return {
|
63
|
+
fontSize: true
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
67
|
+
return {};
|
68
|
+
}
|
69
|
+
|
53
70
|
var _default = {
|
54
71
|
getTextStyle: getTextStyle,
|
55
|
-
setTextStyle: setTextStyle
|
72
|
+
setTextStyle: setTextStyle,
|
73
|
+
getFieldDisabled: getFieldDisabled
|
56
74
|
};
|
57
75
|
exports["default"] = _default;
|
@@ -13,18 +13,32 @@ var _fontStyleUtil = _interopRequireDefault(require("../../../../../../settings/
|
|
13
13
|
|
14
14
|
var _colorUtil = require("../colorUtil");
|
15
15
|
|
16
|
-
var defaultStyle = {
|
16
|
+
var defaultStyle = {
|
17
|
+
color: '#4D6277',
|
18
|
+
font: '10px 微软雅黑',
|
19
|
+
background: '#E4E9EE'
|
20
|
+
};
|
17
21
|
|
18
22
|
function getLabelStyle(element) {
|
19
|
-
|
20
|
-
}
|
23
|
+
var background = element.s('layer.label.background');
|
21
24
|
|
22
|
-
|
23
|
-
|
25
|
+
if (background === undefined) {
|
26
|
+
background = defaultStyle.background;
|
27
|
+
}
|
24
28
|
|
25
|
-
|
29
|
+
return {
|
30
|
+
color: element.s('layer.label.color') || defaultStyle.color,
|
31
|
+
font: element.s('layer.label.font') || defaultStyle.font,
|
32
|
+
background: background
|
33
|
+
};
|
34
|
+
}
|
26
35
|
|
27
|
-
|
36
|
+
function setLabelStyle(element, style) {
|
37
|
+
var map = {};
|
38
|
+
Object.keys(style).forEach(function (name) {
|
39
|
+
map["layer.label." + name] = style[name];
|
40
|
+
});
|
41
|
+
element.s(map);
|
28
42
|
} // 分层标题文字样式
|
29
43
|
|
30
44
|
|
@@ -32,7 +46,7 @@ function getTextStyle(element) {
|
|
32
46
|
var style = getLabelStyle(element);
|
33
47
|
var underline = null;
|
34
48
|
return (0, _extends2["default"])({
|
35
|
-
color: (0, _colorUtil.parseColor)(style.
|
49
|
+
color: (0, _colorUtil.parseColor)(style.color),
|
36
50
|
underline: underline
|
37
51
|
}, _fontStyleUtil["default"].toMap(style.font), (0, _colorUtil.parseBackground)(style.background));
|
38
52
|
}
|
@@ -43,7 +57,7 @@ function setTextStyle(element, style) {
|
|
43
57
|
var labelStyle = {};
|
44
58
|
|
45
59
|
if ('color' in style) {
|
46
|
-
labelStyle.
|
60
|
+
labelStyle.color = style.color.hex;
|
47
61
|
} // 背景颜色
|
48
62
|
|
49
63
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports["default"] = void 0;
|
7
|
+
exports.getFieldDisabled = getFieldDisabled;
|
7
8
|
exports.getTextStyle = getTextStyle;
|
8
9
|
exports.setTextStyle = setTextStyle;
|
9
10
|
|
@@ -15,7 +16,7 @@ var _fontStyleUtil = _interopRequireDefault(require("../../../../../../settings/
|
|
15
16
|
|
16
17
|
var _colorUtil = require("../colorUtil");
|
17
18
|
|
18
|
-
var _excluded = ["color", "background", "opacity"];
|
19
|
+
var _excluded = ["color", "background", "opacity", "bold", "italic"];
|
19
20
|
|
20
21
|
function getTextStyle(element) {
|
21
22
|
var underline = null;
|
@@ -26,27 +27,48 @@ function getTextStyle(element) {
|
|
26
27
|
}
|
27
28
|
|
28
29
|
function setTextStyle(element, style, topo) {
|
29
|
-
var
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
var _fontStyleUtil$remove = _fontStyleUtil["default"].removeBoldItalic(style),
|
31
|
+
color = _fontStyleUtil$remove.color,
|
32
|
+
background = _fontStyleUtil$remove.background,
|
33
|
+
opacity = _fontStyleUtil$remove.opacity,
|
34
|
+
bold = _fontStyleUtil$remove.bold,
|
35
|
+
italic = _fontStyleUtil$remove.italic,
|
36
|
+
otherStyle = (0, _objectWithoutPropertiesLoose2["default"])(_fontStyleUtil$remove, _excluded);
|
37
|
+
|
33
38
|
var tagStyle = (0, _extends2["default"])({}, otherStyle);
|
34
39
|
|
35
40
|
if ('color' in style) {
|
36
41
|
tagStyle.color = color.hex;
|
37
42
|
}
|
38
43
|
|
44
|
+
if ('bold' in style) {
|
45
|
+
tagStyle.fontBold = bold;
|
46
|
+
}
|
47
|
+
|
48
|
+
if ('italic' in style) {
|
49
|
+
tagStyle.fontItalic = italic;
|
50
|
+
}
|
51
|
+
|
39
52
|
if ('background' in style || 'opacity' in style) {
|
40
53
|
// 背景颜色
|
41
54
|
var prevStyle = getTextStyle(element);
|
42
55
|
tagStyle.background = (0, _colorUtil.formatBackgroundRgbaColor)(prevStyle, style);
|
43
56
|
}
|
44
57
|
|
45
|
-
|
58
|
+
if (Object.keys(tagStyle).length) {
|
59
|
+
topo.getHtTopo().setNodeLabelStyle(element, tagStyle);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
function getFieldDisabled(element) {
|
64
|
+
return {
|
65
|
+
fontSize: true
|
66
|
+
};
|
46
67
|
}
|
47
68
|
|
48
69
|
var _default = {
|
49
70
|
getTextStyle: getTextStyle,
|
50
|
-
setTextStyle: setTextStyle
|
71
|
+
setTextStyle: setTextStyle,
|
72
|
+
getFieldDisabled: getFieldDisabled
|
51
73
|
};
|
52
74
|
exports["default"] = _default;
|
@@ -4,9 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports.getElementTextStyle = getElementTextStyle;
|
7
|
+
exports.getElementTextStyleFieldDisabled = getElementTextStyleFieldDisabled;
|
7
8
|
exports.getTextStyle = getTextStyle;
|
8
9
|
exports.setTextStyle = setTextStyle;
|
9
10
|
|
11
|
+
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
12
|
+
|
10
13
|
var _htElementUtils = require("../../../../../../../../utils/htElementUtils");
|
11
14
|
|
12
15
|
var _elements = _interopRequireDefault(require("./elements"));
|
@@ -40,23 +43,31 @@ function getElementTextStyle(element) {
|
|
40
43
|
return null;
|
41
44
|
}
|
42
45
|
|
43
|
-
function
|
44
|
-
|
45
|
-
|
46
|
-
return getElementTextStyle(element);
|
47
|
-
} else if (htSelection.length) {
|
48
|
-
// 多选时值相同返回?
|
49
|
-
var values = htSelection.map(function (element) {
|
50
|
-
return getElementTextStyle(element);
|
51
|
-
}).filter(function (item) {
|
52
|
-
return !!item;
|
53
|
-
});
|
46
|
+
function getElementTextStyleFieldDisabled(element) {
|
47
|
+
var type = getElementType(element);
|
48
|
+
var handler = _elements["default"][type];
|
54
49
|
|
55
|
-
|
56
|
-
|
50
|
+
if (handler) {
|
51
|
+
if (handler.getFieldDisabled) {
|
52
|
+
return handler.getFieldDisabled(element) || {};
|
57
53
|
}
|
58
54
|
|
59
|
-
|
55
|
+
return {};
|
56
|
+
}
|
57
|
+
|
58
|
+
return null;
|
59
|
+
}
|
60
|
+
|
61
|
+
function getTextStyle(htSelection, styleNames) {
|
62
|
+
// 多选时值相同返回?
|
63
|
+
var values = htSelection.map(function (element) {
|
64
|
+
return getElementTextStyle(element);
|
65
|
+
}).filter(function (item) {
|
66
|
+
return !!item;
|
67
|
+
});
|
68
|
+
var value = {};
|
69
|
+
|
70
|
+
if (values.length) {
|
60
71
|
styleNames.forEach(function (styleName) {
|
61
72
|
var val = values[0][styleName];
|
62
73
|
var different = values.filter(function (obj) {
|
@@ -67,10 +78,30 @@ function getTextStyle(htSelection, styleNames) {
|
|
67
78
|
value[styleName] = val;
|
68
79
|
}
|
69
80
|
});
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
81
|
+
} // 多选时元素都不支持字段时禁用
|
82
|
+
|
83
|
+
|
84
|
+
var fieldDisableds = htSelection.map(function (element) {
|
85
|
+
return getElementTextStyleFieldDisabled(element);
|
86
|
+
}).filter(function (item) {
|
87
|
+
return !!item;
|
88
|
+
});
|
89
|
+
var fieldDisabled = styleNames.reduce(function (result, fieldName) {
|
90
|
+
var _extends2;
|
91
|
+
|
92
|
+
var disabled = fieldDisableds.length && fieldDisableds.filter(function (item) {
|
93
|
+
return !!item[fieldName];
|
94
|
+
}).length === fieldDisableds.length;
|
95
|
+
return (0, _extends3["default"])({}, result, (_extends2 = {}, _extends2[fieldName] = disabled, _extends2));
|
96
|
+
}, {});
|
97
|
+
return {
|
98
|
+
style: value,
|
99
|
+
fieldDisabled: fieldDisabled,
|
100
|
+
debugData: {
|
101
|
+
values: values,
|
102
|
+
fieldDisableds: fieldDisableds
|
103
|
+
}
|
104
|
+
};
|
74
105
|
}
|
75
106
|
|
76
107
|
function setTextStyle(element, style, topo) {
|
@@ -19,6 +19,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
19
19
|
|
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
|
+
var fieldDisabled = {
|
23
|
+
fontSize: true
|
24
|
+
};
|
25
|
+
|
22
26
|
function GlobalTagStyleSetting(props) {
|
23
27
|
var topo = props.topo;
|
24
28
|
var Component = props.Component,
|
@@ -31,7 +35,8 @@ function GlobalTagStyleSetting(props) {
|
|
31
35
|
}, []);
|
32
36
|
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({
|
33
37
|
style: values,
|
34
|
-
setStyle: setStyle
|
38
|
+
setStyle: setStyle,
|
39
|
+
fieldDisabled: fieldDisabled
|
35
40
|
}, widgetProps));
|
36
41
|
}
|
37
42
|
|
@@ -1,7 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
3
5
|
exports.__esModule = true;
|
4
6
|
exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
9
|
+
|
10
|
+
var _excluded = ["bold", "italic"];
|
5
11
|
var fontStyleUtil = {
|
6
12
|
// 字体样式格式: bold italic 12px 黑体 或 12px 黑体
|
7
13
|
toMap: function toMap(font) {
|
@@ -43,6 +49,13 @@ var fontStyleUtil = {
|
|
43
49
|
}
|
44
50
|
});
|
45
51
|
return map;
|
52
|
+
},
|
53
|
+
// TODO 临时方法
|
54
|
+
removeBoldItalic: function removeBoldItalic(obj) {
|
55
|
+
var bold = obj.bold,
|
56
|
+
italic = obj.italic,
|
57
|
+
ohter = (0, _objectWithoutPropertiesLoose2["default"])(obj, _excluded);
|
58
|
+
return ohter;
|
46
59
|
}
|
47
60
|
};
|
48
61
|
var _default = fontStyleUtil;
|
@@ -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.57" === 'string' ? "6.0.0-alpha.57" : null;
|
56
56
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
57
57
|
/**
|
58
58
|
* 拓扑显示和编辑
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@riil-frontend/component-topology",
|
3
|
-
"version": "6.0.0-alpha.
|
3
|
+
"version": "6.0.0-alpha.57",
|
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.
|
119
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.57/build/index.html",
|
120
120
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
121
121
|
}
|