diff --git a/src/components/EditorCanvas/Canvas.jsx b/src/components/EditorCanvas/Canvas.jsx index 95665f2..d74dd63 100644 --- a/src/components/EditorCanvas/Canvas.jsx +++ b/src/components/EditorCanvas/Canvas.jsx @@ -436,6 +436,7 @@ export default function Canvas() { }_fk`, id: relationships.length, subtype: false, + subtype_restriction: "", }; delete newRelationship.startX; delete newRelationship.startY; diff --git a/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx b/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx index fcd21ae..4bd028d 100644 --- a/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx +++ b/src/components/EditorSidePanel/RelationshipsTab/RelationshipInfo.jsx @@ -6,6 +6,7 @@ import { } from "@douyinfe/semi-icons"; import { Cardinality, + SubtypeRestriction, Constraint, Action, ObjectType, @@ -97,6 +98,29 @@ export default function RelationshipInfo({ data }) { ); }; + const changeSubtypeRestriction = (value) => { + setUndoStack((prev) => [ + ...prev, + { + action: Action.EDIT, + element: ObjectType.RELATIONSHIP, + rid: data.id, + undo: { subtype_restriction: data.subtype_restriction }, + redo: { subtype_restriction: value }, + message: t("edit_relationship", { + refName: data.name, + extra: "[subtype_restriction]", + }), + }, + ]); + setRedoStack([]); + setRelationships((prev) => + prev.map((e, idx) => + idx === data.id ? { ...e, subtype_restriction: value } : e, + ), + ); + }; + const toggleSubtype = () => { const prevVal = data.subtype; setUndoStack((prev) => [ @@ -206,7 +230,7 @@ export default function RelationshipInfo({ data }) { /> -
{'Subtype'}: +
{t("subtype")}:
@@ -216,7 +240,20 @@ export default function RelationshipInfo({ data }) { /> - {console.log(data)} + {data.subtype && + +
{t("subtype_restriction")}:
+