@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
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import _NumberPicker from "@alifd/next/es/number-picker";
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
3
|
var _excluded = ["topo", "showLabel"];
|
4
4
|
import React, { useState, useEffect } from 'react';
|
@@ -51,27 +51,13 @@ function NodeAlignWidget(props) {
|
|
51
51
|
};
|
52
52
|
|
53
53
|
var leftInputChange = function leftInputChange(v) {
|
54
|
-
|
55
|
-
|
56
|
-
} else if (v * 1 > 10000) {
|
57
|
-
setLeftInputVal(10000);
|
58
|
-
} else {
|
59
|
-
setLeftInputVal(v);
|
60
|
-
}
|
61
|
-
|
62
|
-
setSpace('v', leftInputVal);
|
54
|
+
setLeftInputVal(v);
|
55
|
+
setSpace('h', v);
|
63
56
|
};
|
64
57
|
|
65
58
|
var rightInputChange = function rightInputChange(v) {
|
66
|
-
|
67
|
-
|
68
|
-
} else if (v * 1 > 10000) {
|
69
|
-
setRightInputVal(10000);
|
70
|
-
} else {
|
71
|
-
setRightInputVal(v);
|
72
|
-
}
|
73
|
-
|
74
|
-
setSpace('h', rightInputVal);
|
59
|
+
setRightInputVal(v);
|
60
|
+
setSpace('v', v);
|
75
61
|
};
|
76
62
|
|
77
63
|
useEffect(function () {
|
@@ -82,10 +68,17 @@ function NodeAlignWidget(props) {
|
|
82
68
|
});
|
83
69
|
setDisabled(nodes.length <= 1);
|
84
70
|
getClickType('none');
|
71
|
+
setLeftInputVal();
|
72
|
+
setRightInputVal();
|
85
73
|
}
|
86
74
|
}, [graphLoaded, selection]);
|
87
75
|
|
88
76
|
var getClickType = function getClickType(type) {
|
77
|
+
if (leftInputVal || rightInputVal) {
|
78
|
+
setLeftInputVal();
|
79
|
+
setRightInputVal();
|
80
|
+
}
|
81
|
+
|
89
82
|
setLeftDisable(true);
|
90
83
|
setRightDisable(true);
|
91
84
|
|
@@ -116,23 +109,25 @@ function NodeAlignWidget(props) {
|
|
116
109
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AlignSetting, {
|
117
110
|
topo: topo,
|
118
111
|
getClickType: getClickType
|
119
|
-
}), /*#__PURE__*/React.createElement(
|
112
|
+
}), /*#__PURE__*/React.createElement(_NumberPicker, {
|
120
113
|
disabled: leftDisable,
|
121
114
|
size: "small",
|
115
|
+
hasTrigger: false,
|
122
116
|
placeholder: "\u591A\u4E2A\u503C",
|
123
117
|
className: styles.leftInput,
|
124
118
|
value: leftInputVal,
|
125
|
-
|
126
|
-
|
119
|
+
min: 0,
|
120
|
+
max: 10000,
|
127
121
|
onChange: leftInputChange
|
128
|
-
}), /*#__PURE__*/React.createElement(
|
122
|
+
}), /*#__PURE__*/React.createElement(_NumberPicker, {
|
129
123
|
disabled: rightDisable,
|
130
124
|
size: "small",
|
125
|
+
hasTrigger: false,
|
131
126
|
placeholder: "\u591A\u4E2A\u503C",
|
132
127
|
className: styles.rightInput,
|
133
128
|
value: rightInputVal,
|
134
|
-
|
135
|
-
|
129
|
+
min: 0,
|
130
|
+
max: 10000,
|
136
131
|
onChange: rightInputChange
|
137
132
|
}))));
|
138
133
|
}
|
@@ -1,12 +1,28 @@
|
|
1
1
|
.leftInput{
|
2
|
-
|
3
|
-
background-position: right center;
|
4
|
-
width: 100px;
|
2
|
+
width: 100px !important;
|
5
3
|
margin-right: 10px;
|
6
4
|
margin-left: 5px;
|
5
|
+
:global{
|
6
|
+
input{
|
7
|
+
background: url('/img/topo/editor/toolbar/对齐/水平间距_normal.svg')no-repeat 5px center !important;
|
8
|
+
background-position: right center !important;
|
9
|
+
}
|
10
|
+
.next-disabled input{
|
11
|
+
background: url('/img/topo/editor/toolbar/对齐/水平间距_disable.svg')no-repeat 5px center !important;
|
12
|
+
background-position: right center !important;
|
13
|
+
}
|
14
|
+
}
|
7
15
|
}
|
8
16
|
.rightInput{
|
9
|
-
width: 100px;
|
10
|
-
|
11
|
-
|
17
|
+
width: 100px !important;
|
18
|
+
:global{
|
19
|
+
input{
|
20
|
+
background: url('/img/topo/editor/toolbar/对齐/垂直间距 _normal.svg')no-repeat 5px center !important;
|
21
|
+
background-position: right center !important;
|
22
|
+
}
|
23
|
+
.next-disabled input{
|
24
|
+
background: url('/img/topo/editor/toolbar/对齐/垂直间距_disable.svg')no-repeat 5px center !important;
|
25
|
+
background-position: right center !important;
|
26
|
+
}
|
27
|
+
}
|
12
28
|
}
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
2
2
|
var _excluded = ["topo", "showLabel"];
|
3
|
-
import React, { useEffect, useState } from
|
3
|
+
import React, { useEffect, useState } from 'react'; // import BatchSetNodeSize from "../../../settings/propertyViews/view/BatchSetNodeSize";
|
4
4
|
|
5
5
|
import BatchSetNodeSize from "../../../settings/propertyViews/multipleElements/BatchSetNodeSize/BatchSetNodeSize";
|
6
6
|
import NodeSizeInput from "../../../settings/common/NodeSizeInput/NodeSizeInput";
|
7
7
|
import useSettingRuntimeState from "../../../settings/useSettingRuntimeState";
|
8
8
|
import WidgetBox from "../WidgetBox";
|
9
|
-
import BoxBackgroundSetting from "./BoxBackgroundSetting";
|
10
9
|
import styles from "./NodeSizeButton.module.scss";
|
11
10
|
import { isGroup, isNode } from "../../../../../../utils/htElementUtils";
|
12
11
|
/**
|
@@ -29,10 +28,15 @@ function NodeSizeButton(props) {
|
|
29
28
|
setSize = _useState2[1]; // 选中的元素
|
30
29
|
|
31
30
|
|
32
|
-
var selection = topo.selectionManager.
|
31
|
+
var selection = topo.selectionManager.useSelection();
|
33
32
|
var settingRuntimeState = useSettingRuntimeState();
|
34
33
|
useEffect(function () {
|
35
|
-
var
|
34
|
+
var elements = selection.map(function (item) {
|
35
|
+
return item.id;
|
36
|
+
}).map(function (id) {
|
37
|
+
return topo.getDataModel().getDataById(id);
|
38
|
+
});
|
39
|
+
var nodes = elements.filter(function (ele) {
|
36
40
|
return isGroup(ele) || isNode(ele);
|
37
41
|
});
|
38
42
|
|
@@ -40,9 +44,10 @@ function NodeSizeButton(props) {
|
|
40
44
|
setDisabled(false);
|
41
45
|
|
42
46
|
if (selection.length === 1) {
|
47
|
+
var element = nodes[0];
|
43
48
|
setSize({
|
44
|
-
width:
|
45
|
-
height:
|
49
|
+
width: element.getWidth(),
|
50
|
+
height: element.getHeight()
|
46
51
|
});
|
47
52
|
}
|
48
53
|
} else {
|
@@ -57,12 +62,11 @@ function NodeSizeButton(props) {
|
|
57
62
|
var _onChange = function onChange(prop) {
|
58
63
|
var name = prop.name,
|
59
64
|
value = prop.value;
|
60
|
-
var gv = topo.view.topoClient.getGraphView();
|
61
65
|
var element = topo.getSelectionModel().getFirstData();
|
62
66
|
|
63
|
-
if (name ===
|
67
|
+
if (name === 'width') {
|
64
68
|
element.setWidth(value);
|
65
|
-
} else if (name ===
|
69
|
+
} else if (name === 'height') {
|
66
70
|
element.setHeight(value);
|
67
71
|
}
|
68
72
|
};
|
@@ -106,12 +110,12 @@ function NodeSizeButton(props) {
|
|
106
110
|
topo.historyManager.beginTransaction();
|
107
111
|
|
108
112
|
_onChange({
|
109
|
-
name:
|
113
|
+
name: 'width',
|
110
114
|
value: size.width
|
111
115
|
});
|
112
116
|
|
113
117
|
_onChange({
|
114
|
-
name:
|
118
|
+
name: 'height',
|
115
119
|
value: size.height
|
116
120
|
});
|
117
121
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import _Dropdown from "@alifd/next/es/dropdown";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
3
|
import React, { useState } from 'react';
|
3
4
|
import PropTypes from 'prop-types';
|
4
5
|
import ButtonBox from "./ButtonBox";
|
@@ -11,24 +12,38 @@ function DropdownButton(props) {
|
|
11
12
|
showArrow = _props$showArrow === void 0 ? true : _props$showArrow,
|
12
13
|
_props$showContainer = props.showContainer,
|
13
14
|
showContainer = _props$showContainer === void 0 ? true : _props$showContainer,
|
15
|
+
buttonBoxProps = props.buttonBoxProps,
|
14
16
|
children = props.children;
|
15
17
|
|
16
18
|
var _useState = useState(false),
|
17
|
-
|
18
|
-
|
19
|
+
visible = _useState[0],
|
20
|
+
setVisible = _useState[1];
|
19
21
|
|
20
|
-
var button = /*#__PURE__*/React.createElement(ButtonBox, {
|
21
|
-
active:
|
22
|
+
var button = /*#__PURE__*/React.createElement(ButtonBox, _extends({
|
23
|
+
active: visible,
|
22
24
|
disabled: disabled,
|
23
25
|
showArrow: showArrow
|
24
|
-
}, trigger);
|
26
|
+
}, buttonBoxProps), trigger);
|
27
|
+
|
28
|
+
var renderContent = function renderContent() {
|
29
|
+
if (!visible) {
|
30
|
+
return /*#__PURE__*/React.createElement("div", null);
|
31
|
+
}
|
32
|
+
|
33
|
+
if (showContainer) {
|
34
|
+
return /*#__PURE__*/React.createElement(PopupCard, null, children);
|
35
|
+
}
|
36
|
+
|
37
|
+
return children;
|
38
|
+
};
|
39
|
+
|
25
40
|
return /*#__PURE__*/React.createElement(_Dropdown, {
|
26
|
-
visible:
|
41
|
+
visible: visible,
|
27
42
|
disabled: disabled,
|
28
43
|
trigger: button,
|
29
44
|
triggerType: "click",
|
30
|
-
onVisibleChange:
|
31
|
-
},
|
45
|
+
onVisibleChange: setVisible
|
46
|
+
}, renderContent());
|
32
47
|
}
|
33
48
|
|
34
49
|
DropdownButton.propTypes = {
|
@@ -6,18 +6,26 @@ import DropdownButton from "./DropdownButton";
|
|
6
6
|
function DropdownMenu(props) {
|
7
7
|
var value = props.value,
|
8
8
|
children = props.children,
|
9
|
+
multiple = props.multiple,
|
9
10
|
onChange = props.onChange,
|
10
11
|
valueRender = props.valueRender;
|
11
12
|
var selectedKeys = Array.isArray(value) ? value : [value];
|
12
13
|
var valueDisplay = valueRender ? valueRender(value) : value;
|
14
|
+
var selectMode = multiple ? 'multiple' : 'single';
|
15
|
+
|
16
|
+
var handleChange = function handleChange(keys) {
|
17
|
+
onChange(multiple ? keys : keys[0]);
|
18
|
+
};
|
19
|
+
|
20
|
+
var menu = /*#__PURE__*/React.createElement(_Menu, {
|
21
|
+
selectMode: selectMode,
|
22
|
+
selectedKeys: selectedKeys,
|
23
|
+
onSelect: handleChange
|
24
|
+
}, children);
|
13
25
|
return /*#__PURE__*/React.createElement(DropdownButton, {
|
14
26
|
trigger: valueDisplay,
|
15
27
|
showContainer: false
|
16
|
-
}, /*#__PURE__*/React.createElement(
|
17
|
-
selectMode: "single",
|
18
|
-
selectedKeys: selectedKeys,
|
19
|
-
onSelect: onChange
|
20
|
-
}, children));
|
28
|
+
}, multiple ? /*#__PURE__*/React.createElement("div", null, menu) : menu);
|
21
29
|
}
|
22
30
|
|
23
31
|
DropdownButton.propTypes = {
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["Component"];
|
4
|
+
import React, { useMemo, useState } from 'react';
|
5
|
+
import { getTextStyle, setTextStyle } from "./textStyleUtil";
|
6
|
+
|
7
|
+
function ElementTextStyleSetting(props) {
|
8
|
+
var topo = props.topo;
|
9
|
+
|
10
|
+
var Component = props.Component,
|
11
|
+
widgetProps = _objectWithoutPropertiesLoose(props, _excluded); // 选中的元素
|
12
|
+
|
13
|
+
|
14
|
+
var selection = topo.selectionManager.useSelection();
|
15
|
+
var htSelection = useMemo(function () {
|
16
|
+
if (!selection.length) {
|
17
|
+
return [];
|
18
|
+
}
|
19
|
+
|
20
|
+
return topo.getHtTopo().getGraphView().getSelectionModel().getSelection().toArray();
|
21
|
+
}, [selection, topo]);
|
22
|
+
var value = useMemo(function () {
|
23
|
+
return getTextStyle(htSelection) || {};
|
24
|
+
}, [htSelection, topo]);
|
25
|
+
var setStyle = useMemo(function () {
|
26
|
+
return function (style) {
|
27
|
+
htSelection.forEach(function (element) {
|
28
|
+
setTextStyle(element, style);
|
29
|
+
});
|
30
|
+
};
|
31
|
+
}, [htSelection]);
|
32
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
33
|
+
disabled: false,
|
34
|
+
htSelection: htSelection,
|
35
|
+
style: value,
|
36
|
+
setStyle: setStyle
|
37
|
+
}, widgetProps));
|
38
|
+
}
|
39
|
+
|
40
|
+
export default ElementTextStyleSetting;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export function getTextStyle(element) {
|
2
|
+
return {
|
3
|
+
color: null,
|
4
|
+
fontFamily: null,
|
5
|
+
fontSize: null,
|
6
|
+
fontStyle: []
|
7
|
+
};
|
8
|
+
}
|
9
|
+
export function setTextStyle(element, style) {}
|
10
|
+
export default {
|
11
|
+
getTextStyle: getTextStyle,
|
12
|
+
setTextStyle: setTextStyle
|
13
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export function getTextStyle(element) {
|
2
|
+
return {
|
3
|
+
color: null,
|
4
|
+
fontFamily: null,
|
5
|
+
fontSize: null,
|
6
|
+
fontStyle: []
|
7
|
+
};
|
8
|
+
}
|
9
|
+
export function setTextStyle(element, style) {}
|
10
|
+
export default {
|
11
|
+
getTextStyle: getTextStyle,
|
12
|
+
setTextStyle: setTextStyle
|
13
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import text from "./text";
|
2
|
+
import nodeTag from "./nodeTag";
|
3
|
+
import edgeTag from "./edgeTag";
|
4
|
+
import groupTitle from "./groupTitle";
|
5
|
+
import layerTitle from "./layerTitle";
|
6
|
+
export default {
|
7
|
+
nodeTag: nodeTag,
|
8
|
+
edgeTag: edgeTag,
|
9
|
+
text: text,
|
10
|
+
groupTitle: groupTitle,
|
11
|
+
layerTitle: layerTitle
|
12
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export function getTextStyle(element) {
|
2
|
+
return {
|
3
|
+
color: null,
|
4
|
+
fontFamily: null,
|
5
|
+
fontSize: null,
|
6
|
+
fontStyle: []
|
7
|
+
};
|
8
|
+
}
|
9
|
+
export function setTextStyle(element, style) {}
|
10
|
+
export default {
|
11
|
+
getTextStyle: getTextStyle,
|
12
|
+
setTextStyle: setTextStyle
|
13
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export function getTextStyle(element) {
|
2
|
+
return {
|
3
|
+
color: null,
|
4
|
+
fontFamily: null,
|
5
|
+
fontSize: null,
|
6
|
+
fontStyle: []
|
7
|
+
};
|
8
|
+
}
|
9
|
+
export function setTextStyle(element, style) {}
|
10
|
+
export default {
|
11
|
+
getTextStyle: getTextStyle,
|
12
|
+
setTextStyle: setTextStyle
|
13
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import fontStyleUtil from "../../../../../../settings/common/text/fontStyleUtil";
|
3
|
+
export function getTextStyle(element) {
|
4
|
+
var underline = element.s('text.decoration') === 'underline';
|
5
|
+
return _extends({
|
6
|
+
color: null,
|
7
|
+
underline: underline
|
8
|
+
}, fontStyleUtil.toMap(element.s('text.font')));
|
9
|
+
}
|
10
|
+
export function setTextStyle(element, style) {
|
11
|
+
var underline = style.underline;
|
12
|
+
|
13
|
+
if ('underline' in style) {
|
14
|
+
element.s('text.decoration', underline ? 'underline' : null);
|
15
|
+
}
|
16
|
+
|
17
|
+
var fontStyle = _extends({}, getTextStyle(element), style);
|
18
|
+
|
19
|
+
var fontStr = fontStyleUtil.build(fontStyle);
|
20
|
+
element.s('text.font', fontStr);
|
21
|
+
}
|
22
|
+
export default {
|
23
|
+
getTextStyle: getTextStyle,
|
24
|
+
setTextStyle: setTextStyle
|
25
|
+
};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { isGroup, isLayer, isNode, isText, isEdge } from "../../../../../../../../utils/htElementUtils";
|
2
|
+
import typeMap from "./elements";
|
3
|
+
|
4
|
+
function getElementType(element) {
|
5
|
+
if (isText(element)) {
|
6
|
+
return 'text';
|
7
|
+
} else if (isGroup(element)) {
|
8
|
+
return 'groupTitle';
|
9
|
+
} else if (isNode(element)) {
|
10
|
+
return 'nodeTag';
|
11
|
+
} else if (isEdge(element)) {
|
12
|
+
return 'edgeTag';
|
13
|
+
} else if (isLayer(element)) {
|
14
|
+
return 'layerTitle';
|
15
|
+
}
|
16
|
+
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
|
20
|
+
export function getElementTextStyle(element) {
|
21
|
+
var type = getElementType(element);
|
22
|
+
var handler = typeMap[type];
|
23
|
+
|
24
|
+
if (handler) {
|
25
|
+
return handler.getTextStyle(element);
|
26
|
+
}
|
27
|
+
|
28
|
+
return null;
|
29
|
+
}
|
30
|
+
export function getTextStyle(htSelection) {
|
31
|
+
if (htSelection.length === 1) {
|
32
|
+
var element = htSelection[0];
|
33
|
+
return getElementTextStyle(element);
|
34
|
+
} // 多选时值相同返回?
|
35
|
+
|
36
|
+
|
37
|
+
return null;
|
38
|
+
}
|
39
|
+
export function setTextStyle(element, style) {
|
40
|
+
var type = getElementType(element);
|
41
|
+
var handler = typeMap[type];
|
42
|
+
|
43
|
+
if (handler) {
|
44
|
+
handler.setTextStyle(element, style);
|
45
|
+
}
|
46
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
+
var _excluded = ["Component"];
|
4
|
+
import React, { useMemo } from 'react';
|
5
|
+
import { setGlobalTagStyle, useValues } from "./globalTag";
|
6
|
+
|
7
|
+
function GlobalTagStyleSetting(props) {
|
8
|
+
var topo = props.topo;
|
9
|
+
|
10
|
+
var Component = props.Component,
|
11
|
+
widgetProps = _objectWithoutPropertiesLoose(props, _excluded);
|
12
|
+
|
13
|
+
var values = useValues(topo);
|
14
|
+
var setStyle = useMemo(function () {
|
15
|
+
return function (style) {
|
16
|
+
return setGlobalTagStyle(topo, style);
|
17
|
+
};
|
18
|
+
}, []);
|
19
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
20
|
+
style: values,
|
21
|
+
setStyle: setStyle
|
22
|
+
}, widgetProps));
|
23
|
+
}
|
24
|
+
|
25
|
+
export default GlobalTagStyleSetting;
|
@@ -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() {}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import React from 'react';
|
3
|
+
import ElementTextStyleSetting from "./ElementTextStyleSetting/ElementTextStyleSetting";
|
4
|
+
import GlobalTagStyleSetting from "./GlobalTagStyleSetting/GlobalTagStyleSetting";
|
5
|
+
|
6
|
+
function textStyleSettingRouter(Component, options) {
|
7
|
+
return function TextStyleSettingButton(props) {
|
8
|
+
var topo = props.topo;
|
9
|
+
var selection = topo.selectionManager.useHtSelection();
|
10
|
+
var Widget = !selection.length ? GlobalTagStyleSetting : ElementTextStyleSetting;
|
11
|
+
return /*#__PURE__*/React.createElement(Widget, _extends({
|
12
|
+
Component: Component
|
13
|
+
}, props));
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
export default textStyleSettingRouter;
|
@@ -1,13 +1,16 @@
|
|
1
1
|
import _ConfigProvider from "@alifd/next/es/config-provider";
|
2
2
|
import _Icon from "@alifd/next/es/icon";
|
3
3
|
import React from 'react';
|
4
|
+
import styles from "./CloseablePanel.module.scss";
|
4
5
|
|
5
6
|
function CloseablePanel(props) {
|
6
7
|
var prefix = props.prefix,
|
7
8
|
title = props.title,
|
8
9
|
onClose = props.onClose,
|
9
10
|
children = props.children;
|
10
|
-
return /*#__PURE__*/React.createElement("div",
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
12
|
+
className: styles.panel
|
13
|
+
}, /*#__PURE__*/React.createElement("div", {
|
11
14
|
className: prefix + "drawer-header",
|
12
15
|
role: "heading",
|
13
16
|
"aria-level": "1"
|
@@ -19,7 +22,9 @@ function CloseablePanel(props) {
|
|
19
22
|
}, /*#__PURE__*/React.createElement(_Icon, {
|
20
23
|
type: "close",
|
21
24
|
className: "next-drawer-close-icon"
|
22
|
-
}))), /*#__PURE__*/React.createElement("div",
|
25
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
26
|
+
className: styles.body
|
27
|
+
}, children));
|
23
28
|
}
|
24
29
|
|
25
30
|
CloseablePanel.defaultProps = {
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import React from 'react';
|
2
1
|
import classNames from 'classnames';
|
2
|
+
import React from 'react';
|
3
|
+
import CloseablePanel from "./CloseablePanel";
|
4
|
+
import OpenPropertyPanelListener from "./OpenPropertyPanelListener";
|
3
5
|
import Settings from "./Settings";
|
4
6
|
import styles from "./Settings.module.scss";
|
5
|
-
import OpenPropertyPanelListener from "./OpenPropertyPanelListener";
|
6
|
-
import CloseablePanel from "./CloseablePanel";
|
7
7
|
export default function PropertyView(props) {
|
8
8
|
var _classNames;
|
9
9
|
|
@@ -28,7 +28,7 @@ export default function PropertyView(props) {
|
|
28
28
|
}
|
29
29
|
|
30
30
|
var renderContent = function renderContent() {
|
31
|
-
if (!
|
31
|
+
if (!propertyPanelVisible) {
|
32
32
|
return null;
|
33
33
|
}
|
34
34
|
|
@@ -52,5 +52,7 @@ export default function PropertyView(props) {
|
|
52
52
|
propertyPanelVisible: false
|
53
53
|
});
|
54
54
|
}
|
55
|
-
}
|
55
|
+
}, /*#__PURE__*/React.createElement(OpenPropertyPanelListener, {
|
56
|
+
topo: topo
|
57
|
+
}, renderContent())));
|
56
58
|
}
|
@@ -13,8 +13,7 @@ export default function AlignSetting(props) {
|
|
13
13
|
return !isLayer(ele) && !isEdge(ele);
|
14
14
|
}); // console.info("element--selectList", element, selectList);
|
15
15
|
|
16
|
-
topo.view.topoClient.htTopoClient.setAlignmentBySelectionNodes(type, nodes);
|
17
|
-
|
16
|
+
topo.view.topoClient.htTopoClient.setAlignmentBySelectionNodes(type, nodes);
|
18
17
|
topo.historyManager.endTransaction();
|
19
18
|
};
|
20
19
|
|
@@ -8,7 +8,8 @@ var fontStyleUtil = {
|
|
8
8
|
var arr = font.trim().split(' ');
|
9
9
|
var bold = font.indexOf('bold') > -1;
|
10
10
|
var italic = font.indexOf('italic') > -1;
|
11
|
-
var fontFamily
|
11
|
+
var fontFamily;
|
12
|
+
var fontSize;
|
12
13
|
|
13
14
|
if (arr.length) {
|
14
15
|
fontFamily = arr[arr.length - 1];
|
@@ -29,15 +30,15 @@ var fontStyleUtil = {
|
|
29
30
|
build: function build(style) {
|
30
31
|
var font = '';
|
31
32
|
|
32
|
-
if (style.
|
33
|
+
if (style.bold) {
|
33
34
|
font += 'bold ';
|
34
35
|
}
|
35
36
|
|
36
|
-
if (style.
|
37
|
+
if (style.italic) {
|
37
38
|
font += 'italic ';
|
38
39
|
}
|
39
40
|
|
40
|
-
return "" + font + style.
|
41
|
+
return "" + font + style.fontSize + "px " + style.fontFamily;
|
41
42
|
},
|
42
43
|
getFontStyleMap: function getFontStyleMap(obj, prefix) {
|
43
44
|
var map = {};
|