bugfix
This commit is contained in:
parent
72721b93dc
commit
a81bbd456b
102
bricks/form.js
102
bricks/form.js
@ -7,10 +7,9 @@ bricks.show_resp_message_or_error = async function(resp){
|
|||||||
await bricks.widgetBuild(desc, bricks.Body);
|
await bricks.widgetBuild(desc, bricks.Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
bricks.FieldGroup = class extends bricks.VBox {
|
bricks.FieldGroup = class {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
opts.leftMargin = '10px';
|
this.opts = opts
|
||||||
super(opts);
|
|
||||||
}
|
}
|
||||||
build_fields(form, parent, fields){
|
build_fields(form, parent, fields){
|
||||||
var dc = new bricks.DynamicColumn({mobile_cols:2});
|
var dc = new bricks.DynamicColumn({mobile_cols:2});
|
||||||
@ -88,48 +87,10 @@ bricks.FormBody = class extends bricks.VScrollPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bricks.Form = class extends bricks.VBox {
|
bricks.FormBase = class extends bricks.Layout {
|
||||||
/*
|
|
||||||
{
|
|
||||||
title:
|
|
||||||
description:
|
|
||||||
notoolbar:False,
|
|
||||||
input_layout:"VBox" or "HBox", default is "VBox",
|
|
||||||
cols:
|
|
||||||
dataurl:
|
|
||||||
toolbar:
|
|
||||||
submit_url:
|
|
||||||
method:
|
|
||||||
fields
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
opts.height = "100%";
|
|
||||||
opts.width = "100%";
|
|
||||||
opts.overflow = "auto";
|
|
||||||
super(opts);
|
super(opts);
|
||||||
this.name_inputs = {};
|
this.name_inputs = {};
|
||||||
this.need_formdata = false;
|
|
||||||
if (this.opts.title){
|
|
||||||
var t = new bricks.Title3({
|
|
||||||
otext:this.opts.title,
|
|
||||||
height:'auto',
|
|
||||||
i18n:true});
|
|
||||||
this.add_widget(t, 0);
|
|
||||||
}
|
|
||||||
if (this.opts.description){
|
|
||||||
var d = new bricks.Text({
|
|
||||||
otext:this.opts.description,
|
|
||||||
height:'auto',
|
|
||||||
i18n:true});
|
|
||||||
this.add_widget(d);
|
|
||||||
}
|
|
||||||
var filler = new bricks.Filler({});
|
|
||||||
this.add_widget(filler);
|
|
||||||
this.body = new bricks.FormBody(this, opts);
|
|
||||||
filler.add_widget(this.body);
|
|
||||||
if (! opts.notoolbar)
|
|
||||||
this.build_toolbar(this);
|
|
||||||
}
|
}
|
||||||
build_toolbar(widget){
|
build_toolbar(widget){
|
||||||
var box = new bricks.HBox({height:'auto', width:'100%'});
|
var box = new bricks.HBox({height:'auto', width:'100%'});
|
||||||
@ -284,4 +245,61 @@ bricks.Form = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bricks.InlineForm = class extends bricks.FormBase {
|
||||||
|
constructor(opts){
|
||||||
|
opts.height = "100%";
|
||||||
|
opts.width = "100%";
|
||||||
|
opts.overflow = "auto";
|
||||||
|
super(opts);
|
||||||
|
this.fg = new bricks.FieldGroup({});
|
||||||
|
this.fg.build_fields(this, this, this.opts.fields)
|
||||||
|
this.build_toolbar(this.children[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bricks.Form = class extends bricks.FormBase {
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
title:
|
||||||
|
description:
|
||||||
|
notoolbar:False,
|
||||||
|
input_layout:"VBox" or "HBox", default is "VBox",
|
||||||
|
cols:
|
||||||
|
dataurl:
|
||||||
|
toolbar:
|
||||||
|
submit_url:
|
||||||
|
method:
|
||||||
|
fields
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
constructor(opts){
|
||||||
|
opts.height = "100%";
|
||||||
|
opts.width = "100%";
|
||||||
|
opts.overflow = "auto";
|
||||||
|
super(opts);
|
||||||
|
this.need_formdata = false;
|
||||||
|
if (this.opts.title){
|
||||||
|
var t = new bricks.Title3({
|
||||||
|
otext:this.opts.title,
|
||||||
|
height:'auto',
|
||||||
|
i18n:true});
|
||||||
|
this.add_widget(t, 0);
|
||||||
|
}
|
||||||
|
if (this.opts.description){
|
||||||
|
var d = new bricks.Text({
|
||||||
|
otext:this.opts.description,
|
||||||
|
height:'auto',
|
||||||
|
i18n:true});
|
||||||
|
this.add_widget(d);
|
||||||
|
}
|
||||||
|
var filler = new bricks.Filler({});
|
||||||
|
this.add_widget(filler);
|
||||||
|
this.body = new bricks.FormBody(this, opts);
|
||||||
|
filler.add_widget(this.body);
|
||||||
|
if (! opts.notoolbar)
|
||||||
|
this.build_toolbar(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bricks.Factory.register('InlineForm', bricks.InlineForm);
|
||||||
bricks.Factory.register('Form', bricks.Form);
|
bricks.Factory.register('Form', bricks.Form);
|
||||||
|
Loading…
Reference in New Issue
Block a user