@cardenelabs/cdl 0.66.0 → 0.68.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 +90 -1
- package/dist/index.cjs +119 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +119 -84
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +119 -84
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +119 -84
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/kinds/gantt.tsx +136 -51
package/dist/react.cjs
CHANGED
|
@@ -14436,15 +14436,16 @@ function GanttNode({
|
|
|
14436
14436
|
const x0 = node.cx - node.w / 2;
|
|
14437
14437
|
const y0 = node.cy - node.h / 2;
|
|
14438
14438
|
const tasks = resolveGanttData(node.ganttData ?? [], stateValues);
|
|
14439
|
-
const PAD_TOP2 =
|
|
14439
|
+
const PAD_TOP2 = 46;
|
|
14440
14440
|
const PAD_RIGHT2 = 48;
|
|
14441
|
-
const PAD_BOTTOM2 =
|
|
14441
|
+
const PAD_BOTTOM2 = 26;
|
|
14442
14442
|
const PAD_LEFT2 = 156;
|
|
14443
14443
|
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
14444
14444
|
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
14445
14445
|
const rowGap = 20;
|
|
14446
14446
|
const rowCount = tasks.length || 1;
|
|
14447
14447
|
const rowH = Math.max(28, (canvasH - rowGap * (rowCount + 1)) / rowCount);
|
|
14448
|
+
const \u5E2F\u306E\u9AD8\u3055 = Math.min(rowH, 30);
|
|
14448
14449
|
const \u4F4D\u7F6E\u306E\u4E0A\u9650 = 1e6;
|
|
14449
14450
|
const \u53CE\u3081\u305F = tasks.map((t) => {
|
|
14450
14451
|
const \u59CB = Math.min(\u4F4D\u7F6E\u306E\u4E0A\u9650, Math.max(0, Number.isFinite(t.startIdx) ? t.startIdx : 0));
|
|
@@ -14470,6 +14471,7 @@ function GanttNode({
|
|
|
14470
14471
|
const \u76EE\u76DB\u308A\u306E\u672C\u6570 = Math.ceil(maxIdx / \u76EE\u76DB\u308A\u306E\u9593\u9694);
|
|
14471
14472
|
const xAt = (idx) => PAD_LEFT2 + idx * cellW;
|
|
14472
14473
|
const yAt = (row) => PAD_TOP2 + rowGap + row * (rowH + rowGap);
|
|
14474
|
+
const \u5E2F\u306E\u4E0A = (row) => yAt(row) + (rowH - \u5E2F\u306E\u9AD8\u3055) / 2;
|
|
14473
14475
|
const \u540D\u524D = { \u6574\u6570\u306E\u958B\u59CB: /* @__PURE__ */ new Map(), \u6574\u6570\u306E\u7D42\u4E86: /* @__PURE__ */ new Map(), \u7AEF\u6570\u306E\u958B\u59CB: /* @__PURE__ */ new Map(), \u7AEF\u6570\u306E\u7D42\u4E86: /* @__PURE__ */ new Map() };
|
|
14474
14476
|
const \u7F6E\u304F = (\u8868, \u4F4D\u7F6E, label) => {
|
|
14475
14477
|
if (label !== "" && Number.isFinite(\u4F4D\u7F6E) && !\u8868.has(\u4F4D\u7F6E)) \u8868.set(\u4F4D\u7F6E, label);
|
|
@@ -14491,6 +14493,7 @@ function GanttNode({
|
|
|
14491
14493
|
const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
|
|
14492
14494
|
const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
|
|
14493
14495
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
14496
|
+
const \u884C\u306E\u4F38\u3073 = (row) => \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, row + 1, rowCount);
|
|
14494
14497
|
const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
|
|
14495
14498
|
const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
|
|
14496
14499
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
@@ -14508,6 +14511,43 @@ function GanttNode({
|
|
|
14508
14511
|
strokeWidth: active ? 3 : 1.25
|
|
14509
14512
|
}
|
|
14510
14513
|
),
|
|
14514
|
+
\u6574\u3048\u305F.map(
|
|
14515
|
+
(t, row) => row % 2 === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
14516
|
+
"rect",
|
|
14517
|
+
{
|
|
14518
|
+
"data-cdl-role": "gantt-row",
|
|
14519
|
+
x: PAD_LEFT2,
|
|
14520
|
+
y: yAt(row) - rowGap / 2,
|
|
14521
|
+
width: canvasW,
|
|
14522
|
+
height: rowH + rowGap,
|
|
14523
|
+
fill: "var(--cdl-surface-sunken, #f4f2ed)",
|
|
14524
|
+
opacity: 0.55
|
|
14525
|
+
},
|
|
14526
|
+
`band-${t.id}`
|
|
14527
|
+
)
|
|
14528
|
+
),
|
|
14529
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14530
|
+
"line",
|
|
14531
|
+
{
|
|
14532
|
+
x1: PAD_LEFT2,
|
|
14533
|
+
y1: PAD_TOP2,
|
|
14534
|
+
x2: PAD_LEFT2 + canvasW,
|
|
14535
|
+
y2: PAD_TOP2,
|
|
14536
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
14537
|
+
strokeWidth: 1
|
|
14538
|
+
}
|
|
14539
|
+
),
|
|
14540
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14541
|
+
"line",
|
|
14542
|
+
{
|
|
14543
|
+
x1: PAD_LEFT2,
|
|
14544
|
+
y1: PAD_TOP2,
|
|
14545
|
+
x2: PAD_LEFT2,
|
|
14546
|
+
y2: PAD_TOP2 + canvasH,
|
|
14547
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
14548
|
+
strokeWidth: 1
|
|
14549
|
+
}
|
|
14550
|
+
),
|
|
14511
14551
|
gridLabels.map(({ \u4F4D\u7F6E: i, label }) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
14512
14552
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14513
14553
|
"line",
|
|
@@ -14518,9 +14558,8 @@ function GanttNode({
|
|
|
14518
14558
|
x2: xAt(i),
|
|
14519
14559
|
y2: PAD_TOP2 + canvasH,
|
|
14520
14560
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
14521
|
-
strokeWidth:
|
|
14522
|
-
|
|
14523
|
-
opacity: 0.5
|
|
14561
|
+
strokeWidth: 1,
|
|
14562
|
+
opacity: 0.45
|
|
14524
14563
|
}
|
|
14525
14564
|
),
|
|
14526
14565
|
label === "" ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14528,7 +14567,7 @@ function GanttNode({
|
|
|
14528
14567
|
{
|
|
14529
14568
|
"data-cdl-role": "gantt-tick",
|
|
14530
14569
|
x: xAt(i) + cellW / 2,
|
|
14531
|
-
y: PAD_TOP2
|
|
14570
|
+
y: PAD_TOP2 - 16,
|
|
14532
14571
|
fontSize: 11,
|
|
14533
14572
|
textAnchor: "middle",
|
|
14534
14573
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
@@ -14544,14 +14583,14 @@ function GanttNode({
|
|
|
14544
14583
|
x2: xAt(maxIdx),
|
|
14545
14584
|
y2: PAD_TOP2 + canvasH,
|
|
14546
14585
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
14547
|
-
strokeWidth:
|
|
14548
|
-
opacity: 0.
|
|
14586
|
+
strokeWidth: 1,
|
|
14587
|
+
opacity: 0.45
|
|
14549
14588
|
}
|
|
14550
14589
|
),
|
|
14551
14590
|
\u6574\u3048\u305F.map((t, row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14552
14591
|
"text",
|
|
14553
14592
|
{
|
|
14554
|
-
x: PAD_LEFT2 -
|
|
14593
|
+
x: PAD_LEFT2 - 16,
|
|
14555
14594
|
y: yAt(row) + rowH / 2 + 4,
|
|
14556
14595
|
fontSize: 12,
|
|
14557
14596
|
textAnchor: "end",
|
|
@@ -14563,89 +14602,85 @@ function GanttNode({
|
|
|
14563
14602
|
)),
|
|
14564
14603
|
\u6574\u3048\u305F.map((t, row) => {
|
|
14565
14604
|
const bx = \u5E2F\u306E\u5DE6(t.startIdx);
|
|
14566
|
-
const by =
|
|
14605
|
+
const by = \u5E2F\u306E\u4E0A(row);
|
|
14567
14606
|
const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
`bar-${t.id}`
|
|
14602
|
-
);
|
|
14607
|
+
const \u3053\u306E\u884C = \u884C\u306E\u4F38\u3073(row);
|
|
14608
|
+
const \u4ECA\u306E\u5E45 = drawing ? bw * \u3053\u306E\u884C : bw;
|
|
14609
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
14610
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14611
|
+
"rect",
|
|
14612
|
+
{
|
|
14613
|
+
"data-cdl-role": "gantt-bar",
|
|
14614
|
+
"data-cdl-unresolved": t.unresolved ? "true" : void 0,
|
|
14615
|
+
"data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
|
|
14616
|
+
x: bx,
|
|
14617
|
+
y: by,
|
|
14618
|
+
width: \u4ECA\u306E\u5E45,
|
|
14619
|
+
height: \u5E2F\u306E\u9AD8\u3055,
|
|
14620
|
+
rx: \u5E2F\u306E\u9AD8\u3055 / 2,
|
|
14621
|
+
ry: \u5E2F\u306E\u9AD8\u3055 / 2,
|
|
14622
|
+
fill: toneColor4(t.tone),
|
|
14623
|
+
fillOpacity: 0.9
|
|
14624
|
+
}
|
|
14625
|
+
),
|
|
14626
|
+
t.owner && \u5E2F\u306E\u9AD8\u3055 >= 22 && \u3053\u306E\u884C >= 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
14627
|
+
"text",
|
|
14628
|
+
{
|
|
14629
|
+
"data-cdl-role": "gantt-owner",
|
|
14630
|
+
x: bx + bw / 2,
|
|
14631
|
+
y: by + \u5E2F\u306E\u9AD8\u3055 / 2 + 4,
|
|
14632
|
+
fontSize: 11,
|
|
14633
|
+
textAnchor: "middle",
|
|
14634
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
14635
|
+
fontWeight: 600,
|
|
14636
|
+
children: t.owner
|
|
14637
|
+
}
|
|
14638
|
+
)
|
|
14639
|
+
] }, `bar-${t.id}`);
|
|
14603
14640
|
}),
|
|
14604
14641
|
\u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
|
|
14605
14642
|
const parent = taskById.get(t.dependsOn);
|
|
14606
14643
|
const parentRow = rowOf.get(parent.id);
|
|
14607
14644
|
const childRow = rowOf.get(t.id);
|
|
14608
14645
|
const parentBarRight = \u5E2F\u306E\u53F3(parent.endIdx);
|
|
14609
|
-
const parentMidY = yAt(parentRow) + rowH / 2;
|
|
14610
14646
|
const childBarLeft = \u5E2F\u306E\u5DE6(t.startIdx);
|
|
14611
|
-
const
|
|
14612
|
-
const
|
|
14613
|
-
const
|
|
14614
|
-
const
|
|
14615
|
-
const
|
|
14616
|
-
const
|
|
14617
|
-
const
|
|
14618
|
-
const
|
|
14619
|
-
const
|
|
14620
|
-
const
|
|
14621
|
-
const
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
);
|
|
14647
|
+
const \u77E2\u3058\u308A\u306E\u5E45 = 11;
|
|
14648
|
+
const \u77E2\u3058\u308A\u306E\u9AD8\u3055 = 7;
|
|
14649
|
+
const \u4E38\u307F = \u5E2F\u306E\u9AD8\u3055 / 2;
|
|
14650
|
+
const \u89AA\u306E\u5DE6 = \u5E2F\u306E\u5DE6(parent.startIdx);
|
|
14651
|
+
const \u5B50\u306E\u53F3 = \u5E2F\u306E\u53F3(t.endIdx);
|
|
14652
|
+
const \u5BC4\u305B = (\u5DE6, \u53F3) => Math.min(\u4E38\u307F, (\u53F3 - \u5DE6) / 2);
|
|
14653
|
+
const \u51FA\u767AX = parentBarRight - \u5BC4\u305B(\u89AA\u306E\u5DE6, parentBarRight);
|
|
14654
|
+
const \u51FA\u767AY = \u5E2F\u306E\u4E0A(parentRow) + \u5E2F\u306E\u9AD8\u3055;
|
|
14655
|
+
const \u7740\u5730X = childBarLeft + \u5BC4\u305B(childBarLeft, \u5B50\u306E\u53F3);
|
|
14656
|
+
const \u7740\u5730Y = \u5E2F\u306E\u4E0A(childRow);
|
|
14657
|
+
const \u7E26\u306E\u7D42\u308F\u308AY = \u7740\u5730Y - \u77E2\u3058\u308A\u306E\u9AD8\u3055;
|
|
14658
|
+
const \u624B = Math.max(6, (\u7E26\u306E\u7D42\u308F\u308AY - \u51FA\u767AY) * 0.55);
|
|
14659
|
+
const path = `M ${\u51FA\u767AX} ${\u51FA\u767AY} C ${\u51FA\u767AX} ${\u51FA\u767AY + \u624B}, ${\u7740\u5730X} ${\u7E26\u306E\u7D42\u308F\u308AY - \u624B}, ${\u7740\u5730X} ${\u7E26\u306E\u7D42\u308F\u308AY}`;
|
|
14660
|
+
const arrowHeadPath = `M ${\u7740\u5730X} ${\u7740\u5730Y} L ${\u7740\u5730X - \u77E2\u3058\u308A\u306E\u5E45 / 2} ${\u7E26\u306E\u7D42\u308F\u308AY} L ${\u7740\u5730X + \u77E2\u3058\u308A\u306E\u5E45 / 2} ${\u7E26\u306E\u7D42\u308F\u308AY} Z`;
|
|
14661
|
+
return drawing && !(\u884C\u306E\u4F38\u3073(parentRow) >= 1 && \u884C\u306E\u4F38\u3073(childRow) >= 1) ? null : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
|
|
14662
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14663
|
+
"path",
|
|
14664
|
+
{
|
|
14665
|
+
d: path,
|
|
14666
|
+
fill: "none",
|
|
14667
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
14668
|
+
strokeWidth: 2.4,
|
|
14669
|
+
strokeLinejoin: "round",
|
|
14670
|
+
strokeLinecap: "round"
|
|
14671
|
+
}
|
|
14672
|
+
),
|
|
14673
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14674
|
+
"path",
|
|
14675
|
+
{
|
|
14676
|
+
d: arrowHeadPath,
|
|
14677
|
+
fill: "var(--cdl-text-mute, #8a8678)",
|
|
14678
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
14679
|
+
strokeWidth: 0.5,
|
|
14680
|
+
strokeLinejoin: "round"
|
|
14681
|
+
}
|
|
14682
|
+
)
|
|
14683
|
+
] }, `dep-${parent.id}-${t.id}`);
|
|
14649
14684
|
})
|
|
14650
14685
|
] });
|
|
14651
14686
|
}
|