Гант: подсказка на стрелке зависимости (от -> к, названия шагов)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -284,7 +284,9 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
|
||||
const x1 = from.xe;
|
||||
const x2 = to.xs;
|
||||
const d = x2 >= x1 ? `M${x1} ${from.y} V${to.y} H${x2}` : `M${x1} ${from.y} H${x1 + 6} V${to.y} H${x2}`;
|
||||
arrows.push(`<path d="${d}" fill="none" stroke="#444" stroke-width="1.1" marker-end="url(#arr)"/>`);
|
||||
const depRow = model.rows.find((r) => r.id === dep);
|
||||
const label = `${dep} -> ${row.id} ${depRow?.actionName ?? ""} -> ${row.actionName ?? ""}`;
|
||||
arrows.push(`<g>${tooltip([label])}<path d="${d}" fill="none" stroke="#444" stroke-width="1.1" marker-end="url(#arr)"/><path d="${d}" fill="none" stroke="transparent" stroke-width="8" pointer-events="stroke"/></g>`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,6 +332,13 @@ describe("Гант: группы, вехи, свёртывание, масшта
|
||||
expect(arrows(renderGantt(ms, sch, {}))).toBeGreaterThan(arrows(shut));
|
||||
});
|
||||
|
||||
it("стрелка зависимости имеет подсказку «от -> к» с названиями шагов", () => {
|
||||
const rows = [row({ id: "A", stage: "S", action_name: "Первый", duration: "1d", date_constraint: "день 0 → день 1" }), row({ id: "B", stage: "S", action_name: "Второй", depends_on: "A", duration: "1d" })];
|
||||
const m: ProcessModel = { ...model, rows };
|
||||
const svg = renderGantt(m, computeSchedule(rows), {});
|
||||
expect(svg).toContain("<title>A -> B Первый -> Второй</title>");
|
||||
});
|
||||
|
||||
it("зависимость, следующая из цепочки других, не рисуется стрелкой (A→C при A→B→C)", () => {
|
||||
const rows = [row({ id: "A" }), row({ id: "B", depends_on: "A" }), row({ id: "C", depends_on: "B", depends_on2: "A" })];
|
||||
const redundant = redundantDependencies(rows);
|
||||
|
||||
Reference in New Issue
Block a user