作用域链

默认作用域链逻辑

详见:画布中的作用域

editor-props 中定制

作用域的定制逻辑,通常在 editor-props 中,通过 variableEngine.chainConfig 定制。

use-editor-props.tsx
// ...
{
  // ...
  variableEngine: {
    enable: true,
    chainConfig: {
      // 作用域链逻辑定制
    }
  }
  // ...
}
// ...

子节点能否被后续节点依赖

默认情况下,子节点是不可以被父节点的后续节点依赖的

如果需要定制这个逻辑,需要在 variableEngine.chainConfig.isNodeChildrenPrivate 中配置。

use-editor-props.tsx
{
  variableEngine: {
    enable: true,
    chainConfig: {
      /**
       * 定制:子节点是否可以被父节点的后续节点依赖
       */
      isNodeChildrenPrivate(node) {
        // 当命中用户某类自定义节点时,允许其子节点被后续节点依赖
        if (node.flowNodeType === 'Your_Custom_Type') {
          return false;
        }
        // 否则:默认不允许子节点被后续节点依赖
        return true;
      },
    }
  }
}