feat: move InlineForm into Tabular search_form option

Remove standalone InlineForm sibling from CRUD template. Pass filter
fields as search_form config inside Tabular options. Toolbar filter
button toggles the embedded form visibility.
This commit is contained in:
Hermes Agent 2026-06-22 13:27:22 +08:00
parent 11fe135a40
commit 7c64b70e74
2 changed files with 8 additions and 29 deletions

View File

@ -3,35 +3,6 @@ data_browser_tmpl = """
"widgettype":"VBox",
"options":{"height":"100%","width":"100%"},
"subwidgets":[
{% if data_filter and data_filter.fields %}
{
"widgettype":"InlineForm",
"id":"{{tblname}}_search",
"options":{
"css":"card",
"padding":"8px",
"show_label":false,
"submit_label":"搜索",
"submit_css":"primary",
"fields":[
{%- for f in data_filter.fields %}
{%- if f.uitype == 'code' %}
{{json.dumps(filter_fields[loop.index0], ensure_ascii=False)}}{% if not loop.last %},{% endif %}
{%- else %}
{"name":"{{f.field}}","uitype":"{{f.uitype}}","placeholder":"{{f.title}}","cwidth":15}{% if not loop.last %},{% endif %}
{%- endif %}
{%- endfor %}
]
},
"binds":[{
"wid":"self",
"event":"submit",
"actiontype":"script",
"target":"app.{{tblname}}_tbl",
"script":"var tbl = bricks.getWidgetById('app.{{tblname}}_tbl'); if(tbl) await tbl.render(params);"
}]
},
{% endif %}
{
"id":"{{tblname}}_tbl",
"widgettype":"Tabular",
@ -104,6 +75,14 @@ data_browser_tmpl = """
{% endif %}
{% if data_filter %}
"data_filter":{{json.dumps(data_filter, indent=4, ensure_ascii=False)}},
"search_form":{
"css":"card",
"padding":"8px",
"show_label":false,
"submit_label":"搜索",
"submit_css":"primary",
"fields":{{json.dumps(filter_fields, indent=4, ensure_ascii=False)}}
},
{% endif %}
{% if filter_labels %}
"filter_labels":{{json.dumps(filter_labels, indent=4, ensure_ascii=False)}},