Skip to content

Commit 2db3d0c

Browse files
author
昔梦
committed
fix:更改iconSvg的引入的方式+补充API:节点描述:description
1 parent 142f3f0 commit 2db3d0c

File tree

21 files changed

+577
-341
lines changed

21 files changed

+577
-341
lines changed

docs/xflow/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Handle 配置继承自 React Flow 的 Handle 配置,用于控制节点连接
132132
| ------------------------------- | ----------------------------------------------------------- | ---------------------------------- | ------ |
133133
| title | 节点名称 | `string` | |
134134
| type | 节点类型 | `string` | |
135+
| description | 节点描述 | `string` | |
135136
| hidden | 是否在配置面板中显示节点 | `boolean` | false |
136137
| targetHandleHidden | 是否隐藏左侧输入连接头 | `boolean` | false |
137138
| sourceHandleHidden | 是否隐藏右侧输出连接头 | `boolean` | false |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const CustomSvg = () => (
2+
<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor">
3+
<title>Panda icon</title>
4+
<path
5+
d="M99.096 315.634s-82.58-64.032-82.58-132.13c0-66.064 33.032-165.162 148.646-148.646 83.37 11.91 99.096 165.162 99.096 165.162l-165.162 115.614zM924.906 315.634s82.58-64.032 82.58-132.13c0-66.064-33.032-165.162-148.646-148.646-83.37 11.91-99.096 165.162-99.096 165.162l165.162 115.614z"
6+
fill="#6B676E"
7+
/>
8+
<path
9+
d="M1024 561.548c0 264.526-229.23 429.42-512.002 429.42S0 826.076 0 561.548 283.96 66.064 512.002 66.064 1024 297.022 1024 561.548z"
10+
fill="#FFEBD2"
11+
/>
12+
<path
13+
d="M330.324 842.126c0 82.096 81.34 148.646 181.678 148.646s181.678-66.55 181.678-148.646H330.324z"
14+
fill="#E9D7C3"
15+
/>
16+
<path
17+
d="M644.13 611.098C594.582 528.516 561.55 512 512.002 512c-49.548 0-82.58 16.516-132.13 99.096-42.488 70.814-78.73 211.264-49.548 247.742 66.064 82.58 165.162 33.032 181.678 33.032 16.516 0 115.614 49.548 181.678-33.032 29.18-36.476-7.064-176.93-49.55-247.74z"
18+
fill="#FFFFFF"
19+
/>
20+
<path
21+
d="M611.098 495.484c0-45.608 36.974-82.58 82.58-82.58 49.548 0 198.194 99.098 198.194 165.162s-79.934 144.904-148.646 99.096c-49.548-33.032-132.128-148.646-132.128-181.678zM412.904 495.484c0-45.608-36.974-82.58-82.58-82.58-49.548 0-198.194 99.098-198.194 165.162s79.934 144.904 148.646 99.096c49.548-33.032 132.128-148.646 132.128-181.678z"
22+
fill="#6B676E"
23+
/>
24+
<path
25+
d="M512.002 726.622c-30.06 0-115.614 5.668-115.614 33.032 0 49.638 105.484 85.24 115.614 82.58 10.128 2.66 115.614-32.944 115.614-82.58-0.002-27.366-85.556-33.032-115.614-33.032z"
26+
fill="#464655"
27+
/>
28+
<path
29+
d="M330.324 495.484m-33.032 0a33.032 33.032 0 1 0 66.064 0 33.032 33.032 0 1 0-66.064 0Z"
30+
fill="#464655"
31+
/>
32+
<path
33+
d="M693.678 495.484m-33.032 0a33.032 33.032 0 1 0 66.064 0 33.032 33.032 0 1 0-66.064 0Z"
34+
fill="#464655"
35+
/>
36+
</svg>
37+
);
38+
39+
export default CustomSvg;

docs/xflow/demo/best/demo2/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Button, Space, message } from 'antd';
44
import { PlayCircleOutlined, SaveOutlined } from '@ant-design/icons';
55
import { settings } from './setting';
66
import './index.less';
7+
import CustomSvg from './CustomSvg';
78

