@riil-frontend/component-topology 2.3.20 → 2.4.2
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/CHANGELOG.md +26 -0
- 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/components/TopoView/Topo.js +0 -6
- package/es/core/components/titlebar/TitleBar.module.scss +7 -1
- 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/README.md +2 -0
- package/es/core/editor/components/settings/Settings.js +47 -42
- package/es/core/editor/components/settings/Settings.module.scss +8 -2
- 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 +121 -126
- 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 +30 -144
- package/es/core/editor/components/settings/view/ViewPropertyView.js +1 -1
- package/es/core/editor/components/titlebar/TopoEditorTitleBar.js +4 -4
- 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/topoCenter/store/topoTreeMod.d.ts +3 -2
- package/es/topoCenter/store/topoTreeMod.js +34 -180
- package/es/utils/htElementDataUtil.js +1 -1
- package/es/utils/topoData.js +1 -1
- package/es/utils/tree.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/components/TopoView/Topo.js +0 -12
- package/lib/core/components/titlebar/TitleBar.module.scss +7 -1
- 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/README.md +2 -0
- package/lib/core/editor/components/settings/Settings.js +45 -42
- package/lib/core/editor/components/settings/Settings.module.scss +8 -2
- 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 +127 -129
- 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 +29 -149
- package/lib/core/editor/components/settings/view/ViewPropertyView.js +1 -1
- package/lib/core/editor/components/titlebar/TopoEditorTitleBar.js +5 -4
- 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/topoCenter/store/topoTreeMod.d.ts +3 -2
- package/lib/topoCenter/store/topoTreeMod.js +34 -184
- package/lib/utils/htElementDataUtil.js +1 -1
- package/lib/utils/topoData.js +1 -1
- package/lib/utils/tree.js +1 -1
- package/package.json +6 -6
- package/es/core/editor/buildContextmenu.js +0 -14
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import _NumberPicker from "@alifd/next/lib/number-picker";
|
|
2
|
+
import _Form from "@alifd/next/lib/form";
|
|
3
|
+
import _Field from "@alifd/next/lib/field";
|
|
4
|
+
import _Select from "@alifd/next/lib/select";
|
|
5
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
6
|
+
import ColorPicker from "../../../LinkDynamicStyleSettingDrawer/rule/ColorPicker";
|
|
7
|
+
import FontStyleCheckbox from "./FontStyleCheckbox";
|
|
8
|
+
var Option = _Select.Option;
|
|
9
|
+
|
|
10
|
+
function parseValue(value) {
|
|
11
|
+
return {
|
|
12
|
+
fontFamily: value.font.fontFamily || '黑体',
|
|
13
|
+
fontSize: value.font.fontSize || 12,
|
|
14
|
+
color: value.color || '#000000',
|
|
15
|
+
fontStyleChecked: {
|
|
16
|
+
underline: value.underline,
|
|
17
|
+
bold: value.font.bold,
|
|
18
|
+
italic: value.font.italic
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function TextStyle(props) {
|
|
24
|
+
var value = props.value,
|
|
25
|
+
_onChange = props.onChange;
|
|
26
|
+
|
|
27
|
+
var field = _Field.useField({
|
|
28
|
+
autoUnmount: false,
|
|
29
|
+
values: parseValue(value),
|
|
30
|
+
onChange: function onChange(name, value) {
|
|
31
|
+
var values = field.getValues();
|
|
32
|
+
var aValues = {
|
|
33
|
+
color: values.color,
|
|
34
|
+
underline: values.fontStyleChecked.underline,
|
|
35
|
+
font: {
|
|
36
|
+
fontFamily: values.fontFamily,
|
|
37
|
+
fontSize: values.fontSize,
|
|
38
|
+
bold: values.fontStyleChecked.bold,
|
|
39
|
+
italic: values.fontStyleChecked.italic
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
_onChange && _onChange(aValues);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
field.setValues(parseValue(value));
|
|
48
|
+
}, [value]);
|
|
49
|
+
return /*#__PURE__*/React.createElement(_Form, {
|
|
50
|
+
field: field,
|
|
51
|
+
labelAlign: "top",
|
|
52
|
+
component: "div"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
style: {
|
|
55
|
+
display: 'flex'
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
style: {
|
|
59
|
+
flex: 1,
|
|
60
|
+
paddingRight: 12
|
|
61
|
+
}
|
|
62
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
63
|
+
label: "\u5B57\u4F53"
|
|
64
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
|
65
|
+
defaultValue: "\u9ED1\u4F53",
|
|
66
|
+
name: "fontFamily",
|
|
67
|
+
style: {
|
|
68
|
+
width: '100%',
|
|
69
|
+
marginRight: 8
|
|
70
|
+
}
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Option, {
|
|
72
|
+
value: "\u5B8B\u4F53"
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
style: {
|
|
75
|
+
fontFamily: '宋体'
|
|
76
|
+
}
|
|
77
|
+
}, "\u5B8B\u4F53")), /*#__PURE__*/React.createElement(Option, {
|
|
78
|
+
value: "\u9ED1\u4F53"
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
style: {
|
|
81
|
+
fontFamily: '黑体'
|
|
82
|
+
}
|
|
83
|
+
}, "\u9ED1\u4F53")), /*#__PURE__*/React.createElement(Option, {
|
|
84
|
+
value: "Arial"
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
style: {
|
|
87
|
+
fontFamily: 'Arial'
|
|
88
|
+
}
|
|
89
|
+
}, "Arial"))))), /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
style: {
|
|
91
|
+
width: 70
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
94
|
+
label: "\u5B57\u53F7",
|
|
95
|
+
hasFeedback: true,
|
|
96
|
+
required: true,
|
|
97
|
+
requiredMessage: "\u4E0D\u80FD\u4E3A\u7A7A",
|
|
98
|
+
requiredTrigger: "onBlur",
|
|
99
|
+
asterisk: false
|
|
100
|
+
}, /*#__PURE__*/React.createElement(_NumberPicker, {
|
|
101
|
+
name: "fontSize",
|
|
102
|
+
min: 8,
|
|
103
|
+
max: 36,
|
|
104
|
+
style: {
|
|
105
|
+
width: '100%',
|
|
106
|
+
marginRight: 8
|
|
107
|
+
},
|
|
108
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
109
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
style: {
|
|
111
|
+
display: 'flex'
|
|
112
|
+
}
|
|
113
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
style: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
paddingRight: 12
|
|
117
|
+
}
|
|
118
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
119
|
+
label: "\u6837\u5F0F"
|
|
120
|
+
}, /*#__PURE__*/React.createElement(FontStyleCheckbox, {
|
|
121
|
+
name: "fontStyleChecked"
|
|
122
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
style: {
|
|
124
|
+
width: 70
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
|
127
|
+
label: "\u989C\u8272"
|
|
128
|
+
}, /*#__PURE__*/React.createElement(ColorPicker, {
|
|
129
|
+
name: "color",
|
|
130
|
+
align: "br"
|
|
131
|
+
}))))));
|
|
132
|
+
}
|
|
133
|
+
;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default fontStyleUtil;
|
|
2
|
+
declare namespace fontStyleUtil {
|
|
3
|
+
export function toMap(font?: string): {
|
|
4
|
+
fontFamily: string;
|
|
5
|
+
fontSize: number;
|
|
6
|
+
bold: boolean;
|
|
7
|
+
italic: boolean;
|
|
8
|
+
};
|
|
9
|
+
export function toMap(font?: string): {
|
|
10
|
+
fontFamily: string;
|
|
11
|
+
fontSize: number;
|
|
12
|
+
bold: boolean;
|
|
13
|
+
italic: boolean;
|
|
14
|
+
};
|
|
15
|
+
export function build(style: any): string;
|
|
16
|
+
export function build(style: any): string;
|
|
17
|
+
export function getFontStyleMap(obj: any, prefix: any): {};
|
|
18
|
+
export function getFontStyleMap(obj: any, prefix: any): {};
|
|
19
|
+
}
|
|
@@ -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;
|