根因(核实 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 支持)
96 lines
3.4 KiB
XML
96 lines
3.4 KiB
XML
{
|
|
"widgettype": "VBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"padding": "16px",
|
|
"spacing": "16px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"width": "100%",
|
|
"justifyContent": "space-between",
|
|
"alignItems": "center"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Text",
|
|
"options": {
|
|
"text": "知识库",
|
|
"cfontsize": 22,
|
|
"fontWeight": "bold",
|
|
"color": "#333"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "HBox",
|
|
"options": {
|
|
"spacing": "8px"
|
|
},
|
|
"subwidgets": [
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "🔍 检索知识",
|
|
"bgcolor": "#10b981",
|
|
"color": "#fff"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "app.rag_main_content",
|
|
"mode": "replace",
|
|
"options": {
|
|
"url": "./search.ui"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "Button",
|
|
"options": {
|
|
"label": "+ 新建知识库",
|
|
"bgcolor": "#4a90d9",
|
|
"color": "#fff"
|
|
},
|
|
"binds": [
|
|
{
|
|
"wid": "self",
|
|
"event": "click",
|
|
"actiontype": "urlwidget",
|
|
"target": "Popup",
|
|
"popup_options": {
|
|
"auto_dismiss": false,
|
|
"dismiss_events": ["cancel", "submited"],
|
|
"movable": true,
|
|
"width": "34%",
|
|
"height": "auto"
|
|
},
|
|
"options": {
|
|
"url": "{{entire_url('./new_kb_form.ui')}}"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"widgettype": "urlwidget",
|
|
"options": {
|
|
"url": "{{entire_url('./storage_stats.dspy')}}"
|
|
}
|
|
},
|
|
{
|
|
"widgettype": "urlwidget",
|
|
"options": {
|
|
"url": "{{entire_url('./kb_list.dspy')}}"
|
|
}
|
|
}
|
|
]
|
|
}
|