89
export default () => {
910
const [loading, setLoading] = useState(false);
@@ -186,6 +187,7 @@ export default () => {
186187
],
187188
},
188189
}}
190+
widgets={{ CustomSvg }}
189191
/>
190192
</div>
191193
<Space className="tools">

docs/xflow/demo/best/demo2/setting.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const settings = [
132132
{
133133
title: '条件判断',
134134
type: 'Switch',
135+
description:'条件判断',
135136
showTestingBtn: true,
136137
icon: {
137138
type: 'icon-switch',
@@ -157,10 +158,12 @@ export const settings = [
157158
title: 'LLM',
158159
type: 'LLM',
159160
showTestingBtn: true,
161+
description:'LLM',
160162
icon: {
161-
type: 'icon-model',
163+
// type: 'icon-model',
162164
bgColor: '#1890FF',
163165
},
166+
iconSvg:'CustomSvg',
164167
settingSchema: {
165168
type: 'object',
166169
properties: {

docs/xflow/demo/nodeSetting/data.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,24 @@ export const settings = [
135135
title: '代码执行',
136136
type: 'Code',
137137
description: '执行一段 Groovy 或 Python 或 NodeJS 代码实现自定义逻辑',
138-
iconSvg: (
139-
<svg
140-
t="1733888001185"
141-
class="icon"
142-
viewBox="0 0 1024 1024"
143-
version="1.1"
144-
xmlns="http://www.w3.org/2000/svg"
145-
p-id="4378"
146-
width="200"
147-
height="200"
148-
>
149-
<path
150-
d="M700.427093 797.610667a39.253333 39.253333 0 0 1 0-56.746667l228.864-228.949333-221.610666-228.864a40.021333 40.021333 0 0 1-12.117334-28.330667 40.277333 40.277333 0 0 1 12.117334-28.330667 39.253333 39.253333 0 0 1 56.746666 0l254.037334 254.037334v0.597333a61.184 61.184 0 0 1-8.106667 62.890667L757.17376 797.610667a39.253333 39.253333 0 0 1-56.746667 0z m-434.688-7.338667L12.128427 536.746667a39.253333 39.253333 0 0 1 0-56.746667L273.07776 226.304a39.253333 39.253333 0 0 1 56.661333 0l0.426667 0.426667v0.597333a65.621333 65.621333 0 0 1 0 54.528v0.597333l-0.426667 0.682667-228.864 228.778667 221.866667 221.866666a40.533333 40.533333 0 0 1-28.416 68.864 39.936 39.936 0 0 1-28.586667-12.373333z m175.530667 8.533333c-26.965333-8.96-38.826667-27.306667-31.658667-48.810666l130.304-493.056a49.322667 49.322667 0 0 1 47.616-31.744h0.682667l0.597333 0.170666a51.797333 51.797333 0 0 1 31.317334 27.733334 26.026667 26.026667 0 0 1 0 21.248L490.251093 766.634667c-7.338667 22.016-20.309333 34.133333-36.693333 34.133333a39.850667 39.850667 0 0 1-12.288-2.218667z"
151-
p-id="4379"
152-
fill="#ffffff"
153-
></path>
154-
</svg>
155-
),
138+
// iconSvg: (
139+
// <svg
140+
// t="1733888001185"
141+
// class="icon"
142+
// viewBox="0 0 1024 1024"
143+
// version="1.1"
144+
// xmlns="http://www.w3.org/2000/svg"
145+
// p-id="4378"
146+
// width="200"
147+
// height="200"
148+
// >
149+
// <path
150+
// d="M700.427093 797.610667a39.253333 39.253333 0 0 1 0-56.746667l228.864-228.949333-221.610666-228.864a40.021333 40.021333 0 0 1-12.117334-28.330667 40.277333 40.277333 0 0 1 12.117334-28.330667 39.253333 39.253333 0 0 1 56.746666 0l254.037334 254.037334v0.597333a61.184 61.184 0 0 1-8.106667 62.890667L757.17376 797.610667a39.253333 39.253333 0 0 1-56.746667 0z m-434.688-7.338667L12.128427 536.746667a39.253333 39.253333 0 0 1 0-56.746667L273.07776 226.304a39.253333 39.253333 0 0 1 56.661333 0l0.426667 0.426667v0.597333a65.621333 65.621333 0 0 1 0 54.528v0.597333l-0.426667 0.682667-228.864 228.778667 221.866667 221.866666a40.533333 40.533333 0 0 1-28.416 68.864 39.936 39.936 0 0 1-28.586667-12.373333z m175.530667 8.533333c-26.965333-8.96-38.826667-27.306667-31.658667-48.810666l130.304-493.056a49.322667 49.322667 0 0 1 47.616-31.744h0.682667l0.597333 0.170666a51.797333 51.797333 0 0 1 31.317334 27.733334 26.026667 26.026667 0 0 1 0 21.248L490.251093 766.634667c-7.338667 22.016-20.309333 34.133333-36.693333 34.133333a39.850667 39.850667 0 0 1-12.288-2.218667z"
151+
// p-id="4379"
152+
// fill="#ffffff"
153+
// ></path>
154+
// </svg>
155+
// ),
156156
},
157157
{
158158
title: '工具',
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const CustomSvg = () => (
2+
<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor">
3+
<title>Panda icon</title>
4+
<path
5+
d="M99.096 315.634s-82.58-64.032-82.58-132.13c0-66.064 33.032-165.162 148.646-148.646 83.37 11.91 99.096 165.162 99.096 165.162l-165.162 115.614zM924.906 315.634s82.58-64.032 82.58-132.13c0-66.064-33.032-165.162-148.646-148.646-83.37 11.91-99.096 165.162-99.096 165.162l165.162 115.614z"
6+
fill="#6B676E"
7+
/>
8+
<path
9+
d="M1024 561.548c0 264.526-229.23 429.42-512.002 429.42S0 826.076 0 561.548 283.96 66.064 512.002 66.064 1024 297.022 1024 561.548z"
10+
fill="#FFEBD2"
11+
/>
12+
<path
13+
d="M330.324 842.126c0 82.096 81.34 148.646 181.678 148.646s181.678-66.55 181.678-148.646H330.324z"
14+
fill="#E9D7C3"
15+
/>
16+
<path
17+
d="M644.13 611.098C594.582 528.516 561.55 512 512.002 512c-49.548 0-82.58 16.516-132.13 99.096-42.488 70.814-78.73 211.264-49.548 247.742 66.064 82.58 165.162 33.032 181.678 33.032 16.516 0 115.614 49.548 181.678-33.032 29.18-36.476-7.064-176.93-49.55-247.74z"
18+
fill="#FFFFFF"
19+
/>
20+
<path
21+
d="M611.098 495.484c0-45.608 36.974-82.58 82.58-82.58 49.548 0 198.194 99.098 198.194 165.162s-79.934 144.904-148.646 99.096c-49.548-33.032-132.128-148.646-132.128-181.678zM412.904 495.484c0-45.608-36.974-82.58-82.58-82.58-49.548 0-198.194 99.098-198.194 165.162s79.934 144.904 148.646 99.096c49.548-33.032 132.128-148.646 132.128-181.678z"
22+
fill="#6B676E"
23+
/>
24+
<path
25+
d="M512.002 726.622c-30.06 0-115.614 5.668-115.614 33.032 0 49.638 105.484 85.24 115.614 82.58 10.128 2.66 115.614-32.944 115.614-82.58-0.002-27.366-85.556-33.032-115.614-33.032z"
26+
fill="#464655"
27+
/>
28+
<path
29+
d="M330.324 495.484m-33.032 0a33.032 33.032 0 1 0 66.064 0 33.032 33.032 0 1 0-66.064 0Z"
30+
fill="#464655"
31+
/>
32+
<path
33+
d="M693.678 495.484m-33.032 0a33.032 33.032 0 1 0 66.064 0 33.032 33.032 0 1 0-66.064 0Z"
34+
fill="#464655"
35+
/>
36+
</svg>
37+
);
38+
39+
export default CustomSvg;

0 commit comments

Comments
 (0)