Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] sourceRules规则不触发 #140

Closed
ouzhou opened this issue Apr 21, 2021 · 1 comment
Closed

[Bug report] sourceRules规则不触发 #140

ouzhou opened this issue Apr 21, 2021 · 1 comment
Projects

Comments

@ouzhou
Copy link

ouzhou commented Apr 21, 2021

问题描述
做一个审批流,希望开始节点只能连接一个其他节点,但是以下代码不符合期望

最简复现demo

  lf.register('START', ({ CircleNode, CircleNodeModel }) => {
    class StartNodeModel extends CircleNodeModel {
      // 开始 0个连入 1个连出
      setAttributes() {
        this.targetRules.push({
          message: '开始节点只能连出',
          validate: (source, target) => {
            return false;
          },
        });
        this.sourceRules.push({
          message: '开始节点只能连出一条分支',
          validate: (source, target) => {
            console.log('触发source', source, target);
            const arr = lf.getEdge({
              sourceNodeId: source.id,
            });
            if (arr.length === 0) {
              return true;
            } else {
              return false;
            }
          },
        });
      }
    }
    return {
      view: CircleNode,
      model: StartNodeModel,
    };
  });

bug复现操作
第一次连接处于选中状态的时候,可以对同一个节点连接多次,没有触发sourceRules里面的规则,后续取消选中状态后恢复正常

bug样式
image

@ouzhou ouzhou changed the title [Bug report] [Bug report] sourceRules规则不触发 Apr 21, 2021
@towersxu towersxu added this to Needs triage in Bug Apr 23, 2021
@towersxu
Copy link
Collaborator

towersxu commented Jul 3, 2021

问题已修复,请测试最新版本。

@towersxu towersxu closed this as completed Jul 3, 2021
Bug automation moved this from Needs triage to Closed Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Bug
Closed
Development

No branches or pull requests

2 participants