@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/dist/react.cjs CHANGED
@@ -7380,6 +7380,10 @@ function verticalCornerDir(from, to) {
7380
7380
  function cornerRadiusFor(\u534A\u5F84, ...\u8D70\u308A) {
7381
7381
  return Math.min(\u534A\u5F84, ...\u8D70\u308A.map((v) => Math.abs(v)));
7382
7382
  }
7383
+ function runCrossesBox(\u8D70\u308A, \u7BB1) {
7384
+ if (\u8D70\u308A.y <= \u7BB1.cy - \u7BB1.h / 2 || \u8D70\u308A.y >= \u7BB1.cy + \u7BB1.h / 2) return false;
7385
+ 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);
7386
+ }
7383
7387
  var VERTICAL_DETOUR_EXIT = 45;
7384
7388
  function nearestBoxDistance(anchorX, dir, verticalTop, verticalBottom, boxes) {
7385
7389
  let nearest = Infinity;
@@ -8372,18 +8376,28 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
8372
8376
  const labelIntersect = oTop < labelBottom && oBottom > labelTop;
8373
8377
  return segIntersect || labelIntersect;
8374
8378
  };
8379
+ const \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B = (mx) => labelObstacles.some((o) => {
8380
+ if (o.id === from.id || o.id === to.id) return false;
8381
+ return runCrossesBox({ y: A.y, x1: A.x, x2: mx }, o) || runCrossesBox({ y: B.y, x1: mx, x2: B.x }, o);
8382
+ });
8375
8383
  let iter = 0;
8376
8384
  while (iter < 12) {
8377
8385
  const band = labelBand(midX2);
8378
- const hit = labelObstacles.find((o) => intersects(o, band));
8386
+ const hit = labelObstacles.find((o) => intersects(o, band)) ?? labelObstacles.find(
8387
+ (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))
8388
+ );
8379
8389
  if (!hit) break;
8380
8390
  const hitLeft = hit.cx - hit.w / 2;
8381
8391
  const hitRight = hit.cx + hit.w / 2;
8382
8392
  const retreatRight = hitRight + labelHalfW + CLEARANCE_NODE_LABEL + 4;
8383
8393
  const retreatLeft = hitLeft - labelHalfW - CLEARANCE_NODE_LABEL - 4;
8394
+ const \u53F3\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatRight);
8395
+ const \u5DE6\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatLeft);
8384
8396
  const dRight = Math.abs(retreatRight - midX2);
8385
8397
  const dLeft = Math.abs(retreatLeft - midX2);
8386
- midX2 = dRight <= dLeft ? retreatRight : retreatLeft;
8398
+ const \u6B21 = \u53F3\u304C\u585E\u304C\u308B === \u5DE6\u304C\u585E\u304C\u308B ? dRight <= dLeft ? retreatRight : retreatLeft : \u53F3\u304C\u585E\u304C\u308B ? retreatLeft : retreatRight;
8399
+ if (\u6B21 === midX2) break;
8400
+ midX2 = \u6B21;
8387
8401
  iter++;
8388
8402
  }
8389
8403
  }
