diff --git a/src/components/EditorCanvas/Canvas.jsx b/src/components/EditorCanvas/Canvas.jsx index 7587f12..1f15384 100644 --- a/src/components/EditorCanvas/Canvas.jsx +++ b/src/components/EditorCanvas/Canvas.jsx @@ -87,6 +87,8 @@ export default function Canvas() { * @param {ObjectType[keyof ObjectType]} type */ const handlePointerDownOnElement = (e, id, type) => { + if (selectedElement.open && !layout.sidebar) return; + if (!e.isPrimary) return; if (type === ObjectType.TABLE) { @@ -138,6 +140,8 @@ export default function Canvas() { * @param {PointerEvent} e */ const handlePointerMove = (e) => { + if (selectedElement.open && !layout.sidebar) return; + if (!e.isPrimary) return; if (linking) { @@ -226,6 +230,8 @@ export default function Canvas() { * @param {PointerEvent} e */ const handlePointerDown = (e) => { + if (selectedElement.open && !layout.sidebar) return; + if (!e.isPrimary) return; // don't pan if the sidesheet for editing a table is open @@ -309,6 +315,8 @@ export default function Canvas() { * @param {PointerEvent} e */ const handlePointerUp = (e) => { + if (selectedElement.open && !layout.sidebar) return; + if (!e.isPrimary) return; if (coordsDidUpdate(dragging.element)) { diff --git a/src/components/EditorCanvas/Relationship.jsx b/src/components/EditorCanvas/Relationship.jsx index 331fdeb..9f512a9 100644 --- a/src/components/EditorCanvas/Relationship.jsx +++ b/src/components/EditorCanvas/Relationship.jsx @@ -3,6 +3,8 @@ import { Cardinality, ObjectType, Tab } from "../../data/constants"; import { calcPath } from "../../utils/calcPath"; import { useDiagram, useSettings, useLayout, useSelect } from "../../hooks"; import { useTranslation } from "react-i18next"; +import { SideSheet } from "@douyinfe/semi-ui"; +import RelationshipInfo from "../EditorSidePanel/RelationshipsTab/RelationshipInfo"; export default function Relationship({ data }) { const { settings } = useSettings(); @@ -79,67 +81,90 @@ export default function Relationship({ data }) { }; return ( - - + + + {pathRef.current && settings.showCardinality && ( + <> + + + {cardinalityStart} + + + + {cardinalityEnd} + + )} - stroke="gray" - className="group-hover:stroke-sky-700" - fill="none" - strokeWidth={2} - cursor="pointer" - /> - {pathRef.current && settings.showCardinality && ( - <> - - - {cardinalityStart} - - - - {cardinalityEnd} - - - )} - + + { + setSelectedElement((prev) => ({ + ...prev, + open: false, + })); + }} + style={{ paddingBottom: "16px" }} + > +
+ +
+
+ ); } diff --git a/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx b/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx index 114afcc..bc184f1 100644 --- a/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx +++ b/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx @@ -1,12 +1,4 @@ -import { - Collapse, - Row, - Col, - Select, - Button, - Popover, - Table, -} from "@douyinfe/semi-ui"; +import { Row, Col, Select, Button, Popover, Table } from "@douyinfe/semi-ui"; import { IconDeleteStroked, IconLoopTextStroked, @@ -128,110 +120,100 @@ export default function RelationshipInfo({ data }) { }; return ( -
- - {data.name} -
- } - itemKey={`${data.id}`} - > -
-
- {t("primary")}: - {tables[data.endTableId].name} -
-
- {t("foreign")}: - {tables[data.startTableId].name} -
-
- - -
- -
- - } - trigger="click" - position="rightTop" - showArrow - > - -
{t("on_delete")}:
-
+
+ +
+ + } + trigger="click" + position="rightTop" + showArrow + > + +
{t("on_delete")}:
+