Comments (8)
明白了,之前是设计了 addIcon 用来自定义节点图标的,这个分支节点增加条件的按钮忘记了。可以尝试升级到 0.1.25 或者 1.0.2 版本,我都加上了
from flow-builder.
分支节点的 conditionNodeType 属性要对应一个节点的 type 属性,例如这样:
[
{
type: 'branch',
name: '分支节点',
conditionNodeType: 'myCondition',
},
{
type: 'myCondition',
name: '条件节点',
}
]
from flow-builder.
displayComponent 分支节点应该没办法自定义,分支节点下面渲染了条件节点,以及其他 children。
其实我想要 添加条件节点的按钮自定义。
from flow-builder.
displayComponent 分支节点应该没办法自定义,分支节点下面渲染了条件节点,以及其他 children。 其实我想要 添加条件节点的按钮自定义。
我就是这个意思,我也想自定义添加条件节点的按钮自定义
from flow-builder.
明白了,之前是设计了 addIcon 用来自定义节点图标的,这个分支节点增加条件的按钮忘记了。可以尝试升级到 0.1.25 或者 1.0.2 版本,我都加上了
{
type: "branch",
name: "分支",
removeConfirmTitle: "确认要删除此节点?",
conditionNodeType: "condition",
addableComponent: CustomAddableComponent,
initialNodeData: {
id: createUUID(),
name: "分支",
type: "branch",
children: [
{
id: createUUID(),
properties: {},
default: false,
name: "分支节点",
content: "请设置条件",
type: "condition"
},
{
id: createUUID(),
name: "分支节点",
properties: {},
default: true,
content: "默认分支节点",
type: "condition"
}
]
}
}
大佬,我这样初始化分支节点数据之后,分支节点下面继续添加分支节点,所有数据都是一样的,我id用了uuid还有时间戳,debugger看了新增出来的id都是一样的
from flow-builder.
@Komorebiqch 你定义节点的时候,就已经把 initialNodeData 的 id 求出来了,(你的 createUUID 函数已经调用了)。当然每次都是一样的。话说,现在好像不支持传一个函数过去惰性求值。
from flow-builder.
明白了,之前是设计了 addIcon 用来自定义节点图标的,这个分支节点增加条件的按钮忘记了。可以尝试升级到 0.1.25 或者 1.0.2 版本,我都加上了
{ type: "branch", name: "分支", removeConfirmTitle: "确认要删除此节点?", conditionNodeType: "condition", addableComponent: CustomAddableComponent, initialNodeData: { id: createUUID(), name: "分支", type: "branch", children: [ { id: createUUID(), properties: {}, default: false, name: "分支节点", content: "请设置条件", type: "condition" }, { id: createUUID(), name: "分支节点", properties: {}, default: true, content: "默认分支节点", type: "condition" } ] } } 大佬,我这样初始化分支节点数据之后,分支节点下面继续添加分支节点,所有数据都是一样的,我id用了uuid还有时间戳,debugger看了新增出来的id都是一样的
每次增加节点时,会把 registerNodes 中的 initialNodeData 结构出来赋值给当前节点(initialNodeData 可能不太适用于你现在这个场景),代码实现比较简单,可以看这里 https://github.com/bytedance/flow-builder/blob/main/src/utils/index.ts#L80。
from flow-builder.
@Komorebiqch 你定义节点的时候,就已经把 initialNodeData 的 id 求出来了,(你的 createUUID 函数已经调用了)。当然每次都是一样的。话说,现在好像不支持传一个函数过去惰性求值。
是的,我们暂时还没有遇到这么复杂的场景,所以就没有这样设计 😁
from flow-builder.
Related Issues (20)
- How to get id of the deleted node HOT 3
- 无法正常工作 Critical dependency: the request of a dependency is an expression HOT 1
- Add Multiple `isStart` Nodes. HOT 1
- Change `onAddNodeSuccess` to return `INode` HOT 2
- Get only changed node HOT 1
- [feature request] 能否增加画布拖动功能 HOT 5
- Conflicting peer dependency - react-sortable-hoc HOT 2
- 当ConfigComponent中表单存在树形结构,渲染报错 HOT 7
- 可以支持在 FlowBuilder 里面支持传 children 吗,这样就可以share context 了 HOT 1
- Help required
- 【特性】增加点击节点和点击画布的回调通知 HOT 1
- [Feature Request] 增加并行节点类型 HOT 3
- 样式优化 HOT 2
- Cannot add data to the node with addNode HOT 3
- Disable adding nodes before created one HOT 1
- Getting the current position (index) of the clicked "add node button" HOT 1
- Cannot use removeNode to remove my branch node HOT 1
- [Feature] Full screen editor
- Custom add button HOT 2
- Branch route labels HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flow-builder.