Skip to content

Commit 8fe3444

Browse files
committed
Merge branch 'xflow' of https://github.com/alibaba/x-render into xflow
2 parents 8b34f6d + c35bd43 commit 8fe3444

File tree

17 files changed

+72
-74
lines changed

17 files changed

+72
-74
lines changed

docs/xflow/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ title: API
3737
| title | 节点名称 | `string` | |
3838
| type | 节点类型 | `string` | |
3939
| hidden | 是否在配置面板中显示节点 | `boolean` | false |
40+
| hideDesc | 是否在配置面板中显示节点的描述信息 | `boolean` | false |
4041
| targetHandleHidden | 是否隐藏左侧输入连接头 | `boolean` | false |
4142
| sourceHandleHidden | 是否隐藏右侧输出连接头 | `boolean` | false |
4243
| icon | 节点的图标配置 | `{type:string;bgColor:string}` | |

docs/xflow/schema/custom-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default [
5959
type: 'icon-model',
6060
bgColor: '#6172F3',
6161
},
62+
hideDesc:true // 隐藏配置面板描述信息
6263
},
6364
{
6465
title: 'Prompt',

packages/x-flow/src/XFlow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const XFlow: FC<FlowProps> = memo(() => {
257257
}}
258258
>
259259
<CandidateNode />
260-
<Operator addNode={handleAddNode} />
260+
<Operator addNode={handleAddNode} xflowRef={workflowContainerRef} />
261261
<Background
262262
gap={[16, 16]}
263263
size={0.6}

packages/x-flow/src/components/CustomNode/sourceHandle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default memo((props: any) => {
5454
fontSize: '12px',
5555
}}
5656
open={isShowTooltip}
57+
getPopupContainer={() => document.getElementById('xflow-container')}
5758
>
5859
<PlusOutlined style={{ color: '#fff', fontSize: 10 }} />
5960
</Tooltip>

packages/x-flow/src/components/IconView/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
77
*/
88

99
const Icon = createFromIconfontCN({
10-
scriptUrl: '//at.alicdn.com/t/a/font_4069358_4p70zmc30ro.js',
10+
scriptUrl: '//at.alicdn.com/t/a/font_4069358_36flyyai0sm.js',
1111
});
1212

1313
export default Icon;

packages/x-flow/src/components/NodeContainer/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default memo((props: any) => {
3333
title={<MenuTooltip {...props} />}
3434
placement="bottomLeft"
3535
trigger="click"
36+
getPopupContainer={() => document.getElementById('xflow-container')}
3637
>
3738
<Tooltip
3839
title="点击图标查看节点信息"
@@ -43,6 +44,7 @@ export default memo((props: any) => {
4344
color: '#354052',
4445
fontSize: '12px',
4546
}}
47+
getPopupContainer={() => document.getElementById('xflow-container')}
4648
>
4749
<span className="icon-box" style={{ background: icon?.bgColor }}>
4850
{iconSvg ? iconSvg : <IconBox {...icon} /> }
@@ -60,6 +62,7 @@ export default memo((props: any) => {
6062
color: '#354052',
6163
fontSize: '12px',
6264
},
65+
getPopupContainer:() => document.getElementById('xflow-container')
6366
},
6467
}}
6568
>
@@ -81,6 +84,7 @@ export default memo((props: any) => {
8184
color: '#354052',
8285
fontSize: '12px',
8386
},
87+
getPopupContainer: () => document.getElementById('xflow-container')
8488
},
8589
}}
8690
className="node-desc"

packages/x-flow/src/components/NodesMenu/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const MenuItem = (props: any) => {
6666
title={<MenuTooltip {...props} />}
6767
placement='right'
6868
arrow={false}
69+
getPopupContainer={() => document.getElementById('xflow-container')}
6970
>
7071
<div
7172
className='menu-item'

packages/x-flow/src/components/NodesPopover/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default forwardRef((props: any, popoverRef) => {
4444

4545
return (
4646
<Popover
47+
getPopupContainer={() => document.getElementById('xflow-container')}
4748
zIndex={2000}
4849
arrow={false}
4950
overlayInnerStyle={{ padding: '12px 6px' }}

packages/x-flow/src/components/PanelContainer/index.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
border-color: #fff;
5757
}
5858
textarea {
59-
margin: 12px 0;
59+
margin-top: 12px;
6060
}
6161
}
6262

@@ -122,4 +122,4 @@
122122
font-size: 12px;
123123
}
124124
}
125-
}
125+
}

