@cardenelabs/cdl 0.65.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -1
- package/dist/index.cjs +64 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +64 -50
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +64 -50
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +64 -50
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/kinds/gantt.tsx +57 -24
- package/src/layout/edges.ts +60 -3
package/dist/react.js
CHANGED
|
@@ -7378,6 +7378,10 @@ function verticalCornerDir(from, to) {
|
|
|
7378
7378
|
function cornerRadiusFor(\u534A\u5F84, ...\u8D70\u308A) {
|
|
7379
7379
|
return Math.min(\u534A\u5F84, ...\u8D70\u308A.map((v) => Math.abs(v)));
|
|
7380
7380
|
}
|
|
7381
|
+
function runCrossesBox(\u8D70\u308A, \u7BB1) {
|
|
7382
|
+
if (\u8D70\u308A.y <= \u7BB1.cy - \u7BB1.h / 2 || \u8D70\u308A.y >= \u7BB1.cy + \u7BB1.h / 2) return false;
|
|
7383
|
+
return \u7BB1.cx + \u7BB1.w / 2 > Math.min(\u8D70\u308A.x1, \u8D70\u308A.x2) && \u7BB1.cx - \u7BB1.w / 2 < Math.max(\u8D70\u308A.x1, \u8D70\u308A.x2);
|
|
7384
|
+
}
|
|
7381
7385
|
var VERTICAL_DETOUR_EXIT = 45;
|
|
7382
7386
|
function nearestBoxDistance(anchorX, dir, verticalTop, verticalBottom, boxes) {
|
|
7383
7387
|
let nearest = Infinity;
|
|
@@ -8370,18 +8374,28 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
|
|
|
8370
8374
|
const labelIntersect = oTop < labelBottom && oBottom > labelTop;
|
|
8371
8375
|
return segIntersect || labelIntersect;
|
|
8372
8376
|
};
|
|
8377
|
+
const \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B = (mx) => labelObstacles.some((o) => {
|
|
8378
|
+
if (o.id === from.id || o.id === to.id) return false;
|
|
8379
|
+
return runCrossesBox({ y: A.y, x1: A.x, x2: mx }, o) || runCrossesBox({ y: B.y, x1: mx, x2: B.x }, o);
|
|
8380
|
+
});
|
|
8373
8381
|
let iter = 0;
|
|
8374
8382
|
while (iter < 12) {
|
|
8375
8383
|
const band = labelBand(midX2);
|
|
8376
|
-
const hit = labelObstacles.find((o) => intersects(o, band))
|
|
8384
|
+
const hit = labelObstacles.find((o) => intersects(o, band)) ?? labelObstacles.find(
|
|
8385
|
+
(o) => o.id !== from.id && o.id !== to.id && (runCrossesBox({ y: A.y, x1: A.x, x2: midX2 }, o) || runCrossesBox({ y: B.y, x1: midX2, x2: B.x }, o))
|
|
8386
|
+
);
|
|
8377
8387
|
if (!hit) break;
|
|
8378
8388
|
const hitLeft = hit.cx - hit.w / 2;
|
|
8379
8389
|
const hitRight = hit.cx + hit.w / 2;
|
|
8380
8390
|
const retreatRight = hitRight + labelHalfW + CLEARANCE_NODE_LABEL + 4;
|
|
8381
8391
|
const retreatLeft = hitLeft - labelHalfW - CLEARANCE_NODE_LABEL - 4;
|
|
8392
|
+
const \u53F3\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatRight);
|
|
8393
|
+
const \u5DE6\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatLeft);
|
|
8382
8394
|
const dRight = Math.abs(retreatRight - midX2);
|
|
8383
8395
|
const dLeft = Math.abs(retreatLeft - midX2);
|
|
8384
|
-
|
|
8396
|
+
const \u6B21 = \u53F3\u304C\u585E\u304C\u308B === \u5DE6\u304C\u585E\u304C\u308B ? dRight <= dLeft ? retreatRight : retreatLeft : \u53F3\u304C\u585E\u304C\u308B ? retreatLeft : retreatRight;
|
|
8397
|
+
if (\u6B21 === midX2) break;
|
|
8398
|
+
midX2 = \u6B21;
|
|
8385
8399
|
iter++;
|
|
8386
8400
|
}
|
|
8387
8401
|
}
|
|
@@ -14475,6 +14489,7 @@ function GanttNode({
|
|
|
14475
14489
|
const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
|
|
14476
14490
|
const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
|
|
14477
14491
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
14492
|
+
const \u884C\u306E\u4F38\u3073 = (row) => \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, row + 1, rowCount);
|
|
14478
14493
|
const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
|
|
14479
14494
|
const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
|
|
14480
14495
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
@@ -14549,12 +14564,13 @@ function GanttNode({
|
|
|
14549
14564
|
const bx = \u5E2F\u306E\u5DE6(t.startIdx);
|
|
14550
14565
|
const by = yAt(row);
|
|
14551
14566
|
const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14567
|
+
const \u3053\u306E\u884C = \u884C\u306E\u4F38\u3073(row);
|
|
14568
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
14569
|
+
/* @__PURE__ */ jsx(
|
|
14570
|
+
"g",
|
|
14571
|
+
{
|
|
14572
|
+
...drawing ? { transform: `translate(${bx} 0) scale(${\u3053\u306E\u884C} 1) translate(${-bx} 0)` } : {},
|
|
14573
|
+
children: /* @__PURE__ */ jsx(
|
|
14558
14574
|
"rect",
|
|
14559
14575
|
{
|
|
14560
14576
|
"data-cdl-role": "gantt-bar",
|
|
@@ -14568,22 +14584,23 @@ function GanttNode({
|
|
|
14568
14584
|
fill: toneColor4(t.tone),
|
|
14569
14585
|
fillOpacity: 0.9
|
|
14570
14586
|
}
|
|
14571
|
-
),
|
|
14572
|
-
t.owner && rowH >= 22 && /* @__PURE__ */ jsx(
|
|
14573
|
-
"text",
|
|
14574
|
-
{
|
|
14575
|
-
x: bx + 8,
|
|
14576
|
-
y: by + rowH / 2 + 4,
|
|
14577
|
-
fontSize: 11,
|
|
14578
|
-
fill: "var(--cdl-node-fill, #ffffff)",
|
|
14579
|
-
fontWeight: 600,
|
|
14580
|
-
children: t.owner
|
|
14581
|
-
}
|
|
14582
14587
|
)
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14588
|
+
}
|
|
14589
|
+
),
|
|
14590
|
+
t.owner && rowH >= 22 && \u3053\u306E\u884C >= 1 && /* @__PURE__ */ jsx(
|
|
14591
|
+
"text",
|
|
14592
|
+
{
|
|
14593
|
+
"data-cdl-role": "gantt-owner",
|
|
14594
|
+
x: bx + bw / 2,
|
|
14595
|
+
y: by + rowH / 2 + 4,
|
|
14596
|
+
fontSize: 11,
|
|
14597
|
+
textAnchor: "middle",
|
|
14598
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
14599
|
+
fontWeight: 600,
|
|
14600
|
+
children: t.owner
|
|
14601
|
+
}
|
|
14602
|
+
)
|
|
14603
|
+
] }, `bar-${t.id}`);
|
|
14587
14604
|
}),
|
|
14588
14605
|
\u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
|
|
14589
14606
|
const parent = taskById.get(t.dependsOn);
|
|
@@ -14603,33 +14620,30 @@ function GanttNode({
|
|
|
14603
14620
|
const hasRoom = enterX - startX >= elbowGap;
|
|
14604
14621
|
const path = hasRoom ? `M ${startX} ${parentMidY} L ${enterX} ${parentMidY} L ${enterX} ${tipY} L ${tipX} ${tipY}` : `M ${startX} ${parentMidY} L ${startX + elbowGap} ${parentMidY} L ${startX + elbowGap} ${(parentMidY + tipY) / 2} L ${enterX} ${(parentMidY + tipY) / 2} L ${enterX} ${tipY} L ${tipX} ${tipY}`;
|
|
14605
14622
|
const arrowHeadPath = `M ${tipX + arrowHeadSize} ${tipY} L ${tipX} ${tipY - arrowHeadSize / 2} L ${tipX} ${tipY + arrowHeadSize / 2} Z`;
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
)
|
|
14631
|
-
] }, `dep-${parent.id}-${t.id}`)
|
|
14632
|
-
);
|
|
14623
|
+
const \u4E21\u7AEF\u304C\u51FA\u305F = \u884C\u306E\u4F38\u3073(parentRow) >= 1 && \u884C\u306E\u4F38\u3073(childRow) >= 1;
|
|
14624
|
+
return drawing && !\u4E21\u7AEF\u304C\u51FA\u305F ? null : /* @__PURE__ */ jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
|
|
14625
|
+
/* @__PURE__ */ jsx(
|
|
14626
|
+
"path",
|
|
14627
|
+
{
|
|
14628
|
+
d: path,
|
|
14629
|
+
fill: "none",
|
|
14630
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
14631
|
+
strokeWidth: 1.75,
|
|
14632
|
+
strokeLinejoin: "round",
|
|
14633
|
+
strokeLinecap: "round"
|
|
14634
|
+
}
|
|
14635
|
+
),
|
|
14636
|
+
/* @__PURE__ */ jsx(
|
|
14637
|
+
"path",
|
|
14638
|
+
{
|
|
14639
|
+
d: arrowHeadPath,
|
|
14640
|
+
fill: "var(--cdl-text-mute, #8a8678)",
|
|
14641
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
14642
|
+
strokeWidth: 0.5,
|
|
14643
|
+
strokeLinejoin: "round"
|
|
14644
|
+
}
|
|
14645
|
+
)
|
|
14646
|
+
] }, `dep-${parent.id}-${t.id}`);
|
|
14633
14647
|
})
|
|
14634
14648
|
] });
|
|
14635
14649
|
}
|