This commit is contained in:
yumoqing 2024-05-07 18:15:06 +08:00
parent e903fe9b4a
commit 840a103182
2 changed files with 39 additions and 3 deletions

View File

@ -7,9 +7,16 @@ bricks.DataRow = class extends bricks.HBox {
] ]
fields:[] fields:[]
css css
browser_excloud_fields:[] browserfields{
edit_excloud_fields:[], exclouded
cwidth:{
field:10,
field2:11
}
}
edit:{
exclouded:[],
}
header_css header_css
} }
*/ */
@ -96,14 +103,29 @@ bricks.DataRow = class extends bricks.HBox {
this.dispatch(e); this.dispatch(e);
} }
build_fields(header){ build_fields(header){
var exclouded = [];
var cwidths = {};
if (this.browserfields && this.browserfields.exclouded){
exclouded = this.browserfields.exclouded;
}
if (this.browserfields && this.browserfields.cwidths}{
cwidths = this.browserfields.cwidths;
}
for (var i=0;i<this.fields.length;i++){ for (var i=0;i<this.fields.length;i++){
var f = this.fields[i] var f = this.fields[i]
if (this.exclouded.includes(f.name)){
continue;
}
var opts = bricks.extend({ var opts = bricks.extend({
margin:'3px' margin:'3px'
}, f); }, f);
if (header){ if (header){
opts.value = f.label || f.name; opts.value = f.label || f.name;
} }
var cwidth = cwidths[f.name];
if (cwidth){
opts.cwidth = cwidth;
}
var f = bricks.get_ViewBuilder(f.uitype); var f = bricks.get_ViewBuilder(f.uitype);
if (!f) f = bricks.get_ViewBuilder('str'); if (!f) f = bricks.get_ViewBuilder('str');
var w = f(opts); var w = f(opts);

View File

@ -4,6 +4,20 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
super(opts); super(opts);
this.fields = this.record_view.options.fields; this.fields = this.record_view.options.fields;
} }
get_eidt_fields(){
var fs = this.record_view_.optiosn.fields;
this.fields = [];
var exclouded = [];
if (this.record_view.options.editexcloded){
exclouded = this.record_view.options.eiditexclouded;
}
fs.forEach(f => {
if (!exclouded.includes(f.name){
this.fields.push(f);
}
}
}
async build_info(item, record){ async build_info(item, record){
if (this.record_view.widgettype != 'DataRow'){ if (this.record_view.widgettype != 'DataRow'){
console.log('record_view must be DataRow'); console.log('record_view must be DataRow');