@cardenelabs/cdl 0.114.0 → 0.115.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 +32 -1
- package/dist/index.cjs +24 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +24 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +24 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/kinds/tree.tsx +49 -2
package/dist/react.js
CHANGED
|
@@ -4910,6 +4910,28 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
4910
4910
|
const \u8981\u308B = measureTextWidth(\u540D\u524D.text, { fontSize: \u540D\u524D.fontSize}) + (nodeW - \u4F7F\u3048\u308B\u5E45(nodeW));
|
|
4911
4911
|
return Math.min(Math.max(\u8981\u308B, nodeW), slotW * 0.92);
|
|
4912
4912
|
};
|
|
4913
|
+
const \u8449\u306E\u4E26\u3073 = [];
|
|
4914
|
+
const \u6BB5\u306E\u8868 = /* @__PURE__ */ new Map();
|
|
4915
|
+
const \u5E45\u306E\u8868 = /* @__PURE__ */ new Map();
|
|
4916
|
+
{
|
|
4917
|
+
const \u898B\u305F = /* @__PURE__ */ new Set();
|
|
4918
|
+
const \u4E0B\u898B = (n, depth) => {
|
|
4919
|
+
\u898B\u305F.add(n.id);
|
|
4920
|
+
\u6BB5\u306E\u8868.set(n.id, depth);
|
|
4921
|
+
\u5E45\u306E\u8868.set(n.id, \u7BB1\u306E\u5E45(n, depth));
|
|
4922
|
+
const kids = (childrenOf.get(n.id) ?? []).filter((k) => !\u898B\u305F.has(k.id));
|
|
4923
|
+
if (kids.length === 0) {
|
|
4924
|
+
\u8449\u306E\u4E26\u3073.push(n.id);
|
|
4925
|
+
return;
|
|
4926
|
+
}
|
|
4927
|
+
for (const k of kids) \u4E0B\u898B(k, depth + 1);
|
|
4928
|
+
};
|
|
4929
|
+
for (const r of roots) if (!\u898B\u305F.has(r.id)) \u4E0B\u898B(r, 0);
|
|
4930
|
+
}
|
|
4931
|
+
const \u8449\u306E\u6570 = Math.max(\u8449\u306E\u4E26\u3073.length, 1);
|
|
4932
|
+
const \u6BB5\u306E\u9699\u9593 = depthGap - nodeH;
|
|
4933
|
+
const \u8449\u306E\u9593\u9694 = Math.min(slotW, nodeW + \u6BB5\u306E\u9699\u9593);
|
|
4934
|
+
const \u8449\u306Ex = (i) => canvasW / 2 - (\u8449\u306E\u6570 - 1) * \u8449\u306E\u9593\u9694 / 2 + i * \u8449\u306E\u9593\u9694;
|
|
4913
4935
|
const posOf = /* @__PURE__ */ new Map();
|
|
4914
4936
|
const nodes = [];
|
|
4915
4937
|
const placed = /* @__PURE__ */ new Set();
|
|
@@ -4919,7 +4941,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
4919
4941
|
const kids = (childrenOf.get(n.id) ?? []).filter((k) => !placed.has(k.id));
|
|
4920
4942
|
let x;
|
|
4921
4943
|
if (kids.length === 0) {
|
|
4922
|
-
x = leafCursor
|
|
4944
|
+
x = \u8449\u306Ex(leafCursor);
|
|
4923
4945
|
leafCursor += 1;
|
|
4924
4946
|
} else {
|
|
4925
4947
|
const xs = kids.map((k) => place(k, depth + 1));
|
|
@@ -4933,7 +4955,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
|
|
|
4933
4955
|
...n.subtitle !== void 0 ? { subtitle: n.subtitle } : {},
|
|
4934
4956
|
x,
|
|
4935
4957
|
y,
|
|
4936
|
-
w: \u7BB1\u306E\u5E45(n, depth),
|
|
4958
|
+
w: \u5E45\u306E\u8868.get(n.id) ?? \u7BB1\u306E\u5E45(n, depth),
|
|
4937
4959
|
h: nodeH,
|
|
4938
4960
|
depth,
|
|
4939
4961
|
...n.unresolved ? { unresolved: true } : {}
|