@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/index.js CHANGED
@@ -18758,6 +18758,10 @@ function verticalCornerDir(from, to) {
18758
18758
  function cornerRadiusFor(\u534A\u5F84, ...\u8D70\u308A) {
18759
18759
  return Math.min(\u534A\u5F84, ...\u8D70\u308A.map((v) => Math.abs(v)));
18760
18760
  }
18761
+ function runCrossesBox(\u8D70\u308A, \u7BB1) {
18762
+ if (\u8D70\u308A.y <= \u7BB1.cy - \u7BB1.h / 2 || \u8D70\u308A.y >= \u7BB1.cy + \u7BB1.h / 2) return false;
18763
+ 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);
18764
+ }
18761
18765
  var VERTICAL_DETOUR_EXIT = 45;
18762
18766
  function nearestBoxDistance(anchorX, dir, verticalTop, verticalBottom, boxes) {
18763
18767
  let nearest = Infinity;
@@ -19750,18 +19754,28 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
19750
19754
  const labelIntersect = oTop < labelBottom && oBottom > labelTop;
19751
19755
  return segIntersect || labelIntersect;
19752
19756
  };
19757
+ const \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B = (mx) => labelObstacles.some((o) => {
19758
+ if (o.id === from.id || o.id === to.id) return false;
19759
+ return runCrossesBox({ y: A.y, x1: A.x, x2: mx }, o) || runCrossesBox({ y: B.y, x1: mx, x2: B.x }, o);
19760
+ });
19753
19761
  let iter = 0;
19754
19762
  while (iter < 12) {
19755
19763
  const band = labelBand(midX2);
19756
- const hit = labelObstacles.find((o) => intersects(o, band));
19764
+ const hit = labelObstacles.find((o) => intersects(o, band)) ?? labelObstacles.find(
19765
+ (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))
19766
+ );
19757
19767
  if (!hit) break;
19758
19768
  const hitLeft = hit.cx - hit.w / 2;
19759
19769
  const hitRight = hit.cx + hit.w / 2;
19760
19770
  const retreatRight = hitRight + labelHalfW + CLEARANCE_NODE_LABEL + 4;
19761
19771
  const retreatLeft = hitLeft - labelHalfW - CLEARANCE_NODE_LABEL - 4;
19772
+ const \u53F3\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatRight);
19773
+ const \u5DE6\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatLeft);
19762
19774
  const dRight = Math.abs(retreatRight - midX2);
19763
19775
  const dLeft = Math.abs(retreatLeft - midX2);
19764
- midX2 = dRight <= dLeft ? retreatRight : retreatLeft;
19776
+ const \u6B21 = \u53F3\u304C\u585E\u304C\u308B === \u5DE6\u304C\u585E\u304C\u308B ? dRight <= dLeft ? retreatRight : retreatLeft : \u53F3\u304C\u585E\u304C\u308B ? retreatLeft : retreatRight;
19777
+ if (\u6B21 === midX2) break;
19778
+ midX2 = \u6B21;
19765
19779
  iter++;
19766
19780
  }
19767
19781
  }
