@riil-frontend/component-topology 6.0.0-alpha.30 → 6.0.0-alpha.32
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/1.js +2 -2
- package/build/2.js +1 -1
- package/build/index.css +1 -1
- package/build/index.js +20 -20
- package/es/core/editor/components/EditorPlugin.js +2 -1
- package/es/core/editor/components/Sidebar/Sidebar.js +2 -1
- package/es/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +2 -3
- package/es/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +1 -0
- package/es/core/editor/components/Toolbar/buttons.js +5 -4
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/EmptySetting.js +8 -0
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/edgeTagSetting.js +8 -0
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/globalTag.js +36 -0
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/nodeTagSetting.js +8 -0
- package/es/core/editor/components/Toolbar/hooks/textStyleSetting/text.js +8 -0
- package/es/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +54 -14
- package/es/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +29 -9
- package/es/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +15 -0
- package/es/core/editor/components/Toolbar/widgets/FontColorButton.js +4 -0
- package/es/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +16 -16
- package/es/core/editor/components/Toolbar/widgets/FontSizeWidget.js +20 -18
- package/es/core/editor/components/Toolbar/widgets/FontStyleButton.js +85 -39
- package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +20 -25
- package/es/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +22 -6
- package/es/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +15 -11
- package/es/core/editor/components/Toolbar/widgets/components/DropdownButton.js +23 -8
- package/es/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +13 -5
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +40 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +13 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +13 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/index.js +12 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +13 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +13 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +25 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +46 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +25 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +36 -0
- package/es/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +17 -0
- package/es/core/editor/components/settings/CloseablePanel.js +7 -2
- package/es/core/editor/components/settings/CloseablePanel.module.scss +9 -0
- package/es/core/editor/components/settings/PropertyView.js +7 -5
- package/es/core/editor/components/settings/common/AlignSetting/index.js +1 -2
- package/es/core/editor/components/settings/common/text/fontStyleUtil.js +5 -4
- package/es/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
- package/es/core/editor/components/settings/propertyViews/text/TextPropertyView.js +1 -1
- package/es/core/editor/utils/textStyleUtil.js +0 -0
- package/es/core/hooks/usePolling.js +2 -5
- package/es/core/models/AttributeMetricDisplay.js +4 -0
- package/es/core/models/TopoApp.js +1 -1
- package/es/utils/htElementUtils.js +3 -0
- package/lib/core/editor/components/EditorPlugin.js +3 -1
- package/lib/core/editor/components/Sidebar/Sidebar.js +2 -1
- package/lib/core/editor/components/Sidebar/views/CanvasPanel/CanvasPanel.js +2 -3
- package/lib/core/editor/components/Sidebar/views/ImagePanel/HtImagePalette.js +1 -0
- package/lib/core/editor/components/Toolbar/buttons.js +5 -4
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/EmptySetting.js +13 -0
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/edgeTagSetting.js +13 -0
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/globalTag.js +47 -0
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/nodeTagSetting.js +13 -0
- package/lib/core/editor/components/Toolbar/hooks/textStyleSetting/text.js +13 -0
- package/lib/core/editor/components/Toolbar/hooks/useFontStyleSetting.js +57 -17
- package/lib/core/editor/components/Toolbar/widgets/EdgeColorButton/EdgeColorButton.js +29 -8
- package/lib/core/editor/components/Toolbar/widgets/EdgeTypeButton/index.js +15 -0
- package/lib/core/editor/components/Toolbar/widgets/FontColorButton.js +5 -0
- package/lib/core/editor/components/Toolbar/widgets/FontFamilyWidget.js +17 -16
- package/lib/core/editor/components/Toolbar/widgets/FontSizeWidget.js +21 -18
- package/lib/core/editor/components/Toolbar/widgets/FontStyleButton.js +89 -39
- package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.js +20 -25
- package/lib/core/editor/components/Toolbar/widgets/NodeAlignWidget.module.scss +22 -6
- package/lib/core/editor/components/Toolbar/widgets/NodeSizeButton/NodeSizeButton.js +14 -11
- package/lib/core/editor/components/Toolbar/widgets/components/DropdownButton.js +23 -8
- package/lib/core/editor/components/Toolbar/widgets/components/DropdownMenu.js +14 -5
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/ElementTextStyleSetting.js +54 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/edgeTag.js +23 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/groupTitle.js +23 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/index.js +25 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/layerTitle.js +23 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/nodeTag.js +23 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/elements/text.js +40 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/ElementTextStyleSetting/textStyleUtil.js +58 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/GlobalTagStyleSetting.js +39 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/GlobalTagStyleSetting/globalTag.js +47 -0
- package/lib/core/editor/components/Toolbar/widgets/components/textStyleSetting/textStyleSettingRouter.js +28 -0
- package/lib/core/editor/components/settings/CloseablePanel.js +8 -2
- package/lib/core/editor/components/settings/CloseablePanel.module.scss +9 -0
- package/lib/core/editor/components/settings/PropertyView.js +9 -7
- package/lib/core/editor/components/settings/common/AlignSetting/index.js +1 -2
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +5 -4
- package/lib/core/editor/components/settings/propertyViews/edge/CommonEdgePropertyView.js +7 -1
- package/lib/core/editor/components/settings/propertyViews/text/TextPropertyView.js +1 -1
- package/lib/core/editor/utils/textStyleUtil.js +1 -0
- package/lib/core/hooks/usePolling.js +2 -5
- package/lib/core/models/AttributeMetricDisplay.js +4 -0
- package/lib/core/models/TopoApp.js +1 -1
- package/lib/utils/htElementUtils.js +5 -0
- package/package.json +2 -2
@@ -4,13 +4,14 @@ import CustomIconPlugin from "./CustomIconPlugin";
|
|
4
4
|
import SaveLoading from "./plugins/SaveLoading";
|
5
5
|
import MultipleResourceSelectPlugin from "./plugins/MultipleResourceSelectPlugin";
|
6
6
|
import GroupAddResourceDrawerPlugin from "./GroupAddResourceDrawerPlugin";
|
7
|
+
import MetricPollingPlugin from "../../viewer/components/plugins/MetricPollingPlugin";
|
7
8
|
export default function TopoEditorPlugin(props) {
|
8
9
|
var topo = props.topo,
|
9
10
|
topoContext = props.topoContext,
|
10
11
|
topoEdit = props.topoEdit,
|
11
12
|
editorProps = props.editorProps;
|
12
13
|
var store = topo.store;
|
13
|
-
var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, CustomIconPlugin].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
|
14
|
+
var plugins = [SaveLoading, GroupAddResourceDrawerPlugin, MultipleResourceSelectPlugin, CustomIconPlugin, MetricPollingPlugin].concat((editorProps === null || editorProps === void 0 ? void 0 : editorProps.plugins) || []);
|
14
15
|
return /*#__PURE__*/React.createElement(React.Fragment, null, plugins.map(function (Plugin, index) {
|
15
16
|
return /*#__PURE__*/React.createElement(Plugin, _extends({
|
16
17
|
key: index,
|
@@ -45,7 +45,7 @@ export default function CanvasPanel(props) {
|
|
45
45
|
topo.historyManager.beginTransaction();
|
46
46
|
displayConfigDispatchers.update({
|
47
47
|
canvasTheme: theme
|
48
|
-
}); //
|
48
|
+
}); // 设置资源/链路标注样式
|
49
49
|
|
50
50
|
var _topo$store$getModelS = topo.store.getModelState('displayConfig'),
|
51
51
|
nodeLabelStyle = _topo$store$getModelS.nodeLabelStyle,
|
@@ -65,8 +65,7 @@ export default function CanvasPanel(props) {
|
|
65
65
|
displayConfigDispatchers.update({
|
66
66
|
nodeLabelStyle: globalNodeLabelStyle,
|
67
67
|
defaultEdgeLabelStyle: globalEdgeTagStyle
|
68
|
-
});
|
69
|
-
|
68
|
+
});
|
70
69
|
topo.historyManager.endTransaction();
|
71
70
|
};
|
72
71
|
|
@@ -26,13 +26,14 @@ export default function getButtons(isNetworkTopo) {
|
|
26
26
|
FontSizeWidget, // 字号
|
27
27
|
FontStyleButton, // 文字样式
|
28
28
|
FontColorButton, // 文字颜色
|
29
|
-
Divider, BoxBackgroundButton, // 框背景
|
30
|
-
Divider,
|
29
|
+
Divider, // BoxBackgroundButton, // 框背景
|
30
|
+
// Divider,
|
31
|
+
EdgeColorButton, // 线条颜色
|
31
32
|
EdgeTypeButton, // 线形
|
32
33
|
Divider, NodeImageButton, // 替换图片
|
33
34
|
NodeSizeButton, // 图片尺寸
|
34
35
|
Divider, Layout, // 布局方式
|
35
|
-
NodeAlignWidget
|
36
|
-
SearchWidget // 搜索
|
36
|
+
NodeAlignWidget // 对齐方式
|
37
|
+
// SearchWidget, // 搜索
|
37
38
|
]);
|
38
39
|
}
|
@@ -0,0 +1,36 @@
|
|
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,33 +1,73 @@
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
2
1
|
import React, { useMemo } from 'react';
|
3
2
|
import { isText } from "../../../../../utils/htElementDataUtil";
|
4
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 = {};
|
5
45
|
|
6
46
|
function useFontStyleSetting(props) {
|
7
47
|
var topo = props.topo;
|
8
|
-
var
|
9
|
-
var buttonEnabled = true; //
|
48
|
+
var selection = topo.selectionManager.useHtSelection();
|
49
|
+
var buttonEnabled = true; // const values = useValues(topo, selection)
|
10
50
|
|
11
|
-
var
|
12
|
-
nodeLabelStyle = _topo$store$useModel[0].nodeLabelStyle,
|
13
|
-
displayConfigDispatchers = _topo$store$useModel[1];
|
51
|
+
var values = {};
|
14
52
|
|
15
53
|
var setStyle = function setStyle(styleData) {
|
16
|
-
// 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
nodeLabelStyle: _extends({}, nodeLabelStyle, styleData)
|
21
|
-
});
|
54
|
+
topo.historyManager.beginTransaction(); // 全局调整(资源和链路):无选择时,按钮亮起,即可修改全局资源和链路的标注,不影响“文本”、框名称、区域名称、分层名称的格式。
|
55
|
+
|
56
|
+
if (!selection.length) {
|
57
|
+
globalTagSetting.setGlobalTagStyle(topo, styleData);
|
22
58
|
} else {
|
23
|
-
|
24
|
-
|
59
|
+
selection.forEach(function (element) {
|
60
|
+
var elementType = getElementType(element);
|
25
61
|
});
|
26
62
|
}
|
63
|
+
|
64
|
+
topo.historyManager.endTransaction();
|
27
65
|
};
|
28
66
|
|
29
67
|
return {
|
68
|
+
selection: selection,
|
30
69
|
buttonEnabled: buttonEnabled,
|
70
|
+
values: values,
|
31
71
|
setStyle: setStyle
|
32
72
|
};
|
33
73
|
}
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
1
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
2
3
|
var _excluded = ["topo", "showLabel"];
|
3
4
|
import React, { useEffect, useState } from 'react';
|
4
|
-
import { getEdgesBySelection
|
5
|
+
import { getEdgesBySelection } from "../../../../utils/edgeTypeStyleUtil";
|
5
6
|
import DropdownButton from "../components/DropdownButton";
|
6
7
|
import WidgetBox from "../WidgetBox";
|
7
8
|
import Content from "./Content";
|
@@ -31,10 +32,16 @@ function EdgeColorButton(props) {
|
|
31
32
|
|
32
33
|
var selection = topo.selectionManager.useHtSelection();
|
33
34
|
|
35
|
+
var loopEdges = function loopEdges(edges, operateEdgeFn) {
|
36
|
+
edges.forEach(function (edge) {
|
37
|
+
operateEdgeFn(edge);
|
38
|
+
});
|
39
|
+
};
|
40
|
+
|
34
41
|
var getLines = function getLines(list) {
|
35
42
|
// eslint-disable-next-line prefer-const
|
36
43
|
var arr = [];
|
37
|
-
|
44
|
+
loopEdges(list, function (edge) {
|
38
45
|
// eslint-disable-next-line eqeqeq
|
39
46
|
if (edge.getAttrObject().type == 'line') {
|
40
47
|
arr.push(edge);
|
@@ -49,7 +56,7 @@ function EdgeColorButton(props) {
|
|
49
56
|
var list = getLines(edges);
|
50
57
|
setLineWidth(0); // eslint-disable-next-line eqeqeq
|
51
58
|
|
52
|
-
if (selection.length == 1 && selection[0].
|
59
|
+
if (selection.length == 1 && selection[0].a('type') == 'line') {
|
53
60
|
setLineWidth(list[0] && (list[0].a('styles') && list[0].a('styles').width || list[0].getStyleMap()['edge.width']) || 2);
|
54
61
|
}
|
55
62
|
|
@@ -57,14 +64,20 @@ function EdgeColorButton(props) {
|
|
57
64
|
}
|
58
65
|
}, [selection, graphLoaded]);
|
59
66
|
|
60
|
-
var colorOnChange = function colorOnChange(
|
67
|
+
var colorOnChange = function colorOnChange(colors, type) {
|
61
68
|
// eslint-disable-next-line eqeqeq
|
62
69
|
if (type == 'select') topo.historyManager.beginTransaction();
|
63
70
|
var edges = getEdgesBySelection(topo);
|
64
|
-
|
71
|
+
loopEdges(edges, function (edge) {
|
65
72
|
// eslint-disable-next-line eqeqeq
|
66
73
|
if (edge.getAttrObject().type == 'line') {
|
67
|
-
|
74
|
+
var color = colors.hex;
|
75
|
+
edge.s('edge.color', color);
|
76
|
+
edge.s('edge.dash.color', color);
|
77
|
+
var style = edge.a('styles') || {};
|
78
|
+
edge.a('styles', _extends({}, style, {
|
79
|
+
color: color
|
80
|
+
}));
|
68
81
|
}
|
69
82
|
}); // eslint-disable-next-line eqeqeq
|
70
83
|
|
@@ -80,14 +93,21 @@ function EdgeColorButton(props) {
|
|
80
93
|
topo.historyManager.endTransaction();
|
81
94
|
};
|
82
95
|
|
83
|
-
var lineSizeChange = function lineSizeChange(
|
96
|
+
var lineSizeChange = function lineSizeChange(width) {
|
84
97
|
var edges = getEdgesBySelection(topo);
|
85
|
-
|
98
|
+
topo.historyManager.beginTransaction();
|
99
|
+
loopEdges(edges, function (edge) {
|
86
100
|
// eslint-disable-next-line eqeqeq
|
87
101
|
if (edge.getAttrObject().type == 'line') {
|
88
|
-
edge.s('edge.width',
|
102
|
+
edge.s('edge.dash.width', width);
|
103
|
+
edge.s('edge.width', width);
|
104
|
+
var style = edge.a('styles') || {};
|
105
|
+
edge.a('styles', _extends({}, style, {
|
106
|
+
width: width
|
107
|
+
}));
|
89
108
|
}
|
90
109
|
});
|
110
|
+
topo.historyManager.endTransaction();
|
91
111
|
};
|
92
112
|
|
93
113
|
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
@@ -67,8 +67,23 @@ function EdgeTypeButton(props) {
|
|
67
67
|
edge.s('icons', _extends({}, edge.s('icons')));
|
68
68
|
edge.addStyleIcon(value, EDGE_END_POINT_TYPE_MAP[value]);
|
69
69
|
} else if (name === 'lineMold') {
|
70
|
+
// 修改实线虚线
|
70
71
|
edge.a('lineMode', value);
|
71
72
|
htTopo.setElementStyle(edge, LINE_MOLD_MAP[value]);
|
73
|
+
|
74
|
+
if (value !== 'solid') {
|
75
|
+
var edgeWidth = edge.s('edge.width');
|
76
|
+
|
77
|
+
if (edgeWidth) {
|
78
|
+
edge.s('edge.dash.width', edgeWidth);
|
79
|
+
}
|
80
|
+
|
81
|
+
var color = edge.s('edge.color');
|
82
|
+
|
83
|
+
if (edgeWidth) {
|
84
|
+
edge.s('edge.dash.color', color);
|
85
|
+
}
|
86
|
+
}
|
72
87
|
}
|
73
88
|
});
|
74
89
|
};
|
@@ -5,6 +5,7 @@ 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";
|
8
9
|
|
9
10
|
function FontFamilySelect(props) {
|
10
11
|
var value = props.value,
|
@@ -15,6 +16,9 @@ function FontFamilySelect(props) {
|
|
15
16
|
disabled = _useState[0],
|
16
17
|
setDisabled = _useState[1];
|
17
18
|
|
19
|
+
var fontStyleSetting = useFontStyleSetting({
|
20
|
+
topo: topo
|
21
|
+
});
|
18
22
|
console.log(topo, 'topo这里需要处理颜色改变的事情');
|
19
23
|
|
20
24
|
var backOpacityChange = function backOpacityChange(value) {
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import React, { useState } from 'react';
|
2
|
-
import useFontStyleSetting from "../hooks/useFontStyleSetting";
|
1
|
+
import React, { useState, useEffect } from 'react';
|
3
2
|
import DropdownMenu from "./components/DropdownMenu";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
4
4
|
import WidgetBox from "./WidgetBox";
|
5
5
|
|
6
6
|
function FontFamilySelect(props) {
|
@@ -8,7 +8,14 @@ function FontFamilySelect(props) {
|
|
8
8
|
onChange = props.onChange;
|
9
9
|
var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
|
10
10
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
11
|
-
value: value,
|
11
|
+
value: value || '',
|
12
|
+
valueRender: function valueRender(val) {
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
14
|
+
style: {
|
15
|
+
width: 48
|
16
|
+
}
|
17
|
+
}, val || '微软雅黑');
|
18
|
+
},
|
12
19
|
onChange: onChange
|
13
20
|
}, items.map(function (item) {
|
14
21
|
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
@@ -23,28 +30,21 @@ function FontFamilySelect(props) {
|
|
23
30
|
|
24
31
|
function FontFamilyWidget(props) {
|
25
32
|
var topo = props.topo,
|
26
|
-
showLabel = props.showLabel
|
27
|
-
|
28
|
-
|
29
|
-
value = _useState[0],
|
30
|
-
setValue = _useState[1];
|
31
|
-
|
32
|
-
var fontStyleSetting = useFontStyleSetting({
|
33
|
-
topo: topo
|
34
|
-
});
|
33
|
+
showLabel = props.showLabel,
|
34
|
+
style = props.style,
|
35
|
+
setStyle = props.setStyle;
|
35
36
|
return /*#__PURE__*/React.createElement(WidgetBox, {
|
36
37
|
label: "\u5B57\u4F53",
|
37
38
|
tooltip: "\u5B57\u4F53",
|
38
39
|
showLabel: showLabel
|
39
40
|
}, /*#__PURE__*/React.createElement(FontFamilySelect, {
|
40
|
-
value:
|
41
|
+
value: style.fontFamily,
|
41
42
|
onChange: function onChange(val) {
|
42
|
-
|
43
|
-
fontStyleSetting.setStyle({
|
43
|
+
setStyle({
|
44
44
|
fontFamily: val
|
45
45
|
});
|
46
46
|
}
|
47
47
|
}));
|
48
48
|
}
|
49
49
|
|
50
|
-
export default FontFamilyWidget;
|
50
|
+
export default textStyleSettingRouter(FontFamilyWidget);
|
@@ -1,15 +1,24 @@
|
|
1
|
-
import React, { useState } from 'react';
|
2
|
-
import useFontStyleSetting from "../hooks/useFontStyleSetting";
|
1
|
+
import React, { useEffect, useState } from 'react';
|
3
2
|
import DropdownMenu from "./components/DropdownMenu";
|
3
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
4
4
|
import WidgetBox from "./WidgetBox";
|
5
5
|
|
6
6
|
function FontSizeSelect(props) {
|
7
7
|
var value = props.value,
|
8
|
-
|
8
|
+
_onChange = props.onChange;
|
9
9
|
var items = [9, 10, 11, 12, 14, 16, 18, 20, 24, 30, 36];
|
10
10
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
11
|
-
value: value,
|
12
|
-
|
11
|
+
value: "" + (value || ''),
|
12
|
+
valueRender: function valueRender(val) {
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
14
|
+
style: {
|
15
|
+
width: 18
|
16
|
+
}
|
17
|
+
}, val || 12);
|
18
|
+
},
|
19
|
+
onChange: function onChange(val) {
|
20
|
+
return _onChange(parseInt(val, 10));
|
21
|
+
}
|
13
22
|
}, items.map(function (item) {
|
14
23
|
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
15
24
|
key: item
|
@@ -19,27 +28,20 @@ function FontSizeSelect(props) {
|
|
19
28
|
|
20
29
|
function FontSizeWidget(props) {
|
21
30
|
var topo = props.topo,
|
22
|
-
showLabel = props.showLabel
|
23
|
-
|
24
|
-
|
25
|
-
});
|
26
|
-
|
27
|
-
var _useState = useState(12),
|
28
|
-
fontSize = _useState[0],
|
29
|
-
setFontSize = _useState[1];
|
30
|
-
|
31
|
+
showLabel = props.showLabel,
|
32
|
+
style = props.style,
|
33
|
+
setStyle = props.setStyle;
|
31
34
|
return /*#__PURE__*/React.createElement(WidgetBox, {
|
32
35
|
label: "\u5B57\u53F7",
|
33
36
|
showLabel: showLabel
|
34
37
|
}, /*#__PURE__*/React.createElement(FontSizeSelect, {
|
35
|
-
value: fontSize,
|
38
|
+
value: style.fontSize,
|
36
39
|
onChange: function onChange(val) {
|
37
|
-
|
38
|
-
fontStyleSetting.setStyle({
|
40
|
+
setStyle({
|
39
41
|
fontSize: val
|
40
42
|
});
|
41
43
|
}
|
42
44
|
}));
|
43
45
|
}
|
44
46
|
|
45
|
-
export default FontSizeWidget;
|
47
|
+
export default textStyleSettingRouter(FontSizeWidget);
|
@@ -1,62 +1,108 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
1
2
|
import React, { useState, useEffect } from 'react';
|
2
3
|
import DropdownMenu from "./components/DropdownMenu";
|
4
|
+
import textStyleSettingRouter from "./components/textStyleSetting/textStyleSettingRouter.js";
|
3
5
|
import WidgetBox from "./WidgetBox";
|
6
|
+
var items = [{
|
7
|
+
key: 'bold',
|
8
|
+
label: '加粗',
|
9
|
+
icon: 'bold'
|
10
|
+
}, {
|
11
|
+
key: 'italic',
|
12
|
+
label: '斜体',
|
13
|
+
icon: 'Italics'
|
14
|
+
}, {
|
15
|
+
key: 'underline',
|
16
|
+
label: '下划线',
|
17
|
+
icon: 'Underline'
|
18
|
+
}];
|
4
19
|
|
5
|
-
function
|
6
|
-
|
7
|
-
|
8
|
-
onChange = props.onChange;
|
9
|
-
var items = ['宋体', '微软雅黑', '黑体', 'Arial'];
|
10
|
-
var icon = disabled ? /*#__PURE__*/React.createElement("img", {
|
11
|
-
src: "/img/topo/editor/toolbar/bold/Disable.svg",
|
12
|
-
alt: ""
|
13
|
-
}) : /*#__PURE__*/React.createElement("img", {
|
14
|
-
src: "/img/topo/editor/toolbar/bold/Normal.svg",
|
15
|
-
alt: ""
|
20
|
+
function buildValue(obj) {
|
21
|
+
return Object.keys(obj).filter(function (key) {
|
22
|
+
return !!obj[key];
|
16
23
|
});
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
style: {
|
28
|
-
fontFamily: item
|
29
|
-
}
|
30
|
-
}, item));
|
31
|
-
}));
|
24
|
+
}
|
25
|
+
|
26
|
+
function formatStyle(arr) {
|
27
|
+
return items.map(function (item) {
|
28
|
+
return item.key;
|
29
|
+
}).reduce(function (map, name) {
|
30
|
+
var _extends2;
|
31
|
+
|
32
|
+
return _extends({}, map, (_extends2 = {}, _extends2[name] = arr.includes(name), _extends2));
|
33
|
+
}, {});
|
32
34
|
}
|
33
35
|
|
34
36
|
function FontStyleButton(props) {
|
35
37
|
var topo = props.topo,
|
36
|
-
showLabel = props.showLabel
|
38
|
+
showLabel = props.showLabel,
|
39
|
+
style = props.style,
|
40
|
+
setStyle = props.setStyle;
|
37
41
|
|
38
|
-
var _useState = useState(
|
39
|
-
|
40
|
-
|
42
|
+
var _useState = useState(false),
|
43
|
+
disabled = _useState[0],
|
44
|
+
setDisabled = _useState[1];
|
41
45
|
|
42
|
-
var
|
43
|
-
|
44
|
-
|
46
|
+
var bold = style.bold,
|
47
|
+
italic = style.italic,
|
48
|
+
underline = style.underline;
|
45
49
|
|
50
|
+
var _useState2 = useState(buildValue({
|
51
|
+
bold: bold,
|
52
|
+
italic: italic,
|
53
|
+
underline: underline
|
54
|
+
})),
|
55
|
+
value = _useState2[0],
|
56
|
+
setValue = _useState2[1]; // 选中的元素
|
46
57
|
|
47
|
-
|
58
|
+
|
59
|
+
var selection = topo.selectionManager.useHtSelection();
|
48
60
|
useEffect(function () {
|
49
61
|
setDisabled(false);
|
50
62
|
}, [selection]);
|
63
|
+
useEffect(function () {
|
64
|
+
setValue(buildValue({
|
65
|
+
bold: bold,
|
66
|
+
italic: italic,
|
67
|
+
underline: underline
|
68
|
+
}));
|
69
|
+
}, [bold, italic, underline]);
|
70
|
+
/**
|
71
|
+
*
|
72
|
+
* @param {Array} selectedKeys
|
73
|
+
*/
|
74
|
+
|
75
|
+
var handleChange = function handleChange(selectedKeys) {
|
76
|
+
setStyle(formatStyle(selectedKeys));
|
77
|
+
};
|
78
|
+
|
51
79
|
return /*#__PURE__*/React.createElement(WidgetBox, {
|
52
80
|
label: "\u6587\u5B57\u6837\u5F0F",
|
53
81
|
tooltip: "\u6587\u5B57\u6837\u5F0F",
|
54
82
|
showLabel: showLabel
|
55
|
-
}, /*#__PURE__*/React.createElement(
|
83
|
+
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
56
84
|
value: value,
|
57
|
-
|
58
|
-
|
59
|
-
|
85
|
+
valueRender: function valueRender() {
|
86
|
+
return /*#__PURE__*/React.createElement("img", {
|
87
|
+
src: "/img/topo/editor/toolbar/bold/" + (disabled ? 'Disable' : 'Normal') + ".svg",
|
88
|
+
alt: ""
|
89
|
+
});
|
90
|
+
},
|
91
|
+
multiple: true,
|
92
|
+
onChange: handleChange
|
93
|
+
}, items.map(function (item) {
|
94
|
+
return /*#__PURE__*/React.createElement(DropdownMenu.Item, {
|
95
|
+
key: item.key
|
96
|
+
}, /*#__PURE__*/React.createElement("div", {
|
97
|
+
style: {
|
98
|
+
display: 'flex',
|
99
|
+
alignItems: 'center'
|
100
|
+
}
|
101
|
+
}, /*#__PURE__*/React.createElement("img", {
|
102
|
+
src: "/img/topo/editor/toolbar/" + item.icon + "/Normal.svg",
|
103
|
+
alt: ""
|
104
|
+
}), /*#__PURE__*/React.createElement("span", null, item.label)));
|
105
|
+
})));
|
60
106
|
}
|
61
107
|
|
62
|
-
export default FontStyleButton;
|
108
|
+
export default textStyleSettingRouter(FontStyleButton);
|