From f2afaa82e88dbdd5ca3f17f4af279d3aab4a4b8b Mon Sep 17 00:00:00 2001 From: ymq Date: Tue, 25 Aug 2026 16:05:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(popup):=20=E6=96=B0=E5=BB=BA=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E5=BC=B9=E7=AA=97=E7=82=B9=E5=87=BB=E5=8D=B3?= =?UTF-8?q?=E5=85=B3=E9=97=AD=20+=20Cancel=20=E6=8C=89=E9=92=AE=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=85=B3=E9=97=AD=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因(核实 bricks/popup.js 源码): 1. popup_options 显式写了 auto_dismiss:true,Popup 构造时把 click 绑到整个 bricks.Body, 而 click_outside 只判断 event.target != this.dom_element(无子树 contains 判定), 点击弹窗内任何子元素(输入框/下拉/按钮)都命中 → 立即 dismiss。改为 auto_dismiss:false。 2. 加 dismiss_events:['cancel','submited'] 让 Form 的取消/提交完成关闭弹窗。 但 set_dismiss_events 只绑 load_content 返回的根 widget,而 dispatch 用 new Event() 不冒泡(bubbles:false) —— 原根节点是 VBox、事件由子 Form 发出,绑不上。 故把 Form 提为 new_kb_form.ui 根 widget,标题改用 Form 自带 title 选项。 (title 不是 Popup 的合法 option,仅 PopupWindow/Form 支持) --- wwwroot/knowledge_bases_list/index.ui | 6 +++- wwwroot/knowledge_bases_list/new_kb_form.ui | 31 +++++++++------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/wwwroot/knowledge_bases_list/index.ui b/wwwroot/knowledge_bases_list/index.ui index e5f6750..34353f7 100644 --- a/wwwroot/knowledge_bases_list/index.ui +++ b/wwwroot/knowledge_bases_list/index.ui @@ -63,7 +63,11 @@ "actiontype": "urlwidget", "target": "Popup", "popup_options": { - "auto_dismiss": true + "auto_dismiss": false, + "dismiss_events": ["cancel", "submited"], + "movable": true, + "width": "34%", + "height": "auto" }, "options": { "url": "{{entire_url('./new_kb_form.ui')}}" diff --git a/wwwroot/knowledge_bases_list/new_kb_form.ui b/wwwroot/knowledge_bases_list/new_kb_form.ui index d631171..263289c 100644 --- a/wwwroot/knowledge_bases_list/new_kb_form.ui +++ b/wwwroot/knowledge_bases_list/new_kb_form.ui @@ -1,24 +1,19 @@ { - "widgettype": "VBox", - "options": {"padding": "16px", "spacing": "12px"}, - "subwidgets": [ - {"widgettype": "Text", "options": {"text": "新建知识库", "cfontsize": 18, "fontWeight": "bold"}}, - { - "widgettype": "Form", - "id": "kb_form", - "options": { - "cols": 1, - "fields": [ - {"name": "name", "label": "名称", "uitype": "str", "required": true}, - {"name": "description", "label": "描述", "uitype": "text"}, - {"name": "embedding_type", "label": "向量引擎", "uitype": "code", "value": "clip-vith14", "dataurl": "{{entire_url('./embedding_options.dspy')}}"} - ] - } - } - ], + "widgettype": "Form", + "id": "kb_form", + "options": { + "cols": 1, + "title": "新建知识库", + "padding": "16px", + "fields": [ + {"name": "name", "label": "名称", "uitype": "str", "required": true}, + {"name": "description", "label": "描述", "uitype": "text"}, + {"name": "embedding_type", "label": "向量引擎", "uitype": "code", "value": "clip-vith14", "dataurl": "{{entire_url('./embedding_options.dspy')}}"} + ] + }, "binds": [ { - "wid": "kb_form", + "wid": "self", "event": "submit", "actiontype": "urlwidget", "target": "app.rag_main_content",