@@ -27013,6 +27027,7 @@ function GanttNode({
27013
27027
  const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
27014
27028
  const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
27015
27029
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
27030
+ const \u884C\u306E\u4F38\u3073 = (row) => \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, row + 1, rowCount);
27016
27031
  const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
27017
27032
  const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
27018
27033
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
@@ -27087,12 +27102,13 @@ function GanttNode({
27087
27102
  const bx = \u5E2F\u306E\u5DE6(t.startIdx);
27088
27103
  const by = yAt(row);
27089
27104
  const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
27090
- return /* @__PURE__ */ jsxs(
27091
- "g",
27092
- {
27093
- ...drawing ? { transform: `translate(${bx} 0) scale(${\u4F38\u3073} 1) translate(${-bx} 0)` } : {},
27094
- children: [
27095
- /* @__PURE__ */ jsx(
27105
+ const \u3053\u306E\u884C = \u884C\u306E\u4F38\u3073(row);
27106
+ return /* @__PURE__ */ jsxs("g", { children: [
27107
+ /* @__PURE__ */ jsx(
27108
+ "g",
27109
+ {
27110
+ ...drawing ? { transform: `translate(${bx} 0) scale(${\u3053\u306E\u884C} 1) translate(${-bx} 0)` } : {},
27111
+ children: /* @__PURE__ */ jsx(
27096
27112
  "rect",
27097
27113
  {
27098
27114
  "data-cdl-role": "gantt-bar",
@@ -27106,22 +27122,23 @@ function GanttNode({
27106
27122
  fill: toneColor4(t.tone),
27107
27123
  fillOpacity: 0.9
27108
27124
  }
27109
- ),
27110
- t.owner && rowH >= 22 && /* @__PURE__ */ jsx(
27111
- "text",
27112
- {
27113
- x: bx + 8,
27114
- y: by + rowH / 2 + 4,
27115
- fontSize: 11,
27116
- fill: "var(--cdl-node-fill, #ffffff)",
27117
- fontWeight: 600,
27118
- children: t.owner
27119
- }
27120
27125
  )
27121
- ]
27122
- },
27123
- `bar-${t.id}`
27124
- );
27126
+ }
27127
+ ),
27128
+ t.owner && rowH >= 22 && \u3053\u306E\u884C >= 1 && /* @__PURE__ */ jsx(
27129
+ "text",
27130
+ {
27131
+ "data-cdl-role": "gantt-owner",
27132
+ x: bx + bw / 2,
27133
+ y: by + rowH / 2 + 4,
27134
+ fontSize: 11,
27135
+ textAnchor: "middle",
27136
+ fill: "var(--cdl-node-fill, #ffffff)",
27137
+ fontWeight: 600,
27138
+ children: t.owner
27139
+ }
27140
+ )
27141
+ ] }, `bar-${t.id}`);
27125
27142
  }),
27126
27143
  \u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
27127
27144
  const parent = taskById.get(t.dependsOn);
@@ -27141,33 +27158,30 @@ function GanttNode({
27141
27158
  const hasRoom = enterX - startX >= elbowGap;
27142
27159
  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}`;
27143
27160
  const arrowHeadPath = `M ${tipX + arrowHeadSize} ${tipY} L ${tipX} ${tipY - arrowHeadSize / 2} L ${tipX} ${tipY + arrowHeadSize / 2} Z`;
27144
- return (
27145
- // 矢印は両端の帯が出てから描く。 帯が無い場所へ矢印だけが伸びると、
27146
- // 指す先の無い線になる (cdl#521)
27147
- drawing && \u4F38\u3073 < 1 ? null : /* @__PURE__ */ jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
27148
- /* @__PURE__ */ jsx(
27149
- "path",
27150
- {
27151
- d: path,
27152
- fill: "none",
27153
- stroke: "var(--cdl-text-mute, #8a8678)",
27154
- strokeWidth: 1.75,
27155
- strokeLinejoin: "round",
27156
- strokeLinecap: "round"
27157
- }
27158
- ),
27159
- /* @__PURE__ */ jsx(
27160
- "path",
27161
- {
27162
- d: arrowHeadPath,
27163
- fill: "var(--cdl-text-mute, #8a8678)",
27164
- stroke: "var(--cdl-text-mute, #8a8678)",
27165
- strokeWidth: 0.5,
27166
- strokeLinejoin: "round"
27167
- }
27168
- )
27169
- ] }, `dep-${parent.id}-${t.id}`)
27170
- );
27161
+ const \u4E21\u7AEF\u304C\u51FA\u305F = \u884C\u306E\u4F38\u3073(parentRow) >= 1 && \u884C\u306E\u4F38\u3073(childRow) >= 1;
27162
+ return drawing && !\u4E21\u7AEF\u304C\u51FA\u305F ? null : /* @__PURE__ */ jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
27163
+ /* @__PURE__ */ jsx(
27164
+ "path",
27165
+ {
27166
+ d: path,
27167
+ fill: "none",
27168
+ stroke: "var(--cdl-text-mute, #8a8678)",
27169
+ strokeWidth: 1.75,
27170
+ strokeLinejoin: "round",
27171
+ strokeLinecap: "round"
27172
+ }
27173
+ ),
27174
+ /* @__PURE__ */ jsx(
27175
+ "path",
27176
+ {
27177
+ d: arrowHeadPath,
27178
+ fill: "var(--cdl-text-mute, #8a8678)",
27179
+ stroke: "var(--cdl-text-mute, #8a8678)",
27180
+ strokeWidth: 0.5,
27181
+ strokeLinejoin: "round"
27182
+ }
27183
+ )
27184
+ ] }, `dep-${parent.id}-${t.id}`);
27171
27185
  })
27172
27186
  ] });
27173
27187
  }