@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/index.js
CHANGED
|
@@ -26972,15 +26972,16 @@ function GanttNode({
|
|
|
26972
26972
|
const x0 = node.cx - node.w / 2;
|
|
26973
26973
|
const y0 = node.cy - node.h / 2;
|
|
26974
26974
|
const tasks = resolveGanttData(node.ganttData ?? [], stateValues);
|
|
26975
|
-
const PAD_TOP2 =
|
|
26975
|
+
const PAD_TOP2 = 46;
|
|
26976
26976
|
const PAD_RIGHT2 = 48;
|
|
26977
|
-
const PAD_BOTTOM2 =
|
|
26977
|
+
const PAD_BOTTOM2 = 26;
|
|
26978
26978
|
const PAD_LEFT2 = 156;
|
|
26979
26979
|
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
26980
26980
|
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
26981
26981
|
const rowGap = 20;
|
|
26982
26982
|
const rowCount = tasks.length || 1;
|
|
26983
26983
|
const rowH = Math.max(28, (canvasH - rowGap * (rowCount + 1)) / rowCount);
|
|
26984
|
+
const \u5E2F\u306E\u9AD8\u3055 = Math.min(rowH, 30);
|
|
26984
26985
|
const \u4F4D\u7F6E\u306E\u4E0A\u9650 = 1e6;
|
|
26985
26986
|
const \u53CE\u3081\u305F = tasks.map((t) => {
|
|
26986
26987
|
const \u59CB = Math.min(\u4F4D\u7F6E\u306E\u4E0A\u9650, Math.max(0, Number.isFinite(t.startIdx) ? t.startIdx : 0));
|
|
@@ -27006,6 +27007,7 @@ function GanttNode({
|
|
|
27006
27007
|
const \u76EE\u76DB\u308A\u306E\u672C\u6570 = Math.ceil(maxIdx / \u76EE\u76DB\u308A\u306E\u9593\u9694);
|
|
27007
27008
|
const xAt = (idx) => PAD_LEFT2 + idx * cellW;
|
|
27008
27009
|
const yAt = (row) => PAD_TOP2 + rowGap + row * (rowH + rowGap);
|
|
27010
|
+
const \u5E2F\u306E\u4E0A = (row) => yAt(row) + (rowH - \u5E2F\u306E\u9AD8\u3055) / 2;
|
|
27009
27011
|
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() };
|
|
27010
27012
|
const \u7F6E\u304F = (\u8868, \u4F4D\u7F6E, label) => {
|
|
27011
27013
|
if (label !== "" && Number.isFinite(\u4F4D\u7F6E) && !\u8868.has(\u4F4D\u7F6E)) \u8868.set(\u4F4D\u7F6E, label);
|
|
@@ -27027,6 +27029,7 @@ function GanttNode({
|
|
|
27027
27029
|
const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
|
|
27028
27030
|
const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
|
|
27029
27031
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
27032
|
+
const \u884C\u306E\u4F38\u3073 = (row) => \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, row + 1, rowCount);
|
|
27030
27033
|
const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
|
|
27031
27034
|
const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
|
|
27032
27035
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
@@ -27044,6 +27047,43 @@ function GanttNode({
|
|
|
27044
27047
|
strokeWidth: active ? 3 : 1.25
|
|
27045
27048
|
}
|
|
27046
27049
|
),
|
|
27050
|
+
\u6574\u3048\u305F.map(
|
|
27051
|
+
(t, row) => row % 2 === 0 ? null : /* @__PURE__ */ jsx(
|
|
27052
|
+
"rect",
|
|
27053
|
+
{
|
|
27054
|
+
"data-cdl-role": "gantt-row",
|
|
27055
|
+
x: PAD_LEFT2,
|
|
27056
|
+
y: yAt(row) - rowGap / 2,
|
|
27057
|
+
width: canvasW,
|
|
27058
|
+
height: rowH + rowGap,
|
|
27059
|
+
fill: "var(--cdl-surface-sunken, #f4f2ed)",
|
|
27060
|
+
opacity: 0.55
|
|
27061
|
+
},
|
|
27062
|
+
`band-${t.id}`
|
|
27063
|
+
)
|
|
27064
|
+
),
|
|
27065
|
+
/* @__PURE__ */ jsx(
|
|
27066
|
+
"line",
|
|
27067
|
+
{
|
|
27068
|
+
x1: PAD_LEFT2,
|
|
27069
|
+
y1: PAD_TOP2,
|
|
27070
|
+
x2: PAD_LEFT2 + canvasW,
|
|
27071
|
+
y2: PAD_TOP2,
|
|
27072
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
27073
|
+
strokeWidth: 1
|
|
27074
|
+
}
|
|
27075
|
+
),
|
|
27076
|
+
/* @__PURE__ */ jsx(
|
|
27077
|
+
"line",
|
|
27078
|
+
{
|
|
27079
|
+
x1: PAD_LEFT2,
|
|
27080
|
+
y1: PAD_TOP2,
|
|
27081
|
+
x2: PAD_LEFT2,
|
|
27082
|
+
y2: PAD_TOP2 + canvasH,
|
|
27083
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
27084
|
+
strokeWidth: 1
|
|
27085
|
+
}
|
|
27086
|
+
),
|
|
27047
27087
|
gridLabels.map(({ \u4F4D\u7F6E: i, label }) => /* @__PURE__ */ jsxs("g", { children: [
|
|
27048
27088
|
/* @__PURE__ */ jsx(
|
|
27049
27089
|
"line",
|
|
@@ -27054,9 +27094,8 @@ function GanttNode({
|
|
|
27054
27094
|
x2: xAt(i),
|
|
27055
27095
|
y2: PAD_TOP2 + canvasH,
|
|
27056
27096
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
27057
|
-
strokeWidth:
|
|
27058
|
-
|
|
27059
|
-
opacity: 0.5
|
|
27097
|
+
strokeWidth: 1,
|
|
27098
|
+
opacity: 0.45
|
|
27060
27099
|
}
|
|
27061
27100
|
),
|
|
27062
27101
|
label === "" ? null : /* @__PURE__ */ jsx(
|
|
@@ -27064,7 +27103,7 @@ function GanttNode({
|
|
|
27064
27103
|
{
|
|
27065
27104
|
"data-cdl-role": "gantt-tick",
|
|
27066
27105
|
x: xAt(i) + cellW / 2,
|
|
27067
|
-
y: PAD_TOP2
|
|
27106
|
+
y: PAD_TOP2 - 16,
|
|
27068
27107
|
fontSize: 11,
|
|
27069
27108
|
textAnchor: "middle",
|
|
27070
27109
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
@@ -27080,14 +27119,14 @@ function GanttNode({
|
|
|
27080
27119
|
x2: xAt(maxIdx),
|
|
27081
27120
|
y2: PAD_TOP2 + canvasH,
|
|
27082
27121
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
27083
|
-
strokeWidth:
|
|
27084
|
-
opacity: 0.
|
|
27122
|
+
strokeWidth: 1,
|
|
27123
|
+
opacity: 0.45
|
|
27085
27124
|
}
|
|
27086
27125
|
),
|
|
27087
27126
|
\u6574\u3048\u305F.map((t, row) => /* @__PURE__ */ jsx(
|
|
27088
27127
|
"text",
|
|
27089
27128
|
{
|
|
27090
|
-
x: PAD_LEFT2 -
|
|
27129
|
+
x: PAD_LEFT2 - 16,
|
|
27091
27130
|
y: yAt(row) + rowH / 2 + 4,
|
|
27092
27131
|
fontSize: 12,
|
|
27093
27132
|
textAnchor: "end",
|
|
@@ -27099,89 +27138,85 @@ function GanttNode({
|
|
|
27099
27138
|
)),
|
|
27100
27139
|
\u6574\u3048\u305F.map((t, row) => {
|
|
27101
27140
|
const bx = \u5E2F\u306E\u5DE6(t.startIdx);
|
|
27102
|
-
const by =
|
|
27141
|
+
const by = \u5E2F\u306E\u4E0A(row);
|
|
27103
27142
|
const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
|
|
27104
|
-
|
|
27105
|
-
|
|
27106
|
-
|
|
27107
|
-
|
|
27108
|
-
|
|
27109
|
-
|
|
27110
|
-
|
|
27111
|
-
|
|
27112
|
-
|
|
27113
|
-
|
|
27114
|
-
|
|
27115
|
-
|
|
27116
|
-
|
|
27117
|
-
|
|
27118
|
-
|
|
27119
|
-
|
|
27120
|
-
|
|
27121
|
-
|
|
27122
|
-
|
|
27123
|
-
|
|
27124
|
-
|
|
27125
|
-
|
|
27126
|
-
|
|
27127
|
-
|
|
27128
|
-
|
|
27129
|
-
|
|
27130
|
-
|
|
27131
|
-
|
|
27132
|
-
|
|
27133
|
-
|
|
27134
|
-
|
|
27135
|
-
|
|
27136
|
-
|
|
27137
|
-
`bar-${t.id}`
|
|
27138
|
-
);
|
|
27143
|
+
const \u3053\u306E\u884C = \u884C\u306E\u4F38\u3073(row);
|
|
27144
|
+
const \u4ECA\u306E\u5E45 = drawing ? bw * \u3053\u306E\u884C : bw;
|
|
27145
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
27146
|
+
/* @__PURE__ */ jsx(
|
|
27147
|
+
"rect",
|
|
27148
|
+
{
|
|
27149
|
+
"data-cdl-role": "gantt-bar",
|
|
27150
|
+
"data-cdl-unresolved": t.unresolved ? "true" : void 0,
|
|
27151
|
+
"data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
|
|
27152
|
+
x: bx,
|
|
27153
|
+
y: by,
|
|
27154
|
+
width: \u4ECA\u306E\u5E45,
|
|
27155
|
+
height: \u5E2F\u306E\u9AD8\u3055,
|
|
27156
|
+
rx: \u5E2F\u306E\u9AD8\u3055 / 2,
|
|
27157
|
+
ry: \u5E2F\u306E\u9AD8\u3055 / 2,
|
|
27158
|
+
fill: toneColor4(t.tone),
|
|
27159
|
+
fillOpacity: 0.9
|
|
27160
|
+
}
|
|
27161
|
+
),
|
|
27162
|
+
t.owner && \u5E2F\u306E\u9AD8\u3055 >= 22 && \u3053\u306E\u884C >= 1 && /* @__PURE__ */ jsx(
|
|
27163
|
+
"text",
|
|
27164
|
+
{
|
|
27165
|
+
"data-cdl-role": "gantt-owner",
|
|
27166
|
+
x: bx + bw / 2,
|
|
27167
|
+
y: by + \u5E2F\u306E\u9AD8\u3055 / 2 + 4,
|
|
27168
|
+
fontSize: 11,
|
|
27169
|
+
textAnchor: "middle",
|
|
27170
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
27171
|
+
fontWeight: 600,
|
|
27172
|
+
children: t.owner
|
|
27173
|
+
}
|
|
27174
|
+
)
|
|
27175
|
+
] }, `bar-${t.id}`);
|
|
27139
27176
|
}),
|
|
27140
27177
|
\u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
|
|
27141
27178
|
const parent = taskById.get(t.dependsOn);
|
|
27142
27179
|
const parentRow = rowOf.get(parent.id);
|
|
27143
27180
|
const childRow = rowOf.get(t.id);
|
|
27144
27181
|
const parentBarRight = \u5E2F\u306E\u53F3(parent.endIdx);
|
|
27145
|
-
const parentMidY = yAt(parentRow) + rowH / 2;
|
|
27146
27182
|
const childBarLeft = \u5E2F\u306E\u5DE6(t.startIdx);
|
|
27147
|
-
const
|
|
27148
|
-
const
|
|
27149
|
-
const
|
|
27150
|
-
const
|
|
27151
|
-
const
|
|
27152
|
-
const
|
|
27153
|
-
const
|
|
27154
|
-
const
|
|
27155
|
-
const
|
|
27156
|
-
const
|
|
27157
|
-
const
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27161
|
-
|
|
27162
|
-
|
|
27163
|
-
|
|
27164
|
-
|
|
27165
|
-
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
|
|
27171
|
-
|
|
27172
|
-
|
|
27173
|
-
|
|
27174
|
-
|
|
27175
|
-
|
|
27176
|
-
|
|
27177
|
-
|
|
27178
|
-
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
|
|
27184
|
-
);
|
|
27183
|
+
const \u77E2\u3058\u308A\u306E\u5E45 = 11;
|
|
27184
|
+
const \u77E2\u3058\u308A\u306E\u9AD8\u3055 = 7;
|
|
27185
|
+
const \u4E38\u307F = \u5E2F\u306E\u9AD8\u3055 / 2;
|
|
27186
|
+
const \u89AA\u306E\u5DE6 = \u5E2F\u306E\u5DE6(parent.startIdx);
|
|
27187
|
+
const \u5B50\u306E\u53F3 = \u5E2F\u306E\u53F3(t.endIdx);
|
|
27188
|
+
const \u5BC4\u305B = (\u5DE6, \u53F3) => Math.min(\u4E38\u307F, (\u53F3 - \u5DE6) / 2);
|
|
27189
|
+
const \u51FA\u767AX = parentBarRight - \u5BC4\u305B(\u89AA\u306E\u5DE6, parentBarRight);
|
|
27190
|
+
const \u51FA\u767AY = \u5E2F\u306E\u4E0A(parentRow) + \u5E2F\u306E\u9AD8\u3055;
|
|
27191
|
+
const \u7740\u5730X = childBarLeft + \u5BC4\u305B(childBarLeft, \u5B50\u306E\u53F3);
|
|
27192
|
+
const \u7740\u5730Y = \u5E2F\u306E\u4E0A(childRow);
|
|
27193
|
+
const \u7E26\u306E\u7D42\u308F\u308AY = \u7740\u5730Y - \u77E2\u3058\u308A\u306E\u9AD8\u3055;
|
|
27194
|
+
const \u624B = Math.max(6, (\u7E26\u306E\u7D42\u308F\u308AY - \u51FA\u767AY) * 0.55);
|
|
27195
|
+
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}`;
|
|
27196
|
+
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`;
|
|
27197
|
+
return drawing && !(\u884C\u306E\u4F38\u3073(parentRow) >= 1 && \u884C\u306E\u4F38\u3073(childRow) >= 1) ? null : /* @__PURE__ */ jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
|
|
27198
|
+
/* @__PURE__ */ jsx(
|
|
27199
|
+
"path",
|
|
27200
|
+
{
|
|
27201
|
+
d: path,
|
|
27202
|
+
fill: "none",
|
|
27203
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
27204
|
+
strokeWidth: 2.4,
|
|
27205
|
+
strokeLinejoin: "round",
|
|
27206
|
+
strokeLinecap: "round"
|
|
27207
|
+
}
|
|
27208
|
+
),
|
|
27209
|
+
/* @__PURE__ */ jsx(
|
|
27210
|
+
"path",
|
|
27211
|
+
{
|
|
27212
|
+
d: arrowHeadPath,
|
|
27213
|
+
fill: "var(--cdl-text-mute, #8a8678)",
|
|
27214
|
+
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
27215
|
+
strokeWidth: 0.5,
|
|
27216
|
+
strokeLinejoin: "round"
|
|
27217
|
+
}
|
|
27218
|
+
)
|
|
27219
|
+
] }, `dep-${parent.id}-${t.id}`);
|
|
27185
27220
|
})
|
|
27186
27221
|
] });
|
|
27187
27222
|
}
|