feat: Implement ElementEditor component to manage UI element properties, design, data, and provide a draggable panel.
This commit is contained in:
@@ -56,13 +56,19 @@ const ElementEditor: React.FC<ElementEditorProps> = ({
|
|||||||
const { getElementById } = simulationDashBoardStore();
|
const { getElementById } = simulationDashBoardStore();
|
||||||
const element = getElementById(selectedBlock, selectedElement);
|
const element = getElementById(selectedBlock, selectedElement);
|
||||||
const [selectType, setSelectType] = useState("design");
|
const [selectType, setSelectType] = useState("design");
|
||||||
const [selectDataMapping, setSelectDataMapping] = useState<"singleMachine" | "multipleMachine" | "global">(
|
const [selectDataMapping, setSelectDataMapping] = useState<"singleMachine" | "multipleMachine" | "global">("singleMachine");
|
||||||
element?.type === "graph" && element.dataBinding?.dataType === "multiple-machine"
|
|
||||||
? "multipleMachine"
|
useEffect(() => {
|
||||||
: element?.type === "graph" && element.dataBinding?.dataType === "global"
|
if (element?.type === "graph") {
|
||||||
? "global"
|
if (element.dataBinding?.dataType === "multiple-machine") {
|
||||||
: "singleMachine"
|
setSelectDataMapping("multipleMachine");
|
||||||
);
|
} else if (element.dataBinding?.dataType === "global") {
|
||||||
|
setSelectDataMapping("global");
|
||||||
|
} else {
|
||||||
|
setSelectDataMapping("singleMachine");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [element?.elementUuid, element?.dataBinding?.dataType, element?.type]);
|
||||||
|
|
||||||
// Use shared position from VisualizationStore
|
// Use shared position from VisualizationStore
|
||||||
const { editorPosition, setEditorPosition } = useVisualizationStore();
|
const { editorPosition, setEditorPosition } = useVisualizationStore();
|
||||||
|
|||||||
Reference in New Issue
Block a user