fix(workspace_files): right = VBox(100%x100%) + fixed-height droppable + filler VScrollPanel file list
This commit is contained in:
parent
327d3f39a4
commit
69925d48ba
@ -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]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user