删掉节点的「说明」字段 —— 它填得进、存得下,却从来画不出来

`sub` 声称是「画布上的第二行小字」,但画笔里那支只在 `variant !== 'business'`
(步骤图)才走,而全仓的调用点一律是 business:这个字段写了、存了、
一次也没显示过。属性面上那句提示是句假话。

整条清:属性面的一行 · `ProcessNode.sub`(契约) · `FlowNode.sub` ·
图↔包两处映射 · 画笔里那支画不出来的分支(连同它带来的「两种画法」分叉,
现在节点框里就一行活动名) · 节点宽度算法里 `node.sub || node.ghost` 的宽框判据
(sub 没了,只剩 ghost 决定宽窄)。

存量数据不受影响:库里没有一条带 sub 的定义(查过),schema 非严格,
真有旧值也只是解析时被剥掉。

五闸绿;契约快照随本提交入库(去一个可选字段,加法的反面,无下游)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
2026-07-29 17:48:12 +08:00
co-authored by Claude Opus 5
parent 28623cd1cb
commit 6cff6ab34c
8 changed files with 14 additions and 80 deletions
+1 -2
View File
@@ -29,7 +29,6 @@ export interface FlowNode {
/** Case 节点引用的库案例 id(cases[].id):L2 只是引用,下钻编辑共享库案例。 */
caseRef?: string;
label: string;
sub?: string | undefined;
code?: string;
ghost?: boolean;
note?: string;
@@ -265,7 +264,7 @@ function nodeWidth(node: FlowNode, m: Metrics, shrink: number): number {
case "callout":
return m.calloutW;
case "activity":
return Math.max(80, (node.sub || node.ghost ? m.actWide : m.actW) - shrink);
return Math.max(80, (node.ghost ? m.actWide : m.actW) - shrink);
}
}
@@ -126,32 +126,14 @@ export function paintNode(group: SVGElement, node: FlowNode, w: number, h: numbe
const titleSize = variant === "business" ? 12 : 11.5;
const inkColor = ghost ? "#6A7686" : skin.ink;
const title = fitLine(node.label, w - 12, titleSize, 10);
// L2 主图只留 标号/活动名/责任角标(2026-07 精简)——sub 小字仅步骤图(steps)渲染。
if (node.sub && variant !== "business") {
const sub = fitLine(node.sub, w - 12, 8.6, 8);
group.append(
svgEl(
"text",
{ x: w / 2, y: 18, "text-anchor": "middle", "font-family": FLOW_SANS, "font-size": title.size, "font-weight": 600, fill: inkColor },
title.text,
),
);
group.append(
svgEl(
"text",
{ x: w / 2, y: 32, "text-anchor": "middle", "font-family": FLOW_SANS, "font-size": sub.size, fill: ghost ? "#9AA6B4" : "#6A7686" },
sub.text,
),
);
} else {
group.append(
svgEl(
"text",
{ x: w / 2, y: h / 2 + 4, "text-anchor": "middle", "font-family": FLOW_SANS, "font-size": title.size, "font-weight": 600, fill: inkColor },
title.text,
),
);
}
// 节点框里只写活动名(标号走左上角标)—— sub 第二行小字已退役,没有第二种画法了。
group.append(
svgEl(
"text",
{ x: w / 2, y: h / 2 + 4, "text-anchor": "middle", "font-family": FLOW_SANS, "font-size": title.size, "font-weight": 600, fill: inkColor },
title.text,
),
);
// 标号角标:business 一贯有;步骤图(steps)的真实节点也要 S#/B# 编号与指导书条目对齐
// (2026-07 用户纠正)——ghost 骨架节点不标。
if (variant === "business" || !ghost) {
@@ -47,7 +47,6 @@ export function mergeGraphIntoPackage(
const base = {
id,
label: n.label,
...(n.sub === undefined ? {} : { sub: n.sub }),
layout,
};
@@ -87,7 +87,6 @@ export function packageToGraph(pkg: ProcessPackage, marks: readonly InstanceMark
kind: 'activity',
label: n.label,
code: n.id,
...(n.sub === undefined ? {} : { sub: n.sub }),
...(state === undefined ? {} : { note: state }),
};
if (n.kind === 'approval') {