From 47cfe17d16ea2cdeecfad37c800656337613b640 Mon Sep 17 00:00:00 2001 From: alivender <13898766233@163.com> Date: Wed, 7 May 2025 15:42:35 +0800 Subject: [PATCH] Refactor component configuration and diagram management - Removed the component configuration from `componentConfig.ts` to streamline the codebase. - Introduced a new `diagram.json` file to define the initial structure for diagrams. - Created a `diagramManager.ts` to handle diagram data, including loading, saving, and validating diagram structures. - Updated `ProjectView.vue` to integrate the new diagram management system, including handling component selection and property updates. - Enhanced the component property management to support dynamic attributes and improved error handling. - Added functions for managing connections between components within the diagram. --- src/components/ComponentSelector.vue | 27 +- src/components/DiagramCanvas.vue | 924 +++++++++++------- src/components/diagram.json | 8 + src/components/diagramManager.ts | 309 ++++++ .../equipments/MechanicalButton.vue | 25 +- src/components/equipments/Pin.vue | 76 +- src/components/equipments/SMT_LED.vue | 129 ++- src/components/equipments/Wire.vue | 176 +++- src/components/equipments/componentConfig.ts | 363 ------- src/views/ProjectView.vue | 310 ++++-- 10 files changed, 1457 insertions(+), 890 deletions(-) create mode 100644 src/components/diagram.json create mode 100644 src/components/diagramManager.ts diff --git a/src/components/ComponentSelector.vue b/src/components/ComponentSelector.vue index 691ed84..7957b62 100644 --- a/src/components/ComponentSelector.vue +++ b/src/components/ComponentSelector.vue @@ -101,7 +101,6 @@