Skip to content

Commit

Permalink
fix:1.文字缩略气泡白底黑字 2.switchData改名为list
Browse files Browse the repository at this point in the history
  • Loading branch information
昔梦 committed Dec 9, 2024
1 parent 76932de commit 0219408
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 17 deletions.
1 change: 0 additions & 1 deletion docs/xflow/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ title: API
| settings | 节点配置,定义页面中可拖动的节点配置 | ( [TNodeGroup](#tnodegroup) \| [TNodeItem](#tnodeitem) )[ ] | |
| nodeSelector | 节点选择器配置,可控制节点的可搜索性 | `TNodeSelector`
| iconFontUrl | iconfont url,用于配置图标渲染 | `String` | |
| |

### TNodeGroup

Expand Down
2 changes: 1 addition & 1 deletion docs/xflow/demo/switchNode/customSwitchNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default () => {
type: 'Switch',
id: '2',
position: { x: 171.25, y: 218.75 },
data: { switchData:[{value:"条件1"}]}
data: { list:[{value:"条件1"}]}
},
];

Expand Down
2 changes: 1 addition & 1 deletion docs/xflow/demo/switchNode/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default () => {
type: 'Switch',
id: '2',
position: { x: 171.25, y: 218.75 },
data: { switchData: [{ value: '条件1' }] },
data: { list: [{ value: '条件1' }] },
},
{
type: 'End',
Expand Down
2 changes: 1 addition & 1 deletion docs/xflow/nodeBuildIn.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ group:
# 内置节点

## 条件内置节点
内置条件节点,可以直接设置type为`Switch`使用,条件节点的数据格式为` switchData:[{value:"条件1"}]`
内置条件节点,可以直接设置type为`Switch`使用,条件节点的数据格式为` list:[{value:"条件1"}]`

<code src="./demo/switchNode/index.tsx"></code>

Expand Down
46 changes: 35 additions & 11 deletions packages/x-flow/src/components/NodeContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ import './index.less';
const { Text, Paragraph } = Typography;

export default memo((props: any) => {
const { className, onClick, children, icon, title, desc, hideDesc, NodeWidget, iconFontUrl } = props;
const {
className,
onClick,
children,
icon,
title,
desc,
hideDesc,
NodeWidget,
iconFontUrl,
} = props;
const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]);

return (
Expand All @@ -17,30 +27,44 @@ export default memo((props: any) => {
})}
onClick={onClick}
>
<div className='node-title'>
<span className='icon-box' style={{ background: icon?.bgColor }}>
<div className="node-title">
<span className="icon-box" style={{ background: icon?.bgColor }}>
<IconBox {...icon} />
</span>
<Text
style={{ width: 188, marginLeft: '8px' }}
ellipsis={{ tooltip: title }}
ellipsis={{
tooltip: {
title: title,
placement: 'topRight',
color: '#ffff',
overlayInnerStyle: {
color: '#354052',
fontSize: '12px',
},
},
}}
>
{title}
</Text>
</div>
<div className="node-body">{children}</div>
{
NodeWidget && <div className='node-widget'>
{NodeWidget}
</div>
}
{NodeWidget && <div className="node-widget">{NodeWidget}</div>}
{!hideDesc && !!desc && (
<Paragraph
ellipsis={{
rows: 2,
tooltip: { title: desc, placement: 'topRight' },
tooltip: {
title: desc,
placement: 'bottomRight',
color: '#ffff',
overlayInnerStyle: {
color: '#354052',
fontSize: '12px',
},
},
}}
className='node-desc'
className="node-desc"
>
{desc}
</Paragraph>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default memo((props: any) => {

return (
<Flex vertical className="node-switch-widget" gap={5}>
{(data?.switchData || [{}])?.map((item, index) => (
{(data?.list || [{}])?.map((item, index) => (
<div className="node-switch-widget-item" key={index}>
<div className="item-header">
<div className="item-title">{index === 0 ? 'IF' : 'ELIF'}</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/x-flow/src/nodes/node-switch/setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const schema: Schema = {
span: 24,
displayType: 'row',
properties: {
switchData: {
list: {
type: 'array',
widget: 'simpleList',
display: 'block',
Expand Down

0 comments on commit 0219408

Please sign in to comment.