From 35ca8285d0abe59b52511024448c3e5a3737a1b4 Mon Sep 17 00:00:00 2001 From: codetypes Date: Thu, 20 Mar 2025 13:34:08 +0800 Subject: [PATCH] show subtree variable --- src/components/inspector.tsx | 71 ++++++++++++++++++++++++++----- src/contexts/workspace-context.ts | 6 +-- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/src/components/inspector.tsx b/src/components/inspector.tsx index fc08135..fbcc681 100644 --- a/src/components/inspector.tsx +++ b/src/components/inspector.tsx @@ -1,4 +1,10 @@ -import { AimOutlined, EditOutlined, MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; +import { + AimOutlined, + EditOutlined, + FormOutlined, + MinusCircleOutlined, + PlusOutlined, +} from "@ant-design/icons"; import { AutoComplete, Button, @@ -144,6 +150,8 @@ const TreeInspector: FC = () => { groupDefs: state.groupDefs, nodeDefs: state.nodeDefs, relative: state.relative, + open: state.open, + workdir: state.workdir, })) ); const { t } = useTranslation(); @@ -241,10 +249,12 @@ const TreeInspector: FC = () => { ); form.setFieldValue( "subtree", - workspace.editingTree.subtree.map((v) => ({ - name: v.name, - desc: v.desc, - count: usingCount[v.name] ?? 0, + workspace.editingTree.subtree.map((entry) => ({ + path: entry.path, + vars: entry.vars.map((v) => ({ + name: v.name, + count: usingCount[v.name] ?? 0, + })), })) ); }, [workspace.editingTree, groupDefs, usingCount]); @@ -402,12 +412,51 @@ const TreeInspector: FC = () => {

{t("tree.vars.subtree")}

- {(fields) => ( -
- {fields.map((item) => ( - - - + {(items) => ( +
+ {items.map((item) => ( + + + +