chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -76,7 +76,7 @@ export class CustomHoverService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据鼠标位置计算和线条的间距
|
||||
* Calculate and line spacing based on mouse position
|
||||
*/
|
||||
getCloseInLineFromMousePos(
|
||||
mousePos: IPoint,
|
||||
@@ -123,7 +123,7 @@ export class CustomHoverService {
|
||||
}
|
||||
}
|
||||
|
||||
// 折叠策略:访问所有连线的元素,同时访问其父元素,执行 collapse。
|
||||
// Collapse strategy: access all connected elements and access their parent elements simultaneously, performing collapse.
|
||||
hoverCollapse(from?: FlowNodeEntity) {
|
||||
this.onHoverCollapseEmitter.fire(from);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ export class CustomHoverService {
|
||||
const selectNodes = this.getRelatedNodes(node);
|
||||
this.renderStateEntity.setSelectNodes(selectNodes);
|
||||
this.renderStateEntity.setActivatedNode(node);
|
||||
// 高亮所有相关的线条
|
||||
// Highlight all relevant lines
|
||||
const activeLines: string[] = [];
|
||||
this.linesManager.lines.map(line => {
|
||||
const fromInclude = selectNodes.includes(line.from.id);
|
||||
@@ -164,9 +164,9 @@ export class CustomHoverService {
|
||||
}
|
||||
this.edges.forEach(edge => {
|
||||
if (edge.to === getTreeIdFromNodeId(node.id)) {
|
||||
// push 额外线条
|
||||
// Push extra lines
|
||||
ancArr.push(edge.from);
|
||||
// 遍历之前的节点信息
|
||||
// Traverse the previous node information
|
||||
const fromNode = this.document.getNode(getNodeIdFromTreeId(edge.from));
|
||||
if (fromNode) {
|
||||
const arr = this.traverseAncestors(fromNode);
|
||||
@@ -195,7 +195,7 @@ export class CustomHoverService {
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据当前树结构,遍历节点并且选中
|
||||
* According to the current tree structure, iterate through the nodes and select
|
||||
*/
|
||||
getRelatedNodes = (node: FlowNodeEntity) => {
|
||||
const parentRelated = this.traverseAncestors(node);
|
||||
|
||||
@@ -36,7 +36,7 @@ export class CustomLinesManager {
|
||||
|
||||
@inject(EntityManager) declare entityManager: EntityManager;
|
||||
|
||||
// 额外的连线
|
||||
// Additional connection
|
||||
@inject(TreeService) declare treeService: TreeService;
|
||||
|
||||
get edges(): EdgeItem[] {
|
||||
@@ -58,7 +58,7 @@ export class CustomLinesManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤其他的非渲染节点
|
||||
* Filter other non-rendering nodes
|
||||
*/
|
||||
filterTreeNode(nodes: FlowNodeEntity[]) {
|
||||
return nodes.filter(
|
||||
@@ -94,7 +94,7 @@ export class CustomLinesManager {
|
||||
if (node.flowNodeType === 'root') {
|
||||
queue.push(node.children[0]);
|
||||
} else if (node.flowNodeType === 'split') {
|
||||
// 分支逻辑特殊处理
|
||||
// Branch logic special handling
|
||||
const inlineBlocksChildren = node.children[1]?.children || [];
|
||||
const branchChildren =
|
||||
inlineBlocksChildren
|
||||
@@ -138,7 +138,7 @@ export class CustomLinesManager {
|
||||
}
|
||||
|
||||
renderLines() {
|
||||
// 下一帧渲染,保证线条数据最新
|
||||
// The next frame is rendered to ensure the latest line data
|
||||
requestAnimationFrame(() => {
|
||||
const lines = this.bfsAddLine(this.document.originTree.root);
|
||||
const extraLines: CustomLine[] = (this.edges || [])
|
||||
|
||||
@@ -53,9 +53,9 @@ export class TreeService {
|
||||
edges: EdgeItem[] = [];
|
||||
|
||||
treeHistory: {
|
||||
// 唯一标识符
|
||||
// unique device identifier
|
||||
id: string;
|
||||
// 判断是否已经存在的两个条件
|
||||
// To determine whether two conditions already exist
|
||||
resourceId: string;
|
||||
version?: string;
|
||||
depth: number;
|
||||
@@ -73,7 +73,7 @@ export class TreeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于检查是否有重复项
|
||||
* Used to check for duplicates
|
||||
*/
|
||||
getNodeDuplicateFromTree = (id: string, version?: string) => {
|
||||
let duplicate = false;
|
||||
@@ -122,7 +122,7 @@ export class TreeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 knowledge、plugin、table 的逻辑
|
||||
* Handling knowledge, plugins, table logic
|
||||
*/
|
||||
transformDuplicateInfo = (
|
||||
id: string,
|
||||
@@ -144,13 +144,13 @@ export class TreeService {
|
||||
} else {
|
||||
newSchema = transformTable(depth + 1, info);
|
||||
}
|
||||
// 如果重复,判断添加线还是节点
|
||||
// If repeated, determine whether to add a line or a node
|
||||
if (duplicate) {
|
||||
for (const [i, d] of dupDepth.entries()) {
|
||||
// 只要有一个匹配,就加线。
|
||||
// 兜底走加节点的逻辑
|
||||
// As long as there is a match, add the line.
|
||||
// The logic of adding nodes at the bottom
|
||||
if (depth + 1 === d) {
|
||||
// 存到线条中
|
||||
// Save in line
|
||||
this.edges.push({
|
||||
from: fromId,
|
||||
to: dupId[i],
|
||||
@@ -160,7 +160,7 @@ export class TreeService {
|
||||
}
|
||||
return newSchema;
|
||||
}
|
||||
// 否则,正常往 blocks 里添加数据
|
||||
// Otherwise, add data to blocks normally
|
||||
return newSchema;
|
||||
};
|
||||
|
||||
@@ -202,7 +202,7 @@ export class TreeService {
|
||||
}
|
||||
}
|
||||
const loop = node.id && isLoop(node.id, this.globalJson);
|
||||
// 重复节点,停止继续往下
|
||||
// Repeat node, stop, continue down
|
||||
const endData = {
|
||||
id: nodeId,
|
||||
type: 'custom',
|
||||
@@ -315,7 +315,7 @@ export class TreeService {
|
||||
undefined,
|
||||
nodeId,
|
||||
);
|
||||
// 检测 workflow 的重复
|
||||
// Detect duplication of workflow
|
||||
if (subWorkflowSchema) {
|
||||
this.treeHistory.push({
|
||||
id: subWorkflowSchema.id,
|
||||
@@ -353,7 +353,7 @@ export class TreeService {
|
||||
};
|
||||
};
|
||||
|
||||
// 展开所有的子元素
|
||||
// Expand all child elements
|
||||
dfsCloneCollapsedOpen(node: TreeNode): TreeNode {
|
||||
const children = node.children?.map(c => this.dfsCloneCollapsedOpen(c));
|
||||
return {
|
||||
@@ -366,14 +366,14 @@ export class TreeService {
|
||||
};
|
||||
}
|
||||
|
||||
// 根据 edges,移动节点到另一个 TreeNode 的 children 下。
|
||||
// 需要将内部的 collapsed 全部变成 open
|
||||
// According to edges, move the node to the children of another TreeNode.
|
||||
// It needs to be collapsed and opened
|
||||
cloneNode(node: TreeNode) {
|
||||
return this.dfsCloneCollapsedOpen(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定父元素 parent
|
||||
* Bind parent element parent
|
||||
*/
|
||||
bindTreeParent(node: TreeNode, parent?: TreeNode) {
|
||||
if (parent) {
|
||||
@@ -393,7 +393,7 @@ export class TreeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化数据,将数据从后端数据 json 变成 tree 结构
|
||||
* Initialize the data and turn the data from the back-end data json into a tree structure
|
||||
*/
|
||||
transformSchema(json: DependencyTree) {
|
||||
this.globalJson = json;
|
||||
@@ -465,7 +465,7 @@ export class TreeService {
|
||||
this.addNode(block, addItem);
|
||||
});
|
||||
}
|
||||
// 可能因此原本设置为结束的节点现在有 child 了
|
||||
// Perhaps because of this, the node that was originally set to end now has children
|
||||
if (json.blocks?.length) {
|
||||
if (json.type === 'custom') {
|
||||
json.type = 'split';
|
||||
|
||||
Reference in New Issue
Block a user