@@ -14477,6 +14491,7 @@ function GanttNode({
14477
14491
  const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
14478
14492
  const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
14479
14493
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
14494
+ const \u884C\u306E\u4F38\u3073 = (row) => \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, row + 1, rowCount);
14480
14495
  const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
14481
14496
  const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
14482
14497
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
@@ -14551,12 +14566,13 @@ function GanttNode({
14551
14566
  const bx = \u5E2F\u306E\u5DE6(t.startIdx);
14552
14567
  const by = yAt(row);
14553
14568
  const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
14554
- return /* @__PURE__ */ jsxRuntime.jsxs(
14555
- "g",
14556
- {
14557
- ...drawing ? { transform: `translate(${bx} 0) scale(${\u4F38\u3073} 1) translate(${-bx} 0)` } : {},
14558
- children: [
14559
- /* @__PURE__ */ jsxRuntime.jsx(
14569
+ const \u3053\u306E\u884C = \u884C\u306E\u4F38\u3073(row);
14570
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
14571
+ /* @__PURE__ */ jsxRuntime.jsx(
14572
+ "g",
14573
+ {
14574
+ ...drawing ? { transform: `translate(${bx} 0) scale(${\u3053\u306E\u884C} 1) translate(${-bx} 0)` } : {},
14575
+ children: /* @__PURE__ */ jsxRuntime.jsx(
14560
14576
  "rect",
14561
14577
  {
14562
14578
  "data-cdl-role": "gantt-bar",
@@ -14570,22 +14586,23 @@ function GanttNode({
14570
14586
  fill: toneColor4(t.tone),
14571
14587
  fillOpacity: 0.9
14572
14588
  }
14573
- ),
14574
- t.owner && rowH >= 22 && /* @__PURE__ */ jsxRuntime.jsx(
14575
- "text",
14576
- {
14577
- x: bx + 8,
14578
- y: by + rowH / 2 + 4,
14579
- fontSize: 11,
14580
- fill: "var(--cdl-node-fill, #ffffff)",
14581
- fontWeight: 600,
14582
- children: t.owner
14583
- }
14584
14589
  )
14585
- ]
14586
- },
14587
- `bar-${t.id}`
14588
- );
14590
+ }
14591
+ ),
14592
+ t.owner && rowH >= 22 && \u3053\u306E\u884C >= 1 && /* @__PURE__ */ jsxRuntime.jsx(
14593
+ "text",
14594
+ {
14595
+ "data-cdl-role": "gantt-owner",
14596
+ x: bx + bw / 2,
14597
+ y: by + rowH / 2 + 4,
14598
+ fontSize: 11,
14599
+ textAnchor: "middle",
14600
+ fill: "var(--cdl-node-fill, #ffffff)",
14601
+ fontWeight: 600,
14602
+ children: t.owner
14603
+ }
14604
+ )
14605
+ ] }, `bar-${t.id}`);
14589
14606
  }),
14590
14607
  \u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
14591
14608
  const parent = taskById.get(t.dependsOn);
@@ -14605,33 +14622,30 @@ function GanttNode({
14605
14622
  const hasRoom = enterX - startX >= elbowGap;
14606
14623
  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}`;
14607
14624
  const arrowHeadPath = `M ${tipX + arrowHeadSize} ${tipY} L ${tipX} ${tipY - arrowHeadSize / 2} L ${tipX} ${tipY + arrowHeadSize / 2} Z`;
14608
- return (
14609
- // 矢印は両端の帯が出てから描く。 帯が無い場所へ矢印だけが伸びると、
14610
- // 指す先の無い線になる (cdl#521)
14611
- drawing && \u4F38\u3073 < 1 ? null : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
14612
- /* @__PURE__ */ jsxRuntime.jsx(
14613
- "path",
14614
- {
14615
- d: path,
14616
- fill: "none",
14617
- stroke: "var(--cdl-text-mute, #8a8678)",
14618
- strokeWidth: 1.75,
14619
- strokeLinejoin: "round",
14620
- strokeLinecap: "round"
14621
- }
14622
- ),
14623
- /* @__PURE__ */ jsxRuntime.jsx(
14624
- "path",
14625
- {
14626
- d: arrowHeadPath,
14627
- fill: "var(--cdl-text-mute, #8a8678)",
14628
- stroke: "var(--cdl-text-mute, #8a8678)",
14629
- strokeWidth: 0.5,
14630
- strokeLinejoin: "round"
14631
- }
14632
- )
14633
- ] }, `dep-${parent.id}-${t.id}`)
14634
- );
14625
+ const \u4E21\u7AEF\u304C\u51FA\u305F = \u884C\u306E\u4F38\u3073(parentRow) >= 1 && \u884C\u306E\u4F38\u3073(childRow) >= 1;
14626
+ return drawing && !\u4E21\u7AEF\u304C\u51FA\u305F ? null : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
14627
+ /* @__PURE__ */ jsxRuntime.jsx(
14628
+ "path",
14629
+ {
14630
+ d: path,
14631
+ fill: "none",
14632
+ stroke: "var(--cdl-text-mute, #8a8678)",
14633
+ strokeWidth: 1.75,
14634
+ strokeLinejoin: "round",
14635
+ strokeLinecap: "round"
14636
+ }
14637
+ ),
14638
+ /* @__PURE__ */ jsxRuntime.jsx(
14639
+ "path",
14640
+ {
14641
+ d: arrowHeadPath,
14642
+ fill: "var(--cdl-text-mute, #8a8678)",
14643
+ stroke: "var(--cdl-text-mute, #8a8678)",
14644
+ strokeWidth: 0.5,
14645
+ strokeLinejoin: "round"
14646
+ }
14647
+ )
14648
+ ] }, `dep-${parent.id}-${t.id}`);
14635
14649
  })
14636
14650
  ] });
14637
14651
  }