packages/x-flow/src/components/PanelContainer/index.tsx

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
3939
const isDisabled = ['Input', 'Output'].includes(nodeType) || disabled;
4040
const [descVal, setDescVal] = useState(data?.desc);
4141
const [titleVal, setTitleVal] = useState(data?.title || nodeSetting?.title);
42+
const { hideDesc, nodeConfigPanelWidth, iconSvg } = nodeSetting;
4243

4344
// const description = getDescription(nodeType, props.description);
44-
4545
const handleNodeValueChange = debounce((data: any) => {
4646
const newNodes = produce(nodes, draft => {
4747
let node = null;
@@ -69,31 +69,36 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
6969

7070
return (
7171
<Drawer
72+
getContainer={false}
7273
rootClassName="custom-node-panel"
7374
open={true}
74-
width={nodeSetting?.nodeConfigPanelWidth || configPanelWidth || 400} // 改为配置的width 节点的width > 全局的width> 默认 400
75+
width={nodeConfigPanelWidth || configPanelWidth || 400} // 改为配置的width 节点的width > 全局的width> 默认 400
7576
mask={false}
7677
onClose={onClose}
78+
headerStyle={{ paddingBottom: '12px' }}
7779
title={
7880
<>
7981
<div className="title-box">
8082
<div style={{ display: 'flex', alignItems: 'center', flex: 1 }}>
8183
<span
8284
className="icon-box"
83-
style={{ background: nodeSetting?.icon?.bgColor }}
85+
style={{ background: nodeSetting?.icon?.bgColor || '#F79009'}}
8486
>
85-
<Icon
86-
style={{ fontSize: 14, color: '#fff' }}
87-
type={nodeSetting?.icon?.type}
88-
/>
87+
{iconSvg ? (
88+
iconSvg
89+
) : (
90+
<Icon
91+
style={{ fontSize: 14, color: '#fff' }}
92+
type={nodeSetting?.icon?.type}
93+
/>
94+
)}
8995
</span>
9096
{isDisabled ? (
9197
<span style={{ marginLeft: '11px' }}>{nodeSetting?.title}</span>
9298
) : (
9399
<Input
94100
style={{ width: '100%' }}
95-
// defaultValue={data?.title || nodeSetting?.title}
96-
value={titleVal} // || nodeSetting?.title
101+
value={titleVal}
97102
onChange={e => {
98103
setTitleVal(e.target.value);
99104
handleNodeValueChange({ title: e.target.value });
@@ -118,23 +123,23 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
118123
</Space>
119124
</div>
120125
</div>
121-
<div className="desc-box">
122-
{isDisabled ? (
123-
description
124-
) : (
125-
<Input.TextArea
126-
placeholder="添加描述..."
127-
autoSize={{ minRows: 1 }}
128-
value={descVal}
129-
// value={data?.desc}
130-
// defaultValue={description}
131-
onChange={e => {
132-
setDescVal(e.target.value);
133-
handleNodeValueChange({ desc: e.target.value });
134-
}}
135-
/>
136-
)}
137-
</div>
126+
{!hideDesc && (
127+
<div className="desc-box">
128+
{isDisabled ? (
129+
description
130+
) : (
131+
<Input.TextArea
132+
placeholder="添加描述..."
133+
autoSize={{ minRows: 1 }}
134+
value={descVal}
135+
onChange={e => {
136+
setDescVal(e.target.value);
137+
handleNodeValueChange({ desc: e.target.value });
138+
}}
139+
/>
140+
)}
141+
</div>
142+
)}
138143
</>
139144
}
140145
>

0 commit comments

Comments
 (0)