feat: InlineForm支持wrap折行,搜索表单默认开启多行布局

This commit is contained in:
Hermes Agent 2026-06-22 16:54:18 +08:00
parent 1e33a70627
commit 17d7e946e8
2 changed files with 4 additions and 1 deletions

View File

@ -119,6 +119,7 @@ bricks.DataViewer = class extends bricks.VBox {
form_opts.show_label = sf.show_label !== undefined ? sf.show_label : false;
form_opts.submit_label = sf.submit_label || '搜索';
form_opts.submit_css = sf.submit_css || 'primary';
form_opts.wrap = sf.wrap !== undefined ? sf.wrap : true;
this.search_form_w = new bricks.InlineForm(form_opts);
this.search_form_w.bind('submit', this.search_form_submited.bind(this));
this.add_widget(this.search_form_w);

View File

@ -453,7 +453,7 @@ bricks.FormBase = class extends bricks.Layout {
bricks.InlineForm = class extends bricks.HBox {
/*
Horizontal inline form all fields in one row.
Horizontal inline form all fields in one row (or wrap to multiple rows).
Options:
fields: [{name, label, uitype, placeholder, ...}]
submit_label: "搜索" (button text, default "Submit")
@ -462,6 +462,7 @@ bricks.InlineForm = class extends bricks.HBox {
submit_bgcolor: "#xxx" (background color)
gap: "0.5" (gap between items in charsize)
show_label: true/false (show label before input, default true)
wrap: true/false (allow fields to wrap to next line, default false)
Events:
submit: dispatched with form data on button click
*/
@ -471,6 +472,7 @@ bricks.InlineForm = class extends bricks.HBox {
opts.overflow = 'none';
opts.alignItems = 'center';
opts.gap = opts.gap || '0.5';
if (opts.wrap) opts.flexWrap = 'wrap';
super(opts);
this.name_inputs = {};
this.build_fields();