@riil-frontend/component-topology 2.3.21 → 2.4.0
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 +28 -28
- package/demo/5/345/205/266/344/273/226/347/273/204/344/273/266//345/233/276/346/240/207/351/200/211/346/213/251.md +5 -5
- package/es/components/Drawer/index.js +2 -1
- package/es/components/Drawer/index.module.scss +13 -0
- package/es/components/ResourceList/ResourceSelect.js +3 -2
- package/es/components/ResourceList/ResourceSelect.module.scss +7 -0
- package/es/components/ResourceSelect/ResourceSelectDrawer.js +3 -1
- package/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts +15 -0
- package/es/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js +62 -0
- package/es/core/common/text.module.scss +5 -0
- package/es/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +7 -3
- package/es/core/editor/components/iconManage/UploadIconDialog.js +2 -2
- package/es/core/editor/components/settings/Settings.js +47 -42
- package/es/core/editor/components/settings/Settings.module.scss +6 -1
- package/es/core/editor/components/settings/common/{NodeSizeInput.d.ts → NodeSizeInput/NodeSizeInput.d.ts} +0 -0
- package/es/core/editor/components/settings/common/{NodeSizeInput.js → NodeSizeInput/NodeSizeInput.js} +2 -0
- package/es/core/editor/components/settings/common/NodeSizeInput/img/icon_/350/247/243/351/224/201.svg +16 -0
- package/es/core/editor/components/settings/common/NodeSizeInput/img/icon_/351/224/201.svg +15 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.d.ts +1 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.js +50 -0
- package/es/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +31 -0
- package/es/core/editor/components/settings/common/text/TextStyle.d.ts +1 -0
- package/es/core/editor/components/settings/common/text/TextStyle.js +133 -0
- package/es/core/editor/components/settings/common/text/fontStyleUtil.d.ts +19 -0
- package/es/core/editor/components/settings/common/text/fontStyleUtil.js +53 -0
- package/es/core/editor/components/settings/common/text/img/bold.svg +12 -0
- package/es/core/editor/components/settings/common/text/img/italics.svg +10 -0
- package/es/core/editor/components/settings/common/text/img/underline.svg +12 -0
- package/es/core/editor/components/settings/group/GroupNodeList/ResourceList.js +22 -6
- package/es/core/editor/components/settings/group/GroupNodeList/ResourceList.module.scss +16 -0
- package/es/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -0
- package/es/core/editor/components/settings/group/GroupNodeList/icon.js +20 -1
- package/es/core/editor/components/settings/node/NodeIconSelect.d.ts +1 -0
- package/es/core/editor/components/settings/node/NodeIconSelect.js +42 -0
- package/es/core/editor/components/settings/node/NodePropertyView.d.ts +1 -1
- package/es/core/editor/components/settings/node/NodePropertyView.js +68 -86
- package/es/core/editor/components/settings/node/NodeRelateResourceButton.d.ts +4 -0
- package/es/core/editor/components/settings/node/NodeRelateResourceButton.js +22 -0
- package/es/core/editor/components/settings/node/TopoTreeSelect.d.ts +1 -0
- package/es/core/editor/components/settings/node/TopoTreeSelect.js +40 -0
- package/es/core/editor/components/settings/text/TextPropertyView.js +31 -144
- package/es/core/editor/components/settings/view/ViewPropertyView.js +1 -1
- package/es/core/editor/{buildContextmenu.d.ts → contextmenu/buildContextmenu.d.ts} +1 -4
- package/es/core/editor/contextmenu/buildContextmenu.js +10 -0
- package/es/hooks/useSelection.js +9 -3
- package/es/plugins/useSelectionPlugin.d.ts +23 -0
- package/es/plugins/useSelectionPlugin.js +84 -0
- package/es/style.js +1 -0
- package/es/utils/topoData.js +1 -1
- package/lib/components/Drawer/index.js +2 -1
- package/lib/components/Drawer/index.module.scss +13 -0
- package/lib/components/ResourceList/ResourceSelect.js +4 -2
- package/lib/components/ResourceList/ResourceSelect.module.scss +7 -0
- package/lib/components/ResourceSelect/ResourceSelectDrawer.js +3 -1
- package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.d.ts +15 -0
- package/lib/core/{editor/components/settings/group/GroupNodeList → common}/icons/defaultIcons.js +68 -1
- package/lib/core/common/text.module.scss +5 -0
- package/lib/core/editor/components/LinkDynamicStyleSettingDrawer/rule/ColorPicker.module.scss +7 -3
- package/lib/core/editor/components/iconManage/UploadIconDialog.js +2 -2
- package/lib/core/editor/components/settings/Settings.js +45 -42
- package/lib/core/editor/components/settings/Settings.module.scss +6 -1
- package/lib/core/editor/components/settings/common/{NodeSizeInput.d.ts → NodeSizeInput/NodeSizeInput.d.ts} +0 -0
- package/lib/core/editor/components/settings/common/{NodeSizeInput.js → NodeSizeInput/NodeSizeInput.js} +2 -0
- package/lib/core/editor/components/settings/common/NodeSizeInput/img/icon_/350/247/243/351/224/201.svg +16 -0
- package/lib/core/editor/components/settings/common/NodeSizeInput/img/icon_/351/224/201.svg +15 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.d.ts +1 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.js +68 -0
- package/lib/core/editor/components/settings/common/text/FontStyleCheckbox.module.scss +31 -0
- package/lib/core/editor/components/settings/common/text/TextStyle.d.ts +1 -0
- package/lib/core/editor/components/settings/common/text/TextStyle.js +150 -0
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.d.ts +19 -0
- package/lib/core/editor/components/settings/common/text/fontStyleUtil.js +58 -0
- package/lib/core/editor/components/settings/common/text/img/bold.svg +12 -0
- package/lib/core/editor/components/settings/common/text/img/italics.svg +10 -0
- package/lib/core/editor/components/settings/common/text/img/underline.svg +12 -0
- package/lib/core/editor/components/settings/group/GroupNodeList/ResourceList.js +22 -7
- package/lib/core/editor/components/settings/group/GroupNodeList/ResourceList.module.scss +16 -0
- package/lib/core/editor/components/settings/group/GroupNodeList/icon.d.ts +10 -0
- package/lib/core/editor/components/settings/group/GroupNodeList/icon.js +23 -1
- package/lib/core/editor/components/settings/node/NodeIconSelect.d.ts +1 -0
- package/lib/core/editor/components/settings/node/NodeIconSelect.js +57 -0
- package/lib/core/editor/components/settings/node/NodePropertyView.d.ts +1 -1
- package/lib/core/editor/components/settings/node/NodePropertyView.js +74 -89
- package/lib/core/editor/components/settings/node/NodeRelateResourceButton.d.ts +4 -0
- package/lib/core/editor/components/settings/node/NodeRelateResourceButton.js +31 -0
- package/lib/core/editor/components/settings/node/TopoTreeSelect.d.ts +1 -0
- package/lib/core/editor/components/settings/node/TopoTreeSelect.js +53 -0
- package/lib/core/editor/components/settings/text/TextPropertyView.js +30 -149
- package/lib/core/editor/components/settings/view/ViewPropertyView.js +1 -1
- package/lib/core/editor/{buildContextmenu.d.ts → contextmenu/buildContextmenu.d.ts} +1 -4
- package/lib/core/editor/{buildContextmenu.js → contextmenu/buildContextmenu.js} +3 -7
- package/lib/hooks/useSelection.js +9 -3
- package/lib/plugins/useSelectionPlugin.d.ts +23 -0
- package/lib/plugins/useSelectionPlugin.js +90 -0
- package/lib/style.js +1 -0
- package/lib/utils/topoData.js +1 -1
- package/package.json +6 -6
- package/es/core/editor/buildContextmenu.js +0 -14
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var fontStyleUtil = {
|
|
2
|
+
// 字体样式格式: bold italic 12px 黑体 或 12px 黑体
|
|
3
|
+
toMap: function toMap(font) {
|
|
4
|
+
if (font === void 0) {
|
|
5
|
+
font = '';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
var arr = font.trim().split(' ');
|
|
9
|
+
var bold = font.indexOf('bold') > -1;
|
|
10
|
+
var italic = font.indexOf('italic') > -1;
|
|
11
|
+
var fontFamily, fontSize;
|
|
12
|
+
|
|
13
|
+
if (arr.length) {
|
|
14
|
+
fontFamily = arr[arr.length - 1];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (arr.length >= 2) {
|
|
18
|
+
fontSize = parseInt(arr[arr.length - 2].replace('px', ''), 10);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
fontFamily: fontFamily,
|
|
23
|
+
fontSize: fontSize,
|
|
24
|
+
bold: bold,
|
|
25
|
+
italic: italic
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
// 字体样式格式: bold italic 12px 黑体 或 12px 黑体
|
|
29
|
+
build: function build(style) {
|
|
30
|
+
var font = '';
|
|
31
|
+
|
|
32
|
+
if (style.font.bold) {
|
|
33
|
+
font += 'bold ';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (style.font.italic) {
|
|
37
|
+
font += 'italic ';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return "" + font + style.font.fontSize + "px " + style.font.fontFamily;
|
|
41
|
+
},
|
|
42
|
+
getFontStyleMap: function getFontStyleMap(obj, prefix) {
|
|
43
|
+
var map = {};
|
|
44
|
+
Object.keys(obj).forEach(function (key) {
|
|
45
|
+
if (key.startsWith(prefix)) {
|
|
46
|
+
map[key.replace(prefix, '')] = obj[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
console.error(obj, prefix, map);
|
|
50
|
+
return map;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export default fontStyleUtil;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
|
|
4
|
+
<title>topo/source/Icon/bold</title>
|
|
5
|
+
<desc>Created with Sketch.</desc>
|
|
6
|
+
<g id="topo/source/Icon/bold" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
7
|
+
<rect id="矩形" fill="#000000" fill-rule="nonzero" opacity="0" x="0" y="0" width="16" height="16"></rect>
|
|
8
|
+
<g id="Icon-zitijiacu" transform="translate(4.000000, 3.000000)" fill="#4D6277" fill-rule="nonzero">
|
|
9
|
+
<path d="M7.01125,5.739125 C6.75175,5.339375 6.368875,5.0735 5.863,4.941875 L5.863,4.916375 C6.131125,4.788875 6.3565,4.646375 6.539125,4.488875 C6.722125,4.34 6.862375,4.1825 6.96025,4.01675 C7.1515,3.668 7.243,3.302375 7.234375,2.9195 C7.234375,2.171 7.002625,1.569125 6.539125,1.113875 C6.07975,0.663125 5.39275,0.433625 4.4785,0.425 L0.52225,0.425 L0.52225,9.7265 L4.79125,9.7265 C5.522875,9.7265 6.133,9.482 6.622375,8.992625 C7.115875,8.524625 7.36675,7.889 7.375,7.085375 C7.375,6.6005 7.253875,6.151625 7.01125,5.739125 Z M2.035,1.681625 L4.319125,1.681625 C4.833625,1.69025 5.212375,1.8155 5.454625,2.058125 C5.701375,2.317625 5.82475,2.6345 5.82475,3.00875 C5.82475,3.383 5.701375,3.6935 5.454625,3.94025 C5.212375,4.208 4.833625,4.34225 4.319125,4.34225 L2.035,4.34225 L2.035,1.681625 Z M5.601625,7.965875 C5.359375,8.24225 4.9765,8.38475 4.453375,8.393375 L2.035,8.393375 L2.035,5.59925 L4.453,5.59925 C4.976125,5.6075 5.359,5.745875 5.60125,6.014 C5.8435,6.28625 5.965,6.613625 5.965,6.9965 C5.965,7.370375 5.843875,7.693625 5.601625,7.965875 L5.601625,7.965875 Z" id="形状"></path>
|
|
10
|
+
</g>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
|
|
4
|
+
<title>topo/source/Icon/italics</title>
|
|
5
|
+
<desc>Created with Sketch.</desc>
|
|
6
|
+
<g id="topo/source/Icon/italics" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
7
|
+
<rect id="矩形" fill="#000000" fill-rule="nonzero" opacity="0" x="2" y="2" width="12" height="12"></rect>
|
|
8
|
+
<polygon id="路径" fill="#4D6277" fill-rule="nonzero" points="8.77666667 4.29166666 7.19333333 12.2083333 8.77666667 12.2083333 8.77666667 13 4.02666667 13 4.02666667 12.2083333 5.60999999 12.2083333 7.19333333 4.29166666 5.60999999 4.29166666 5.60999999 3.5 10.36 3.5 10.36 4.29166666"></polygon>
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<!-- Generator: Sketch 63.1 (92452) - https://sketch.com -->
|
|
4
|
+
<title>topo/source/Icon/underline</title>
|
|
5
|
+
<desc>Created with Sketch.</desc>
|
|
6
|
+
<g id="topo/source/Icon/underline" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
7
|
+
<rect id="矩形" fill="#000000" fill-rule="nonzero" opacity="0" x="0" y="0" width="16" height="16"></rect>
|
|
8
|
+
<g id="Icon-zitixiahuaxian" transform="translate(3.000000, 3.000000)" fill="#4D6277" fill-rule="nonzero">
|
|
9
|
+
<path d="M5,8.507375 C7.01929112,8.507375 8.65625,6.87041612 8.65625,4.851125 L8.65625,0.05 L7.34375,0.05 L7.34375,4.851125 C7.34375,6.14554238 6.29441738,7.194875 5,7.194875 C3.70558262,7.194875 2.65625,6.14554238 2.65625,4.851125 L2.65625,0.05 L1.34375,0.05 L1.34375,4.851125 C1.34375,6.87041612 2.98070888,8.507375 5,8.507375 Z M9.125,9.380375 L0.875,9.380375 C0.667893219,9.380375 0.5,9.54826822 0.5,9.755375 C0.5,9.96248178 0.667893219,10.130375 0.875,10.130375 L9.125,10.130375 C9.33210678,10.130375 9.5,9.96248178 9.5,9.755375 C9.5,9.54826822 9.33210678,9.380375 9.125,9.380375 Z" id="形状"></path>
|
|
10
|
+
</g>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import _List from "@alifd/next/lib/list";
|
|
2
|
-
import _Avatar from "@alifd/next/lib/avatar";
|
|
3
2
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
4
3
|
import styles from "./ResourceList.module.scss";
|
|
5
4
|
|
|
6
5
|
function ResourceList(props) {
|
|
7
6
|
var data = props.data;
|
|
7
|
+
|
|
8
|
+
var renderIcon = function renderIcon(src) {
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
style: {
|
|
11
|
+
width: 28,
|
|
12
|
+
height: 28,
|
|
13
|
+
background: "url(" + src + ") no-repeat center center"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var renderIcon2 = function renderIcon2(src) {
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: styles.iconWarp
|
|
21
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
22
|
+
src: src,
|
|
23
|
+
className: styles.iconImg,
|
|
24
|
+
alt: ""
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
|
|
8
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
9
29
|
className: styles.list
|
|
10
30
|
}, /*#__PURE__*/React.createElement(_List, {
|
|
@@ -14,11 +34,7 @@ function ResourceList(props) {
|
|
|
14
34
|
return /*#__PURE__*/React.createElement(_List.Item, {
|
|
15
35
|
key: i,
|
|
16
36
|
extra: item.money,
|
|
17
|
-
media:
|
|
18
|
-
src: item.img,
|
|
19
|
-
shape: "square",
|
|
20
|
-
size: "small"
|
|
21
|
-
})
|
|
37
|
+
media: renderIcon2(item.img)
|
|
22
38
|
}, item.title);
|
|
23
39
|
}
|
|
24
40
|
}));
|
|
@@ -13,3 +13,19 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
.iconWarp {
|
|
18
|
+
width: 28px;
|
|
19
|
+
height: 28px;
|
|
20
|
+
line-height: 28px;
|
|
21
|
+
text-align: center;
|
|
22
|
+
|
|
23
|
+
.iconImg {
|
|
24
|
+
display: inline-block;
|
|
25
|
+
width: auto;
|
|
26
|
+
height: auto;
|
|
27
|
+
max-width: 28px;
|
|
28
|
+
max-height: 100%;
|
|
29
|
+
vertical-align: middle;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -66,4 +66,14 @@ export function getIconMap(topo: any): {
|
|
|
66
66
|
'editor.icon.balanc.small': string;
|
|
67
67
|
'editor.icon.calendar.small': string;
|
|
68
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param topo
|
|
72
|
+
* @param type {'node' | 'container'}
|
|
73
|
+
* @return {{label: string, icons: *[]}[]}
|
|
74
|
+
*/
|
|
75
|
+
export function getIconGroups(topo: any, type: 'node' | 'container'): {
|
|
76
|
+
label: string;
|
|
77
|
+
icons: any[];
|
|
78
|
+
}[];
|
|
69
79
|
export function getIconById(id: any, topo: any): any;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import defaultIcons from "
|
|
2
|
+
import defaultIcons, { DEFAULT_NODE_ICONS } from "../../../../../common/icons/defaultIcons";
|
|
3
|
+
|
|
4
|
+
function getUserCustomIcons(topo) {
|
|
5
|
+
var uploadIcons = topo.store.getModelState('iconManage').icons;
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export function getIconMap(topo) {
|
|
4
10
|
var bizIconMap = {};
|
|
5
11
|
var uploadIcons = topo.store.getModelState('iconManage').icons.node;
|
|
@@ -8,6 +14,19 @@ export function getIconMap(topo) {
|
|
|
8
14
|
});
|
|
9
15
|
return _extends({}, defaultIcons, bizIconMap);
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param topo
|
|
20
|
+
* @param type {'node' | 'container'}
|
|
21
|
+
* @return {{label: string, icons: *[]}[]}
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export function getIconGroups(topo, type) {
|
|
25
|
+
return [{
|
|
26
|
+
label: '默认',
|
|
27
|
+
icons: [].concat(DEFAULT_NODE_ICONS, topo.options.icons || [])
|
|
28
|
+
}];
|
|
29
|
+
}
|
|
11
30
|
export function getIconById(id, topo) {
|
|
12
31
|
var iconMap = getIconMap(topo);
|
|
13
32
|
var icon = iconMap[id];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function NodeIconSelect(props: any): JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _Avatar from "@alifd/next/lib/avatar";
|
|
2
|
+
import _Select from "@alifd/next/lib/select";
|
|
3
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
4
|
+
import { getIconGroups, getIconMap } from "../group/GroupNodeList/icon";
|
|
5
|
+
var Option = _Select.Option;
|
|
6
|
+
export default function NodeIconSelect(props) {
|
|
7
|
+
var value = props.value,
|
|
8
|
+
onChange = props.onChange,
|
|
9
|
+
topo = props.topo;
|
|
10
|
+
var iconGroups = getIconGroups(topo, 'node');
|
|
11
|
+
var newId = value;
|
|
12
|
+
var a = iconGroups[0].icons.filter(function (item) {
|
|
13
|
+
return newId.indexOf(item.oldId) !== -1;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (a.length) {
|
|
17
|
+
newId = a[0].id;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(_Select, {
|
|
21
|
+
value: newId,
|
|
22
|
+
onChange: onChange,
|
|
23
|
+
style: {
|
|
24
|
+
width: '100%'
|
|
25
|
+
}
|
|
26
|
+
}, iconGroups.map(function (group) {
|
|
27
|
+
return /*#__PURE__*/React.createElement(_Select.OptionGroup, {
|
|
28
|
+
label: group.label,
|
|
29
|
+
key: group.label
|
|
30
|
+
}, group.icons.map(function (icon) {
|
|
31
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
32
|
+
key: icon.id,
|
|
33
|
+
value: icon.id
|
|
34
|
+
}, /*#__PURE__*/React.createElement(_Avatar, {
|
|
35
|
+
src: icon.url,
|
|
36
|
+
shape: "square",
|
|
37
|
+
size: "small"
|
|
38
|
+
}), "\xA0", icon.name);
|
|
39
|
+
}));
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function
|
|
1
|
+
export default function NodePropertyView(props: any): JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _Input from "@alifd/next/lib/input";
|
|
2
2
|
import _Tab from "@alifd/next/lib/tab";
|
|
3
|
-
import _Button from "@alifd/next/lib/button";
|
|
4
3
|
import _Field from "@alifd/next/lib/field";
|
|
5
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
6
5
|
import _Radio from "@alifd/next/lib/radio";
|
|
@@ -12,94 +11,47 @@ import React, { useState, useEffect } from 'react';
|
|
|
12
11
|
import ColorPicker from "../../LinkDynamicStyleSettingDrawer/rule/ColorPicker";
|
|
13
12
|
import ResourceSelectButton from "../group/GroupNodeList/ResourceSelectButton";
|
|
14
13
|
import { getIconMap } from "../group/GroupNodeList/icon";
|
|
15
|
-
import NodeSizeInput from "../common/NodeSizeInput";
|
|
14
|
+
import NodeSizeInput from "../common/NodeSizeInput/NodeSizeInput";
|
|
15
|
+
import textStyles from "../../../../common/text.module.scss";
|
|
16
|
+
import TopoTreeSelect from "./TopoTreeSelect";
|
|
17
|
+
import NodeIconSelect from "./NodeIconSelect";
|
|
18
|
+
import NodeRelateResourceButton from "./NodeRelateResourceButton";
|
|
16
19
|
var FormItem = _Form.Item;
|
|
17
20
|
var Row = _Grid.Row,
|
|
18
21
|
Col = _Grid.Col;
|
|
19
22
|
var Option = _Select.Option;
|
|
20
23
|
var CollapsePanel = _Collapse.Panel;
|
|
21
|
-
var RadioGroup = _Radio.Group;
|
|
24
|
+
var RadioGroup = _Radio.Group;
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
fontSize: parseInt(arr[0].replace('px', ''), 10),
|
|
31
|
-
bold: bold,
|
|
32
|
-
italic: italic,
|
|
33
|
-
underline: false
|
|
34
|
-
};
|
|
35
|
-
return Object.keys(map).reduce(function (result, key) {
|
|
36
|
-
result["" + prefix + key] = map[key];
|
|
37
|
-
return result;
|
|
38
|
-
}, {});
|
|
39
|
-
},
|
|
40
|
-
getFontStyleMap: function getFontStyleMap(obj, prefix) {
|
|
41
|
-
var map = {};
|
|
42
|
-
Object.keys(obj).forEach(function (key) {
|
|
43
|
-
if (key.startsWith(prefix)) {
|
|
44
|
-
map[key.replace(prefix, '')] = obj[key];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
console.error(obj, prefix, map);
|
|
48
|
-
return map;
|
|
49
|
-
},
|
|
50
|
-
build: function build(style) {
|
|
51
|
-
return style.fontSize + "px " + style.fontFamily;
|
|
26
|
+
function parseValues(values) {
|
|
27
|
+
return _extends({}, values);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getBindType(values) {
|
|
31
|
+
if (values.tag) {
|
|
32
|
+
return 'resource';
|
|
52
33
|
}
|
|
53
|
-
}; // 线型--node.s('dash',false) ---false代表是实线,默认为true代表虚线
|
|
54
|
-
// 线型为实线时设置颜色--node.s('borderColor','rgba(0,0,0,0.00)') //默认颜色rgba(0,0,0,0.00)
|
|
55
|
-
// 线型为虚线时设置颜色--node.s('dashColor','rgb(173,173,173)') //默认颜色rgb(173,173,173)
|
|
56
|
-
// 线宽--node.s('borderWidth',1)//默认宽度是1
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
// 为了实现切换时更好的效果,在设置线型为虚线时可以这样设置:
|
|
60
|
-
// node.s('dash',true);
|
|
61
|
-
// node.s('borderColor','rgba(0,0,0,0.00)');//将borderColor改为默认
|
|
62
|
-
// node.s('dashColor','当前设置的颜色')
|
|
63
|
-
// 虚线颜色用的是dashColor
|
|
64
|
-
//
|
|
65
|
-
// 设置线型为实线时
|
|
66
|
-
// node.s('dash',false);
|
|
67
|
-
// node.s('borderColor','当前设置的颜色');
|
|
68
|
-
// node.s('dashColor','rgb(173,173,173)');dash可设置为默认
|
|
69
|
-
// 实线用的是borderColor
|
|
70
34
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'styleMap.borderWidth': values['styleMap.borderWidth'] || 1
|
|
77
|
-
});
|
|
35
|
+
if (values.attr.bindType) {
|
|
36
|
+
return values.attr.bindType;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return 'none';
|
|
78
40
|
}
|
|
79
41
|
|
|
80
|
-
export default function
|
|
42
|
+
export default function NodePropertyView(props) {
|
|
81
43
|
var topo = props.topo,
|
|
82
44
|
topoEditApi = props.topoEditApi,
|
|
83
45
|
values = props.values,
|
|
84
46
|
_onChange = props.onChange,
|
|
85
47
|
editorProps = props.editorProps;
|
|
48
|
+
var bindType = getBindType(values);
|
|
86
49
|
|
|
87
50
|
var field = _Field.useField({
|
|
88
51
|
autoUnmount: false,
|
|
89
52
|
values: parseValues(values),
|
|
90
53
|
onChange: function onChange(name, value) {
|
|
91
|
-
var newValues = field.getValues();
|
|
92
|
-
|
|
93
|
-
if (name.startsWith('styleMap.label.fontStyle.')) {
|
|
94
|
-
name = 'styleMap.label.font';
|
|
95
|
-
value = fontStyleUtil.build(fontStyleUtil.getFontStyleMap(newValues, 'styleMap.label.fontStyle.'));
|
|
96
|
-
} // 层间线
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (name === 'styleMap.borderType') {
|
|
100
|
-
name = 'styleMap.dash';
|
|
101
|
-
value = value === 'dash';
|
|
102
|
-
}
|
|
54
|
+
var newValues = field.getValues();
|
|
103
55
|
|
|
104
56
|
if (values[name] !== value) {
|
|
105
57
|
_onChange(name, value, newValues);
|
|
@@ -107,6 +59,10 @@ export default function TextPropertyView(props) {
|
|
|
107
59
|
}
|
|
108
60
|
});
|
|
109
61
|
|
|
62
|
+
var setBindType = function setBindType(value) {
|
|
63
|
+
_onChange('attrObject.bindType', value);
|
|
64
|
+
};
|
|
65
|
+
|
|
110
66
|
useEffect(function () {
|
|
111
67
|
field.setValues(parseValues(values));
|
|
112
68
|
}, [values]);
|
|
@@ -121,12 +77,46 @@ export default function TextPropertyView(props) {
|
|
|
121
77
|
}, /*#__PURE__*/React.createElement(CollapsePanel, {
|
|
122
78
|
key: "\u76F8\u5173\u8D44\u6E90",
|
|
123
79
|
title: "\u76F8\u5173\u8D44\u6E90"
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
80
|
+
}, /*#__PURE__*/React.createElement(_Form, {
|
|
81
|
+
field: field,
|
|
82
|
+
labelAlign: "top"
|
|
83
|
+
}, !values.tag && /*#__PURE__*/React.createElement(_Form.Item, {
|
|
84
|
+
label: "\u5173\u8054\u7C7B\u578B"
|
|
85
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
|
86
|
+
name: "bindType",
|
|
87
|
+
value: bindType,
|
|
88
|
+
style: {
|
|
89
|
+
width: '100%',
|
|
90
|
+
marginRight: 8
|
|
91
|
+
},
|
|
92
|
+
onChange: setBindType
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Option, {
|
|
94
|
+
value: "none"
|
|
95
|
+
}, "\u672A\u5173\u8054"), /*#__PURE__*/React.createElement(Option, {
|
|
96
|
+
value: "resource"
|
|
97
|
+
}, "\u5173\u8054\u8D44\u6E90"), /*#__PURE__*/React.createElement(Option, {
|
|
98
|
+
value: "topo"
|
|
99
|
+
}, "\u5173\u8054\u62D3\u6251"))), bindType === 'resource' && /*#__PURE__*/React.createElement(_Form.Item, {
|
|
100
|
+
label: "\u5173\u8054\u8D44\u6E90"
|
|
101
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
style: {
|
|
103
|
+
display: 'flex'
|
|
128
104
|
}
|
|
129
|
-
}
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: textStyles.textEllipsis,
|
|
107
|
+
style: {
|
|
108
|
+
flex: 1,
|
|
109
|
+
paddingRight: 16,
|
|
110
|
+
color: '#4D6277'
|
|
111
|
+
},
|
|
112
|
+
title: values.tag ? values.name : null
|
|
113
|
+
}, values.tag ? values.name : '—'), /*#__PURE__*/React.createElement(NodeRelateResourceButton, {
|
|
114
|
+
node: values,
|
|
115
|
+
topo: topo,
|
|
116
|
+
topoEditApi: topoEditApi
|
|
117
|
+
}))), bindType === 'topo' && /*#__PURE__*/React.createElement(_Form.Item, {
|
|
118
|
+
label: "\u5173\u8054\u62D3\u6251"
|
|
119
|
+
}, /*#__PURE__*/React.createElement(TopoTreeSelect, null)))))), /*#__PURE__*/React.createElement(_Tab.Item, {
|
|
130
120
|
title: "\u8BBE\u7F6E",
|
|
131
121
|
key: "2"
|
|
132
122
|
}, /*#__PURE__*/React.createElement(_Form, {
|
|
@@ -141,23 +131,15 @@ export default function TextPropertyView(props) {
|
|
|
141
131
|
key: "\u663E\u793A\u8BBE\u7F6E",
|
|
142
132
|
title: "\u663E\u793A\u8BBE\u7F6E"
|
|
143
133
|
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
144
|
-
label: "\u540D\u79F0"
|
|
134
|
+
label: "\u56FE\u7247\u540D\u79F0"
|
|
145
135
|
}, /*#__PURE__*/React.createElement(_Input, {
|
|
146
136
|
name: "attrObject.name"
|
|
147
137
|
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
148
138
|
label: "\u663E\u793A\u56FE\u7247"
|
|
149
|
-
}, /*#__PURE__*/React.createElement(
|
|
139
|
+
}, /*#__PURE__*/React.createElement(NodeIconSelect, {
|
|
150
140
|
name: "image",
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
marginRight: 8
|
|
154
|
-
}
|
|
155
|
-
}, Object.keys(getIconMap(topo)).map(function (id) {
|
|
156
|
-
return /*#__PURE__*/React.createElement(Option, {
|
|
157
|
-
key: id,
|
|
158
|
-
value: id
|
|
159
|
-
}, id);
|
|
160
|
-
}))), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
141
|
+
topo: topo
|
|
142
|
+
})), /*#__PURE__*/React.createElement(_Form.Item, {
|
|
161
143
|
label: "\u56FE\u7247\u5C3A\u5BF8"
|
|
162
144
|
}, /*#__PURE__*/React.createElement(NodeSizeInput, {
|
|
163
145
|
value: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _Button from "@alifd/next/lib/button";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @return {React.ReactNode | null}
|
|
6
|
+
*/
|
|
7
|
+
export default function NodeRelateResourceButton(props) {
|
|
8
|
+
var _node$attr$data, _topo$options$editor;
|
|
9
|
+
|
|
10
|
+
var topo = props.topo,
|
|
11
|
+
topoEditApi = props.topoEditApi,
|
|
12
|
+
node = props.node;
|
|
13
|
+
var hide = ((_node$attr$data = node.attr.data) === null || _node$attr$data === void 0 ? void 0 : _node$attr$data.relateResource) === false || ((_topo$options$editor = topo.options.editor) === null || _topo$options$editor === void 0 ? void 0 : _topo$options$editor.enableRelateResource) === false;
|
|
14
|
+
return !hide ? /*#__PURE__*/React.createElement(_Button, {
|
|
15
|
+
type: "primary",
|
|
16
|
+
text: true,
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
topoEditApi.bindNodeResource({});
|
|
19
|
+
}
|
|
20
|
+
}, "\u9009\u62E9\u8D44\u6E90") : null;
|
|
21
|
+
}
|
|
22
|
+
;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function TopoTreeSelect(props: any): JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _TreeSelect from "@alifd/next/lib/tree-select";
|
|
2
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
|
+
var TreeNode = _TreeSelect.Node;
|
|
4
|
+
export default function TopoTreeSelect(props) {
|
|
5
|
+
var onChange = props.onChange;
|
|
6
|
+
return /*#__PURE__*/React.createElement(_TreeSelect, {
|
|
7
|
+
treeDefaultExpandAll: true,
|
|
8
|
+
onChange: onChange,
|
|
9
|
+
style: {
|
|
10
|
+
width: '100%',
|
|
11
|
+
marginRight: 8
|
|
12
|
+
}
|
|
13
|
+
}, /*#__PURE__*/React.createElement(TreeNode, {
|
|
14
|
+
key: "1",
|
|
15
|
+
value: "1",
|
|
16
|
+
label: "Component"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(TreeNode, {
|
|
18
|
+
key: "2",
|
|
19
|
+
value: "2",
|
|
20
|
+
label: "Form"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(TreeNode, {
|
|
22
|
+
key: "4",
|
|
23
|
+
value: "4",
|
|
24
|
+
label: "Input"
|
|
25
|
+
}), /*#__PURE__*/React.createElement(TreeNode, {
|
|
26
|
+
key: "5",
|
|
27
|
+
value: "5",
|
|
28
|
+
label: "Select",
|
|
29
|
+
disabled: true
|
|
30
|
+
})), /*#__PURE__*/React.createElement(TreeNode, {
|
|
31
|
+
key: "3",
|
|
32
|
+
value: "3",
|
|
33
|
+
label: "Display"
|
|
34
|
+
}, /*#__PURE__*/React.createElement(TreeNode, {
|
|
35
|
+
key: "6",
|
|
36
|
+
value: "6",
|
|
37
|
+
label: "Table"
|
|
38
|
+
}))));
|
|
39
|
+
}
|
|
40
|
+
;
|