File tree Expand file tree Collapse file tree 7 files changed +11
-15
lines changed
docs/xflow/demo/nodeWidget Expand file tree Collapse file tree 7 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 1
1
.node-llm-style {
2
- background-color : rgba (97 , 113 , 243 ,0.3 );
3
- border :1px solid rgba (97 , 113 , 243 , 0.5 )
2
+ .custom-node-container {
3
+ background-color : rgba (97 , 113 , 243 ,0.3 );
4
+ }
4
5
}
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ export default memo((props: any) => {
59
59
const isEnd = type === 'End' ;
60
60
const isSwitchNode = type === 'Switch' || type === 'Parallel' || isNote ; // 判断是否为条件节点/并行节点/注释节点
61
61
const connectable = readOnly ? false : isConnectable ;
62
+ const nodeSetting = settingMap [ type ] || { } ;
63
+ const nodeClassName = nodeSetting ?. className || '' ;
62
64
63
65
// 增加节点并进行联系
64
66
const handleAddNode = ( data : any , sourceHandle ?: string ) => {
@@ -253,6 +255,7 @@ export default memo((props: any) => {
253
255
[ 'xflow-node-container-tb' ] : layout === 'TB' ,
254
256
[ 'xflow-node-container-note' ] : isNote ,
255
257
[ `xflow-node-container-status-${ status } ` ] : isTruthy ( status ) ,
258
+ [ nodeClassName ] : ! ! nodeClassName
256
259
} ) }
257
260
onMouseEnter = { ( ) => setIsHovered ( true ) }
258
261
onMouseLeave = { ( ) => setIsHovered ( false ) }
Original file line number Diff line number Diff line change @@ -12,11 +12,10 @@ export default memo((props: any) => {
12
12
const hideDesc = nodeSetting ?. nodePanel ?. hideDesc ?? globalConfig ?. nodePanel ?. hideDesc ?? false ;
13
13
const hideTitleTips = globalConfig ?. nodeView ?. hideTitleTips ?? false ;
14
14
const SVGWidget = widgets [ nodeSetting ?. iconSvg ] ; // 自定义面板配置组件
15
- const nodeClassName = nodeSetting ?. className || '' ;
16
15
17
16
return (
18
17
< NodeContainer
19
- className = { `custom-node-code ${ nodeClassName } ` }
18
+ className = { `custom-node-code` }
20
19
title = { data ?. title || nodeSetting . title }
21
20
icon = { {
22
21
type : nodeSetting ?. icon ?. type ,
Original file line number Diff line number Diff line change @@ -11,11 +11,10 @@ export default memo((props: any) => {
11
11
const hideDesc = nodeSetting ?. nodePanel ?. hideDesc ?? globalConfig ?. nodePanel ?. hideDesc ?? false ;
12
12
const hideTitleTips = globalConfig ?. nodeView ?. hideTitleTips ?? false ;
13
13
const SVGWidget = widgets [ nodeSetting ?. iconSvg ] ; // 自定义面板配置组件
14
- const nodeClassName = nodeSetting ?. className || '' ;
15
14
16
15
return (
17
16
< NodeContainer
18
- className = { `custom-node-code ${ nodeClassName } ` }
17
+ className = { `custom-node-code` }
19
18
title = { data ?. title || nodeSetting ?. title || '结束' }
20
19
icon = { {
21
20
type : nodeSetting ?. icon ?. type || 'icon-end' ,
Original file line number Diff line number Diff line change @@ -28,13 +28,11 @@ export default memo((props: any) => {
28
28
const hideTitleTips = globalConfig ?. nodeView ?. hideTitleTips ?? false ;
29
29
const isSwitchBottom = position === Position . Bottom ;
30
30
const SVGWidget = widgets [ nodeSetting ?. iconSvg ] ; // 自定义面板配置组件
31
- const nodeClassName = nodeSetting ?. className || '' ;
32
31
33
32
return (
34
33
< NodeContainer
35
34
className = { classNames ( 'custom-node-code' , {
36
- 'switch-node-code-bottom' : isSwitchBottom ,
37
- [ nodeClassName ] : ! ! nodeClassName ,
35
+ 'switch-node-code-bottom' : isSwitchBottom
38
36
} ) }
39
37
title = { data ?. title || nodeSetting ?. title || 'parallel' }
40
38
icon = { {
Original file line number Diff line number Diff line change @@ -15,11 +15,10 @@ export default memo((props: any) => {
15
15
false ;
16
16
const hideTitleTips = globalConfig ?. nodeView ?. hideTitleTips ?? false ;
17
17
const SVGWidget = widgets [ nodeSetting ?. iconSvg ] ; // 自定义面板配置组件
18
- const nodeClassName = nodeSetting ?. className || '' ;
19
18
20
19
return (
21
20
< NodeContainer
22
- className = { `custom-node-code ${ nodeClassName } ` }
21
+ className = { `custom-node-code` }
23
22
title = { data ?. title || nodeSetting ?. title || '开始' }
24
23
icon = { {
25
24
type : nodeSetting ?. icon ?. type || 'icon-start' ,
Original file line number Diff line number Diff line change @@ -29,14 +29,11 @@ export default memo((props: any) => {
29
29
const hideTitleTips = globalConfig ?. nodeView ?. hideTitleTips ?? false ;
30
30
const isSwitchBottom = position === Position . Bottom ;
31
31
const SVGWidget = widgets [ nodeSetting ?. iconSvg ] ; // 自定义面板配置组件
32
- const nodeClassName = nodeSetting ?. className || '' ;
33
-
34
32
35
33
return (
36
34
< NodeContainer
37
35
className = { classNames ( 'custom-node-code' , {
38
- 'switch-node-code-bottom' : isSwitchBottom ,
39
- [ nodeClassName ] : ! ! nodeClassName ,
36
+ 'switch-node-code-bottom' : isSwitchBottom
40
37
} ) }
41
38
title = { data ?. title || nodeSetting ?. title || 'Switch' }
42
39
icon = { {
You can’t perform that action at this time.
0 commit comments