@riil-frontend/component-topology 6.0.0-alpha.32 → 6.0.0-alpha.33
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 +4 -4
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +0 -4
- package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +5 -1
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +5 -1
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +5 -1
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +3 -2
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +25 -2
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +4 -1
- package/es/core/models/TopoApp.js +1 -1
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +0 -5
- package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +5 -1
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +5 -1
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +5 -1
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +3 -2
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +25 -2
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +4 -1
- package/lib/core/models/TopoApp.js +1 -1
- package/package.json +2 -2
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/EmptySetting.js +0 -8
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/edgeTagSetting.js +0 -8
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/globalTag.js +0 -36
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/nodeTagSetting.js +0 -8
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/text.js +0 -8
- package/es/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +0 -75
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/EmptySetting.js +0 -13
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/edgeTagSetting.js +0 -13
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/globalTag.js +0 -47
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/nodeTagSetting.js +0 -13
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/text.js +0 -13
- package/lib/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +0 -90
@@ -5,7 +5,6 @@ import WidgetBox from "./WidgetBox";
|
|
5
5
|
import ColorPanel from "../../../../../components/ColorPanel";
|
6
6
|
import FontColorRange from "../../../../../components/ColorPanel/components/FontColorRange";
|
7
7
|
import styles from "./FontColorButton.module.scss";
|
8
|
-
import useFontStyleSetting from "../hooks/useFontStyleSetting";
|
9
8
|
|
10
9
|
function FontFamilySelect(props) {
|
11
10
|
var value = props.value,
|
@@ -16,9 +15,6 @@ function FontFamilySelect(props) {
|
|
16
15
|
disabled = _useState[0],
|
17
16
|
setDisabled = _useState[1];
|
18
17
|
|
19
|
-
var fontStyleSetting = useFontStyleSetting({
|
20
|
-
topo: topo
|
21
|
-
});
|
22
18
|
console.log(topo, 'topo这里需要处理颜色改变的事情');
|
23
19
|
|
24
20
|
var backOpacityChange = function backOpacityChange(value) {
|
@@ -40,11 +40,15 @@ function FontFamilyWidget(props) {
|
|
40
40
|
}, /*#__PURE__*/React.createElement(FontFamilySelect, {
|
41
41
|
value: style.fontFamily,
|
42
42
|
onChange: function onChange(val) {
|
43
|
+
topo.historyManager.beginTransaction();
|
43
44
|
setStyle({
|
44
45
|
fontFamily: val
|
45
46
|
});
|
47
|
+
topo.historyManager.endTransaction();
|
46
48
|
}
|
47
49
|
}));
|
48
50
|
}
|
49
51
|
|
50
|
-
export default textStyleSettingRouter(FontFamilyWidget
|
52
|
+
export default textStyleSettingRouter(FontFamilyWidget, {
|
53
|
+
names: ['fontFamily']
|
54
|
+
});
|
@@ -37,11 +37,15 @@ function FontSizeWidget(props) {
|
|
37
37
|
}, /*#__PURE__*/React.createElement(FontSizeSelect, {
|
38
38
|
value: style.fontSize,
|
39
39
|
onChange: function onChange(val) {
|
40
|
+
topo.historyManager.beginTransaction();
|
40
41
|
setStyle({
|
41
42
|
fontSize: val
|
42
43
|
});
|
44
|
+
topo.historyManager.endTransaction();
|
43
45
|
}
|
44
46
|
}));
|
45
47
|
}
|
46
48
|
|
47
|
-
export default textStyleSettingRouter(FontSizeWidget
|
49
|
+
export default textStyleSettingRouter(FontSizeWidget, {
|
50
|
+
names: ['fontSize']
|
51
|
+
});
|
@@ -73,7 +73,9 @@ function FontStyleButton(props) {
|
|
73
73
|
*/
|
74
74
|
|
75
75
|
var handleChange = function handleChange(selectedKeys) {
|
76
|
+
topo.historyManager.beginTransaction();
|
76
77
|
setStyle(formatStyle(selectedKeys));
|
78
|
+
topo.historyManager.endTransaction();
|
77
79
|
};
|
78
80
|
|
79
81
|
return /*#__PURE__*/React.createElement(WidgetBox, {
|
@@ -105,4 +107,6 @@ function FontStyleButton(props) {
|
|
105
107
|
})));
|
106
108
|
}
|
107
109
|
|
108
|
-
export default textStyleSettingRouter(FontStyleButton
|
110
|
+
export default textStyleSettingRouter(FontStyleButton, {
|
111
|
+
names: ['bold', 'italic', 'underline']
|
112
|
+
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
-
var _excluded = ["Component"];
|
3
|
+
var _excluded = ["Component", "styleNames"];
|
4
4
|
import React, { useMemo, useState } from 'react';
|
5
5
|
import { getTextStyle, setTextStyle } from "./textStyleUtil";
|
6
6
|
|
@@ -8,6 +8,7 @@ function ElementTextStyleSetting(props) {
|
|
8
8
|
var topo = props.topo;
|
9
9
|
|
10
10
|
var Component = props.Component,
|
11
|
+
styleNames = props.styleNames,
|
11
12
|
widgetProps = _objectWithoutPropertiesLoose(props, _excluded); // 选中的元素
|
12
13
|
|
13
14
|
|
@@ -20,7 +21,7 @@ function ElementTextStyleSetting(props) {
|
|
20
21
|
return topo.getHtTopo().getGraphView().getSelectionModel().getSelection().toArray();
|
21
22
|
}, [selection, topo]);
|
22
23
|
var value = useMemo(function () {
|
23
|
-
return getTextStyle(htSelection) || {};
|
24
|
+
return getTextStyle(htSelection, styleNames) || {};
|
24
25
|
}, [htSelection, topo]);
|
25
26
|
var setStyle = useMemo(function () {
|
26
27
|
return function (style) {
|
@@ -27,12 +27,35 @@ export function getElementTextStyle(element) {
|
|
27
27
|
|
28
28
|
return null;
|
29
29
|
}
|
30
|
-
export function getTextStyle(htSelection) {
|
30
|
+
export function getTextStyle(htSelection, styleNames) {
|
31
31
|
if (htSelection.length === 1) {
|
32
32
|
var element = htSelection[0];
|
33
33
|
return getElementTextStyle(element);
|
34
|
-
}
|
34
|
+
} else if (htSelection.length) {
|
35
|
+
// 多选时值相同返回?
|
36
|
+
var values = htSelection.map(function (element) {
|
37
|
+
return getElementTextStyle(element);
|
38
|
+
}).filter(function (item) {
|
39
|
+
return !!item;
|
40
|
+
});
|
35
41
|
|
42
|
+
if (!values.length) {
|
43
|
+
return null;
|
44
|
+
}
|
45
|
+
|
46
|
+
var value = {};
|
47
|
+
styleNames.forEach(function (styleName) {
|
48
|
+
var val = values[0][styleName];
|
49
|
+
var different = values.filter(function (obj) {
|
50
|
+
return obj[styleName] !== val;
|
51
|
+
});
|
52
|
+
|
53
|
+
if (!different.length) {
|
54
|
+
value[styleName] = val;
|
55
|
+
}
|
56
|
+
});
|
57
|
+
return Object.keys(value).length ? value : null;
|
58
|
+
}
|
36
59
|
|
37
60
|
return null;
|
38
61
|
}
|
@@ -4,13 +4,16 @@ import ElementTextStyleSetting from "./ElementTextStyleSetting/ElementTextStyleS
|
|
4
4
|
import GlobalTagStyleSetting from "./GlobalTagStyleSetting/GlobalTagStyleSetting";
|
5
5
|
|
6
6
|
function textStyleSettingRouter(Component, options) {
|
7
|
+
var names = (options === null || options === void 0 ? void 0 : options.names) || [];
|
7
8
|
return function TextStyleSettingButton(props) {
|
8
9
|
var topo = props.topo;
|
9
10
|
var selection = topo.selectionManager.useHtSelection();
|
10
11
|
var Widget = !selection.length ? GlobalTagStyleSetting : ElementTextStyleSetting;
|
11
12
|
return /*#__PURE__*/React.createElement(Widget, _extends({
|
12
13
|
Component: Component
|
13
|
-
}, props
|
14
|
+
}, props, {
|
15
|
+
styleNames: names
|
16
|
+
}));
|
14
17
|
};
|
15
18
|
}
|
16
19
|
|
@@ -22,7 +22,7 @@ import topoFactory from "./topoFactory";
|
|
22
22
|
import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
|
23
23
|
import SelectionManager from "./SelectionManager"; // eslint-disable-next-line no-undef
|
24
24
|
|
25
|
-
var version = typeof "6.0.0-alpha.
|
25
|
+
var version = typeof "6.0.0-alpha.33" === 'string' ? "6.0.0-alpha.33" : null;
|
26
26
|
console.info("\u62D3\u6251\u7248\u672C: " + version);
|
27
27
|
/**
|
28
28
|
* 拓扑显示和编辑
|
@@ -17,8 +17,6 @@ var _FontColorRange = _interopRequireDefault(require("../../../../../components/
|
|
17
17
|
|
18
18
|
var _FontColorButtonModule = _interopRequireDefault(require("./FontColorButton.module.scss"));
|
19
19
|
|
20
|
-
var _useFontStyleSetting = _interopRequireDefault(require("../hooks/useFontStyleSetting"));
|
21
|
-
|
22
20
|
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
21
|
|
24
22
|
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; }
|
@@ -33,9 +31,6 @@ function FontFamilySelect(props) {
|
|
33
31
|
disabled = _useState[0],
|
34
32
|
setDisabled = _useState[1];
|
35
33
|
|
36
|
-
var fontStyleSetting = (0, _useFontStyleSetting["default"])({
|
37
|
-
topo: topo
|
38
|
-
});
|
39
34
|
console.log(topo, 'topo这里需要处理颜色改变的事情');
|
40
35
|
|
41
36
|
var backOpacityChange = function backOpacityChange(value) {
|
@@ -54,13 +54,17 @@ function FontFamilyWidget(props) {
|
|
54
54
|
}, /*#__PURE__*/_react["default"].createElement(FontFamilySelect, {
|
55
55
|
value: style.fontFamily,
|
56
56
|
onChange: function onChange(val) {
|
57
|
+
topo.historyManager.beginTransaction();
|
57
58
|
setStyle({
|
58
59
|
fontFamily: val
|
59
60
|
});
|
61
|
+
topo.historyManager.endTransaction();
|
60
62
|
}
|
61
63
|
}));
|
62
64
|
}
|
63
65
|
|
64
|
-
var _default = (0, _textStyleSettingRouter["default"])(FontFamilyWidget
|
66
|
+
var _default = (0, _textStyleSettingRouter["default"])(FontFamilyWidget, {
|
67
|
+
names: ['fontFamily']
|
68
|
+
});
|
65
69
|
|
66
70
|
exports["default"] = _default;
|
@@ -51,13 +51,17 @@ function FontSizeWidget(props) {
|
|
51
51
|
}, /*#__PURE__*/_react["default"].createElement(FontSizeSelect, {
|
52
52
|
value: style.fontSize,
|
53
53
|
onChange: function onChange(val) {
|
54
|
+
topo.historyManager.beginTransaction();
|
54
55
|
setStyle({
|
55
56
|
fontSize: val
|
56
57
|
});
|
58
|
+
topo.historyManager.endTransaction();
|
57
59
|
}
|
58
60
|
}));
|
59
61
|
}
|
60
62
|
|
61
|
-
var _default = (0, _textStyleSettingRouter["default"])(FontSizeWidget
|
63
|
+
var _default = (0, _textStyleSettingRouter["default"])(FontSizeWidget, {
|
64
|
+
names: ['fontSize']
|
65
|
+
});
|
62
66
|
|
63
67
|
exports["default"] = _default;
|
@@ -89,7 +89,9 @@ function FontStyleButton(props) {
|
|
89
89
|
*/
|
90
90
|
|
91
91
|
var handleChange = function handleChange(selectedKeys) {
|
92
|
+
topo.historyManager.beginTransaction();
|
92
93
|
setStyle(formatStyle(selectedKeys));
|
94
|
+
topo.historyManager.endTransaction();
|
93
95
|
};
|
94
96
|
|
95
97
|
return /*#__PURE__*/_react["default"].createElement(_WidgetBox["default"], {
|
@@ -121,6 +123,8 @@ function FontStyleButton(props) {
|
|
121
123
|
})));
|
122
124
|
}
|
123
125
|
|
124
|
-
var _default = (0, _textStyleSettingRouter["default"])(FontStyleButton
|
126
|
+
var _default = (0, _textStyleSettingRouter["default"])(FontStyleButton, {
|
127
|
+
names: ['bold', 'italic', 'underline']
|
128
|
+
});
|
125
129
|
|
126
130
|
exports["default"] = _default;
|
@@ -13,7 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
14
14
|
var _textStyleUtil = require("./textStyleUtil");
|
15
15
|
|
16
|
-
var _excluded = ["Component"];
|
16
|
+
var _excluded = ["Component", "styleNames"];
|
17
17
|
|
18
18
|
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); }
|
19
19
|
|
@@ -22,6 +22,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
22
22
|
function ElementTextStyleSetting(props) {
|
23
23
|
var topo = props.topo;
|
24
24
|
var Component = props.Component,
|
25
|
+
styleNames = props.styleNames,
|
25
26
|
widgetProps = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded); // 选中的元素
|
26
27
|
|
27
28
|
var selection = topo.selectionManager.useSelection();
|
@@ -33,7 +34,7 @@ function ElementTextStyleSetting(props) {
|
|
33
34
|
return topo.getHtTopo().getGraphView().getSelectionModel().getSelection().toArray();
|
34
35
|
}, [selection, topo]);
|
35
36
|
var value = (0, _react.useMemo)(function () {
|
36
|
-
return (0, _textStyleUtil.getTextStyle)(htSelection) || {};
|
37
|
+
return (0, _textStyleUtil.getTextStyle)(htSelection, styleNames) || {};
|
37
38
|
}, [htSelection, topo]);
|
38
39
|
var setStyle = (0, _react.useMemo)(function () {
|
39
40
|
return function (style) {
|
@@ -38,12 +38,35 @@ function getElementTextStyle(element) {
|
|
38
38
|
return null;
|
39
39
|
}
|
40
40
|
|
41
|
-
function getTextStyle(htSelection) {
|
41
|
+
function getTextStyle(htSelection, styleNames) {
|
42
42
|
if (htSelection.length === 1) {
|
43
43
|
var element = htSelection[0];
|
44
44
|
return getElementTextStyle(element);
|
45
|
-
}
|
45
|
+
} else if (htSelection.length) {
|
46
|
+
// 多选时值相同返回?
|
47
|
+
var values = htSelection.map(function (element) {
|
48
|
+
return getElementTextStyle(element);
|
49
|
+
}).filter(function (item) {
|
50
|
+
return !!item;
|
51
|
+
});
|
46
52
|
|
53
|
+
if (!values.length) {
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
|
57
|
+
var value = {};
|
58
|
+
styleNames.forEach(function (styleName) {
|
59
|
+
var val = values[0][styleName];
|
60
|
+
var different = values.filter(function (obj) {
|
61
|
+
return obj[styleName] !== val;
|
62
|
+
});
|
63
|
+
|
64
|
+
if (!different.length) {
|
65
|
+
value[styleName] = val;
|
66
|
+
}
|
67
|
+
});
|
68
|
+
return Object.keys(value).length ? value : null;
|
69
|
+
}
|
47
70
|
|
48
71
|
return null;
|
49
72
|
}
|
@@ -14,13 +14,16 @@ var _ElementTextStyleSetting = _interopRequireDefault(require("./ElementTextStyl
|
|
14
14
|
var _GlobalTagStyleSetting = _interopRequireDefault(require("./GlobalTagStyleSetting/GlobalTagStyleSetting"));
|
15
15
|
|
16
16
|
function textStyleSettingRouter(Component, options) {
|
17
|
+
var names = (options === null || options === void 0 ? void 0 : options.names) || [];
|
17
18
|
return function TextStyleSettingButton(props) {
|
18
19
|
var topo = props.topo;
|
19
20
|
var selection = topo.selectionManager.useHtSelection();
|
20
21
|
var Widget = !selection.length ? _GlobalTagStyleSetting["default"] : _ElementTextStyleSetting["default"];
|
21
22
|
return /*#__PURE__*/_react["default"].createElement(Widget, (0, _extends2["default"])({
|
22
23
|
Component: Component
|
23
|
-
}, props
|
24
|
+
}, props, {
|
25
|
+
styleNames: names
|
26
|
+
}));
|
24
27
|
};
|
25
28
|
}
|
26
29
|
|
@@ -52,7 +52,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
|
|
52
52
|
var _SelectionManager = _interopRequireDefault(require("./SelectionManager"));
|
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.33" === 'string' ? "6.0.0-alpha.33" : 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.33",
|
4
4
|
"description": "拓扑",
|
5
5
|
"scripts": {
|
6
6
|
"start": "build-scripts start",
|
@@ -115,6 +115,6 @@
|
|
115
115
|
"access": "public"
|
116
116
|
},
|
117
117
|
"license": "MIT",
|
118
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.
|
118
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.33/build/index.html",
|
119
119
|
"gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
|
120
120
|
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
|
-
var defaultStyle = {
|
3
|
-
color: '#AFB9C2',
|
4
|
-
fontFamily: '微软雅黑'
|
5
|
-
};
|
6
|
-
export function useValues(topo) {
|
7
|
-
var displayConfigState = topo.store.useModelState('displayConfig');
|
8
|
-
var nodeLabelStyle = displayConfigState.nodeLabelStyle,
|
9
|
-
defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
|
10
|
-
return {
|
11
|
-
color: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.color) || defaultStyle.color,
|
12
|
-
fontFamily: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontFamily) || defaultStyle.fontFamily,
|
13
|
-
fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize
|
14
|
-
};
|
15
|
-
}
|
16
|
-
export var setGlobalTagStyle = function setGlobalTagStyle(topo, styleData) {
|
17
|
-
var _topo$store$getModel = topo.store.getModel('displayConfig'),
|
18
|
-
displayConfigState = _topo$store$getModel[0],
|
19
|
-
displayConfigDispatchers = _topo$store$getModel[1];
|
20
|
-
|
21
|
-
var nodeLabelStyle = displayConfigState.nodeLabelStyle,
|
22
|
-
defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
|
23
|
-
|
24
|
-
var globalNodeLabelStyle = _extends({}, nodeLabelStyle, styleData);
|
25
|
-
|
26
|
-
topo.getHtTopo().setGlobalNodeLabelStyle(globalNodeLabelStyle);
|
27
|
-
|
28
|
-
var globalEdgeTagStyle = _extends({}, defaultEdgeLabelStyle, styleData);
|
29
|
-
|
30
|
-
topo.getHtTopo().setGlobalEdgeTagStyle(globalEdgeTagStyle);
|
31
|
-
displayConfigDispatchers.update({
|
32
|
-
nodeLabelStyle: globalNodeLabelStyle,
|
33
|
-
defaultEdgeLabelStyle: globalEdgeTagStyle
|
34
|
-
});
|
35
|
-
};
|
36
|
-
export function setStyle() {}
|
@@ -1,75 +0,0 @@
|
|
1
|
-
import React, { useMemo } from 'react';
|
2
|
-
import { isText } from "../../../../../utils/htElementDataUtil";
|
3
|
-
import { isGroup, isLayer, isNode } from "../../../../../utils/htElementUtils";
|
4
|
-
import * as globalTagSetting from "./textStyleSetting/globalTag";
|
5
|
-
import * as EmptySetting from "./textStyleSetting/EmptySetting"; // 文本
|
6
|
-
|
7
|
-
function getElementType(element) {
|
8
|
-
if (isNode(element)) {
|
9
|
-
return 'nodeTag';
|
10
|
-
} else if (isGroup(element)) {
|
11
|
-
return 'group';
|
12
|
-
} else if (isText(element)) {
|
13
|
-
return 'text';
|
14
|
-
} else if (isLayer(element)) {
|
15
|
-
return 'layer';
|
16
|
-
}
|
17
|
-
|
18
|
-
return null;
|
19
|
-
}
|
20
|
-
|
21
|
-
function getType(selectionElements) {
|
22
|
-
if (!selectionElements.length) {
|
23
|
-
return 'globalTag';
|
24
|
-
} else if (selectionElements.length === 1) {
|
25
|
-
var element = selectionElements[0];
|
26
|
-
return getElementType(element);
|
27
|
-
}
|
28
|
-
|
29
|
-
return null;
|
30
|
-
}
|
31
|
-
|
32
|
-
var useValuesHookMap = {
|
33
|
-
globalTag: globalTagSetting.useValues,
|
34
|
-
empty: EmptySetting.useValues
|
35
|
-
};
|
36
|
-
|
37
|
-
function useValues(topo, selection) {
|
38
|
-
var type = getType(selection);
|
39
|
-
var useValuesHandle = useValuesHookMap[type] || useValuesHookMap.empty;
|
40
|
-
var values = useValuesHandle(topo, selection);
|
41
|
-
return values;
|
42
|
-
}
|
43
|
-
|
44
|
-
var elementSetStyleMap = {};
|
45
|
-
|
46
|
-
function useFontStyleSetting(props) {
|
47
|
-
var topo = props.topo;
|
48
|
-
var selection = topo.selectionManager.useHtSelection();
|
49
|
-
var buttonEnabled = true; // const values = useValues(topo, selection)
|
50
|
-
|
51
|
-
var values = {};
|
52
|
-
|
53
|
-
var setStyle = function setStyle(styleData) {
|
54
|
-
topo.historyManager.beginTransaction(); // 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
|
55
|
-
|
56
|
-
if (!selection.length) {
|
57
|
-
globalTagSetting.setGlobalTagStyle(topo, styleData);
|
58
|
-
} else {
|
59
|
-
selection.forEach(function (element) {
|
60
|
-
var elementType = getElementType(element);
|
61
|
-
});
|
62
|
-
}
|
63
|
-
|
64
|
-
topo.historyManager.endTransaction();
|
65
|
-
};
|
66
|
-
|
67
|
-
return {
|
68
|
-
selection: selection,
|
69
|
-
buttonEnabled: buttonEnabled,
|
70
|
-
values: values,
|
71
|
-
setStyle: setStyle
|
72
|
-
};
|
73
|
-
}
|
74
|
-
|
75
|
-
export default useFontStyleSetting;
|
@@ -1,47 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
exports.__esModule = true;
|
6
|
-
exports.setGlobalTagStyle = void 0;
|
7
|
-
exports.setStyle = setStyle;
|
8
|
-
exports.useValues = useValues;
|
9
|
-
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
|
-
|
12
|
-
var defaultStyle = {
|
13
|
-
color: '#AFB9C2',
|
14
|
-
fontFamily: '微软雅黑'
|
15
|
-
};
|
16
|
-
|
17
|
-
function useValues(topo) {
|
18
|
-
var displayConfigState = topo.store.useModelState('displayConfig');
|
19
|
-
var nodeLabelStyle = displayConfigState.nodeLabelStyle,
|
20
|
-
defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
|
21
|
-
return {
|
22
|
-
color: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.color) || defaultStyle.color,
|
23
|
-
fontFamily: (nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontFamily) || defaultStyle.fontFamily,
|
24
|
-
fontSize: nodeLabelStyle === null || nodeLabelStyle === void 0 ? void 0 : nodeLabelStyle.fontSize
|
25
|
-
};
|
26
|
-
}
|
27
|
-
|
28
|
-
var setGlobalTagStyle = function setGlobalTagStyle(topo, styleData) {
|
29
|
-
var _topo$store$getModel = topo.store.getModel('displayConfig'),
|
30
|
-
displayConfigState = _topo$store$getModel[0],
|
31
|
-
displayConfigDispatchers = _topo$store$getModel[1];
|
32
|
-
|
33
|
-
var nodeLabelStyle = displayConfigState.nodeLabelStyle,
|
34
|
-
defaultEdgeLabelStyle = displayConfigState.defaultEdgeLabelStyle;
|
35
|
-
var globalNodeLabelStyle = (0, _extends2["default"])({}, nodeLabelStyle, styleData);
|
36
|
-
topo.getHtTopo().setGlobalNodeLabelStyle(globalNodeLabelStyle);
|
37
|
-
var globalEdgeTagStyle = (0, _extends2["default"])({}, defaultEdgeLabelStyle, styleData);
|
38
|
-
topo.getHtTopo().setGlobalEdgeTagStyle(globalEdgeTagStyle);
|
39
|
-
displayConfigDispatchers.update({
|
40
|
-
nodeLabelStyle: globalNodeLabelStyle,
|
41
|
-
defaultEdgeLabelStyle: globalEdgeTagStyle
|
42
|
-
});
|
43
|
-
};
|
44
|
-
|
45
|
-
exports.setGlobalTagStyle = setGlobalTagStyle;
|
46
|
-
|
47
|
-
function setStyle() {}
|