From 7c48e4148d9b867787ffc6a15b42fabbcb809353 Mon Sep 17 00:00:00 2001 From: fangzhenwu <1040079213@qq.com> Date: Sat, 20 Dec 2025 20:43:23 +0800 Subject: [PATCH] 1 --- draggable-panels/config.json | 113 ++++++++-- draggable-panels/src/components/Panel.vue | 16 ++ .../src/materials/DataTable/index.vue | 124 ++++++++++- .../src/materials/TextEditor/index.vue | 42 +++- .../src/materials/TreeViewer/index.vue | 200 ++++++++++++++---- draggable-panels/src/types/index.ts | 1 + 6 files changed, 429 insertions(+), 67 deletions(-) diff --git a/draggable-panels/config.json b/draggable-panels/config.json index 4bfcb6a..9b83cfe 100644 --- a/draggable-panels/config.json +++ b/draggable-panels/config.json @@ -24,7 +24,63 @@ "id": "mxfx11j", "title": "树形展示器", "content": "新窗口内容", - "materialId": "TreeViewer" + "materialId": "TreeViewer", + "materialState": { + "treeData": [ + { + "id": "1", + "label": "项目根目录", + "expanded": true, + "children": [ + { + "id": "1-1", + "label": "src", + "expanded": true, + "children": [ + { + "id": "1-1-2", + "label": "stores" + }, + { + "id": "1-1-4", + "label": "App.vue" + }, + { + "id": "1-1-5", + "label": "main.ts" + }, + { + "id": "1-1-1", + "label": "components" + } + ] + }, + { + "id": "1-1-3", + "label": "types" + }, + { + "id": "1-2", + "label": "public", + "children": [ + { + "id": "1-3", + "label": "package.json" + }, + { + "id": "1-2-1", + "label": "favicon.ico" + } + ] + }, + { + "id": "1-4", + "label": "vite.config.ts" + } + ] + } + ] + } }, { "id": "jln5iq9", @@ -33,31 +89,56 @@ "materialId": "TestWidget2" } ], - "activeTabId": "2emt1si" + "activeTabId": "mxfx11j" }, "rightPanel": { "id": "right", "tabs": [ - { - "id": "ojaw0e3", - "title": "新窗口 3", - "content": "新窗口内容" - }, { "id": "vrh9bl2", "title": "数据表格", "content": "新窗口内容", - "materialId": "DataTable" - }, - { - "id": "y2iwzgl", - "title": "测试组件A", - "content": "新窗口内容", - "materialId": "TestWidget1" + "materialId": "DataTable", + "materialState": { + "data": [ + { + "property": "项目名称", + "value": "1111" + }, + { + "property": "框架", + "value": "9999" + }, + { + "property": "语言", + "value": "TypeScript" + }, + { + "property": "构建工具", + "value": "Vite" + }, + { + "property": "状态管理", + "value": "Pinia" + }, + { + "property": "版本", + "value": "1.0.0" + }, + { + "property": "作者", + "value": "Developer" + }, + { + "property": "许可证", + "value": "MIT" + } + ] + } } ], - "activeTabId": "ojaw0e3" + "activeTabId": "vrh9bl2" } }, - "lastUpdated": "2025-12-20T12:28:20.283Z" + "lastUpdated": "2025-12-20T12:43:09.638Z" } \ No newline at end of file diff --git a/draggable-panels/src/components/Panel.vue b/draggable-panels/src/components/Panel.vue index 40808e9..6d499e4 100644 --- a/draggable-panels/src/components/Panel.vue +++ b/draggable-panels/src/components/Panel.vue @@ -25,6 +25,20 @@ const activeMaterialComponent = computed(() => { return null }) +// 获取当前物料组件的状态 +const activeMaterialState = computed(() => { + return activeTab.value?.materialState +}) + +// 处理物料组件状态更新 +const handleStateUpdate = (newState: Record) => { + if (activeTab.value) { + activeTab.value.materialState = newState + // 触发保存 + panelStore.saveConfig() + } +} + const handleTabClick = (tabId: string) => { panelStore.setActiveTab(props.panel.id, tabId) } @@ -69,7 +83,9 @@ const handleCloseTab = (tabId: string, event: Event) => {
diff --git a/draggable-panels/src/materials/DataTable/index.vue b/draggable-panels/src/materials/DataTable/index.vue index b8308a9..b054c47 100644 --- a/draggable-panels/src/materials/DataTable/index.vue +++ b/draggable-panels/src/materials/DataTable/index.vue @@ -1,29 +1,108 @@