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