diff --git a/src/components/EditorSidePanel/Issues.jsx b/src/components/EditorSidePanel/Issues.jsx index 7f02c03..b0e2265 100644 --- a/src/components/EditorSidePanel/Issues.jsx +++ b/src/components/EditorSidePanel/Issues.jsx @@ -27,7 +27,7 @@ export default function Issues() { }, [tables, relationships, issues, types]); return ( - + { setSelectedElement((prev) => ({ ...prev, diff --git a/src/components/EditorSidePanel/RelationshipsTab/RelationshipsTab.jsx b/src/components/EditorSidePanel/RelationshipsTab/RelationshipsTab.jsx index ee23bd2..27139a9 100644 --- a/src/components/EditorSidePanel/RelationshipsTab/RelationshipsTab.jsx +++ b/src/components/EditorSidePanel/RelationshipsTab/RelationshipsTab.jsx @@ -19,6 +19,8 @@ export default function RelationshipsTab() { ? `${selectedElement.id}` : "" } + keepDOM + lazyRender onChange={(k) => setSelectedElement((prev) => ({ ...prev, diff --git a/src/components/EditorSidePanel/SidePanel.jsx b/src/components/EditorSidePanel/SidePanel.jsx index 2a3aaa9..8ac1d90 100644 --- a/src/components/EditorSidePanel/SidePanel.jsx +++ b/src/components/EditorSidePanel/SidePanel.jsx @@ -1,4 +1,4 @@ -import { Tabs } from "@douyinfe/semi-ui"; +import { Tabs, TabPane } from "@douyinfe/semi-ui"; import { Tab } from "../../data/constants"; import { useLayout, useSelect } from "../../hooks"; import RelationshipsTab from "./RelationshipsTab/RelationshipsTab"; @@ -13,19 +13,11 @@ export default function SidePanel({ width, resize, setResize }) { const { selectedElement, setSelectedElement } = useSelect(); const tabList = [ - { tab: "Tables", itemKey: Tab.TABLES }, - { tab: "Relationships", itemKey: Tab.RELATIONSHIPS }, - { tab: "Subject Areas", itemKey: Tab.AREAS }, - { tab: "Notes", itemKey: Tab.NOTES }, - { tab: "Types", itemKey: Tab.TYPES }, - ]; - - const contentList = [ - , - , - , - , - , + { tab: "Tables", itemKey: Tab.TABLES, component: }, + { tab: "Relationships", itemKey: Tab.RELATIONSHIPS, component: }, + { tab: "Subject Areas", itemKey: Tab.AREAS, component: }, + { tab: "Notes", itemKey: Tab.NOTES, component: }, + { tab: "Types", itemKey: Tab.TYPES, component: }, ]; return ( @@ -38,15 +30,19 @@ export default function SidePanel({ width, resize, setResize }) { setSelectedElement((prev) => ({ ...prev, currentTab: key })) } collapsible > -
- {contentList[parseInt(selectedElement.currentTab) - 1]} -
+ {tabList.length && tabList.map(tab => + +
+ {tab.component} +
+
+ )}
{layout.issues && ( diff --git a/src/components/EditorSidePanel/TablesTab/TableInfo.jsx b/src/components/EditorSidePanel/TablesTab/TableInfo.jsx index 7d8e6b8..1b06af0 100644 --- a/src/components/EditorSidePanel/TablesTab/TableInfo.jsx +++ b/src/components/EditorSidePanel/TablesTab/TableInfo.jsx @@ -144,6 +144,8 @@ export default function TableInfo({ data }) { > setIndexActiveKey(itemKey)} accordion > @@ -169,7 +171,7 @@ export default function TableInfo({ data }) { style={{ marginTop: "12px", marginBottom: "12px" }} headerLine={false} > - +