From 69925d48ba5e8b526205d1491cc4d62b94ce9662 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 15 Aug 2026 12:11:49 +0800 Subject: [PATCH] fix(workspace_files): right = VBox(100%x100%) + fixed-height droppable + filler VScrollPanel file list --- wwwroot/api/workspace_files.dspy | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/wwwroot/api/workspace_files.dspy b/wwwroot/api/workspace_files.dspy index 66b7ae2..5acfa98 100644 --- a/wwwroot/api/workspace_files.dspy +++ b/wwwroot/api/workspace_files.dspy @@ -43,17 +43,15 @@ upload_script = ( "if(rb){var cid=rb.current_id;rb.current_id=undefined;await rb.render_browser(cid);}" ) -widgets = [] - -# 拖拽上传区 -widgets.append({ +# 拖拽上传区(固定高度) +droppable = { "widgettype": "Droppable", "options": {"accepts": ["*"], "padding": "10px"}, "subwidgets": [ {"widgettype": "Text", "options": {"text": "📥 拖拽文件到此处上传", "cfontsize": 0.85, "color": "#64748b", "halign": "middle"}} ], "binds": [{"wid": "self", "event": "filedrop", "actiontype": "script", "target": "self", "script": upload_script}] -}) +} files = [] try: @@ -98,12 +96,19 @@ for name in entries: files.append(row) if not files: - widgets.append({"widgettype": "Text", "options": {"text": "(空目录)", "cfontsize": 0.85, "color": "#94a3b8", "padding": "8px"}}) + file_list_content = [{"widgettype": "Text", "options": {"text": "(空目录)", "cfontsize": 0.85, "color": "#94a3b8", "padding": "8px"}}] else: - widgets.extend(files) + file_list_content = files + +# 文件列表区:filler + VScrollPanel(占满剩余高度并可滚动) +file_list_panel = { + "widgettype": "VScrollPanel", + "options": {"css": "filler", "width": "100%"}, + "subwidgets": file_list_content +} return { "widgettype": "VBox", - "options": {"width": "100%", "padding": "8px", "gap": "6px"}, - "subwidgets": widgets + "options": {"width": "100%", "height": "100%", "padding": "8px", "gap": "6px"}, + "subwidgets": [droppable, file_list_panel] }