diff --git a/src/components/EditorSidePanel/TablesTab/SearchBar.jsx b/src/components/EditorSidePanel/TablesTab/SearchBar.jsx
index ab0f35d..bcaec05 100644
--- a/src/components/EditorSidePanel/TablesTab/SearchBar.jsx
+++ b/src/components/EditorSidePanel/TablesTab/SearchBar.jsx
@@ -1,40 +1,64 @@
-import { useMemo, useState } from "react";
+import { useMemo } from "react";
import { useSelect } from "../../../hooks";
-import { AutoComplete } from "@douyinfe/semi-ui";
+import { TreeSelect } from "@douyinfe/semi-ui";
import { IconSearch } from "@douyinfe/semi-icons";
import { ObjectType } from "../../../data/constants";
import { useTranslation } from "react-i18next";
export default function SearchBar({ tables }) {
const { setSelectedElement } = useSelect();
- const [searchText, setSearchText] = useState("");
const { t } = useTranslation();
- const filteredTable = useMemo(
- () => tables.map((t) => t.name).filter((i) => i.includes(searchText)),
- [tables, searchText],
- );
+
+ const treeData = useMemo(() => {
+ return tables.map(({ id, name: parentName, fields }, i) => {
+ const children = fields.map(({ name }, j) => ({
+ tableId: id,
+ id: `${j}`,
+ label: name,
+ value: name,
+ key: `${i}-${j}`,
+ }));
+
+ return {
+ tableId: id,
+ id: `${i}`,
+ label: parentName,
+ value: parentName,
+ key: `${i}`,
+ children,
+ };
+ });
+ }, [tables]);
return (
-